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
51
52
53
54
55
56
#include "THcPShHit.h"
#include "TMath.h"
#include <vector>
#include <iterator>
#include <iostream>
#include <fstream>
using namespace std;
// Track class for the SHMS calorimeter calibration.
// Comprises the spectrometer track parameters and calorimeter hits.
//
// Container (collection) of hits and its iterator.
//
typedef vector<THcPShHit*> THcPShHitList;
typedef THcPShHitList::iterator THcPShHitIt;
class THcPShTrack {
Double_t P; // track momentum
Double_t Dp; // track momentum deviation, %/
Double_t X; // at the Preshower face
Double_t Xp; // slope
Double_t Y; // at the Preshower face
Double_t Yp; // slope
THcPShHitList Hits;
public:
THcPShTrack();
THcPShTrack(Double_t p, Double_t dp, Double_t x, Double_t xp,
Double_t y, Double_t yp);
~THcPShTrack();
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, Double_t edep, UInt_t blk_number);
THcPShHit* GetHit(UInt_t k);
UInt_t GetNhits() {return Hits.size();};
void Print(ostream & ostrm);
void SetEs(Double_t* alpha);
Double_t Enorm();
Double_t EPRnorm();
Double_t ESHnorm();
Double_t GetP() {return P*1000.;} //MeV
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
Double_t GetX() {return X;}
Double_t GetY() {return Y;}
Float_t Ycor(Double_t, UInt_t); // coord. corection for Preshower module
// Coordinate correction constants for Preshower blocks
//
static constexpr Double_t fAcor = 106.73;
static constexpr Double_t fBcor = 2.329;
// Calorimeter geometry constants.
//
static const UInt_t fNrows_pr = 14; //Row number for Preshower
static const UInt_t fNrows_sh = 16; //Row number for Shower
static const UInt_t fNcols_pr = 2; //2 columns in Preshower
static const UInt_t fNcols_sh = 14; //14 columnsin Shower
static const UInt_t fNpmts_pr = fNrows_pr*fNcols_pr;
static const UInt_t fNpmts = fNpmts_pr + fNrows_sh*fNcols_sh;;
};
//------------------------------------------------------------------------------
THcPShTrack::THcPShTrack() { };
THcPShTrack::THcPShTrack(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 THcPShTrack::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 THcPShTrack::AddHit(Double_t adc, Double_t edep, UInt_t blk_number) {
// Add a hit to the hit list.
THcPShHit* hit = new THcPShHit(adc, blk_number);
hit->SetEdep(edep);
Hits.push_back(hit);
};
//------------------------------------------------------------------------------
THcPShHit* THcPShTrack::GetHit(UInt_t k) {
THcPShHitIt it = Hits.begin();
for (UInt_t i=0; i<k; i++) it++;
return *it;
}
//------------------------------------------------------------------------------
void THcPShTrack::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 (THcPShHitIt iter = Hits.begin(); iter != Hits.end(); iter++) {
(*iter)->Print(ostrm);
};
};
//------------------------------------------------------------------------------
THcPShTrack::~THcPShTrack() {
for (THcPShHitIt i = Hits.begin(); i != Hits.end(); ++i) {
delete *i;
*i = 0;
}
};
//------------------------------------------------------------------------------
void THcPShTrack::SetEs(Double_t* alpha) {
// Set hit energy depositions by use of calibration (gain) constants alpha.
for (THcPShHitIt iter = Hits.begin(); iter != Hits.end(); iter++) {
Double_t adc = (*iter)->GetADC();
UInt_t nblk = (*iter)->GetBlkNumber();
if(nblk <= fNrows_pr*fNcols_pr) {
//Preshower block, correct for Y coordinate
UInt_t ncol = 1;
if (nblk > fNrows_pr) ncol = 2;
(*iter)->SetEdep(adc*Ycor(Y,ncol)*alpha[nblk-1]);
//(*iter)->SetEdep(adc*alpha[nblk-1]);
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
}
else
//Shower block, no coordinate correction.
(*iter)->SetEdep(adc*alpha[nblk-1]);
};
}
//------------------------------------------------------------------------------
Double_t THcPShTrack::Enorm() {
// Normalized to the track momentum energy depostion in the calorimeter.
Double_t sum = 0;
for (THcPShHitIt iter = Hits.begin(); iter != Hits.end(); iter++) {
sum += (*iter)->GetEdep();
};
return sum/P/1000.; //Momentum in MeV.
}
//------------------------------------------------------------------------------
Double_t THcPShTrack::EPRnorm() {
// Normalized to the track momentum energy depostion in Preshower.
Double_t sum = 0;
for (THcPShHitIt iter = Hits.begin(); iter != Hits.end(); iter++) {
if ((*iter)->GetBlkNumber() <= fNpmts_pr)
sum += (*iter)->GetEdep();
};
return sum/P/1000.; //Momentum in MeV.
}
//------------------------------------------------------------------------------
Double_t THcPShTrack::ESHnorm() {
// Normalized to the track momentum energy depostion in Shower.
Double_t sum = 0;
for (THcPShHitIt iter = Hits.begin(); iter != Hits.end(); iter++) {
if ((*iter)->GetBlkNumber() > fNpmts_pr)
sum += (*iter)->GetEdep();
};
return sum/P/1000.; //Momentum in MeV.
}
//------------------------------------------------------------------------------
// Coordinate correction for Preshower modules.
// Fit to GEANT pion data @ 5 GeV/c (Simon).
Float_t THcPShTrack::Ycor(Double_t yhit, UInt_t ncol) {
Float_t cor;
// Warn if hit does not belong to Preshower.
//
if (ncol > fNcols_pr || ncol < 1)
cout << "*** THcPShTrack::Ycor: wrong ncol = " << ncol << " ***" << endl;
// Check if the hit coordinate matches the fired block's column.
//
if ((yhit < 0. && ncol == 2) || (yhit > 0. && ncol == 1))
cor = 1./(1. + TMath::Power(TMath::Abs(yhit)/fAcor, fBcor));
else
cor = 1.;
// Debug output.
// cout << "THcShTrack::Ycor = " << cor << " yhit = " << yhit
// << " ncol = " << ncol << endl;
return cor;
}