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 |
// 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); |
if ( !cp ) cp = new CaloPreSampler(L2); |
43 |
cp->SplitInto(0,22); |
cp->SplitInto(0,22); |
44 |
cp->SetForceFitMode(1000); |
cp->SetForceFitMode(1000); |
45 |
// cp->UseTracker(false); |
// cp->UseTracker(false); |
46 |
// cp->ForceCaloFit(); |
// cp->ForceCaloFit(); |
47 |
// cp->SetDebug(true); |
// cp->SetDebug(true); |
48 |
// cp->Process(); |
// cp->Process(); |
49 |
|
if ( clong ) clong->SetCaloLevel2Pointer(cp->GetLevel2Pointer()); |
50 |
|
} |
51 |
|
|
52 |
|
|
53 |
|
void CaloEnergy::UseLongFit(){ |
54 |
|
fPl = 0; |
55 |
|
fLong = true; |
56 |
|
if ( !clong ){ |
57 |
|
clong = new CaloLong(L2); |
58 |
|
if ( cp ) clong->SetCaloLevel2Pointer(cp->GetLevel2Pointer()); |
59 |
|
clong->SplitInto(0,22); |
60 |
|
}; |
61 |
|
// |
62 |
} |
} |
63 |
|
|
64 |
void CaloEnergy::Set(){ |
void CaloEnergy::Set(){ |
83 |
fPl = 1; |
fPl = 1; |
84 |
fRad = -1; |
fRad = -1; |
85 |
cp = NULL; |
cp = NULL; |
86 |
|
clong = NULL; |
87 |
|
x0max = -1.; |
88 |
// |
// |
89 |
this->DefineGeometry(); |
this->DefineGeometry(); |
90 |
fXosel =true; |
fXosel =true; |
99 |
fXemin = 1000; |
fXemin = 1000; |
100 |
fYomin = 1000; |
fYomin = 1000; |
101 |
fYemin = 1000; |
fYemin = 1000; |
102 |
|
// |
103 |
} |
} |
104 |
|
|
105 |
void CaloEnergy::SetMinimumContainment(TString section, Int_t plane){ |
void CaloEnergy::SetMinimumContainment(TString section, Int_t plane){ |
155 |
return(-1); |
return(-1); |
156 |
} |
} |
157 |
|
|
158 |
|
Float_t CaloEnergy::GetEnergyAtMaxplane(TString section){ |
159 |
|
section.ToUpper(); |
160 |
|
if ( section.Contains("XO") ) return xomax_en; |
161 |
|
if ( section.Contains("XE") ) return xemax_en; |
162 |
|
if ( section.Contains("YO") ) return yomax_en; |
163 |
|
if ( section.Contains("YE") ) return yemax_en; |
164 |
|
return(-1); |
165 |
|
} |
166 |
|
|
167 |
Float_t CaloEnergy::GetMaxEnergy(TString section){ |
Float_t CaloEnergy::GetMaxEnergy(TString section){ |
168 |
section.ToUpper(); |
section.ToUpper(); |
169 |
if ( section.Contains("XO") ) return fXOen_maxplane; |
if ( fLong ){ |
170 |
if ( section.Contains("XE") ) return fXEen_maxplane; |
this->Process(section); |
171 |
if ( section.Contains("YO") ) return fYOen_maxplane; |
return fXOen_maxplane; |
172 |
if ( section.Contains("YE") ) return fYEen_maxplane; |
} else { |
173 |
|
if ( section.Contains("XO") ) return fXOen_maxplane; |
174 |
|
if ( section.Contains("XE") ) return fXEen_maxplane; |
175 |
|
if ( section.Contains("YO") ) return fYOen_maxplane; |
176 |
|
if ( section.Contains("YE") ) return fYEen_maxplane; |
177 |
|
}; |
178 |
return(-1); |
return(-1); |
179 |
} |
} |
180 |
|
|
181 |
|
Float_t CaloEnergy::GetMaxEnergy(){ |
182 |
|
if ( fLong ){ |
183 |
|
if ( debug ) printf(" oh! call process! with asntr %s and sntr %s \n",asntr.Data(),sntr.Data()); |
184 |
|
this->Process(asntr); |
185 |
|
}; |
186 |
|
return((fXEen_maxplane+fYOen_maxplane+fYEen_maxplane+fXOen_maxplane)); |
187 |
|
} |
188 |
|
|
189 |
void CaloEnergy::DefineGeometry(){ |
void CaloEnergy::DefineGeometry(){ |
190 |
// |
// |
191 |
// Use CaloStrip to determine once the position of border strips for each section |
// Use CaloStrip to determine once the position of border strips for each section |
192 |
// |
// |
193 |
// |
// |
194 |
fM = 2. + 0.096; // real position from cbar |
// fM = 2. + 0.096; // real position from cbar BUG the 0.096 is already taken into account in the border calculation made by Giovanna |
195 |
fM1 = 2. - 0.122 - 0.096; // due to calculation of xe1 etc. |
fM = 2. ; // real position from cbar |
196 |
|
// fM1 = 2. - 0.122 - 0.096; // due to calculation of xe1 etc. BUG! this way we count from the silicon border not from the silicon sensitive area |
197 |
|
fM1 = 2. - 0.122 - 0.096 + 0.096; // due to calculation of xe1 etc. |
198 |
if ( fM1 < 0. ) fM1 = 0.; |
if ( fM1 < 0. ) fM1 = 0.; |
199 |
// |
// |
200 |
CaloStrip *cs = new CaloStrip(fSimu); |
CaloStrip *cs = new CaloStrip(fSimu); |
219 |
cs->Set(1,0,95); |
cs->Set(1,0,95); |
220 |
xe6= cs->GetY(); |
xe6= cs->GetY(); |
221 |
|
|
222 |
|
// printf(" xe1 %f xe2 %f xe3 %f xe4 %f xe5 %f xe6 %f \n",xe1,xe2,xe3,xe4,xe5,xe6); |
223 |
|
|
224 |
// view x plane 0 strip 0 |
// view x plane 0 strip 0 |
225 |
cs->Set(0,0,0); |
cs->Set(0,0,0); |
226 |
yo1= cs->GetX(); |
yo1= cs->GetX(); |
241 |
cs->Set(0,0,95); |
cs->Set(0,0,95); |
242 |
yo6= cs->GetX(); |
yo6= cs->GetX(); |
243 |
|
|
|
|
|
244 |
// view y plane 1 strip 0 |
// view y plane 1 strip 0 |
245 |
cs->Set(1,1,0); |
cs->Set(1,1,0); |
246 |
xo1= cs->GetY(); |
xo1= cs->GetY(); |
281 |
cs->Set(0,1,95); |
cs->Set(0,1,95); |
282 |
ye6= cs->GetX(); |
ye6= cs->GetX(); |
283 |
|
|
284 |
|
//printf(" ye1 %f ye2 %f ye3 %f ye4 %f ye5 %f ye6 %f \n",ye1,ye2,ye3,ye4,ye5,ye6); |
285 |
|
|
286 |
// |
// |
287 |
for (Int_t p = 0; p<22; p ++){ |
for (Int_t p = 0; p<22; p ++){ |
288 |
for (Int_t v = 0; v<2; v++ ){ |
for (Int_t v = 0; v<2; v++ ){ |
315 |
fMax_planexo = 0; |
fMax_planexo = 0; |
316 |
fMax_planexe = 0; |
fMax_planexe = 0; |
317 |
fMax_planeyo = 0; |
fMax_planeyo = 0; |
318 |
fMax_planeye = 0; |
fMax_planeye = 0; |
319 |
|
xomax_en= 0.; |
320 |
|
xemax_en= 0.; |
321 |
|
yomax_en= 0.; |
322 |
|
yemax_en= 0.; |
323 |
|
// |
324 |
memset(enstrip,0,2*22*96*(sizeof(Float_t))); |
memset(enstrip,0,2*22*96*(sizeof(Float_t))); |
325 |
en = 0.; |
en = 0.; |
326 |
view = 0; |
view = 0; |
343 |
memset(en_xop,0,11*sizeof(Float_t)); |
memset(en_xop,0,11*sizeof(Float_t)); |
344 |
memset(en_yop,0,11*sizeof(Float_t)); |
memset(en_yop,0,11*sizeof(Float_t)); |
345 |
// |
// |
346 |
|
fColumn = -1; |
347 |
|
memset(encol,0,2*3*sizeof(Float_t)); |
348 |
|
// |
349 |
} |
} |
350 |
|
|
351 |
void CaloEnergy::Print(){ |
void CaloEnergy::Print(){ |
378 |
printf(" fM1 :.............. %f \n",fM1); |
printf(" fM1 :.............. %f \n",fM1); |
379 |
printf(" fRad :.............. %i \n",fRad); |
printf(" fRad :.............. %i \n",fRad); |
380 |
printf(" fPl :.............. %i \n",fPl); |
printf(" fPl :.............. %i \n",fPl); |
381 |
|
printf(" fColumn :.............. %i \n",fColumn); |
382 |
printf(" fConv_rxe ............. %f \n",fConv_rxe); |
printf(" fConv_rxe ............. %f \n",fConv_rxe); |
383 |
printf(" fConv_rxo ............. %f \n",fConv_rxo); |
printf(" fConv_rxo ............. %f \n",fConv_rxo); |
384 |
printf(" fConv_ryo ............. %f \n",fConv_ryo); |
printf(" fConv_ryo ............. %f \n",fConv_ryo); |
388 |
printf(" energyxo:.............. %f \n",energyxo); |
printf(" energyxo:.............. %f \n",energyxo); |
389 |
printf(" energyye:.............. %f \n",energyye); |
printf(" energyye:.............. %f \n",energyye); |
390 |
printf(" energyyo:.............. %f \n",energyyo); |
printf(" energyyo:.............. %f \n",energyyo); |
391 |
|
printf(" fXEen_maxplane:........ %f \n",fXEen_maxplane); |
392 |
|
printf(" fXOen_maxplane:........ %f \n",fXOen_maxplane); |
393 |
|
printf(" fYEen_maxplane:........ %f \n",fYEen_maxplane); |
394 |
|
printf(" fYOen_maxplane:........ %f \n",fYOen_maxplane); |
395 |
|
printf(" x0max :.............. %f \n",x0max); |
396 |
printf(" debug :.............. %i \n",debug); |
printf(" debug :.............. %i \n",debug); |
397 |
|
|
398 |
printf("========================================================================\n"); |
printf("========================================================================\n"); |
468 |
enstrip[view][plane][strip]=en; |
enstrip[view][plane][strip]=en; |
469 |
}; |
}; |
470 |
// |
// |
471 |
|
if ( debug && ((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)); |
472 |
|
// |
473 |
// sum energy plane by plane for each sections |
// sum energy plane by plane for each sections |
474 |
// |
// |
475 |
for (Int_t i=0;i<11;i++){ |
for (Int_t i=0;i<11;i++){ |
476 |
for(strip=0; strip<96; strip++) { |
for(strip=0; strip<96; strip++) { |
477 |
if ( fRad < 0 ){ |
if ( fRad < 0 ){ |
478 |
// |
// |
479 |
// run over all the strips of the plane |
// run over all the strips of the plane |
480 |
// |
// |
481 |
en_xep[i] += enstrip[1][2*i][strip]; |
en_xep[i] += enstrip[1][2*i][strip]; |
482 |
en_yop[i] += enstrip[0][2*i][strip]; |
en_yop[i] += enstrip[0][2*i][strip]; |
483 |
en_xop[i] += enstrip[1][2*i+1][strip]; |
en_xop[i] += enstrip[1][(2*i)+1][strip]; |
484 |
en_yep[i] += enstrip[0][2*i+1][strip]; |
en_yep[i] += enstrip[0][(2*i)+1][strip]; |
485 |
} else { |
} else { |
486 |
// |
// |
487 |
// use only the strips inside a cylinder of given radius fRad |
// use only the strips inside a cylinder of given radius fRad |
488 |
// |
// |
489 |
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]; |
if ( cl2->cibar[2*i][1] >= 1 && cl2->cibar[2*i][1] <= 96 && (strip >= (cl2->cibar[2*i][1]-1-fRad)) && (strip <= (cl2->cibar[2*i][1]-1+fRad)) ) en_xep[i] += enstrip[1][2*i][strip]; |
490 |
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]; |
if ( cl2->cibar[2*i][0] >= 1 && cl2->cibar[2*i][0] <= 96 && (strip >= (cl2->cibar[2*i][0]-1-fRad)) && (strip <= (cl2->cibar[2*i][0]-1+fRad)) ) en_yop[i] += enstrip[0][2*i][strip]; |
491 |
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]; |
if ( cl2->cibar[(2*i)+1][1] >= 1 && cl2->cibar[(2*i)+1][1] <= 96 && (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]; |
492 |
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]; |
if ( cl2->cibar[(2*i)+1][0] >= 1 && cl2->cibar[(2*i)+1][0] <= 96 && (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]; |
493 |
}; |
}; |
494 |
}; |
}; |
495 |
energyxe += en_xep[i]; |
energyxe += en_xep[i]; |
500 |
// |
// |
501 |
// Find the plane of maximum for each section |
// Find the plane of maximum for each section |
502 |
// |
// |
|
Float_t xomax_en= 0.; |
|
|
Float_t xemax_en= 0.; |
|
|
Float_t yomax_en= 0.; |
|
|
Float_t yemax_en= 0.; |
|
|
// |
|
503 |
// |
// |
504 |
Int_t xen = 0; |
Int_t xen = 0; |
505 |
Int_t yon = 0; |
Int_t yon = 0; |
548 |
}; |
}; |
549 |
}; |
}; |
550 |
// |
// |
551 |
|
// the maximum is given externally as X0, convert it to plane and section |
552 |
|
// |
553 |
|
if ( x0max > 0. ){ |
554 |
|
if ( debug ) printf(" CALCULATE MAX PLANE GIVEN X0 ASSUMING PERPENDICULAR TRACK \n"); |
555 |
|
Int_t wpl = (Int_t)roundf(x0max/0.76); |
556 |
|
Bool_t isY = false; |
557 |
|
if ( ((x0max/0.76)-(Float_t)wpl) > 0. ) isY = true; |
558 |
|
xomax_en = 0.; |
559 |
|
yemax_en = 0.; |
560 |
|
xemax_en = 0.; |
561 |
|
yomax_en = 0.; |
562 |
|
// |
563 |
|
if ( !(wpl%2) ){ |
564 |
|
// 0, 2, 4, ... |
565 |
|
if ( isY ){ |
566 |
|
if ( section.Contains("YO") ) yomax_en = 1000.; |
567 |
|
if ( section.Contains("XE") ) xemax_en = 500.; |
568 |
|
fMax_planeyo=wpl/2; |
569 |
|
fMax_planexe=wpl/2; |
570 |
|
if ( section.Contains("XO") ) xomax_en = 10.; |
571 |
|
if ( section.Contains("YE") ) yemax_en = 5.; |
572 |
|
} else { |
573 |
|
if ( section.Contains("YO") ) yomax_en = 500.; |
574 |
|
if ( section.Contains("XE") ) xemax_en = 1000.; |
575 |
|
fMax_planeyo=wpl/2; |
576 |
|
fMax_planexe=wpl/2; |
577 |
|
if ( section.Contains("XO") ) xomax_en = 5.; |
578 |
|
if ( section.Contains("YE") ) yemax_en = 10.; |
579 |
|
}; |
580 |
|
} else { |
581 |
|
// 1, 3, 5, ... |
582 |
|
if ( isY ){ |
583 |
|
if ( section.Contains("YE") ) yemax_en = 1000.; |
584 |
|
if ( section.Contains("XO") ) xomax_en = 500.; |
585 |
|
fMax_planeye=(wpl-1)/2; |
586 |
|
fMax_planexo=(wpl-1)/2; |
587 |
|
if ( section.Contains("XE") ) xemax_en = 10.; |
588 |
|
if ( section.Contains("YO") ) yomax_en = 5.; |
589 |
|
} else { |
590 |
|
if ( section.Contains("YE") ) yemax_en = 500.; |
591 |
|
if ( section.Contains("XO") ) xomax_en = 1000.; |
592 |
|
fMax_planeye=(wpl-1)/2; |
593 |
|
fMax_planexo=(wpl-1)/2; |
594 |
|
if ( section.Contains("XE") ) xemax_en = 5.; |
595 |
|
if ( section.Contains("YO") ) yomax_en = 10.; |
596 |
|
}; |
597 |
|
}; |
598 |
|
if ( debug ) printf(" x0max %f x0max/0.76 %f wpl %i isY %i yomax_en %f xemax_en %f yemax_en %f xomax_en %f fMaxplane %i %i %i %i\n",x0max,(x0max/0.76),wpl,isY,yomax_en,xemax_en,yemax_en,xomax_en,fMax_planeyo,fMax_planexe,fMax_planeye,fMax_planexo); |
599 |
|
}; |
600 |
|
// |
601 |
Int_t nPl = fPl; |
Int_t nPl = fPl; |
602 |
// |
// |
603 |
// Set the maximum in case of coherent mode was selected |
// Set the maximum in case of coherent mode was selected |
667 |
// |
// |
668 |
// 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 |
// 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 |
669 |
// |
// |
|
Float_t track_coordx[22][2]; |
|
|
Float_t track_coordy[22][2]; |
|
670 |
// |
// |
671 |
Float_t tgx_cl2; |
Float_t tgx_cl2; |
672 |
Float_t tgy_cl2; |
Float_t tgy_cl2; |
676 |
for (Int_t p=0; p<22; p++){ |
for (Int_t p=0; p<22; p++){ |
677 |
track_coordy[p][1] = cl2->cbar[p][1]; |
track_coordy[p][1] = cl2->cbar[p][1]; |
678 |
track_coordx[p][1] = cl2->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; |
679 |
|
// track_coordx[p][1] = cl2->cbar[p][0] + fabs(trk_z[p][1]-trk_z[p][0])*tgx_cl2; |
680 |
track_coordx[p][0] = cl2->cbar[p][0]; |
track_coordx[p][0] = cl2->cbar[p][0]; |
681 |
track_coordy[p][0] = cl2->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; |
682 |
|
// track_coordy[p][0] = cl2->cbar[p][1] + fabs(trk_z[p][1]-trk_z[p][0])*tgy_cl2; |
683 |
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]); |
684 |
}; |
}; |
685 |
// |
// |
692 |
for (Int_t i=0; i<11; i++) { |
for (Int_t i=0; i<11; i++) { |
693 |
if |
if |
694 |
( |
( |
695 |
(((track_coordx[2*i+1][1]>=(-12.054+fM))&& |
(((track_coordx[(2*i)+1][1]>=(-12.054+fM))&& |
696 |
(track_coordx[2*i+1][1]<=(-4.246-fM)))&& |
(track_coordx[(2*i)+1][1]<=(-4.246-fM)))&& |
697 |
(((cl2->cbar[2*i+1][1]>=xo1 + fM1)&& |
(((cl2->cbar[(2*i)+1][1]>=xo1 + fM1)&& |
698 |
(cl2->cbar[2*i+1][1]<=xo2 - fM1 ))|| |
(cl2->cbar[(2*i)+1][1]<=xo2 - fM1 ))|| |
699 |
((cl2->cbar[2*i+1][1]>=xo3 + fM1)&& |
((cl2->cbar[(2*i)+1][1]>=xo3 + fM1)&& |
700 |
(cl2->cbar[2*i+1][1]<=xo4 - fM1 ))|| |
(cl2->cbar[(2*i)+1][1]<=xo4 - fM1 ))|| |
701 |
((cl2->cbar[2*i+1][1]>=xo5 + fM1)&& |
((cl2->cbar[(2*i)+1][1]>=xo5 + fM1)&& |
702 |
(cl2->cbar[2*i+1][1]<=xo6 - fM1 ))))|| |
(cl2->cbar[(2*i)+1][1]<=xo6 - fM1 ))))|| |
703 |
|
|
704 |
(((track_coordx[2*i+1][1]>=(-4.004+fM))&& |
(((track_coordx[(2*i)+1][1]>=(-4.004+fM))&& |
705 |
(track_coordx[2*i+1][1]<=(3.804-fM)))&& |
(track_coordx[(2*i)+1][1]<=(3.804-fM)))&& |
706 |
(((cl2->cbar[2*i+1][1]>=xo1 + fM1)&& |
(((cl2->cbar[(2*i)+1][1]>=xo1 + fM1)&& |
707 |
(cl2->cbar[2*i+1][1]<=xo2 - fM1 ))|| |
(cl2->cbar[(2*i)+1][1]<=xo2 - fM1 ))|| |
708 |
((cl2->cbar[2*i+1][1]>=xo3 + fM1)&& |
((cl2->cbar[(2*i)+1][1]>=xo3 + fM1)&& |
709 |
(cl2->cbar[2*i+1][1]<=xo4 - fM1))|| |
(cl2->cbar[(2*i)+1][1]<=xo4 - fM1))|| |
710 |
((cl2->cbar[2*i+1][1]>=xo5 + fM1)&& |
((cl2->cbar[(2*i)+1][1]>=xo5 + fM1)&& |
711 |
(cl2->cbar[2*i+1][1]<=xo6 - fM1 ))))|| |
(cl2->cbar[(2*i)+1][1]<=xo6 - fM1 ))))|| |
712 |
|
|
713 |
(((track_coordx[2*i+1][1]>=(4.046+fM))&& |
(((track_coordx[(2*i)+1][1]>=(4.046+fM))&& |
714 |
(track_coordx[2*i+1][1]<=(11.854-fM)))&& |
(track_coordx[(2*i)+1][1]<=(11.854-fM)))&& |
715 |
(((cl2->cbar[2*i+1][1]>=xo1 + fM1)&& |
(((cl2->cbar[(2*i)+1][1]>=xo1 + fM1)&& |
716 |
(cl2->cbar[2*i+1][1]<=xo2 - fM1))|| |
(cl2->cbar[(2*i)+1][1]<=xo2 - fM1))|| |
717 |
((cl2->cbar[2*i+1][1]>=xo3 + fM1)&& |
((cl2->cbar[(2*i)+1][1]>=xo3 + fM1)&& |
718 |
(cl2->cbar[2*i+1][1]<=xo4 - fM1 ))|| |
(cl2->cbar[(2*i)+1][1]<=xo4 - fM1 ))|| |
719 |
((cl2->cbar[2*i+1][1]>=xo5 + fM1)&& |
((cl2->cbar[(2*i)+1][1]>=xo5 + fM1)&& |
720 |
(cl2->cbar[2*i+1][1]<=xo6 - fM1 )))) |
(cl2->cbar[(2*i)+1][1]<=xo6 - fM1 )))) |
721 |
){ |
){ |
722 |
fXosel = true; |
fXosel = true; |
723 |
fXoout = i; |
fXoout = i; |
738 |
// event is contained (or partially contained) hence we can integrate energy up to the maximum and calculate the energy as measured by this section |
// event is contained (or partially contained) hence we can integrate energy up to the maximum and calculate the energy as measured by this section |
739 |
// |
// |
740 |
if ( fXosel ){ |
if ( fXosel ){ |
741 |
for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planexo+nPl)) ;iplm++) fXOen_maxplane += en_xop[iplm]; |
for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planexo+nPl)) ;iplm++){ |
742 |
|
fXOen_maxplane += en_xop[iplm]; |
743 |
|
if ( debug ) printf(" XO iplm %i fXOen_maxplane %f en_xop[iplm] %f\n",iplm,fXOen_maxplane,en_xop[iplm]); |
744 |
|
}; |
745 |
fEnergyxo = fXOen_maxplane/fConv_rxo; |
fEnergyxo = fXOen_maxplane/fConv_rxo; |
746 |
}; |
}; |
747 |
}; |
}; |
790 |
fXesel = true; |
fXesel = true; |
791 |
}; |
}; |
792 |
if ( fXesel ){ |
if ( fXesel ){ |
793 |
for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planexe+nPl)) ;iplm++) fXEen_maxplane += en_xep[iplm]; |
for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planexe+nPl)) ;iplm++){ |
794 |
|
fXEen_maxplane += en_xep[iplm]; |
795 |
|
if ( debug ) printf(" XE iplm %i fXOen_maxplane %f en_xop[iplm] %f\n",iplm,fXEen_maxplane,en_xep[iplm]); |
796 |
|
}; |
797 |
fEnergyxe = fXEen_maxplane/fConv_rxe; |
fEnergyxe = fXEen_maxplane/fConv_rxe; |
798 |
}; |
}; |
799 |
}; |
}; |
802 |
for (Int_t i=0; i<11; i++) { |
for (Int_t i=0; i<11; i++) { |
803 |
if |
if |
804 |
( |
( |
805 |
(((track_coordy[2*i+1][0]>=(-12.154+fM))&& |
(((track_coordy[(2*i)+1][0]>=(-12.154+fM))&& |
806 |
(track_coordy[2*i+1][0]<=(-4.346-fM)))&& |
(track_coordy[(2*i)+1][0]<=(-4.346-fM)))&& |
807 |
(((cl2->cbar[2*i+1][0]>=ye1 + fM1)&& |
(((cl2->cbar[(2*i)+1][0]>=ye1 + fM1)&& |
808 |
(cl2->cbar[2*i+1][0]<=ye2 - fM1 ))|| |
(cl2->cbar[(2*i)+1][0]<=ye2 - fM1 ))|| |
809 |
((cl2->cbar[2*i+1][0]>=ye3 + fM1)&& |
((cl2->cbar[(2*i)+1][0]>=ye3 + fM1)&& |
810 |
(cl2->cbar[2*i+1][0]<=ye4 - fM1 ))|| |
(cl2->cbar[(2*i)+1][0]<=ye4 - fM1 ))|| |
811 |
((cl2->cbar[2*i+1][0]>=ye5 + fM1)&& |
((cl2->cbar[(2*i)+1][0]>=ye5 + fM1)&& |
812 |
(cl2->cbar[2*i+1][0]<=ye6 - fM1 ))))|| |
(cl2->cbar[(2*i)+1][0]<=ye6 - fM1 ))))|| |
813 |
|
|
814 |
(((track_coordy[2*i+1][0]>=(-4.104+fM))&& |
(((track_coordy[(2*i)+1][0]>=(-4.104+fM))&& |
815 |
(track_coordy[2*i+1][0]<=(3.704-fM)))&& |
(track_coordy[(2*i)+1][0]<=(3.704-fM)))&& |
816 |
(((cl2->cbar[2*i+1][0]>=ye1 + fM1)&& |
(((cl2->cbar[(2*i)+1][0]>=ye1 + fM1)&& |
817 |
(cl2->cbar[2*i+1][0]<=ye2 - fM1 ))|| |
(cl2->cbar[(2*i)+1][0]<=ye2 - fM1 ))|| |
818 |
((cl2->cbar[2*i+1][0]>=ye3 + fM1)&& |
((cl2->cbar[(2*i)+1][0]>=ye3 + fM1)&& |
819 |
(cl2->cbar[2*i+1][0]<=ye4 - fM1))|| |
(cl2->cbar[(2*i)+1][0]<=ye4 - fM1))|| |
820 |
((cl2->cbar[2*i+1][0]>=ye5 + fM1)&& |
((cl2->cbar[(2*i)+1][0]>=ye5 + fM1)&& |
821 |
(cl2->cbar[2*i+1][0]<=ye6 - fM1 ))))|| |
(cl2->cbar[(2*i)+1][0]<=ye6 - fM1 ))))|| |
822 |
|
|
823 |
(((track_coordy[2*i+1][0]>=(3.946+fM))&& |
(((track_coordy[(2*i)+1][0]>=(3.946+fM))&& |
824 |
(track_coordy[2*i+1][0]<=(11.754-fM)))&& |
(track_coordy[(2*i)+1][0]<=(11.754-fM)))&& |
825 |
(((cl2->cbar[2*i+1][0]>=ye1 + fM1)&& |
(((cl2->cbar[(2*i)+1][0]>=ye1 + fM1)&& |
826 |
(cl2->cbar[2*i+1][0]<=ye2 - fM1))|| |
(cl2->cbar[(2*i)+1][0]<=ye2 - fM1))|| |
827 |
((cl2->cbar[2*i+1][0]>=ye3 + fM1)&& |
((cl2->cbar[(2*i)+1][0]>=ye3 + fM1)&& |
828 |
(cl2->cbar[2*i+1][0]<=ye4 - fM1 ))|| |
(cl2->cbar[(2*i)+1][0]<=ye4 - fM1 ))|| |
829 |
((cl2->cbar[2*i+1][0]>=ye5 + fM1)&& |
((cl2->cbar[(2*i)+1][0]>=ye5 + fM1)&& |
830 |
(cl2->cbar[2*i+1][0]<=ye6 - fM1 )))) |
(cl2->cbar[(2*i)+1][0]<=ye6 - fM1 )))) |
831 |
){ |
){ |
832 |
fYesel = true; |
fYesel = true; |
833 |
fYeout = i; |
fYeout = i; |
901 |
// Count the number of sections in which the event is contained |
// Count the number of sections in which the event is contained |
902 |
// |
// |
903 |
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); |
|
if ( debug ) printf(" IsInside XE %i XO %i YE %i YO %i => SEL %i \n",fXesel,fXosel,fYesel,fYosel,fSel); |
|
904 |
// |
// |
905 |
if ( indep ){ |
if ( indep ){ |
906 |
// |
// |
923 |
}; |
}; |
924 |
// |
// |
925 |
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); |
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); |
926 |
|
if ( debug ) printf(" IsInside XE %i XO %i YE %i YO %i => SEL %i \n",fXesel,fXosel,fYesel,fYosel,fSel); |
927 |
// |
// |
928 |
// finish exit |
// finish exit |
929 |
// |
// |
975 |
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)); |
976 |
// |
// |
977 |
if ( fLong ){ |
if ( fLong ){ |
978 |
|
if ( debug ) printf(" ==================================================================> LONGITUDINAL FIT! \n"); |
979 |
|
// |
980 |
|
// use long fit to measure energy |
981 |
// |
// |
982 |
// use long fit to measure energy NOT IMPLEMENTED YET |
if ( this->IsInsideAcceptance(section) ){ |
983 |
|
// |
984 |
|
if ( debug ) printf(" ==================================================================> LONG INSIDE! \n"); |
985 |
|
// |
986 |
|
Float_t myene[2][22]; |
987 |
|
memset(myene,0,(sizeof(Float_t))*2*22); |
988 |
|
for (Int_t j=0; j<11; j++){ |
989 |
|
if ( section.Contains("XE") ) myene[1][2*j] = en_xep[j]; |
990 |
|
if ( section.Contains("YO") ) myene[0][2*j] = en_yop[j]; |
991 |
|
if ( section.Contains("XO") ) myene[1][(2*j)+1] = en_xop[j]; |
992 |
|
if ( section.Contains("YE") ) myene[0][(2*j)+1] = en_yep[j]; |
993 |
|
}; |
994 |
|
clong->UnMaskSections(); |
995 |
|
if ( !(section.Contains("YE")) ) clong->MaskSection("YE"); |
996 |
|
if ( !(section.Contains("YO")) ) clong->MaskSection("YO"); |
997 |
|
if ( !(section.Contains("XO")) ) clong->MaskSection("XO"); |
998 |
|
if ( !(section.Contains("XE")) ) clong->MaskSection("XE"); |
999 |
|
clong->ForceNextFit(); |
1000 |
|
clong->SetEnergies(myene); |
1001 |
|
if ( debug ){ |
1002 |
|
clong->Fit(true); |
1003 |
|
} else { |
1004 |
|
clong->Fit(); |
1005 |
|
}; |
1006 |
|
if ( clong->GetLowerLimit() != 0. || clong->GetUpperLimit() != 0. ){ |
1007 |
|
fXOen_maxplane = clong->Get_defE0(); |
1008 |
|
} else { |
1009 |
|
fXOen_maxplane = clong->Get_E0(); |
1010 |
|
}; |
1011 |
|
fMax_plane = clong->Get_tmax(); |
1012 |
|
fYOen_maxplane = 0.; |
1013 |
|
fYEen_maxplane = 0.; |
1014 |
|
fXEen_maxplane = 0.; |
1015 |
|
fEnergy=fXOen_maxplane/fConv_rxo; |
1016 |
|
if ( fEnergy != fEnergy || clong->Get_fitresult() != 0 ) fEnergy = -1.; |
1017 |
|
// if ( fEnergy != fEnergy ) fEnergy = 1.; |
1018 |
|
// |
1019 |
|
} else { |
1020 |
|
// |
1021 |
|
// if the event is not in the acceptance, return a negative energy. |
1022 |
|
// |
1023 |
|
if ( debug ) printf(" Outside acceptance \n"); |
1024 |
|
fEnergy *= -1.; |
1025 |
|
// |
1026 |
|
}; |
1027 |
// |
// |
1028 |
} else { |
} else { |
1029 |
// |
// |