15 |
**/ |
**/ |
16 |
CaloTrkVar::CaloTrkVar() { |
CaloTrkVar::CaloTrkVar() { |
17 |
this->Clear(); |
this->Clear(); |
18 |
}; |
} |
19 |
|
|
20 |
/** |
/** |
21 |
* Clear variables |
* Clear variables |
22 |
**/ |
**/ |
23 |
void CaloTrkVar::Clear() { |
void CaloTrkVar::Clear(Option_t *t) { |
24 |
|
//void CaloTrkVar::Clear() { |
25 |
trkseqno = 0; |
trkseqno = 0; |
26 |
noint = 0; |
noint = 0; |
27 |
ncore = 0; |
ncore = 0; |
92 |
// |
// |
93 |
this->Clear(); |
this->Clear(); |
94 |
// |
// |
95 |
}; |
} |
96 |
/** |
/** |
97 |
* Create the TClonesArray |
* Create the TClonesArray |
98 |
**/ |
**/ |
103 |
/** |
/** |
104 |
* Clear the CaloLevel2 object |
* Clear the CaloLevel2 object |
105 |
**/ |
**/ |
106 |
void CaloLevel2::Clear() { |
void CaloLevel2::Clear(Option_t *t ) { |
107 |
// |
// |
108 |
// CaloTrk->Clear(); //ELENA |
// CaloTrk->Clear(); //ELENA |
109 |
if(CaloTrk)CaloTrk->Delete(); //ELENA |
if(CaloTrk)CaloTrk->Delete(); //ELENA |
110 |
// |
// |
111 |
nstrip = 0; |
nstrip = 0; |
112 |
|
nsatstrip = 0; |
113 |
qtot = 0.; |
qtot = 0.; |
114 |
impx = 0.; |
// impx = 0.; |
115 |
impy = 0.; |
// impy = 0.; |
|
tanx = 0.; |
|
|
tany = 0.; |
|
116 |
qmax = 0.; |
qmax = 0.; |
117 |
nx22 = 0; |
nx22 = 0; |
118 |
qx22 = 0.; |
qx22 = 0.; |
122 |
memset(swerr, 0, 4*sizeof(Int_t)); |
memset(swerr, 0, 4*sizeof(Int_t)); |
123 |
memset(crc, 0, 4*sizeof(Int_t)); |
memset(crc, 0, 4*sizeof(Int_t)); |
124 |
memset(qq, 0, 4*sizeof(Int_t)); |
memset(qq, 0, 4*sizeof(Int_t)); |
125 |
memset(varcfit, 0, 2*sizeof(Float_t)); |
memset(varcfit, 0, 4*sizeof(Float_t)); |
126 |
memset(npcfit, 0, 2*sizeof(Int_t)); |
memset(npcfit, 0, 4*sizeof(Int_t)); |
127 |
|
memset(tanx, 0, 2*sizeof(Int_t)); |
128 |
|
memset(tany, 0, 2*sizeof(Int_t)); |
129 |
|
memset(fitmode, 0, 2*sizeof(Int_t)); |
130 |
memset(planemax, 0, 2*sizeof(Int_t)); |
memset(planemax, 0, 2*sizeof(Int_t)); |
131 |
|
memset(selfdelay, 0, 4*7*sizeof(Int_t)); |
132 |
memset(cibar, 0, 2*22*sizeof(Int_t)); |
memset(cibar, 0, 2*22*sizeof(Int_t)); |
133 |
memset(cbar, 0, 2*22*sizeof(Float_t)); |
memset(cbar, 0, 2*22*sizeof(Float_t)); |
134 |
good = 0; |
good = 0; |
135 |
selftrigger = 0; |
selftrigger = 0; |
136 |
// |
// |
137 |
}; |
} |
138 |
|
|
139 |
/** |
/** |
140 |
* Delete the CaloLevel2 object |
* Delete the CaloLevel2 object |
141 |
**/ |
**/ |
142 |
void CaloLevel2::Delete() { //ELENA |
void CaloLevel2::Delete(Option_t *t) { //ELENA |
143 |
if(CaloTrk){ //ELENA |
if(CaloTrk){ //ELENA |
144 |
CaloTrk->Delete(); //ELENA |
CaloTrk->Delete(); //ELENA |
145 |
delete CaloTrk; //ELENA |
delete CaloTrk; //ELENA |
158 |
l2->qtot = qtot; |
l2->qtot = qtot; |
159 |
l2->qx22 = qx22; |
l2->qx22 = qx22; |
160 |
l2->qmax = qmax; |
l2->qmax = qmax; |
161 |
l2->impx = impx; |
// l2->impx = impx; |
162 |
l2->impy = impy; |
// l2->impy = impy; |
163 |
l2->tanx = tanx; |
// l2->tanx = tanx; |
164 |
l2->tany = tany; |
// l2->tany = tany; |
165 |
l2->elen = elen; |
l2->elen = elen; |
166 |
l2->selen = selen; |
l2->selen = selen; |
167 |
|
|
214 |
} |
} |
215 |
|
|
216 |
/** |
/** |
217 |
|
* Returns the impact position on the top of the calorimeter as determined by the calorimeter itself. |
218 |
|
* @param tr : if tr = 0 use the calorimeter "normal" fit, if 1 use the calorimeter "selftrigger" fit (if any!) |
219 |
|
**/ |
220 |
|
Float_t CaloLevel2::impx(Int_t tr){ |
221 |
|
if ( tr == 0 ) return(cbar[0][0]); |
222 |
|
if ( tr == 1 ) { |
223 |
|
if ( !CaloTrk ) return(-110.); |
224 |
|
TClonesArray &t = *(CaloTrk); |
225 |
|
for (Int_t itrk=0; itrk<ntrk(); itrk++){ |
226 |
|
CaloTrkVar *calotrack = (CaloTrkVar*)t[itrk]; |
227 |
|
if ( calotrack->trkseqno == -1 ) return(calotrack->tbar[0][0]); |
228 |
|
}; |
229 |
|
}; |
230 |
|
if ( tr !=0 && tr !=1 ){ |
231 |
|
printf(" Cannot get impx for other than calo or selftrigger tracks!\n"); |
232 |
|
} else { |
233 |
|
printf(" Cannot find selftrigger block\n"); |
234 |
|
}; |
235 |
|
return(-100.); |
236 |
|
} |
237 |
|
|
238 |
|
/** |
239 |
|
* Returns the impact position on the top of the calorimeter as determined by the calorimeter itself. |
240 |
|
* @param tr : if tr = 0 use the calorimeter "normal" fit, if 1 use the calorimeter "selftrigger" fit (if any!) |
241 |
|
**/ |
242 |
|
Float_t CaloLevel2::impy(Int_t tr){ |
243 |
|
if ( tr == 0 ) return(cbar[0][1]); |
244 |
|
if ( tr == 1 ) { |
245 |
|
if ( !CaloTrk ) return(-110.); |
246 |
|
TClonesArray &t = *(CaloTrk); |
247 |
|
for (Int_t itrk=0; itrk<ntrk(); itrk++){ |
248 |
|
CaloTrkVar *calotrack = (CaloTrkVar*)t[itrk]; |
249 |
|
if ( calotrack->trkseqno == -1 ) return(calotrack->tbar[0][1]); |
250 |
|
}; |
251 |
|
}; |
252 |
|
if ( tr !=0 && tr !=1 ){ |
253 |
|
printf(" Cannot get impy for other than calo or selftrigger tracks!\n"); |
254 |
|
} else { |
255 |
|
printf(" Cannot find selftrigger block\n"); |
256 |
|
}; |
257 |
|
return(-100.); |
258 |
|
} |
259 |
|
/** |
260 |
* Should return the energy in GeV if the particle would be an electron |
* Should return the energy in GeV if the particle would be an electron |
261 |
* using a parametrization taken from Monte Carlo simulation |
* using a parametrization taken from Monte Carlo simulation |
262 |
**/ |
**/ |
263 |
void CaloLevel2::GetElectronEnergy(Float_t &energy, Float_t &sigma){ |
void CaloLevel2::GetElectronEnergy(Float_t &energy, Float_t &sigma){ |
264 |
if ( nstrip == 0 ) return; |
if ( nstrip == 0 ) return; |
265 |
energy = qtot * 40.82 * 0.000106; |
energy = qtot / 260.; |
266 |
|
// energy = qtot * 40.82 * 0.000106; |
267 |
sigma = 0.; |
sigma = 0.; |
268 |
if ( energy > 0. ) sigma = energy * (0.01183 + 0.121/sqrt(energy)); |
if ( energy > 0. ) sigma = energy * (0.01183 + 0.121/sqrt(energy)); |
269 |
return; |
return; |
270 |
}; |
} |
271 |
|
|
272 |
/** |
/** |
273 |
* Returns pointer to the set of track-related variables "itrk" |
* Returns pointer to the set of track-related variables "itrk" |
284 |
CaloTrkVar *calotrack = (CaloTrkVar*)t[itrk]; |
CaloTrkVar *calotrack = (CaloTrkVar*)t[itrk]; |
285 |
return calotrack; |
return calotrack; |
286 |
} |
} |
287 |
|
|
288 |
|
/** |
289 |
|
* Retrieves the calorimeter track matching the seqno-th tracker stored track. |
290 |
|
* (If seqno = -1 retrieves the self-trigger calorimeter track) |
291 |
|
*/ |
292 |
|
CaloTrkVar *CaloLevel2::GetCaloStoredTrack(int seqno){ |
293 |
|
|
294 |
|
if( ntrk()==0 ){ |
295 |
|
printf("CaloLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo %i but no Calorimeter tracks are stored\n",seqno); |
296 |
|
return NULL; |
297 |
|
}; |
298 |
|
|
299 |
|
CaloTrkVar *c = 0; |
300 |
|
Int_t it_calo=0; |
301 |
|
|
302 |
|
do { |
303 |
|
c = GetCaloTrkVar(it_calo); |
304 |
|
it_calo++; |
305 |
|
} while( c && seqno != c->trkseqno && it_calo < ntrk()); |
306 |
|
|
307 |
|
if(!c || seqno != c->trkseqno){ |
308 |
|
c = 0; |
309 |
|
if(seqno!=-1 && seqno !=-2 && seqno!=-3 ) printf("CaloLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo %i does not match Calorimeter stored tracks\n",seqno); |
310 |
|
}; |
311 |
|
return c; |
312 |
|
|
313 |
|
} |