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 |
|
|
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){ |
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++ ){ |
321 |
yomax_en= 0.; |
yomax_en= 0.; |
322 |
yemax_en= 0.; |
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; |
327 |
plane = 0; |
plane = 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); |
printf(" x0max :.............. %f \n",x0max); |
396 |
printf(" debug :.............. %i \n",debug); |
printf(" debug :.............. %i \n",debug); |
397 |
|
|
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]; |
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]; |
555 |
Int_t wpl = (Int_t)roundf(x0max/0.76); |
Int_t wpl = (Int_t)roundf(x0max/0.76); |
556 |
Bool_t isY = false; |
Bool_t isY = false; |
557 |
if ( ((x0max/0.76)-(Float_t)wpl) > 0. ) isY = true; |
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) ){ |
if ( !(wpl%2) ){ |
564 |
// 0, 2, 4, ... |
// 0, 2, 4, ... |
565 |
if ( isY ){ |
if ( isY ){ |
566 |
yomax_en = 1000.; |
if ( section.Contains("YO") ) yomax_en = 1000.; |
567 |
xemax_en = 500.; |
if ( section.Contains("XE") ) xemax_en = 500.; |
568 |
fMax_planeyo=wpl/2; |
fMax_planeyo=wpl/2; |
569 |
fMax_planexe=wpl/2; |
fMax_planexe=wpl/2; |
570 |
|
if ( section.Contains("XO") ) xomax_en = 10.; |
571 |
|
if ( section.Contains("YE") ) yemax_en = 5.; |
572 |
} else { |
} else { |
573 |
yomax_en = 500.; |
if ( section.Contains("YO") ) yomax_en = 500.; |
574 |
xemax_en = 1000.; |
if ( section.Contains("XE") ) xemax_en = 1000.; |
575 |
fMax_planeyo=wpl/2; |
fMax_planeyo=wpl/2; |
576 |
fMax_planexe=wpl/2; |
fMax_planexe=wpl/2; |
577 |
|
if ( section.Contains("XO") ) xomax_en = 5.; |
578 |
|
if ( section.Contains("YE") ) yemax_en = 10.; |
579 |
}; |
}; |
|
xomax_en = 0.; |
|
|
yemax_en = 0.; |
|
580 |
} else { |
} else { |
581 |
// 1, 3, 5, ... |
// 1, 3, 5, ... |
582 |
if ( isY ){ |
if ( isY ){ |
583 |
yemax_en = 1000.; |
if ( section.Contains("YE") ) yemax_en = 1000.; |
584 |
xomax_en = 500.; |
if ( section.Contains("XO") ) xomax_en = 500.; |
585 |
fMax_planeye=(wpl-1)/2; |
fMax_planeye=(wpl-1)/2; |
586 |
fMax_planexo=(wpl-1)/2; |
fMax_planexo=(wpl-1)/2; |
587 |
|
if ( section.Contains("XE") ) xemax_en = 10.; |
588 |
|
if ( section.Contains("YO") ) yomax_en = 5.; |
589 |
} else { |
} else { |
590 |
yemax_en = 500.; |
if ( section.Contains("YE") ) yemax_en = 500.; |
591 |
xomax_en = 1000.; |
if ( section.Contains("XO") ) xomax_en = 1000.; |
592 |
fMax_planeye=(wpl-1)/2; |
fMax_planeye=(wpl-1)/2; |
593 |
fMax_planexo=(wpl-1)/2; |
fMax_planexo=(wpl-1)/2; |
594 |
|
if ( section.Contains("XE") ) xemax_en = 5.; |
595 |
|
if ( section.Contains("YO") ) yomax_en = 10.; |
596 |
}; |
}; |
|
xemax_en = 0.; |
|
|
yomax_en = 0.; |
|
597 |
}; |
}; |
598 |
if ( debug ) printf(" x0max %f wpl %i isY %i yomax_en %f xemax_en %f yemax_en %f xomax_en %f fMaxplane %i %i %i %i\n",x0max,wpl,isY,yomax_en,xemax_en,yemax_en,xomax_en,fMax_planeyo,fMax_planexe,fMax_planeye,fMax_planexo); |
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; |
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 |
// |
// |
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 |
}; |
}; |
1003 |
} else { |
} else { |
1004 |
clong->Fit(); |
clong->Fit(); |
1005 |
}; |
}; |
1006 |
fXOen_maxplane = clong->Get_E0(); |
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.; |
fYOen_maxplane = 0.; |
1013 |
fYEen_maxplane = 0.; |
fYEen_maxplane = 0.; |
1014 |
fXEen_maxplane = 0.; |
fXEen_maxplane = 0.; |