8#include "EmcRec/EmcRecParameter.h"
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 paraPath5(paraPath);
29 string paraPath6(paraPath);
30 string paraPath7(paraPath);
31 string paraPath8(paraPath);
32 string paraPath9(paraPath);
33 string paraPath10(paraPath);
34 string paraPath11(paraPath);
35 string paraPath12(paraPath);
36 string paraPath13(paraPath);
37 string paraPath14(paraPath);
38 string paraPath15(paraPath);
39 string paraPath16(paraPath);
40 string paraPath17(paraPath);
41 string paraPath18(paraPath);
42 string paraPath19(paraPath);
43 string paraPath20(paraPath);
44 string paraPath21(paraPath);
45 string paraPath22(paraPath);
46 string paraPath23(paraPath);
47 string paraPath24(paraPath);
48 string paraPath25(paraPath);
49 string paraPath26(paraPath);
50 string paraPath27(paraPath);
51 string paraPath28(paraPath);
52 string paraPath29(paraPath);
53 paraPath +=
"/share/EmcRecPara.dat";
56 in.open(paraPath.c_str());
59 const int maxCharOfOneLine=255;
60 char temp[maxCharOfOneLine];
62 while(in.peek()!=EOF) {
63 in.getline(temp,maxCharOfOneLine);
64 if(temp[0]==
'#')
continue;
68 istringstream(temp)>>fElectronicsNoiseLevel>>fEThresholdSeed>>fEThresholdCluster>>fLogPosOffset;
71 istringstream(temp)>>fMoliereRadius>>fLateralProfile;
74 istringstream(temp)>>eCorr[0]>>eCorr[1]>>eCorr[2]>>eCorr[3];
77 istringstream(temp)>>sigE[0]>>sigE[1]>>sigE[2]
78 >>sigTheta[0]>>sigTheta[1]>>sigPhi[0]>>sigPhi[1];
81 istringstream(temp)>>hitNb[0]>>hitNb[1]>>hitNb[2];
84 istringstream(temp)>>elecBias[0]>>elecBias[1]>>elecBias[2]
85 >>elecBias[3]>>elecBias[4];
88 istringstream(temp)>>smCut[0]>>smCut[1]>>smCut[2]>>smCut[3];
96 paraPath1 +=
"/share/Peak1.843_10.12calib.dat";
98 in1.open(paraPath1.c_str());
101 double sigma,sigmaerr,peakerr;
102 for(
int i=0;i<56;i++) {
103 in1>>ntheta>>sigma>>sigmaerr>>peak[i]>>peakerr;
108 paraPath2 +=
"/share/evset.txt";
110 in2.open(paraPath2.c_str());
112 double energy,thetaid,peak1,peakerr1,res,reserr;
114 dt =
new TGraph2DErrors();
115 dtErr =
new TGraph2DErrors();
116 for(
int i=0;i<560;i++){
123 dt->SetPoint(i,
energy,thetaid,peak1);
124 dt->SetPointError(i,0,0,peakerr1);
125 dtErr->SetPoint(i,
energy,thetaid,res);
126 dtErr->SetPointError(i,0,0,reserr);
135 paraPath3 +=
"/share/BarrLogThetaPara.dat";
137 in3.open(paraPath3.c_str());
139 for(
int i=0;i<66;i++){
140 for(
int j=0;j<5;j++){
141 in3>>barrLogThetaPara[i][j];
146 paraPath4 +=
"/share/BarrLogPhiPara.dat";
148 in4.open(paraPath4.c_str());
150 for(
int i=0;i<66;i++){
151 for(
int j=0;j<5;j++){
152 in4>>barrLogPhiPara[i][j];
157 paraPath5 +=
"/share/BarrLinThetaPara.dat";
159 in5.open(paraPath5.c_str());
161 for(
int i=0;i<66;i++){
162 for(
int j=0;j<5;j++){
163 in5>>barrLinThetaPara[i][j];
168 paraPath6 +=
"/share/BarrLinPhiPara.dat";
170 in6.open(paraPath6.c_str());
172 for(
int i=0;i<3;i++){
173 for(
int j=0;j<5;j++){
174 in6>>barrLinPhiPara[i][j];
180 paraPath7 +=
"/share/BarrShLogThetaPara.dat";
182 in7.open(paraPath7.c_str());
184 for(
int i=0;i<66;i++){
185 for(
int j=0;j<5;j++){
186 in7>>barrShLogThetaPara[i][j];
191 paraPath8 +=
"/share/BarrShLogPhiPara.dat";
193 in8.open(paraPath8.c_str());
195 for(
int i=0;i<3;i++){
196 for(
int j=0;j<5;j++){
197 in8>>barrShLogPhiPara[i][j];
202 paraPath9 +=
"/share/BarrShLinThetaPara.dat";
204 in9.open(paraPath9.c_str());
206 for(
int i=0;i<66;i++){
207 for(
int j=0;j<5;j++){
208 in9>>barrShLinThetaPara[i][j];
213 paraPath10 +=
"/share/BarrShLinPhiPara.dat";
215 in10.open(paraPath10.c_str());
217 for(
int i=0;i<3;i++){
218 for(
int j=0;j<5;j++){
219 in10>>barrShLinPhiPara[i][j];
225 paraPath11 +=
"/share/EastLogThetaPara.dat";
227 in11.open(paraPath11.c_str());
229 for(
int i=0;i<18;i++){
230 for(
int j=0;j<5;j++){
231 in11>>eastLogThetaPara[i][j];
236 paraPath12 +=
"/share/WestLogThetaPara.dat";
238 in12.open(paraPath12.c_str());
240 for(
int i=0;i<18;i++){
241 for(
int j=0;j<5;j++){
242 in12>>westLogThetaPara[i][j];
247 paraPath13 +=
"/share/EastLinThetaPara.dat";
249 in13.open(paraPath13.c_str());
251 for(
int i=0;i<6;i++){
252 for(
int j=0;j<5;j++){
253 in13>>eastLinThetaPara[i][j];
258 paraPath14 +=
"/share/WestLinThetaPara.dat";
260 in14.open(paraPath14.c_str());
262 for(
int i=0;i<6;i++){
263 for(
int j=0;j<5;j++){
264 in14>>westLinThetaPara[i][j];
269 paraPath15 +=
"/share/BarrDataLogThetaPara.dat";
271 in15.open(paraPath15.c_str());
273 for(
int i=0;i<22;i++){
274 for(
int j=0;j<5;j++){
275 in15>>barrDataLogThetaPara[i][j];
280 paraPath16 +=
"/share/EastDataLogThetaPara.dat";
282 in16.open(paraPath16.c_str());
284 for(
int i=0;i<6;i++){
285 for(
int j=0;j<5;j++){
286 in16>>eastDataLogThetaPara[i][j];
291 paraPath17 +=
"/share/WestDataLogThetaPara.dat";
293 in17.open(paraPath17.c_str());
295 for(
int i=0;i<6;i++){
296 for(
int j=0;j<5;j++){
297 in17>>westDataLogThetaPara[i][j];
303 paraPath18 +=
"/share/EastLogPhiPara.dat";
305 in18.open(paraPath18.c_str());
307 for(
int i=0;i<3;i++){
308 for(
int j=0;j<5;j++){
309 in18>>eastLogPhiPara[i][j];
314 paraPath19 +=
"/share/WestLogPhiPara.dat";
316 in19.open(paraPath19.c_str());
318 for(
int i=0;i<3;i++){
319 for(
int j=0;j<5;j++){
320 in19>>westLogPhiPara[i][j];
325 paraPath20 +=
"/share/EastLinPhiPara.dat";
327 in20.open(paraPath20.c_str());
329 for(
int i=0;i<1;i++){
330 for(
int j=0;j<5;j++){
331 in20>>eastLinPhiPara[i][j];
336 paraPath21 +=
"/share/WestLinPhiPara.dat";
338 in21.open(paraPath21.c_str());
340 for(
int i=0;i<1;i++){
341 for(
int j=0;j<5;j++){
342 in21>>westLinPhiPara[i][j];
347 paraPath22 +=
"/share/BarrLoglinThetaPara.dat";
349 in22.open(paraPath22.c_str());
351 for(
int i=0;i<22;i++){
352 for(
int j=0;j<5;j++){
353 in22>>barrLoglinThetaPara[i][j];
358 paraPath23 +=
"/share/BarrLoglinPhiPara.dat";
360 in23.open(paraPath23.c_str());
362 for(
int i=0;i<1;i++){
363 for(
int j=0;j<5;j++){
364 in23>>barrLoglinPhiPara[i][j];
371 double dth,dtherr,sig,sigerr;
373 paraPath24 +=
"/share/PosCorDataBarr.conf";
375 in24.open(paraPath24.c_str());
378 for(
int i=0;i<5280;i++){
380 in24>>iph>>ith>>dth>>dtherr>>sig>>sigerr;
381 barrPosDataCorPara[ith][iph]=dth;
386 paraPath25 +=
"/share/PosCorDataWest.conf";
388 in25.open(paraPath25.c_str());
390 for(
int i=0;i<480;i++){
392 in25>>ith>>iph>>dth>>dtherr>>sig>>sigerr;
393 westPosDataCorPara[ith][iph]=dth;
398 paraPath26 +=
"/share/PosCorDataEast.conf";
400 in26.open(paraPath26.c_str());
402 for(
int i=0;i<480;i++){
404 in26>>ith>>iph>>dth>>dtherr>>sig>>sigerr;
405 eastPosDataCorPara[ith][iph]=dth;
411 paraPath27 +=
"/share/PosCorMCBarr.conf";
413 in27.open(paraPath27.c_str());
416 for(
int i=0;i<5280;i++){
418 in27>>iph>>ith>>dth>>dtherr>>sig>>sigerr;
419 barrPosMCCorPara[ith][iph]=dth;
424 paraPath28 +=
"/share/PosCorMCWest.conf";
426 in28.open(paraPath28.c_str());
428 for(
int i=0;i<480;i++){
430 in28>>ith>>iph>>dth>>dtherr>>sig>>sigerr;
431 westPosMCCorPara[ith][iph]=dth;
436 paraPath29 +=
"/share/PosCorMCEast.conf";
438 in29.open(paraPath29.c_str());
440 for(
int i=0;i<480;i++){
442 in29>>ith>>iph>>dth>>dtherr>>sig>>sigerr;
443 eastPosMCCorPara[ith][iph]=dth;
452EmcRecParameter::~EmcRecParameter()
471 return fpInstance!=0;
485 return fElectronicsNoiseLevel;
490 return fEThresholdSeed;
495 return fEThresholdCluster;
500 return fLogPosOffset;
530 return fElecSaturation;
535 return fMoliereRadius;
540 return fLateralProfile;
585 return barrLogThetaPara[
n][m];
592 return barrLogPhiPara[
n][m];
598 return barrLoglinThetaPara[
n][m];
605 return barrLoglinPhiPara[
n][m];
612 return barrLinThetaPara[
n][m];
617 return barrLinPhiPara[
n][m];
622 return barrShLogThetaPara[
n][m];
627 return barrShLogPhiPara[
n][m];
632 return barrShLinThetaPara[
n][m];
637 return barrShLinPhiPara[
n][m];
643 return eastLogThetaPara[
n][m];
648 return westLogThetaPara[
n][m];
653 return eastLogPhiPara[
n][m];
658 return westLogPhiPara[
n][m];
663 return eastLinPhiPara[
n][m];
668 return westLinPhiPara[
n][m];
674 return eastLinThetaPara[
n][m];
679 return westLinThetaPara[
n][m];
684 return barrDataLogThetaPara[
n][m];
689 return barrPosDataCorPara[ntheta][nphi];
694 return westPosDataCorPara[ntheta][nphi];
699 return eastPosDataCorPara[ntheta][nphi];
704 return barrPosMCCorPara[ntheta][nphi];
709 return westPosMCCorPara[ntheta][nphi];
714 return eastPosMCCorPara[ntheta][nphi];
721 return eastDataLogThetaPara[
n][m];
726 return westDataLogThetaPara[
n][m];
735 positionMode1=mode[0];
736 positionMode2=mode[1];
746 if(theid<=0)theid=0.001;
747 if(theid>=27)theid=26.999;
748 Float_t einter = eg + 0.00001;
749 Float_t tinter = theid+0.0001;
750 double ecor=dt->Interpolate(einter,tinter);
751 if(!(ecor))
return Energy5x5;
752 if(ecor<0.5)
return Energy5x5;
753 double EnergyCor=Energy5x5/ecor;
763 if(theid<=0)theid=0.001;
764 if(theid>=27)theid=26.999;
765 Float_t einter = eg + 0.00001;
766 Float_t tinter = theid+0.0001;
767 double err=dtErr->Interpolate(einter,tinter);
************Class m_ypar INTEGER m_KeyWgt INTEGER m_nphot 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 ECorr(int n) 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 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 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 BarrShLogThetaPara(int n, int m) const
double WestLogThetaPara(int n, int m) const
double ElecBias(int n) const
double BarrShLogPhiPara(int n, int m) 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 ErrMC(double eg, double theid) const