Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "THcShHit.h"
#include "TMath.h"
#include <vector>
#include <iterator>
#include <iostream>
#include <fstream>
using namespace std;
// Track class for the HMS calorimeter calibration.
// Comprises the spectrometer track parameters and calorimeter hits.
//
// Container (collection) of hits and its iterator.
//
typedef vector<THcShHit*> THcShHitList;
typedef THcShHitList::iterator THcShHitIt;
class THcShTrack {
Double_t P; // track momentum
Double_t Dp; // track momentum deviation, %
Double_t X; // at the calorimater face
Double_t Xp; // slope
Double_t Y; // at the calorimater face
Double_t Yp; // slope
THcShHitList Hits;
public:
THcShTrack();
THcShTrack(Double_t p, Double_t dp,
Double_t x, Double_t xp, Double_t y, Double_t yp);
~THcShTrack();
void Reset(Double_t p, Double_t dp,
Double_t x, Double_t xp, Double_t y, Double_t yp);
void AddHit(Double_t adc_pos, Double_t adc_neg,
Double_t e_pos, Double_t e_neg,
UInt_t blk_number);
THcShHit* GetHit(UInt_t k);
UInt_t GetNhits() {return Hits.size();};
void Print(ostream & ostrm);
void SetEs(Double_t* alpha);
void SetEsNoCor(Double_t* alpha);
Double_t EPRnorm();
Double_t ETAnorm();
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
Double_t GetP() {return P*1000.;} //MeV
Double_t GetDp() {return Dp;}
Double_t GetX() {return X;}
Double_t GetY() {return Y;}
Float_t Ycor(Double_t); // coord. corection for single PMT module
Float_t Ycor(Double_t, Int_t); // coord. correction for double PMT module
// Coordinate correction constants from hcana.param.
//
static constexpr Double_t fAcor = 200.;
static constexpr Double_t fBcor = 8000.;
static constexpr Double_t fCcor = 64.36;
static constexpr Double_t fDcor = 1.66;
// Calorimeter geometry constants.
//
static constexpr Double_t fZbl = 10; //cm, block transverse size
static constexpr UInt_t fNrows = 13;
static constexpr UInt_t fNcols = 4;
static constexpr UInt_t fNnegs = 26; // number of blocks with neg. side PMTs.
static constexpr UInt_t fNpmts = 78; // total number of PMTs.
static constexpr UInt_t fNblks = fNrows*fNcols;
};
//------------------------------------------------------------------------------
THcShTrack::THcShTrack() { };
THcShTrack::THcShTrack(Double_t p, Double_t dp,
Double_t x, Double_t xp, Double_t y, Double_t yp) {
P = p;
Dp = dp;
X = x;
Xp = xp;
Y = y;
Yp =yp;
};
//------------------------------------------------------------------------------
void THcShTrack::Reset(Double_t p, Double_t dp,
Double_t x, Double_t xp, Double_t y, Double_t yp) {
// Reset track parameters, clear hit list.
P = p;
Dp = dp;
X = x;
Xp = xp;
Y = y;
Yp =yp;
Hits.clear();
};
//------------------------------------------------------------------------------
void THcShTrack::AddHit(Double_t adc_pos, Double_t adc_neg,
Double_t e_pos, Double_t e_neg,
UInt_t blk_number) {
// Add a hit to the hit list.
THcShHit* hit = new THcShHit(adc_pos, adc_neg, blk_number);
hit->SetEpos(e_pos);
hit->SetEneg(e_neg);
Hits.push_back(hit);
};
//------------------------------------------------------------------------------
THcShHit* THcShTrack::GetHit(UInt_t k) {
THcShHitIt it = Hits.begin();
for (UInt_t i=0; i<k; i++) it++;
return *it;
}
void THcShTrack::Print(ostream & ostrm) {
// Output the track parameters and hit list through the stream ostrm.
ostrm << P << " " << Dp << " " << X << " " << Xp << " " << Y << " " << Yp
<< " " << Hits.size() << endl;
for (THcShHitIt iter = Hits.begin(); iter != Hits.end(); iter++) {
(*iter)->Print(ostrm);
};
};
//------------------------------------------------------------------------------
THcShTrack::~THcShTrack() {
for (THcShHitIt i = Hits.begin(); i != Hits.end(); ++i) {
delete *i;
*i = 0;
}
};
//------------------------------------------------------------------------------
void THcShTrack::SetEs(Double_t* alpha) {
// Set hit energy depositions seen from postive and negative sides,
// by use of calibration (gain) constants alpha.
for (THcShHitIt iter = Hits.begin(); iter != Hits.end(); iter++) {
Double_t adc_pos = (*iter)->GetADCpos();
Double_t adc_neg = (*iter)->GetADCneg();
UInt_t nblk = (*iter)->GetBlkNumber();
Int_t ncol=(nblk-1)/fNrows+1;
Double_t xh=X+Xp*(ncol-0.5)*fZbl;
Double_t yh=Y+Yp*(ncol-0.5)*fZbl;
if (nblk <= fNnegs) {
// cout << adc_pos <<"\t"<< Ycor(yh,0) <<"\t"<< alpha[nblk-1] << endl;
// cout << adc_neg <<"\t"<< Ycor(yh,1) <<"\t"<< alpha[fNblks+nblk-1] << endl;
(*iter)->SetEpos(adc_pos*Ycor(yh,0)*alpha[nblk-1]);
(*iter)->SetEneg(adc_neg*Ycor(yh,1)*alpha[fNblks+nblk-1]);
}
else {
// cout << adc_pos <<"\t"<< Ycor(yh) <<"\t"<< alpha[nblk-1] << endl;
(*iter)->SetEpos(adc_pos*Ycor(yh)*alpha[nblk-1]);
(*iter)->SetEneg(0.);
};
};
}
//------------------------------------------------------------------------------
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
void THcShTrack::SetEsNoCor(Double_t* alpha) {
// Set hit energy depositions seen from postive and negative sides,
// by use of calibration (gain) constants alpha.
for (THcShHitIt iter = Hits.begin(); iter != Hits.end(); iter++) {
Double_t adc_pos = (*iter)->GetADCpos();
Double_t adc_neg = (*iter)->GetADCneg();
UInt_t nblk = (*iter)->GetBlkNumber();
Int_t ncol=(nblk-1)/fNrows+1;
Double_t xh=X+Xp*(ncol-0.5)*fZbl;
Double_t yh=Y+Yp*(ncol-0.5)*fZbl;
if (nblk <= fNnegs) {
(*iter)->SetEpos(adc_pos*alpha[nblk-1]);
(*iter)->SetEneg(adc_neg*alpha[fNblks+nblk-1]);
}
else {
(*iter)->SetEpos(adc_pos*alpha[nblk-1]);
(*iter)->SetEneg(0.);
};
};
}
//------------------------------------------------------------------------------
Double_t THcShTrack::Enorm() {
// Normalized to the track momentum energy depostion in the calorimeter.
Double_t sum = 0;
for (THcShHitIt iter = Hits.begin(); iter != Hits.end(); iter++) {
sum += (*iter)->GetEpos();
sum += (*iter)->GetEneg();
};
return sum/P/1000.;
}
//------------------------------------------------------------------------------
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
Double_t THcShTrack::EPRnorm() {
// Normalized to the track momentum energy depostion in Preshower.
Double_t sum = 0;
for (THcShHitIt iter = Hits.begin(); iter != Hits.end(); iter++) {
UInt_t nblk = (*iter)->GetBlkNumber();
Int_t ncol=(nblk-1)/fNrows+1;
if (ncol==1) {
sum += (*iter)->GetEpos();
sum += (*iter)->GetEneg();
}
}
return sum/P/1000.; //Momentum in MeV.
}
//------------------------------------------------------------------------------
Double_t THcShTrack::ETAnorm() {
// Normalized to the track momentum energy depostion in Preshower.
Double_t sum = 0;
for (THcShHitIt iter = Hits.begin(); iter != Hits.end(); iter++) {
UInt_t nblk = (*iter)->GetBlkNumber();
Int_t ncol=(nblk-1)/fNrows+1;
if (ncol!=1) {
sum += (*iter)->GetEpos();
sum += (*iter)->GetEneg();
}
}
return sum/P/1000.; //Momentum in MeV.
}
//------------------------------------------------------------------------------
//Coordinate correction for single PMT modules.
//PMT attached at right (positive) side.
Float_t THcShTrack::Ycor(Double_t y) {
return TMath::Exp(y/fAcor)/(1. + y*y/fBcor);
}
//Coordinate correction for double PMT modules.
//
Float_t THcShTrack::Ycor(Double_t y, Int_t side) {
if (side!=0&&side!=1) {
cout << "THcShower::Ycor : wrong side " << side << endl;
return 0.;
}
Int_t sign = 1 - 2*side;
return (fCcor + sign*y)/(fCcor + sign*y/fDcor);
}