35 |
// |
// |
36 |
} |
} |
37 |
|
|
38 |
|
void CaloEnergy::UseCaloPreSampler(){ |
39 |
|
// |
40 |
|
// use the presampler setting forcefitmode to 1000 means to force the DV routine to find the track inside the calorimeter using the "shower" approach developed for electrons |
41 |
|
// |
42 |
|
cp = new CaloPreSampler(L2); |
43 |
|
cp->SplitInto(0,22); |
44 |
|
cp->SetForceFitMode(1000); |
45 |
|
// cp->UseTracker(false); |
46 |
|
// cp->ForceCaloFit(); |
47 |
|
// cp->SetDebug(true); |
48 |
|
// cp->Process(); |
49 |
|
} |
50 |
|
|
51 |
void CaloEnergy::Set(){ |
void CaloEnergy::Set(){ |
52 |
|
// |
53 |
|
// set default values, NB default conversion factor for energy is just very approximated! |
54 |
|
// |
55 |
OBT = 0; |
OBT = 0; |
56 |
PKT = 0; |
PKT = 0; |
57 |
atime = 0; |
atime = 0; |
64 |
// |
// |
65 |
debug = false; |
debug = false; |
66 |
// |
// |
67 |
|
indep = false; |
68 |
|
// |
69 |
fLong = false; |
fLong = false; |
70 |
fPl = 1; |
fPl = 1; |
71 |
fRad = -1; |
fRad = -1; |
72 |
|
cp = NULL; |
73 |
// |
// |
74 |
this->DefineGeometry(); |
this->DefineGeometry(); |
75 |
fXosel =true; |
fXosel =true; |
94 |
if ( section.Contains("YE") ) fYemin = plane; |
if ( section.Contains("YE") ) fYemin = plane; |
95 |
} |
} |
96 |
|
|
97 |
|
void CaloEnergy::SetMinimumContainment(Int_t plane){ |
98 |
|
this->SetMinimumContainment("XEXOYEYO",plane); |
99 |
|
} |
100 |
|
|
101 |
Int_t CaloEnergy::GetMinimumContainment(TString section){ |
Int_t CaloEnergy::GetMinimumContainment(TString section){ |
102 |
section.ToUpper(); |
section.ToUpper(); |
103 |
if ( section.Contains("XO") ) return(fXomin); |
if ( section.Contains("XO") ) return(fXomin); |
116 |
if ( section.Contains("YE") ) fConv_rye = conv; |
if ( section.Contains("YE") ) fConv_rye = conv; |
117 |
} |
} |
118 |
|
|
119 |
|
void CaloEnergy::SetConversionFactor(Float_t conv){ |
120 |
|
this->SetConversionFactor("XEXOYEYO",conv); |
121 |
|
} |
122 |
|
|
123 |
Float_t CaloEnergy::GetConversionFactor(TString section){ |
Float_t CaloEnergy::GetConversionFactor(TString section){ |
124 |
section.ToUpper(); |
section.ToUpper(); |
125 |
if ( section.Contains("XO") ) return(fConv_rxo); |
if ( section.Contains("XO") ) return(fConv_rxo); |
139 |
return(-1); |
return(-1); |
140 |
} |
} |
141 |
|
|
142 |
|
Float_t CaloEnergy::GetMaxEnergy(TString section){ |
143 |
|
section.ToUpper(); |
144 |
|
if ( section.Contains("XO") ) return fXOen_maxplane; |
145 |
|
if ( section.Contains("XE") ) return fXEen_maxplane; |
146 |
|
if ( section.Contains("YO") ) return fYOen_maxplane; |
147 |
|
if ( section.Contains("YE") ) return fYEen_maxplane; |
148 |
|
return(-1); |
149 |
|
} |
150 |
|
|
151 |
void CaloEnergy::DefineGeometry(){ |
void CaloEnergy::DefineGeometry(){ |
152 |
// |
// |
153 |
|
// Use CaloStrip to determine once the position of border strips for each section |
154 |
|
// |
155 |
|
// |
156 |
fM = 2. + 0.096; // real position from cbar |
fM = 2. + 0.096; // real position from cbar |
157 |
fM1 = 2. - 0.122 - 0.096; // due to calculation of xe1 etc. |
fM1 = 2. - 0.122 - 0.096; // due to calculation of xe1 etc. |
158 |
if ( fM1 < 0. ) fM1 = 0.; |
if ( fM1 < 0. ) fM1 = 0.; |
159 |
// |
// |
160 |
CaloStrip *cs = new CaloStrip(fSimu); |
CaloStrip *cs = new CaloStrip(fSimu); |
161 |
|
// |
162 |
// vista y piano 0 striscia 0 |
// view y plane 0 strip 0 |
163 |
cs->Set(1,0,0); |
cs->Set(1,0,0); |
164 |
xe1= cs->GetY(); |
xe1= cs->GetY(); |
165 |
z1= cs->GetZ(); |
// z1= cs->GetZ(); |
166 |
// vista y piano 0 striscia 31 |
// view y plane 0 strip 31 |
167 |
cs->Set(1,0,31); |
cs->Set(1,0,31); |
168 |
xe2= cs->GetY(); |
xe2= cs->GetY(); |
169 |
// vista y piano 0 striscia 32 |
// view y plane 0 strip 32 |
170 |
cs->Set(1,0,32); |
cs->Set(1,0,32); |
171 |
xe3= cs->GetY(); |
xe3= cs->GetY(); |
172 |
// vista y piano 0 striscia 63 |
// view y plane 0 strip 63 |
173 |
cs->Set(1,0,63); |
cs->Set(1,0,63); |
174 |
xe4= cs->GetY(); |
xe4= cs->GetY(); |
175 |
// vista y piano 0 striscia 64 |
// view y plane 0 strip 64 |
176 |
cs->Set(1,0,64); |
cs->Set(1,0,64); |
177 |
xe5= cs->GetY(); |
xe5= cs->GetY(); |
178 |
// vista y piano 0 striscia 95 |
// view y plane 0 strip 95 |
179 |
cs->Set(1,0,95); |
cs->Set(1,0,95); |
180 |
xe6= cs->GetY(); |
xe6= cs->GetY(); |
181 |
|
|
182 |
// vista x piano 0 striscia 0 |
// view x plane 0 strip 0 |
183 |
cs->Set(0,0,0); |
cs->Set(0,0,0); |
184 |
yo1= cs->GetX(); |
yo1= cs->GetX(); |
185 |
z2= cs->GetZ(); |
// z2= cs->GetZ(); |
186 |
// vista x piano 0 striscia 31 |
// view x plane 0 strip 31 |
187 |
cs->Set(0,0,31); |
cs->Set(0,0,31); |
188 |
yo2= cs->GetX(); |
yo2= cs->GetX(); |
189 |
// vista x piano 0 striscia 32 |
// view x plane 0 strip 32 |
190 |
cs->Set(0,0,32); |
cs->Set(0,0,32); |
191 |
yo3= cs->GetX(); |
yo3= cs->GetX(); |
192 |
// vista x piano 0 striscia 63 |
// view x plane 0 strip 63 |
193 |
cs->Set(0,0,63); |
cs->Set(0,0,63); |
194 |
yo4= cs->GetX(); |
yo4= cs->GetX(); |
195 |
// vista x piano 0 striscia 64 |
// view x plane 0 strip 64 |
196 |
cs->Set(0,0,64); |
cs->Set(0,0,64); |
197 |
yo5= cs->GetX(); |
yo5= cs->GetX(); |
198 |
// vista x piano 0 striscia 95 |
// view x plane 0 strip 95 |
199 |
cs->Set(0,0,95); |
cs->Set(0,0,95); |
200 |
yo6= cs->GetX(); |
yo6= cs->GetX(); |
201 |
|
|
202 |
|
|
203 |
// vista y piano 1 striscia 0 |
// view y plane 1 strip 0 |
204 |
cs->Set(1,1,0); |
cs->Set(1,1,0); |
205 |
xo1= cs->GetY(); |
xo1= cs->GetY(); |
206 |
z3= cs->GetZ(); |
// z3= cs->GetZ(); |
207 |
// vista y piano 1 striscia 31 |
// view y plane 1 strip 31 |
208 |
cs->Set(1,1,31); |
cs->Set(1,1,31); |
209 |
xo2= cs->GetY(); |
xo2= cs->GetY(); |
210 |
// vista y piano 1 striscia 32 |
// view y plane 1 strip 32 |
211 |
cs->Set(1,1,32); |
cs->Set(1,1,32); |
212 |
xo3= cs->GetY(); |
xo3= cs->GetY(); |
213 |
// vista y piano 1 striscia 63 |
// view y plane 1 strip 63 |
214 |
cs->Set(1,1,63); |
cs->Set(1,1,63); |
215 |
xo4= cs->GetY(); |
xo4= cs->GetY(); |
216 |
// vista y piano 1 striscia 64 |
// view y plane 1 strip 64 |
217 |
cs->Set(1,1,64); |
cs->Set(1,1,64); |
218 |
xo5= cs->GetY(); |
xo5= cs->GetY(); |
219 |
// vista y piano 1 striscia 95 |
// view y plane 1 strip 95 |
220 |
cs->Set(1,1,95); |
cs->Set(1,1,95); |
221 |
xo6= cs->GetY(); |
xo6= cs->GetY(); |
222 |
|
|
223 |
// vista x piano 1 striscia 0 |
// view x plane 1 strip 0 |
224 |
cs->Set(0,1,0); |
cs->Set(0,1,0); |
225 |
ye1= cs->GetX(); |
ye1= cs->GetX(); |
226 |
z4= cs->GetZ(); |
// z4= cs->GetZ(); |
227 |
// vista x piano 1 striscia 31 |
// view x plane 1 strip 31 |
228 |
cs->Set(0,1,31); |
cs->Set(0,1,31); |
229 |
ye2= cs->GetX(); |
ye2= cs->GetX(); |
230 |
// vista x piano 1 striscia 32 |
// view x plane 1 strip 32 |
231 |
cs->Set(0,1,32); |
cs->Set(0,1,32); |
232 |
ye3= cs->GetX(); |
ye3= cs->GetX(); |
233 |
// vista x piano 1 striscia 63 |
// view x plane 1 strip 63 |
234 |
cs->Set(0,1,63); |
cs->Set(0,1,63); |
235 |
ye4= cs->GetX(); |
ye4= cs->GetX(); |
236 |
// vista x piano 1 striscia 64 |
// view x plane 1 strip 64 |
237 |
cs->Set(0,1,64); |
cs->Set(0,1,64); |
238 |
ye5= cs->GetX(); |
ye5= cs->GetX(); |
239 |
// vista x piano 1 striscia 95 |
// view x plane 1 strip 95 |
240 |
cs->Set(0,1,95); |
cs->Set(0,1,95); |
241 |
ye6= cs->GetX(); |
ye6= cs->GetX(); |
242 |
|
|
244 |
for (Int_t p = 0; p<22; p ++){ |
for (Int_t p = 0; p<22; p ++){ |
245 |
for (Int_t v = 0; v<2; v++ ){ |
for (Int_t v = 0; v<2; v++ ){ |
246 |
cs->Set(v,p,0); |
cs->Set(v,p,0); |
247 |
trk_z[p][v]= cs->GetZ(); // << cooordinata Z piano |
trk_z[p][v]= cs->GetZ(); // Z coord for each plane |
248 |
}; |
}; |
249 |
}; |
}; |
250 |
// |
// |
254 |
|
|
255 |
void CaloEnergy::Clear(){ |
void CaloEnergy::Clear(){ |
256 |
// |
// |
257 |
|
// clear variables |
258 |
|
// |
259 |
fPartsel = false; |
fPartsel = false; |
260 |
fSel = false; |
fSel = false; |
261 |
fXosel = false; |
fXosel = false; |
286 |
fYeout = 0; |
fYeout = 0; |
287 |
fXoout = 0; |
fXoout = 0; |
288 |
fXeout = 0; |
fXeout = 0; |
289 |
|
fXEen_maxplane = 0.; |
290 |
|
fXOen_maxplane = 0.; |
291 |
|
fYEen_maxplane = 0.; |
292 |
|
fYOen_maxplane = 0.; |
293 |
memset(en_xep,0,11*sizeof(Float_t)); |
memset(en_xep,0,11*sizeof(Float_t)); |
294 |
memset(en_yep,0,11*sizeof(Float_t)); |
memset(en_yep,0,11*sizeof(Float_t)); |
295 |
memset(en_xop,0,11*sizeof(Float_t)); |
memset(en_xop,0,11*sizeof(Float_t)); |
344 |
|
|
345 |
void CaloEnergy::Delete(){ |
void CaloEnergy::Delete(){ |
346 |
Clear(); |
Clear(); |
347 |
|
delete this; |
348 |
} |
} |
349 |
|
|
350 |
|
|
351 |
Bool_t CaloEnergy::IsInsideAcceptance(TString section){ |
Bool_t CaloEnergy::IsInsideAcceptance(TString section){ |
352 |
// |
// |
353 |
|
// check if the event is inside the acceptance of the given section(s) |
354 |
// |
// |
355 |
TString ntr = section; |
TString ntr = section; |
356 |
if ( !L2 ){ |
if ( !L2 ){ |
373 |
newentry = true; |
newentry = true; |
374 |
}; |
}; |
375 |
// |
// |
376 |
|
// if we have already called this method for this event and no input changed then return fSel and exit |
377 |
|
// |
378 |
if ( !newentry ) return fSel; |
if ( !newentry ) return fSel; |
379 |
// |
// |
380 |
|
// process the event |
381 |
|
// |
382 |
if ( debug ) printf(" ########## IsInsideAcceptance ######### \n"); |
if ( debug ) printf(" ########## IsInsideAcceptance ######### \n"); |
383 |
// |
// |
384 |
|
// clear variables |
385 |
|
// |
386 |
this->Clear(); |
this->Clear(); |
387 |
// |
// |
388 |
section.ToUpper(); |
section.ToUpper(); |
389 |
// |
// |
390 |
Int_t ss = Int_t(section.Contains("XO"))+Int_t(section.Contains("XE"))+Int_t(section.Contains("YO"))+Int_t(section.Contains("YE")); |
// Count the number of section(s) given as input |
391 |
if ( !ss ){ |
// |
392 |
|
Int_t fNumSec = Int_t(section.Contains("XO"))+Int_t(section.Contains("XE"))+Int_t(section.Contains("YO"))+Int_t(section.Contains("YE")); |
393 |
|
if ( !fNumSec ){ |
394 |
printf(" ERROR: section must be XO or XE or YO or YE while it is %s \n",section.Data()); |
printf(" ERROR: section must be XO or XE or YO or YE while it is %s \n",section.Data()); |
395 |
return false; |
return false; |
396 |
}; |
}; |
397 |
// |
// |
398 |
|
// If the presampler object exists then use the presampler output instead of the level2 output |
399 |
|
// |
400 |
|
CaloLevel2 *cl2 = NULL; |
401 |
|
if ( cp ){ |
402 |
|
cl2 = cp->GetCaloLevel2(); |
403 |
|
} else { |
404 |
|
cl2 = L2->GetCaloLevel2(); |
405 |
|
}; |
406 |
|
// |
407 |
|
// get the energy for every strip of the calorimeter |
408 |
// |
// |
409 |
for (Int_t ch=0; ch< L2->GetCaloLevel1()->istrip; ch++){ |
for (Int_t ch=0; ch< L2->GetCaloLevel1()->istrip; ch++){ |
410 |
en = L2->GetCaloLevel1()->DecodeEstrip(ch,view,plane,strip); |
en = L2->GetCaloLevel1()->DecodeEstrip(ch,view,plane,strip); |
411 |
enstrip[view][plane][strip]=en; |
enstrip[view][plane][strip]=en; |
412 |
}; |
}; |
413 |
|
// |
414 |
|
// sum energy plane by plane for each sections |
415 |
|
// |
416 |
for (Int_t i=0;i<11;i++){ |
for (Int_t i=0;i<11;i++){ |
417 |
for(strip=0; strip<96; strip++) { |
for(strip=0; strip<96; strip++) { |
418 |
if ( fRad < 0 ){ |
if ( fRad < 0 ){ |
419 |
|
// |
420 |
|
// run over all the strips of the plane |
421 |
|
// |
422 |
en_xep[i] += enstrip[1][2*i][strip]; |
en_xep[i] += enstrip[1][2*i][strip]; |
423 |
en_yop[i] += enstrip[0][2*i][strip]; |
en_yop[i] += enstrip[0][2*i][strip]; |
424 |
en_xop[i] += enstrip[1][2*i+1][strip]; |
en_xop[i] += enstrip[1][2*i+1][strip]; |
425 |
en_yep[i] += enstrip[0][2*i+1][strip]; |
en_yep[i] += enstrip[0][2*i+1][strip]; |
426 |
} else { |
} else { |
427 |
if ( strip >= L2->GetCaloLevel2()->cibar[2*i][1]-1-fRad && strip <= L2->GetCaloLevel2()->cibar[2*i][1]-1+fRad ) en_xep[i] += enstrip[1][2*i][strip]; |
// |
428 |
if ( strip >= L2->GetCaloLevel2()->cibar[2*i][0]-1-fRad && strip <= L2->GetCaloLevel2()->cibar[2*i][0]-1+fRad ) en_yop[i] += enstrip[0][2*i][strip]; |
// use only the strips inside a cylinder of given radius fRad |
429 |
if ( strip >= L2->GetCaloLevel2()->cibar[2*i+1][1]-1-fRad && strip <= L2->GetCaloLevel2()->cibar[2*i+1][1]-1+fRad ) en_xop[i] += enstrip[1][2*i+1][strip]; |
// |
430 |
if ( strip >= L2->GetCaloLevel2()->cibar[2*i+1][0]-1-fRad && strip <= L2->GetCaloLevel2()->cibar[2*i+1][0]-1+fRad ) en_yep[i] += enstrip[0][2*i+1][strip]; |
if ( strip >= cl2->cibar[2*i][1]-1-fRad && strip <= cl2->cibar[2*i][1]-1+fRad ) en_xep[i] += enstrip[1][2*i][strip]; |
431 |
|
if ( strip >= cl2->cibar[2*i][0]-1-fRad && strip <= cl2->cibar[2*i][0]-1+fRad ) en_yop[i] += enstrip[0][2*i][strip]; |
432 |
|
if ( strip >= cl2->cibar[2*i+1][1]-1-fRad && strip <= cl2->cibar[2*i+1][1]-1+fRad ) en_xop[i] += enstrip[1][2*i+1][strip]; |
433 |
|
if ( strip >= cl2->cibar[2*i+1][0]-1-fRad && strip <= cl2->cibar[2*i+1][0]-1+fRad ) en_yep[i] += enstrip[0][2*i+1][strip]; |
434 |
}; |
}; |
435 |
}; |
}; |
436 |
energyxe += en_xep[i]; |
energyxe += en_xep[i]; |
438 |
energyxo += en_xop[i]; |
energyxo += en_xop[i]; |
439 |
energyye += en_yep[i]; |
energyye += en_yep[i]; |
440 |
}; |
}; |
|
Float_t en_maxplane = 0.; |
|
|
Float_t max_en= 0.; |
|
441 |
// |
// |
442 |
for (Int_t ipl =0; ipl < 11; ipl ++) { |
// Find the plane of maximum for each section |
443 |
if(en_xop[ipl] > max_en) { |
// |
444 |
max_en = en_xop[ipl]; |
Float_t xomax_en= 0.; |
445 |
fMax_planexo = ipl; |
Float_t xemax_en= 0.; |
446 |
|
Float_t yomax_en= 0.; |
447 |
|
Float_t yemax_en= 0.; |
448 |
|
// |
449 |
|
// |
450 |
|
Int_t xen = 0; |
451 |
|
Int_t yon = 0; |
452 |
|
Int_t xon = 0; |
453 |
|
Int_t yen = 0; |
454 |
|
// |
455 |
|
if ( section.Contains("XE") ){ |
456 |
|
yon++; |
457 |
|
xon++; |
458 |
|
yen++; |
459 |
|
for (Int_t ipl =0; ipl < 11; ipl ++) { |
460 |
|
if(en_xep[ipl] > xemax_en) { |
461 |
|
xemax_en = en_xep[ipl]; |
462 |
|
fMax_planexe = ipl; |
463 |
}; |
}; |
464 |
|
}; |
465 |
}; |
}; |
466 |
// |
// |
467 |
max_en = 0.; |
if ( section.Contains("YO") ){ |
468 |
for (Int_t ipl =0; ipl < 11; ipl ++) { |
xon++; |
469 |
if(en_xep[ipl] > max_en) { |
yen++; |
470 |
max_en = en_xep[ipl]; |
for (Int_t ipl =0; ipl < 11; ipl ++) { |
471 |
fMax_planexe = ipl; |
if(en_yop[ipl] > yomax_en) { |
472 |
|
yomax_en = en_yop[ipl]; |
473 |
|
fMax_planeyo = ipl; |
474 |
|
}; |
475 |
}; |
}; |
476 |
}; |
}; |
477 |
// |
// |
478 |
max_en = 0.; |
if ( section.Contains("XO") ){ |
479 |
for (Int_t ipl =0; ipl < 11; ipl ++) { |
yen++; |
480 |
if(en_yop[ipl] > max_en) { |
for (Int_t ipl =0; ipl < 11; ipl ++) { |
481 |
max_en = en_yop[ipl]; |
if(en_xop[ipl] > xomax_en) { |
482 |
fMax_planeyo = ipl; |
xomax_en = en_xop[ipl]; |
483 |
|
fMax_planexo = ipl; |
484 |
|
}; |
485 |
}; |
}; |
486 |
}; |
}; |
487 |
// |
// |
488 |
max_en = 0.; |
if ( section.Contains("YE") ){ |
489 |
for (Int_t ipl =0; ipl < 11; ipl ++) { |
for (Int_t ipl =0; ipl < 11; ipl ++) { |
490 |
if(en_yep[ipl] > max_en) { |
if(en_yep[ipl] > yemax_en) { |
491 |
max_en = en_yep[ipl]; |
yemax_en = en_yep[ipl]; |
492 |
fMax_planeye = ipl; |
fMax_planeye = ipl; |
493 |
|
}; |
494 |
|
}; |
495 |
|
}; |
496 |
|
// |
497 |
|
Int_t nPl = fPl; |
498 |
|
// |
499 |
|
// Set the maximum in case of coherent mode was selected |
500 |
|
// |
501 |
|
if ( !indep ){ |
502 |
|
nPl = 0; |
503 |
|
if ( debug ) printf(" A: Check maximum, coherent mode: xoen %f yoen %f xeen %f yeen %f xomax %i yomax %i xemax %i yemax %i\n",xomax_en,yomax_en,xemax_en,yemax_en,fMax_planexo,fMax_planeyo,fMax_planexe,fMax_planeye); |
504 |
|
Int_t nummod = 0; |
505 |
|
Int_t numexpl = 0; |
506 |
|
if ( xomax_en > xemax_en && xomax_en > yemax_en && xomax_en > yomax_en ){ |
507 |
|
// |
508 |
|
// Section XO contains the maximum energy release per plane of the whole calorimeter |
509 |
|
// |
510 |
|
if ( debug ) printf(" XO is MAX %i %i %i %i\n",xen,yon,xon,yen); |
511 |
|
// |
512 |
|
// fMax_plane is the plane of maximum + number of additional dE/dx measurement counting planes from 0 to 43 |
513 |
|
// |
514 |
|
fMax_plane = (fNumSec * fMax_planexo) +(Float_t)xon + fPl; |
515 |
|
// |
516 |
|
// nummod is the integer part of the number of modules in which the maximum is contained |
517 |
|
// |
518 |
|
nummod = (Int_t)(((Float_t)fMax_plane)/(Float_t)fNumSec); |
519 |
|
// |
520 |
|
// numexpl is the number of additional planes (0,1,2) inside the module |
521 |
|
// |
522 |
|
numexpl = (Int_t)((Float_t)fMax_plane-(Float_t)fNumSec*(Float_t)nummod); |
523 |
|
// |
524 |
|
}; |
525 |
|
if ( xemax_en > xomax_en && xemax_en > yemax_en && xemax_en > yomax_en ){ |
526 |
|
if ( debug ) printf(" XE is MAX %i %i %i %i\n",xen,yon,xon,yen); |
527 |
|
fMax_plane = (fNumSec * fMax_planexe) +(Float_t)xen + fPl; |
528 |
|
nummod = (Int_t)(((Float_t)fMax_plane)/(Float_t)fNumSec); |
529 |
|
numexpl = (Int_t)((Float_t)fMax_plane-(Float_t)fNumSec*(Float_t)nummod); |
530 |
|
// |
531 |
|
}; |
532 |
|
|
533 |
|
if ( yemax_en > xomax_en && yemax_en > xemax_en && yemax_en > yomax_en ){ |
534 |
|
if ( debug ) printf(" YE is MAX %i %i %i %i\n",xen,yon,xon,yen); |
535 |
|
fMax_plane = (fNumSec * fMax_planeye) +(Float_t)yen + fPl; |
536 |
|
nummod = (Int_t)(((Float_t)fMax_plane)/(Float_t)fNumSec); |
537 |
|
numexpl = (Int_t)((Float_t)fMax_plane-(Float_t)fNumSec*(Float_t)nummod); |
538 |
|
// |
539 |
|
}; |
540 |
|
if ( yomax_en > xemax_en && yomax_en > yemax_en && yomax_en > xomax_en ){ |
541 |
|
if ( debug ) printf(" YO is MAX %i %i %i %i\n",xen,yon,xon,yen); |
542 |
|
fMax_plane = (fNumSec * fMax_planeyo) +(Float_t)yon + fPl; |
543 |
|
nummod = (Int_t)(((Float_t)fMax_plane)/(Float_t)fNumSec); |
544 |
|
numexpl = (Int_t)((Float_t)fMax_plane-(Float_t)fNumSec*(Float_t)nummod); |
545 |
|
// |
546 |
}; |
}; |
547 |
|
// |
548 |
|
// find the plane up to which is necessary to integrate the energy for each section |
549 |
|
// |
550 |
|
Int_t a = 0; |
551 |
|
Int_t b = 0; |
552 |
|
Int_t c = 0; |
553 |
|
if ( numexpl > xen ) a = 1; |
554 |
|
if ( numexpl > yon ) b = 1; |
555 |
|
if ( numexpl > xon ) c = 1; |
556 |
|
fMax_planexe = nummod; |
557 |
|
fMax_planeyo = nummod - 1 + a; |
558 |
|
fMax_planexo = nummod - 1 + b; |
559 |
|
fMax_planeye = nummod - 1 + c; |
560 |
|
if ( debug ) printf(" fMax_plane %f nummod %i numexpl %i a %i b %i c %i \n",fMax_plane,nummod,numexpl,a,b,c); |
561 |
|
if ( debug ) printf(" DONE: Check maximum, coherent mode: xoen %f yoen %f xeen %f yeen %f xomax %i yomax %i xemax %i yemax %i\n",xomax_en,yomax_en,xemax_en,yemax_en,fMax_planexo,fMax_planeyo,fMax_planexe,fMax_planeye); |
562 |
}; |
}; |
563 |
// |
// |
564 |
|
// for each plane of the calorimeter find the position of the track in the direction along the strip (where we do not have a measurement from the selected plane) by looking at the plane above/below of the other view and extrapolating the trajectory to the given plane |
565 |
|
// |
566 |
Float_t track_coordx[22][2]; |
Float_t track_coordx[22][2]; |
567 |
Float_t track_coordy[22][2]; |
Float_t track_coordy[22][2]; |
568 |
// |
// |
569 |
Float_t tgx_cl2; |
Float_t tgx_cl2; |
570 |
Float_t tgy_cl2; |
Float_t tgy_cl2; |
571 |
tgx_cl2 = L2->GetCaloLevel2()->tanx[0]; |
tgx_cl2 = cl2->tanx[0]; |
572 |
tgy_cl2 = L2->GetCaloLevel2()->tany[0]; |
tgy_cl2 = cl2->tany[0]; |
573 |
// |
// |
574 |
for (Int_t p=0; p<22; p++){ |
for (Int_t p=0; p<22; p++){ |
575 |
track_coordy[p][1] = L2->GetCaloLevel2()->cbar[p][1]; |
track_coordy[p][1] = cl2->cbar[p][1]; |
576 |
track_coordx[p][1] = L2->GetCaloLevel2()->cbar[p][0] - fabs(trk_z[p][1]-trk_z[p][0])*tgx_cl2; |
track_coordx[p][1] = cl2->cbar[p][0] - fabs(trk_z[p][1]-trk_z[p][0])*tgx_cl2; |
577 |
track_coordx[p][0] = L2->GetCaloLevel2()->cbar[p][0]; |
track_coordx[p][0] = cl2->cbar[p][0]; |
578 |
track_coordy[p][0] = L2->GetCaloLevel2()->cbar[p][1] - fabs(trk_z[p][1]-trk_z[p][0])*tgy_cl2; |
track_coordy[p][0] = cl2->cbar[p][1] - fabs(trk_z[p][1]-trk_z[p][0])*tgy_cl2; |
579 |
if ( debug ) printf(" p %i track_coordy[p][1] %f track_coordx[p][1] %f track_coordx[p][0] %f track_coordy[p][0] %f \n",p,track_coordy[p][1],track_coordx[p][1],track_coordx[p][0],track_coordy[p][0]); |
if ( debug ) printf(" p %i track_coordy[p][1] %f track_coordx[p][1] %f track_coordx[p][0] %f track_coordy[p][0] %f \n",p,track_coordy[p][1],track_coordx[p][1],track_coordx[p][0],track_coordy[p][0]); |
580 |
}; |
}; |
581 |
// |
// |
582 |
if ( debug ) printf(" acceptance ss %i tgx %f tgy %f\n",ss,tgx_cl2,tgy_cl2); |
if ( debug ) printf(" acceptance fNumSec %i tgx %f tgy %f\n",fNumSec,tgx_cl2,tgy_cl2); |
583 |
// |
// |
584 |
if ( section.Contains("XO") ){ |
if ( section.Contains("XO") ){ |
585 |
|
// |
586 |
|
// check event is inside XO acceptance |
587 |
|
// |
588 |
for (Int_t i=0; i<11; i++) { |
for (Int_t i=0; i<11; i++) { |
589 |
if |
if |
590 |
( |
( |
591 |
(((track_coordx[2*i+1][1]>=(-12.054+fM))&& |
(((track_coordx[2*i+1][1]>=(-12.054+fM))&& |
592 |
(track_coordx[2*i+1][1]<=(-4.246-fM)))&& |
(track_coordx[2*i+1][1]<=(-4.246-fM)))&& |
593 |
(((L2->GetCaloLevel2()->cbar[2*i+1][1]>=xo1 + fM1)&& |
(((cl2->cbar[2*i+1][1]>=xo1 + fM1)&& |
594 |
(L2->GetCaloLevel2()->cbar[2*i+1][1]<=xo2 - fM1 ))|| |
(cl2->cbar[2*i+1][1]<=xo2 - fM1 ))|| |
595 |
((L2->GetCaloLevel2()->cbar[2*i+1][1]>=xo3 + fM1)&& |
((cl2->cbar[2*i+1][1]>=xo3 + fM1)&& |
596 |
(L2->GetCaloLevel2()->cbar[2*i+1][1]<=xo4 - fM1 ))|| |
(cl2->cbar[2*i+1][1]<=xo4 - fM1 ))|| |
597 |
((L2->GetCaloLevel2()->cbar[2*i+1][1]>=xo5 + fM1)&& |
((cl2->cbar[2*i+1][1]>=xo5 + fM1)&& |
598 |
(L2->GetCaloLevel2()->cbar[2*i+1][1]<=xo6 - fM1 ))))|| |
(cl2->cbar[2*i+1][1]<=xo6 - fM1 ))))|| |
599 |
|
|
600 |
(((track_coordx[2*i+1][1]>=(-4.004+fM))&& |
(((track_coordx[2*i+1][1]>=(-4.004+fM))&& |
601 |
(track_coordx[2*i+1][1]<=(3.804-fM)))&& |
(track_coordx[2*i+1][1]<=(3.804-fM)))&& |
602 |
(((L2->GetCaloLevel2()->cbar[2*i+1][1]>=xo1 + fM1)&& |
(((cl2->cbar[2*i+1][1]>=xo1 + fM1)&& |
603 |
(L2->GetCaloLevel2()->cbar[2*i+1][1]<=xo2 - fM1 ))|| |
(cl2->cbar[2*i+1][1]<=xo2 - fM1 ))|| |
604 |
((L2->GetCaloLevel2()->cbar[2*i+1][1]>=xo3 + fM1)&& |
((cl2->cbar[2*i+1][1]>=xo3 + fM1)&& |
605 |
(L2->GetCaloLevel2()->cbar[2*i+1][1]<=xo4 - fM1))|| |
(cl2->cbar[2*i+1][1]<=xo4 - fM1))|| |
606 |
((L2->GetCaloLevel2()->cbar[2*i+1][1]>=xo5 + fM1)&& |
((cl2->cbar[2*i+1][1]>=xo5 + fM1)&& |
607 |
(L2->GetCaloLevel2()->cbar[2*i+1][1]<=xo6 - fM1 ))))|| |
(cl2->cbar[2*i+1][1]<=xo6 - fM1 ))))|| |
608 |
|
|
609 |
(((track_coordx[2*i+1][1]>=(4.046+fM))&& |
(((track_coordx[2*i+1][1]>=(4.046+fM))&& |
610 |
(track_coordx[2*i+1][1]<=(11.854-fM)))&& |
(track_coordx[2*i+1][1]<=(11.854-fM)))&& |
611 |
(((L2->GetCaloLevel2()->cbar[2*i+1][1]>=xo1 + fM1)&& |
(((cl2->cbar[2*i+1][1]>=xo1 + fM1)&& |
612 |
(L2->GetCaloLevel2()->cbar[2*i+1][1]<=xo2 - fM1))|| |
(cl2->cbar[2*i+1][1]<=xo2 - fM1))|| |
613 |
((L2->GetCaloLevel2()->cbar[2*i+1][1]>=xo3 + fM1)&& |
((cl2->cbar[2*i+1][1]>=xo3 + fM1)&& |
614 |
(L2->GetCaloLevel2()->cbar[2*i+1][1]<=xo4 - fM1 ))|| |
(cl2->cbar[2*i+1][1]<=xo4 - fM1 ))|| |
615 |
((L2->GetCaloLevel2()->cbar[2*i+1][1]>=xo5 + fM1)&& |
((cl2->cbar[2*i+1][1]>=xo5 + fM1)&& |
616 |
(L2->GetCaloLevel2()->cbar[2*i+1][1]<=xo6 - fM1 )))) |
(cl2->cbar[2*i+1][1]<=xo6 - fM1 )))) |
617 |
){ |
){ |
618 |
fXosel = true; |
fXosel = true; |
619 |
fXoout = i; |
fXoout = i; |
622 |
break; |
break; |
623 |
}; |
}; |
624 |
}; |
}; |
625 |
if ( !fXosel && fXoout >= fXomin && fXoout >= (Int_t)(fMax_planexo+fPl) ){ |
// |
626 |
if ( debug ) printf(" XO: this event is only partially contained: fXoout %i fXomin %i fMax_planexo + fPl %i \n",fXoout,fXomin,(Int_t)(fMax_planexo+fPl)); |
// if it goes out of the acceptance BUT the plane up to which we are integrating the energy is contained then the event is "partially" contained |
627 |
|
// |
628 |
|
if ( !fXosel && fXoout >= fXomin && fXoout >= (Int_t)(fMax_planexo+nPl) ){ |
629 |
|
if ( debug ) printf(" XO: this event is only partially contained: fXoout %i fXomin %i fMax_planexo + nPl %i \n",fXoout,fXomin,(Int_t)(fMax_planexo+nPl)); |
630 |
fPartsel = true; |
fPartsel = true; |
631 |
fXosel = true; |
fXosel = true; |
632 |
}; |
}; |
633 |
|
// |
634 |
|
// event is contained (or partially contained) hence we can integrate energy up to the maximum and calculate the energy as measured by this section |
635 |
|
// |
636 |
if ( fXosel ){ |
if ( fXosel ){ |
637 |
en_maxplane = 0.; |
for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planexo+nPl)) ;iplm++) fXOen_maxplane += en_xop[iplm]; |
638 |
for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planexo+fPl)) ;iplm++) en_maxplane += en_xop[iplm]; |
fEnergyxo = fXOen_maxplane/fConv_rxo; |
|
fEnergyxo = en_maxplane/fConv_rxo; |
|
639 |
}; |
}; |
640 |
}; |
}; |
641 |
// |
// |
645 |
( |
( |
646 |
(((track_coordx[2*i][1]>=(-11.854+fM))&& |
(((track_coordx[2*i][1]>=(-11.854+fM))&& |
647 |
(track_coordx[2*i][1]<=(-4.046-fM)))&& |
(track_coordx[2*i][1]<=(-4.046-fM)))&& |
648 |
(((L2->GetCaloLevel2()->cbar[2*i][1]>=xe1 + fM1)&& |
(((cl2->cbar[2*i][1]>=xe1 + fM1)&& |
649 |
(L2->GetCaloLevel2()->cbar[2*i][1]<=xe2 - fM1 ))|| |
(cl2->cbar[2*i][1]<=xe2 - fM1 ))|| |
650 |
((L2->GetCaloLevel2()->cbar[2*i][1]>=xe3 + fM1)&& |
((cl2->cbar[2*i][1]>=xe3 + fM1)&& |
651 |
(L2->GetCaloLevel2()->cbar[2*i][1]<=xe4 - fM1 ))|| |
(cl2->cbar[2*i][1]<=xe4 - fM1 ))|| |
652 |
((L2->GetCaloLevel2()->cbar[2*i][1]>=xe5 + fM1)&& |
((cl2->cbar[2*i][1]>=xe5 + fM1)&& |
653 |
(L2->GetCaloLevel2()->cbar[2*i][1]<=xe6 - fM1 ))))|| |
(cl2->cbar[2*i][1]<=xe6 - fM1 ))))|| |
654 |
|
|
655 |
(((track_coordx[2*i][1]>=(-3.804+fM))&& |
(((track_coordx[2*i][1]>=(-3.804+fM))&& |
656 |
(track_coordx[2*i][1]<=(4.004-fM)))&& |
(track_coordx[2*i][1]<=(4.004-fM)))&& |
657 |
(((L2->GetCaloLevel2()->cbar[2*i][1]>=xe1 + fM1)&& |
(((cl2->cbar[2*i][1]>=xe1 + fM1)&& |
658 |
(L2->GetCaloLevel2()->cbar[2*i][1]<=xe2 - fM1 ))|| |
(cl2->cbar[2*i][1]<=xe2 - fM1 ))|| |
659 |
((L2->GetCaloLevel2()->cbar[2*i][1]>=xe3 + fM1)&& |
((cl2->cbar[2*i][1]>=xe3 + fM1)&& |
660 |
(L2->GetCaloLevel2()->cbar[2*i][1]<=xe4 - fM1))|| |
(cl2->cbar[2*i][1]<=xe4 - fM1))|| |
661 |
((L2->GetCaloLevel2()->cbar[2*i][1]>=xe5 + fM1)&& |
((cl2->cbar[2*i][1]>=xe5 + fM1)&& |
662 |
(L2->GetCaloLevel2()->cbar[2*i][1]<=xe6 - fM1 ))))|| |
(cl2->cbar[2*i][1]<=xe6 - fM1 ))))|| |
663 |
|
|
664 |
(((track_coordx[2*i][1]>=(4.246+fM))&& |
(((track_coordx[2*i][1]>=(4.246+fM))&& |
665 |
(track_coordx[2*i][1]<=(12.054-fM)))&& |
(track_coordx[2*i][1]<=(12.054-fM)))&& |
666 |
(((L2->GetCaloLevel2()->cbar[2*i][1]>=xe1 + fM1)&& |
(((cl2->cbar[2*i][1]>=xe1 + fM1)&& |
667 |
(L2->GetCaloLevel2()->cbar[2*i][1]<=xe2 - fM1))|| |
(cl2->cbar[2*i][1]<=xe2 - fM1))|| |
668 |
((L2->GetCaloLevel2()->cbar[2*i][1]>=xe3 + fM1)&& |
((cl2->cbar[2*i][1]>=xe3 + fM1)&& |
669 |
(L2->GetCaloLevel2()->cbar[2*i][1]<=xe4 - fM1 ))|| |
(cl2->cbar[2*i][1]<=xe4 - fM1 ))|| |
670 |
((L2->GetCaloLevel2()->cbar[2*i][1]>=xe5 + fM1)&& |
((cl2->cbar[2*i][1]>=xe5 + fM1)&& |
671 |
(L2->GetCaloLevel2()->cbar[2*i][1]<=xe6 - fM1 )))) |
(cl2->cbar[2*i][1]<=xe6 - fM1 )))) |
672 |
){ |
){ |
673 |
fXesel = true; |
fXesel = true; |
674 |
fXeout = i; |
fXeout = i; |
677 |
break; |
break; |
678 |
}; |
}; |
679 |
}; |
}; |
680 |
if ( !fXesel && fXeout >= fXemin && fXeout >= (Int_t)(fMax_planexe+fPl) ){ |
if ( !fXesel && fXeout >= fXemin && fXeout >= (Int_t)(fMax_planexe+nPl) ){ |
681 |
if ( debug ) printf(" XE: this event is only partially contained: fXeout %i fXemin %i fMax_planexe + fPl %i \n",fXeout,fXemin,(Int_t)(fMax_planexe+fPl)); |
if ( debug ) printf(" XE: this event is only partially contained: fXeout %i fXemin %i fMax_planexe + nPl %i \n",fXeout,fXemin,(Int_t)(fMax_planexe+nPl)); |
682 |
fPartsel = true; |
fPartsel = true; |
683 |
fXesel = true; |
fXesel = true; |
684 |
}; |
}; |
685 |
if ( fXesel ){ |
if ( fXesel ){ |
686 |
en_maxplane = 0.; |
for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planexe+nPl)) ;iplm++) fXEen_maxplane += en_xep[iplm]; |
687 |
for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planexe+fPl)) ;iplm++) en_maxplane += en_xep[iplm]; |
fEnergyxe = fXEen_maxplane/fConv_rxe; |
|
fEnergyxe = en_maxplane/fConv_rxe; |
|
688 |
}; |
}; |
689 |
}; |
}; |
690 |
// |
// |
694 |
( |
( |
695 |
(((track_coordy[2*i+1][0]>=(-12.154+fM))&& |
(((track_coordy[2*i+1][0]>=(-12.154+fM))&& |
696 |
(track_coordy[2*i+1][0]<=(-4.346-fM)))&& |
(track_coordy[2*i+1][0]<=(-4.346-fM)))&& |
697 |
(((L2->GetCaloLevel2()->cbar[2*i+1][0]>=ye1 + fM1)&& |
(((cl2->cbar[2*i+1][0]>=ye1 + fM1)&& |
698 |
(L2->GetCaloLevel2()->cbar[2*i+1][0]<=ye2 - fM1 ))|| |
(cl2->cbar[2*i+1][0]<=ye2 - fM1 ))|| |
699 |
((L2->GetCaloLevel2()->cbar[2*i+1][0]>=ye3 + fM1)&& |
((cl2->cbar[2*i+1][0]>=ye3 + fM1)&& |
700 |
(L2->GetCaloLevel2()->cbar[2*i+1][0]<=ye4 - fM1 ))|| |
(cl2->cbar[2*i+1][0]<=ye4 - fM1 ))|| |
701 |
((L2->GetCaloLevel2()->cbar[2*i+1][0]>=ye5 + fM1)&& |
((cl2->cbar[2*i+1][0]>=ye5 + fM1)&& |
702 |
(L2->GetCaloLevel2()->cbar[2*i+1][0]<=ye6 - fM1 ))))|| |
(cl2->cbar[2*i+1][0]<=ye6 - fM1 ))))|| |
703 |
|
|
704 |
(((track_coordy[2*i+1][0]>=(-4.104+fM))&& |
(((track_coordy[2*i+1][0]>=(-4.104+fM))&& |
705 |
(track_coordy[2*i+1][0]<=(3.704-fM)))&& |
(track_coordy[2*i+1][0]<=(3.704-fM)))&& |
706 |
(((L2->GetCaloLevel2()->cbar[2*i+1][0]>=ye1 + fM1)&& |
(((cl2->cbar[2*i+1][0]>=ye1 + fM1)&& |
707 |
(L2->GetCaloLevel2()->cbar[2*i+1][0]<=ye2 - fM1 ))|| |
(cl2->cbar[2*i+1][0]<=ye2 - fM1 ))|| |
708 |
((L2->GetCaloLevel2()->cbar[2*i+1][0]>=ye3 + fM1)&& |
((cl2->cbar[2*i+1][0]>=ye3 + fM1)&& |
709 |
(L2->GetCaloLevel2()->cbar[2*i+1][0]<=ye4 - fM1))|| |
(cl2->cbar[2*i+1][0]<=ye4 - fM1))|| |
710 |
((L2->GetCaloLevel2()->cbar[2*i+1][0]>=ye5 + fM1)&& |
((cl2->cbar[2*i+1][0]>=ye5 + fM1)&& |
711 |
(L2->GetCaloLevel2()->cbar[2*i+1][0]<=ye6 - fM1 ))))|| |
(cl2->cbar[2*i+1][0]<=ye6 - fM1 ))))|| |
712 |
|
|
713 |
(((track_coordy[2*i+1][0]>=(3.946+fM))&& |
(((track_coordy[2*i+1][0]>=(3.946+fM))&& |
714 |
(track_coordy[2*i+1][0]<=(11.754-fM)))&& |
(track_coordy[2*i+1][0]<=(11.754-fM)))&& |
715 |
(((L2->GetCaloLevel2()->cbar[2*i+1][0]>=ye1 + fM1)&& |
(((cl2->cbar[2*i+1][0]>=ye1 + fM1)&& |
716 |
(L2->GetCaloLevel2()->cbar[2*i+1][0]<=ye2 - fM1))|| |
(cl2->cbar[2*i+1][0]<=ye2 - fM1))|| |
717 |
((L2->GetCaloLevel2()->cbar[2*i+1][0]>=ye3 + fM1)&& |
((cl2->cbar[2*i+1][0]>=ye3 + fM1)&& |
718 |
(L2->GetCaloLevel2()->cbar[2*i+1][0]<=ye4 - fM1 ))|| |
(cl2->cbar[2*i+1][0]<=ye4 - fM1 ))|| |
719 |
((L2->GetCaloLevel2()->cbar[2*i+1][0]>=ye5 + fM1)&& |
((cl2->cbar[2*i+1][0]>=ye5 + fM1)&& |
720 |
(L2->GetCaloLevel2()->cbar[2*i+1][0]<=ye6 - fM1 )))) |
(cl2->cbar[2*i+1][0]<=ye6 - fM1 )))) |
721 |
){ |
){ |
722 |
fYesel = true; |
fYesel = true; |
723 |
fYeout = i; |
fYeout = i; |
726 |
break; |
break; |
727 |
}; |
}; |
728 |
}; |
}; |
729 |
if ( !fYesel && fYeout >= fYemin && fYeout >= (Int_t)(fMax_planeye+fPl) ){ |
if ( !fYesel && fYeout >= fYemin && fYeout >= (Int_t)(fMax_planeye+nPl) ){ |
730 |
if ( debug ) printf(" YE: this event is only partially contained: fYeout %i fYemin %i fMax_planeye + fPl %i \n",fYeout,fYemin,(Int_t)(fMax_planeye+fPl)); |
if ( debug ) printf(" YE: this event is only partially contained: fYeout %i fYemin %i fMax_planeye + nPl %i \n",fYeout,fYemin,(Int_t)(fMax_planeye+nPl)); |
731 |
fPartsel = true; |
fPartsel = true; |
732 |
fYesel = true; |
fYesel = true; |
733 |
}; |
}; |
734 |
if ( fYesel ){ |
if ( fYesel ){ |
735 |
en_maxplane = 0.; |
for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planeye+nPl)) ;iplm++) fYEen_maxplane += en_yep[iplm]; |
736 |
for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planeye+fPl)) ;iplm++) en_maxplane += en_yep[iplm]; |
fEnergyye = fYEen_maxplane/fConv_rye; |
|
fEnergyye = en_maxplane/fConv_rye; |
|
737 |
}; |
}; |
738 |
}; |
}; |
739 |
// |
// |
740 |
if ( section.Contains("YO") ){ |
if ( section.Contains("YO") ){ |
741 |
for (Int_t i=0; i<11; i++) { |
for (Int_t i=0; i<11; i++) { |
742 |
if ( debug ) printf(" i %i track_coordy[2*i][0] %f L2->GetCaloLevel2()->cbar[2*i][0] %f \n",i,track_coordy[2*i][0],L2->GetCaloLevel2()->cbar[2*i][0]); |
if ( debug ) printf(" i %i track_coordy[2*i][0] %f cl2->cbar[2*i][0] %f \n",i,track_coordy[2*i][0],cl2->cbar[2*i][0]); |
743 |
if ( debug ) printf(" i %i fm %f fm1 %f yo1 %g yo2 %f yo3 %f yo4 %f yo5 %f yo6 %f \n",i,fM,fM1,yo1,yo2,yo3,yo4,yo5,yo6); |
if ( debug ) printf(" i %i fm %f fm1 %f yo1 %g yo2 %f yo3 %f yo4 %f yo5 %f yo6 %f \n",i,fM,fM1,yo1,yo2,yo3,yo4,yo5,yo6); |
744 |
if |
if |
745 |
( |
( |
746 |
(((track_coordy[2*i][0]>=(-11.954+fM))&& |
(((track_coordy[2*i][0]>=(-11.954+fM))&& |
747 |
(track_coordy[2*i][0]<=(-4.146-fM)))&& |
(track_coordy[2*i][0]<=(-4.146-fM)))&& |
748 |
(((L2->GetCaloLevel2()->cbar[2*i][0]>=yo1 + fM1)&& |
(((cl2->cbar[2*i][0]>=yo1 + fM1)&& |
749 |
(L2->GetCaloLevel2()->cbar[2*i][0]<=yo2 - fM1 ))|| |
(cl2->cbar[2*i][0]<=yo2 - fM1 ))|| |
750 |
((L2->GetCaloLevel2()->cbar[2*i][0]>=yo3 + fM1)&& |
((cl2->cbar[2*i][0]>=yo3 + fM1)&& |
751 |
(L2->GetCaloLevel2()->cbar[2*i][0]<=yo4 - fM1 ))|| |
(cl2->cbar[2*i][0]<=yo4 - fM1 ))|| |
752 |
((L2->GetCaloLevel2()->cbar[2*i][0]>=yo5 + fM1)&& |
((cl2->cbar[2*i][0]>=yo5 + fM1)&& |
753 |
(L2->GetCaloLevel2()->cbar[2*i][0]<=yo6 - fM1 ))))|| |
(cl2->cbar[2*i][0]<=yo6 - fM1 ))))|| |
754 |
|
|
755 |
(((track_coordy[2*i][0]>=(-3.904+fM))&& |
(((track_coordy[2*i][0]>=(-3.904+fM))&& |
756 |
(track_coordy[2*i][0]<=(+3.904-fM)))&& |
(track_coordy[2*i][0]<=(+3.904-fM)))&& |
757 |
(((L2->GetCaloLevel2()->cbar[2*i][0]>=yo1 + fM1)&& |
(((cl2->cbar[2*i][0]>=yo1 + fM1)&& |
758 |
(L2->GetCaloLevel2()->cbar[2*i][0]<=yo2 - fM1 ))|| |
(cl2->cbar[2*i][0]<=yo2 - fM1 ))|| |
759 |
((L2->GetCaloLevel2()->cbar[2*i][0]>=yo3 + fM1)&& |
((cl2->cbar[2*i][0]>=yo3 + fM1)&& |
760 |
(L2->GetCaloLevel2()->cbar[2*i][0]<=yo4 - fM1))|| |
(cl2->cbar[2*i][0]<=yo4 - fM1))|| |
761 |
((L2->GetCaloLevel2()->cbar[2*i][0]>=yo5 + fM1)&& |
((cl2->cbar[2*i][0]>=yo5 + fM1)&& |
762 |
(L2->GetCaloLevel2()->cbar[2*i][0]<=yo6 - fM1 ))))|| |
(cl2->cbar[2*i][0]<=yo6 - fM1 ))))|| |
763 |
|
|
764 |
(((track_coordy[2*i][0]>=(4.146+fM))&& |
(((track_coordy[2*i][0]>=(4.146+fM))&& |
765 |
(track_coordy[2*i][0]<=(11.954-fM)))&& |
(track_coordy[2*i][0]<=(11.954-fM)))&& |
766 |
(((L2->GetCaloLevel2()->cbar[2*i][0]>=yo1 + fM1)&& |
(((cl2->cbar[2*i][0]>=yo1 + fM1)&& |
767 |
(L2->GetCaloLevel2()->cbar[2*i][0]<=yo2 - fM1))|| |
(cl2->cbar[2*i][0]<=yo2 - fM1))|| |
768 |
((L2->GetCaloLevel2()->cbar[2*i][0]>=yo3 + fM1)&& |
((cl2->cbar[2*i][0]>=yo3 + fM1)&& |
769 |
(L2->GetCaloLevel2()->cbar[2*i][0]<=yo4 - fM1 ))|| |
(cl2->cbar[2*i][0]<=yo4 - fM1 ))|| |
770 |
((L2->GetCaloLevel2()->cbar[2*i][0]>=yo5 + fM1)&& |
((cl2->cbar[2*i][0]>=yo5 + fM1)&& |
771 |
(L2->GetCaloLevel2()->cbar[2*i][0]<=yo6 - fM1 )))) |
(cl2->cbar[2*i][0]<=yo6 - fM1 )))) |
772 |
){ |
){ |
773 |
fYosel = true; |
fYosel = true; |
774 |
fYoout = i; |
fYoout = i; |
777 |
break; |
break; |
778 |
}; |
}; |
779 |
}; |
}; |
780 |
if ( !fYosel && fYoout >= fYomin && fYoout >= (Int_t)(fMax_planeyo+fPl) ){ |
if ( !fYosel && fYoout >= fYomin && fYoout >= (Int_t)(fMax_planeyo+nPl) ){ |
781 |
if ( debug ) printf(" YO: this event is only partially contained: fYoout %i fYomin %i fMax_planeyo + fPl %i \n",fYoout,fYomin,(Int_t)(fMax_planeyo+fPl)); |
if ( debug ) printf(" YO: this event is only partially contained: fYoout %i fYomin %i fMax_planeyo + nPl %i \n",fYoout,fYomin,(Int_t)(fMax_planeyo+nPl)); |
782 |
fPartsel = true; |
fPartsel = true; |
783 |
fYosel = true; |
fYosel = true; |
784 |
}; |
}; |
785 |
if ( fYosel ){ |
if ( fYosel ){ |
786 |
en_maxplane = 0.; |
for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planeyo+nPl)) ;iplm++) fYOen_maxplane += en_yop[iplm]; |
787 |
for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planeyo+fPl)) ;iplm++) en_maxplane += en_yop[iplm]; |
fEnergyyo = fYOen_maxplane/fConv_ryo; |
|
fEnergyyo = en_maxplane/fConv_ryo; |
|
788 |
}; |
}; |
789 |
}; |
}; |
790 |
// |
// |
791 |
fSel = ( fXesel || fYesel || fXosel || fYosel ); |
// Count the number of sections in which the event is contained |
792 |
|
// |
793 |
fCount = (Float_t)((Int_t)fXesel+(Int_t)fXosel+(Int_t)fYesel+(Int_t)fYosel); |
fCount = (Float_t)((Int_t)fXesel+(Int_t)fXosel+(Int_t)fYesel+(Int_t)fYosel); |
794 |
if ( debug ) printf(" IsInside XE %i XO %i YE %i YO %i => SEL %i \n",fXesel,fXosel,fYesel,fYosel,fSel); |
if ( debug ) printf(" IsInside XE %i XO %i YE %i YO %i => SEL %i \n",fXesel,fXosel,fYesel,fYosel,fSel); |
795 |
fMax_plane = (Float_t)(fMax_planeyo+fMax_planeye+fMax_planexo+fMax_planexe)/fCount; |
// |
796 |
fEnergy = (fEnergyxe+fEnergyyo+fEnergyye+fEnergyxo)/fCount; |
if ( indep ){ |
797 |
if ( debug ) printf(" fMax_plane %f conv_r %f en_maxplane %f encalo %f \n",fMax_plane,fConv_rxo,en_maxplane,fEnergy); |
// |
798 |
|
// independent mode, average the energy measurement and max plane of the contained sections |
799 |
|
// |
800 |
|
fSel = ( fXesel || fYesel || fXosel || fYosel ); |
801 |
|
fMax_plane = (Float_t)(fMax_planeyo+fMax_planeye+fMax_planexo+fMax_planexe)/fCount; |
802 |
|
fEnergy = (fEnergyxe+fEnergyyo+fEnergyye+fEnergyxo)/fCount; |
803 |
|
// |
804 |
|
} else { |
805 |
|
// |
806 |
|
// coherent mode, sum the energy [MIP] of the given sections and convert using fConv_rxo. **** NB: it is assumed that the conversion factor is unique and the method SetConvertionFactor(Float_t) has been used**** The event is selected only if it is contained in all the given sections |
807 |
|
// |
808 |
|
if ( fCount != fNumSec ){ |
809 |
|
fSel = false; |
810 |
|
} else { |
811 |
|
fSel = true; |
812 |
|
}; |
813 |
|
fEnergy = (fXEen_maxplane+fYOen_maxplane+fYEen_maxplane+fXOen_maxplane)/fConv_rxo; |
814 |
|
}; |
815 |
|
// |
816 |
|
if ( debug ) printf("sel %i indep %i fMax_plane %f conv_r %f en_maxplane %f encalo %f \n",fSel,indep,fMax_plane,fConv_rxo,fXOen_maxplane,fEnergy); |
817 |
|
// |
818 |
|
// finish exit |
819 |
// |
// |
820 |
return fSel; |
return fSel; |
821 |
// |
// |
829 |
|
|
830 |
void CaloEnergy::Process(TString section){ |
void CaloEnergy::Process(TString section){ |
831 |
// |
// |
832 |
|
// process the event |
833 |
|
// |
834 |
TString ntr = section; |
TString ntr = section; |
835 |
if ( !L2 ){ |
if ( !L2 ){ |
836 |
printf(" ERROR: cannot find PamLevel2 object, use the correct constructor or check your program!\n"); |
printf(" ERROR: cannot find PamLevel2 object, use the correct constructor or check your program!\n"); |
852 |
newentry = true; |
newentry = true; |
853 |
}; |
}; |
854 |
// |
// |
855 |
|
// if we have already called this method for this event and no input changed then return fSel and exit |
856 |
|
// |
857 |
if ( !newentry ) return; |
if ( !newentry ) return; |
858 |
// |
// |
859 |
|
// process the event |
860 |
|
// |
861 |
if ( debug ) printf(" Processing event at OBT %u PKT %u time %u section %s\n",OBT,PKT,atime,section.Data()); |
if ( debug ) printf(" Processing event at OBT %u PKT %u time %u section %s\n",OBT,PKT,atime,section.Data()); |
862 |
// |
// |
863 |
// this->Clear(); |
// check if the cylinder of integration can go out of the sensor given the frame which has been set (if we use all the calorimeter fRad is < 0 and the printout is suppressed) |
864 |
// |
// |
865 |
if ( (fM1+0.122-0.244*(Float_t)fRad) < 0. ) printf("Error: (fM1+0.122-0.244*(Float_t)fRad) < 0. fM1 %f fRad %i %f \n",fM1,fRad,(fM1+0.122-0.244*(Float_t)fRad)); |
if ( (fM1+0.122-0.244*(Float_t)fRad) < 0. ) printf("Error: (fM1+0.122-0.244*(Float_t)fRad) < 0. fM1 %f fRad %i %f \n",fM1,fRad,(fM1+0.122-0.244*(Float_t)fRad)); |
866 |
// |
// |
867 |
if ( fLong ){ |
if ( fLong ){ |
868 |
// use long fit to measure energy |
// |
869 |
|
// use long fit to measure energy NOT IMPLEMENTED YET |
870 |
|
// |
871 |
} else { |
} else { |
872 |
// |
// |
873 |
|
// use the energy measurement |
874 |
|
// |
875 |
if ( this->IsInsideAcceptance(section) ){ |
if ( this->IsInsideAcceptance(section) ){ |
876 |
// |
// |
877 |
|
// the event is good |
878 |
|
// |
879 |
if ( debug ) printf(" XE %i XO %i YE %i YO %i \n",fXesel,fXosel,fYesel,fYosel); |
if ( debug ) printf(" XE %i XO %i YE %i YO %i \n",fXesel,fXosel,fYesel,fYosel); |
880 |
// |
// |
881 |
} else { |
} else { |
882 |
|
// |
883 |
|
// if the event is not in the acceptance, return a negative energy. |
884 |
|
// |
885 |
if ( debug ) printf(" Outside acceptance \n"); |
if ( debug ) printf(" Outside acceptance \n"); |
886 |
fEnergy = -1.; |
fEnergy *= -1.; |
887 |
|
// |
888 |
}; |
}; |
889 |
}; |
}; |
890 |
// |
// |