9#include "TGraph2DErrors.h"
17pthread_mutex_t EmcRecParameter::m_pthread_lock = PTHREAD_MUTEX_INITIALIZER;
20EmcRecParameter::EmcRecParameter()
22 string paraPath = getenv(
"EMCRECROOT");
24 string paraPath1(paraPath);
25 string paraPath2(paraPath);
26 string paraPath3(paraPath);
27 string paraPath4(paraPath);
28 string paraPath3_1(paraPath);
29 string paraPath4_1(paraPath);
30 string paraPath5(paraPath);
31 string paraPath6(paraPath);
32 string paraPath7(paraPath);
33 string paraPath8(paraPath);
34 string paraPath9(paraPath);
35 string paraPath10(paraPath);
36 string paraPath11(paraPath);
37 string paraPath12(paraPath);
38 string paraPath11_1(paraPath);
39 string paraPath12_1(paraPath);
40 string paraPath13(paraPath);
41 string paraPath14(paraPath);
42 string paraPath15(paraPath);
43 string paraPath16(paraPath);
44 string paraPath17(paraPath);
45 string paraPath18(paraPath);
46 string paraPath19(paraPath);
47 string paraPath18_1(paraPath);
48 string paraPath19_1(paraPath);
49 string paraPath20(paraPath);
50 string paraPath21(paraPath);
51 string paraPath22(paraPath);
52 string paraPath23(paraPath);
53 string paraPath24(paraPath);
54 string paraPath25(paraPath);
55 string paraPath26(paraPath);
56 string paraPath27(paraPath);
57 string paraPath28(paraPath);
58 string paraPath29(paraPath);
59 paraPath +=
"/share/EmcRecPara.dat";
62 in.open(paraPath.c_str());
65 const int maxCharOfOneLine=255;
66 char temp[maxCharOfOneLine];
68 while(in.peek()!=EOF) {
69 in.getline(temp,maxCharOfOneLine);
70 if(temp[0]==
'#')
continue;
74 istringstream(temp)>>fElectronicsNoiseLevel>>fEThresholdSeed>>fEThresholdCluster>>fLogPosOffset;
77 istringstream(temp)>>fMoliereRadius>>fLateralProfile;
80 istringstream(temp)>>eCorr[0]>>eCorr[1]>>eCorr[2]>>eCorr[3];
83 istringstream(temp)>>sigE[0]>>sigE[1]>>sigE[2]
84 >>sigTheta[0]>>sigTheta[1]>>sigPhi[0]>>sigPhi[1];
87 istringstream(temp)>>hitNb[0]>>hitNb[1]>>hitNb[2];
90 istringstream(temp)>>elecBias[0]>>elecBias[1]>>elecBias[2]
91 >>elecBias[3]>>elecBias[4];
94 istringstream(temp)>>smCut[0]>>smCut[1]>>smCut[2]>>smCut[3];
102 paraPath1 +=
"/share/Peak1.843_10.12calib.dat";
104 in1.open(paraPath1.c_str());
107 double sigma,sigmaerr,peakerr;
108 for(
int i=0;i<56;i++) {
109 in1>>ntheta>>
sigma>>sigmaerr>>peak[i]>>peakerr;
114 paraPath2 +=
"/share/evset.txt";
116 in2.open(paraPath2.c_str());
118 double energy,thetaid,peak1,peakerr1,res,reserr;
120 dt =
new TGraph2DErrors();
121 dtErr =
new TGraph2DErrors();
122 for(
int i=0;i<560;i++){
129 dt->SetPoint(i,
energy,thetaid,peak1);
130 dt->SetPointError(i,0,0,peakerr1);
131 dtErr->SetPoint(i,
energy,thetaid,res);
132 dtErr->SetPointError(i,0,0,reserr);
141 paraPath3_1 +=
"/share/BarrLogShMaxThetaPara.dat";
143 in3_1.open(paraPath3_1.c_str());
145 for(
int i=0;i<132;i++){
146 for(
int j=0;j<5;j++){
147 in3_1>>barrLogShMaxThetaPara[i][j];
152 paraPath4_1 +=
"/share/BarrLogShMaxPhiPara.dat";
154 in4_1.open(paraPath4_1.c_str());
156 for(
int i=0;i<132;i++){
157 for(
int j=0;j<5;j++){
158 in4_1>>barrLogShMaxPhiPara[i][j];
163 paraPath11_1 +=
"/share/EastLogShMaxThetaPara.dat";
165 in11_1.open(paraPath11_1.c_str());
167 for(
int i=0;i<18;i++){
168 for(
int j=0;j<5;j++){
169 in11_1>>eastLogShMaxThetaPara[i][j];
174 paraPath12_1 +=
"/share/WestLogShMaxThetaPara.dat";
176 in12_1.open(paraPath12_1.c_str());
178 for(
int i=0;i<18;i++){
179 for(
int j=0;j<5;j++){
180 in12_1>>westLogShMaxThetaPara[i][j];
185 paraPath18_1 +=
"/share/EastLogShMaxPhiPara.dat";
187 in18_1.open(paraPath18_1.c_str());
189 for(
int i=0;i<3;i++){
190 for(
int j=0;j<5;j++){
191 in18_1>>eastLogShMaxPhiPara[i][j];
196 paraPath19_1 +=
"/share/WestLogShMaxPhiPara.dat";
198 in19_1.open(paraPath19_1.c_str());
200 for(
int i=0;i<3;i++){
201 for(
int j=0;j<5;j++){
202 in19_1>>westLogShMaxPhiPara[i][j];
210 paraPath3 +=
"/share/BarrLogThetaPara.dat";
212 in3.open(paraPath3.c_str());
214 for(
int i=0;i<66;i++){
215 for(
int j=0;j<5;j++){
216 in3>>barrLogThetaPara[i][j];
221 paraPath4 +=
"/share/BarrLogPhiPara.dat";
223 in4.open(paraPath4.c_str());
225 for(
int i=0;i<66;i++){
226 for(
int j=0;j<5;j++){
227 in4>>barrLogPhiPara[i][j];
232 paraPath5 +=
"/share/BarrLinThetaPara.dat";
234 in5.open(paraPath5.c_str());
236 for(
int i=0;i<66;i++){
237 for(
int j=0;j<5;j++){
238 in5>>barrLinThetaPara[i][j];
243 paraPath6 +=
"/share/BarrLinPhiPara.dat";
245 in6.open(paraPath6.c_str());
247 for(
int i=0;i<3;i++){
248 for(
int j=0;j<5;j++){
249 in6>>barrLinPhiPara[i][j];
278 paraPath9 +=
"/share/BarrShLinThetaPara.dat";
280 in9.open(paraPath9.c_str());
282 for(
int i=0;i<66;i++){
283 for(
int j=0;j<5;j++){
284 in9>>barrShLinThetaPara[i][j];
289 paraPath10 +=
"/share/BarrShLinPhiPara.dat";
291 in10.open(paraPath10.c_str());
293 for(
int i=0;i<3;i++){
294 for(
int j=0;j<5;j++){
295 in10>>barrShLinPhiPara[i][j];
301 paraPath11 +=
"/share/EastLogThetaPara.dat";
303 in11.open(paraPath11.c_str());
305 for(
int i=0;i<18;i++){
306 for(
int j=0;j<5;j++){
307 in11>>eastLogThetaPara[i][j];
312 paraPath12 +=
"/share/WestLogThetaPara.dat";
314 in12.open(paraPath12.c_str());
316 for(
int i=0;i<18;i++){
317 for(
int j=0;j<5;j++){
318 in12>>westLogThetaPara[i][j];
323 paraPath13 +=
"/share/EastLinThetaPara.dat";
325 in13.open(paraPath13.c_str());
327 for(
int i=0;i<6;i++){
328 for(
int j=0;j<5;j++){
329 in13>>eastLinThetaPara[i][j];
334 paraPath14 +=
"/share/WestLinThetaPara.dat";
336 in14.open(paraPath14.c_str());
338 for(
int i=0;i<6;i++){
339 for(
int j=0;j<5;j++){
340 in14>>westLinThetaPara[i][j];
345 paraPath15 +=
"/share/BarrDataLogThetaPara.dat";
347 in15.open(paraPath15.c_str());
349 for(
int i=0;i<22;i++){
350 for(
int j=0;j<5;j++){
351 in15>>barrDataLogThetaPara[i][j];
356 paraPath16 +=
"/share/EastDataLogThetaPara.dat";
358 in16.open(paraPath16.c_str());
360 for(
int i=0;i<6;i++){
361 for(
int j=0;j<5;j++){
362 in16>>eastDataLogThetaPara[i][j];
367 paraPath17 +=
"/share/WestDataLogThetaPara.dat";
369 in17.open(paraPath17.c_str());
371 for(
int i=0;i<6;i++){
372 for(
int j=0;j<5;j++){
373 in17>>westDataLogThetaPara[i][j];
379 paraPath18 +=
"/share/EastLogPhiPara.dat";
381 in18.open(paraPath18.c_str());
383 for(
int i=0;i<3;i++){
384 for(
int j=0;j<5;j++){
385 in18>>eastLogPhiPara[i][j];
390 paraPath19 +=
"/share/WestLogPhiPara.dat";
392 in19.open(paraPath19.c_str());
394 for(
int i=0;i<3;i++){
395 for(
int j=0;j<5;j++){
396 in19>>westLogPhiPara[i][j];
401 paraPath20 +=
"/share/EastLinPhiPara.dat";
403 in20.open(paraPath20.c_str());
405 for(
int i=0;i<1;i++){
406 for(
int j=0;j<5;j++){
407 in20>>eastLinPhiPara[i][j];
412 paraPath21 +=
"/share/WestLinPhiPara.dat";
414 in21.open(paraPath21.c_str());
416 for(
int i=0;i<1;i++){
417 for(
int j=0;j<5;j++){
418 in21>>westLinPhiPara[i][j];
423 paraPath22 +=
"/share/BarrLoglinThetaPara.dat";
425 in22.open(paraPath22.c_str());
427 for(
int i=0;i<22;i++){
428 for(
int j=0;j<5;j++){
429 in22>>barrLoglinThetaPara[i][j];
434 paraPath23 +=
"/share/BarrLoglinPhiPara.dat";
436 in23.open(paraPath23.c_str());
438 for(
int i=0;i<1;i++){
439 for(
int j=0;j<5;j++){
440 in23>>barrLoglinPhiPara[i][j];
447 double dth,dtherr,sig,sigerr;
449 paraPath24 +=
"/share/PosCorDataBarr.conf";
451 in24.open(paraPath24.c_str());
454 for(
int i=0;i<5280;i++){
456 in24>>iph>>ith>>dth>>dtherr>>sig>>sigerr;
457 barrPosDataCorPara[ith][iph]=dth;
462 paraPath25 +=
"/share/PosCorDataWest.conf";
464 in25.open(paraPath25.c_str());
466 for(
int i=0;i<480;i++){
468 in25>>ith>>iph>>dth>>dtherr>>sig>>sigerr;
469 westPosDataCorPara[ith][iph]=dth;
474 paraPath26 +=
"/share/PosCorDataEast.conf";
476 in26.open(paraPath26.c_str());
478 for(
int i=0;i<480;i++){
480 in26>>ith>>iph>>dth>>dtherr>>sig>>sigerr;
481 eastPosDataCorPara[ith][iph]=dth;
487 paraPath27 +=
"/share/PosCorMCBarr.conf";
489 in27.open(paraPath27.c_str());
492 for(
int i=0;i<5280;i++){
494 in27>>iph>>ith>>dth>>dtherr>>sig>>sigerr;
495 barrPosMCCorPara[ith][iph]=dth;
500 paraPath28 +=
"/share/PosCorMCWest.conf";
502 in28.open(paraPath28.c_str());
504 for(
int i=0;i<480;i++){
506 in28>>ith>>iph>>dth>>dtherr>>sig>>sigerr;
507 westPosMCCorPara[ith][iph]=dth;
512 paraPath29 +=
"/share/PosCorMCEast.conf";
514 in29.open(paraPath29.c_str());
516 for(
int i=0;i<480;i++){
518 in29>>ith>>iph>>dth>>dtherr>>sig>>sigerr;
519 eastPosMCCorPara[ith][iph]=dth;
528EmcRecParameter::~EmcRecParameter()
547 return fpInstance!=0;
561 return fElectronicsNoiseLevel;
566 return fEThresholdSeed;
571 return fEThresholdCluster;
576 return fLogPosOffset;
606 return fElecSaturation;
611 return fMoliereRadius;
616 return fLateralProfile;
661 return barrLogThetaPara[n][m];
668 return barrLogPhiPara[n][m];
674 return barrLoglinThetaPara[n][m];
681 return barrLoglinPhiPara[n][m];
688 return barrLinThetaPara[n][m];
693 return barrLinPhiPara[n][m];
698 return barrLogShMaxThetaPara[n][m];
703 return barrLogShMaxPhiPara[n][m];
708 return barrShLinThetaPara[n][m];
713 return barrShLinPhiPara[n][m];
719 return eastLogThetaPara[n][m];
724 return westLogThetaPara[n][m];
729 return eastLogPhiPara[n][m];
734 return westLogPhiPara[n][m];
740 return eastLogShMaxThetaPara[n][m];
745 return westLogShMaxThetaPara[n][m];
750 return eastLogShMaxPhiPara[n][m];
755 return westLogShMaxPhiPara[n][m];
761 return eastLinPhiPara[n][m];
766 return westLinPhiPara[n][m];
772 return eastLinThetaPara[n][m];
777 return westLinThetaPara[n][m];
782 return barrDataLogThetaPara[n][m];
787 return barrPosDataCorPara[ntheta][nphi];
792 return westPosDataCorPara[ntheta][nphi];
797 return eastPosDataCorPara[ntheta][nphi];
802 return barrPosMCCorPara[ntheta][nphi];
807 return westPosMCCorPara[ntheta][nphi];
812 return eastPosMCCorPara[ntheta][nphi];
819 return eastDataLogThetaPara[n][m];
824 return westDataLogThetaPara[n][m];
833 positionMode1=mode[0];
834 positionMode2=mode[1];
844 if(theid<=0)theid=0.001;
845 if(theid>=27)theid=26.999;
846 Float_t einter = eg + 0.00001;
847 Float_t tinter = theid+0.0001;
848 double ecor=dt->Interpolate(einter,tinter);
849 if(!(ecor))
return Energy5x5;
850 if(ecor<0.5)
return Energy5x5;
851 double EnergyCor=Energy5x5/ecor;
861 if(theid<=0)theid=0.001;
862 if(theid>=27)theid=26.999;
863 Float_t einter = eg + 0.00001;
864 Float_t tinter = theid+0.0001;
865 double err=dtErr->Interpolate(einter,tinter);
************Class m_ypar INTEGER m_KeyWgt INTEGER m_KeyIHVP INTEGER m_KeyGPS INTEGER m_IsBeamPolarized INTEGER m_EvtGenInterface DOUBLE PRECISION m_Emin DOUBLE PRECISION m_sphot DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_q2 DOUBLE PRECISION m_PolBeam2 DOUBLE PRECISION m_xErrPb *COMMON c_KK2f $ !CMS energy average $ !Spin Polarization vector first beam $ !Spin Polarization vector second beam $ !Beam energy spread[GeV] $ !minimum hadronization energy[GeV] $ !input READ never touch them !$ !debug facility $ !maximum weight $ !inverse alfaQED $ !minimum real photon energy
double LogPosOffset() const
double WestLogShMaxPhiPara(int n, int m) const
double ECorr(int n) const
double BarrLogShMaxPhiPara(int n, int m) const
double WestPosMCCor(int ntheta, int nphi) const
double BarrPosMCCor(int ntheta, int nphi) const
void SetPositionMode(std::vector< std::string > &mode)
double ECorrMC(double eg, double theid) const
static EmcRecParameter & GetInstance()
double EastDataLogThetaPara(int n, int m) const
double EastLogShMaxPhiPara(int n, int m) const
double EastPosMCCor(int ntheta, int nphi) const
double WestDataLogThetaPara(int n, int m) const
double EastLinThetaPara(int n, int m) const
double EastPosDataCor(int ntheta, int nphi) const
double EastLinPhiPara(int n, int m) const
double EThresholdCluster() const
double EThresholdSeed() const
double WestPosDataCor(int ntheta, int nphi) const
double BarrLogPhiPara(int n, int m) const
double BarrDataLogThetaPara(int n, int m) const
double HitNb(int n) const
double EastLogShMaxThetaPara(int n, int m) const
double ElectronicsNoiseLevel() const
double E25min(int n) const
double BarrShLinPhiPara(int n, int m) const
double LateralProfile() const
double E25max(int n) const
double MethodMode() const
double SigTheta(int n) const
double WestLogShMaxThetaPara(int n, int m) const
double WestLogThetaPara(int n, int m) const
double ElecBias(int n) const
double BarrShLinThetaPara(int n, int m) const
int ElecSaturation() const
double BarrPosDataCor(int ntheta, int nphi) const
double BarrLogThetaPara(int n, int m) const
double BarrLoglinThetaPara(int n, int m) const
double WestLinThetaPara(int n, int m) const
double MoliereRadius() const
double WestLogPhiPara(int n, int m) const
double BarrLinPhiPara(int n, int m) const
double BarrLinThetaPara(int n, int m) const
double EastLogPhiPara(int n, int m) const
double EastLogThetaPara(int n, int m) const
double BarrLoglinPhiPara(int n, int m) const
double WestLinPhiPara(int n, int m) const
double SmCut(int n) const
double SigPhi(int n) const
double BarrLogShMaxThetaPara(int n, int m) const
double ErrMC(double eg, double theid) const