31 |
fLong = false; |
fLong = false; |
32 |
fSimu = false; |
fSimu = false; |
33 |
fPl = 1; |
fPl = 1; |
34 |
|
fRad = -1; |
35 |
// |
// |
36 |
this->DefineGeometry(); |
this->DefineGeometry(); |
37 |
fXosel = true; |
fXosel = true; |
38 |
fXesel = true; |
fXesel = true; |
39 |
fYosel = true; |
fYosel = true; |
40 |
fYesel = true; |
fYesel = true; |
41 |
fConv_r = 44.4; |
fConv_rxe = 44.4; |
42 |
|
fConv_rxo = 44.4; |
43 |
|
fConv_ryo = 44.4; |
44 |
|
fConv_rye = 44.4; |
45 |
// |
// |
46 |
} |
} |
47 |
|
|
68 |
fLong = false; |
fLong = false; |
69 |
fSimu = simulation; |
fSimu = simulation; |
70 |
fPl = 1; |
fPl = 1; |
71 |
|
fRad = -1; |
72 |
// |
// |
73 |
this->DefineGeometry(); |
this->DefineGeometry(); |
74 |
fXosel =true; |
fXosel =true; |
75 |
fXesel = true; |
fXesel = true; |
76 |
fYosel = true; |
fYosel = true; |
77 |
fYesel = true; |
fYesel = true; |
78 |
fConv_r = 44.4; |
fConv_rxe = 44.4; |
79 |
|
fConv_rxo = 44.4; |
80 |
|
fConv_ryo = 44.4; |
81 |
|
fConv_rye = 44.4; |
82 |
// |
// |
83 |
} |
} |
84 |
|
|
85 |
|
void CaloEnergy::SetConversionFactor(TString section, Float_t conv){ |
86 |
|
section.ToUpper(); |
87 |
|
if ( section.Contains("XO") ) fConv_rxo = conv; |
88 |
|
if ( section.Contains("XE") ) fConv_rxe = conv; |
89 |
|
if ( section.Contains("YO") ) fConv_ryo = conv; |
90 |
|
if ( section.Contains("YE") ) fConv_rye = conv; |
91 |
|
} |
92 |
|
|
93 |
|
Float_t CaloEnergy::GetConversionFactor(TString section){ |
94 |
|
section.ToUpper(); |
95 |
|
if ( section.Contains("XO") ) return(fConv_rxo); |
96 |
|
if ( section.Contains("XE") ) return(fConv_rxe); |
97 |
|
if ( section.Contains("YO") ) return(fConv_ryo); |
98 |
|
if ( section.Contains("YE") ) return(fConv_rye); |
99 |
|
printf(" ERROR: section not recognized \n"); |
100 |
|
return(-1000.); |
101 |
|
} |
102 |
|
|
103 |
|
Int_t CaloEnergy::GetMaxplane(TString section){ |
104 |
|
section.ToUpper(); |
105 |
|
if ( section.Contains("XO") ) return fMax_planexo; |
106 |
|
if ( section.Contains("XE") ) return fMax_planexe; |
107 |
|
if ( section.Contains("YO") ) return fMax_planeyo; |
108 |
|
if ( section.Contains("YE") ) return fMax_planeye; |
109 |
|
return(-1); |
110 |
|
} |
111 |
|
|
112 |
void CaloEnergy::DefineGeometry(){ |
void CaloEnergy::DefineGeometry(){ |
113 |
// |
// |
114 |
fM = 2.; |
fM = 2. + 0.096; // real position from cbar |
115 |
fM1 = fM - 0.122 -0.096; |
fM1 = 2. - 0.122 - 0.096; // due to calculation of xe1 etc. |
116 |
if ( fM1 < 0. ) fM1 = 0.; |
if ( fM1 < 0. ) fM1 = 0.; |
117 |
// |
// |
118 |
CaloStrip *cs = new CaloStrip(fSimu); |
CaloStrip *cs = new CaloStrip(fSimu); |
213 |
void CaloEnergy::Clear(){ |
void CaloEnergy::Clear(){ |
214 |
// |
// |
215 |
fEnergy = 0.; |
fEnergy = 0.; |
216 |
|
fEnergyxe = 0.; |
217 |
|
fEnergyxo = 0.; |
218 |
|
fEnergyye = 0.; |
219 |
|
fEnergyyo = 0.; |
220 |
memset(enstrip,0,2*22*96*(sizeof(Float_t))); |
memset(enstrip,0,2*22*96*(sizeof(Float_t))); |
221 |
en = 0.; |
en = 0.; |
222 |
view = 0; |
view = 0; |
238 |
printf("========================================================================\n"); |
printf("========================================================================\n"); |
239 |
printf(" OBT: %u PKT: %u ATIME: %u \n",OBT,PKT,atime); |
printf(" OBT: %u PKT: %u ATIME: %u \n",OBT,PKT,atime); |
240 |
printf(" fEnergy :.............. %f \n",fEnergy); |
printf(" fEnergy :.............. %f \n",fEnergy); |
241 |
printf(" fMax_plane :........... %i \n",fMax_plane); |
printf(" fMax_plane :........... %f \n",fMax_plane); |
242 |
|
printf(" fMax_planexo :......... %i \n",fMax_planexo); |
243 |
|
printf(" fMax_planexe :......... %i \n",fMax_planexe); |
244 |
|
printf(" fMax_planeyo :......... %i \n",fMax_planeyo); |
245 |
|
printf(" fMax_planeye :......... %i \n",fMax_planeye); |
246 |
printf(" fCount :.............. %f \n",fCount); |
printf(" fCount :.............. %f \n",fCount); |
247 |
printf(" fXesel :.............. %i \n",fXesel); |
printf(" fXesel :.............. %i \n",fXesel); |
248 |
printf(" fXosel :.............. %i \n",fXosel); |
printf(" fXosel :.............. %i \n",fXosel); |
251 |
printf(" fSimu :.............. %i \n",fSimu); |
printf(" fSimu :.............. %i \n",fSimu); |
252 |
printf(" fM :.............. %f \n",fM); |
printf(" fM :.............. %f \n",fM); |
253 |
printf(" fM1 :.............. %f \n",fM1); |
printf(" fM1 :.............. %f \n",fM1); |
254 |
printf(" fPl :.............. %f \n",fPl); |
printf(" fRad :.............. %i \n",fRad); |
255 |
printf(" fConv_r :.............. %f \n",fConv_r); |
printf(" fPl :.............. %i \n",fPl); |
256 |
|
printf(" fConv_rxe ............. %f \n",fConv_rxe); |
257 |
|
printf(" fConv_rxo ............. %f \n",fConv_rxo); |
258 |
|
printf(" fConv_ryo ............. %f \n",fConv_ryo); |
259 |
|
printf(" fConv_rye ............. %f \n",fConv_rye); |
260 |
printf(" fLong :.............. %i \n",fLong); |
printf(" fLong :.............. %i \n",fLong); |
261 |
printf(" energyxe:.............. %f \n",energyxe); |
printf(" energyxe:.............. %f \n",energyxe); |
262 |
printf(" energyxo:.............. %f \n",energyxo); |
printf(" energyxo:.............. %f \n",energyxo); |
542 |
// |
// |
543 |
Clear(); |
Clear(); |
544 |
// |
// |
545 |
|
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)); |
546 |
|
// |
547 |
if ( fLong ){ |
if ( fLong ){ |
548 |
// use long fit to measure energy |
// use long fit to measure energy |
549 |
} else { |
} else { |
556 |
}; |
}; |
557 |
for (Int_t i=0;i<11;i++){ |
for (Int_t i=0;i<11;i++){ |
558 |
for(strip=0; strip<96; strip++) { |
for(strip=0; strip<96; strip++) { |
559 |
en_xep[i] += enstrip[1][2*i][strip]; |
if ( fRad < 0 ){ |
560 |
en_yop[i] += enstrip[0][2*i][strip]; |
en_xep[i] += enstrip[1][2*i][strip]; |
561 |
en_xop[i] += enstrip[1][2*i+1][strip]; |
en_yop[i] += enstrip[0][2*i][strip]; |
562 |
en_yep[i] += enstrip[0][2*i+1][strip]; |
en_xop[i] += enstrip[1][2*i+1][strip]; |
563 |
|
en_yep[i] += enstrip[0][2*i+1][strip]; |
564 |
|
} else { |
565 |
|
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]; |
566 |
|
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]; |
567 |
|
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]; |
568 |
|
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]; |
569 |
|
}; |
570 |
}; |
}; |
571 |
energyxe += en_xep[i]; |
energyxe += en_xep[i]; |
572 |
energyyo += en_yop[i]; |
energyyo += en_yop[i]; |
574 |
energyye += en_yep[i]; |
energyye += en_yep[i]; |
575 |
}; |
}; |
576 |
fMax_plane = 0; |
fMax_plane = 0; |
577 |
|
fMax_planexo = 0; |
578 |
|
fMax_planexe = 0; |
579 |
|
fMax_planeyo = 0; |
580 |
|
fMax_planeye = 0; |
581 |
Float_t en_maxplane = 0.; |
Float_t en_maxplane = 0.; |
582 |
Float_t max_en= 0.; |
Float_t max_en= 0.; |
583 |
if ( fXosel ){ |
if ( fXosel ){ |
585 |
for (Int_t ipl =0; ipl < 11; ipl ++) { |
for (Int_t ipl =0; ipl < 11; ipl ++) { |
586 |
if(en_xop[ipl] > max_en) { |
if(en_xop[ipl] > max_en) { |
587 |
max_en = en_xop[ipl]; |
max_en = en_xop[ipl]; |
588 |
fMax_plane = ipl; |
fMax_planexo = ipl; |
589 |
}; |
}; |
590 |
}; |
}; |
591 |
// |
// |
592 |
for (Int_t iplm=0;iplm<=(fMax_plane+fPl) ;iplm++) en_maxplane += en_xop[iplm]; |
for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planexo+fPl)) ;iplm++) en_maxplane += en_xop[iplm]; |
593 |
|
fEnergyxo = en_maxplane/fConv_rxo; |
594 |
}; |
}; |
595 |
if ( fXesel ){ |
if ( fXesel ){ |
596 |
max_en = 0.; |
max_en = 0.; |
597 |
for (Int_t ipl =0; ipl < 11; ipl ++) { |
for (Int_t ipl =0; ipl < 11; ipl ++) { |
598 |
if(en_xep[ipl] > max_en) { |
if(en_xep[ipl] > max_en) { |
599 |
max_en = en_xep[ipl]; |
max_en = en_xep[ipl]; |
600 |
fMax_plane = ipl; |
fMax_planexe = ipl; |
601 |
}; |
}; |
602 |
}; |
}; |
603 |
// |
// |
604 |
for (Int_t iplm=0;iplm<=(fMax_plane+fPl) ;iplm++) en_maxplane += en_xep[iplm]; |
for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planexe+fPl)) ;iplm++) en_maxplane += en_xep[iplm]; |
605 |
|
fEnergyxe = en_maxplane/fConv_rxe; |
606 |
}; |
}; |
607 |
if ( fYosel ){ |
if ( fYosel ){ |
608 |
max_en = 0.; |
max_en = 0.; |
609 |
for (Int_t ipl =0; ipl < 11; ipl ++) { |
for (Int_t ipl =0; ipl < 11; ipl ++) { |
610 |
if(en_yop[ipl] > max_en) { |
if(en_yop[ipl] > max_en) { |
611 |
max_en = en_yop[ipl]; |
max_en = en_yop[ipl]; |
612 |
fMax_plane = ipl; |
fMax_planeyo = ipl; |
613 |
}; |
}; |
614 |
}; |
}; |
615 |
// |
// |
616 |
for (Int_t iplm=0;iplm<=(fMax_plane+fPl) ;iplm++) en_maxplane += en_yop[iplm]; |
for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planeyo+fPl)) ;iplm++) en_maxplane += en_yop[iplm]; |
617 |
|
fEnergyyo = en_maxplane/fConv_ryo; |
618 |
}; |
}; |
619 |
if ( fYesel ){ |
if ( fYesel ){ |
620 |
max_en = 0.; |
max_en = 0.; |
621 |
for (Int_t ipl =0; ipl < 11; ipl ++) { |
for (Int_t ipl =0; ipl < 11; ipl ++) { |
622 |
if(en_yep[ipl] > max_en) { |
if(en_yep[ipl] > max_en) { |
623 |
max_en = en_yep[ipl]; |
max_en = en_yep[ipl]; |
624 |
fMax_plane = ipl; |
fMax_planeye = ipl; |
625 |
}; |
}; |
626 |
}; |
}; |
627 |
// |
// |
628 |
for (Int_t iplm=0;iplm<=(fMax_plane+fPl) ;iplm++) en_maxplane += en_yep[iplm]; |
for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planeye+fPl)) ;iplm++) en_maxplane += en_yep[iplm]; |
629 |
|
fEnergyye = en_maxplane/fConv_rye; |
630 |
}; |
}; |
631 |
// |
// |
632 |
fEnergy = en_maxplane/fCount/fConv_r; |
fMax_plane = (Float_t)(fMax_planeyo+fMax_planeye+fMax_planexo+fMax_planexe)/fCount; |
633 |
|
fEnergy = (fEnergyxe+fEnergyyo+fEnergyye+fEnergyxo)/fCount; |
634 |
// |
// |
635 |
if ( debug ) printf(" fMax_plane %i conv_r %f en_maxplane %f encalo %f \n",fMax_plane,fConv_r,en_maxplane,fEnergy); |
if ( debug ) printf(" fMax_plane %f conv_r %f en_maxplane %f encalo %f \n",fMax_plane,fConv_rxo,en_maxplane,fEnergy); |
636 |
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); |
637 |
// |
// |
638 |
} else { |
} else { |