210 |
|
|
211 |
|
//SM-scale files Pi0 |
212 |
|
|
213 |
< |
smScaleFiles[0] = "../Pi0Calibration/Barrel/calibres/deriveCalibConst.dflag2.pe1.step1.iter1.root"; |
214 |
< |
smScaleFiles[1] = "../Pi0Calibration/Barrel/calibres/deriveCalibConst.dflag3.pe2.step1.iter1.root"; |
213 |
> |
smScaleFiles[0] = "calibres/deriveCalibConst.dflag2.pe1.step1.iter1.root"; |
214 |
> |
smScaleFiles[1] = "calibres/deriveCalibConst.dflag3.pe2.step1.iter1.root"; |
215 |
|
|
216 |
|
// number of IC periods |
217 |
|
int nIC = 1; |
221 |
|
map<int,string> icFiles; |
222 |
|
|
223 |
|
//IC Pi0 |
224 |
< |
icFiles[0] = "../Pi0Calibration/Barrel/calibres/deriveCalibConst.dflag2.pe1.step4.iter30.txt"; |
224 |
> |
icFiles[0] = "calibres/deriveCalibConst.dflag2.pe1.step4.iter30.txt"; |
225 |
|
//IC Eta |
226 |
< |
icFiles[1] = "../Pi0Calibration/Barrel/calibres/deriveCalibConst.dflag3.pe2.step4.iter30.txt"; |
226 |
> |
icFiles[1] = "calibres/deriveCalibConst.dflag3.pe2.step4.iter30.txt"; |
227 |
|
|
228 |
|
//crystal dead flag |
229 |
< |
getCrystaldeadflagBarrel_v1("../Pi0Calibration/Barrel/crystal_deadflag_eb_dflag2.txt",ndeadflagietaiphi_ic[0]); |
230 |
< |
getCrystaldeadflagBarrel_v1("../Pi0Calibration/Barrel/crystal_deadflag_eb_dflag3.txt",ndeadflagietaiphi_ic[1]); |
229 |
> |
getCrystaldeadflagBarrel_v1("crystal_deadflag_eb_dflag2.txt",ndeadflagietaiphi_ic[0]); |
230 |
> |
getCrystaldeadflagBarrel_v1("crystal_deadflag_eb_dflag3.txt",ndeadflagietaiphi_ic[1]); |
231 |
|
|
232 |
|
|
233 |
|
|
234 |
|
vector<string> inputfileStat; |
235 |
< |
inputfileStat.push_back("../Pi0Calibration/Barrel/calibres/deriveCalibConst.dflag2.pe1.step3.iter11.root"); |
236 |
< |
inputfileStat.push_back("../Pi0Calibration/Barrel/calibres/deriveCalibConst.dflag3.pe2.step3.iter11.root"); |
235 |
> |
inputfileStat.push_back("calibres/deriveCalibConst.dflag2.pe1.step3.iter11.root"); |
236 |
> |
inputfileStat.push_back("calibres/deriveCalibConst.dflag3.pe2.step3.iter11.root"); |
237 |
|
|
238 |
|
|
239 |
|
|
637 |
|
TH1F *hh_res_ieta[50][4];////[4] means the stat error. |
638 |
|
|
639 |
|
for(int n=0; n< int(inputfileStat.size()); n++){ |
640 |
< |
for(int k=0;k<5;k++){ |
640 |
> |
for(int k=0;k<4;k++){ |
641 |
|
string filename = string(Form("hh_res_ieta_%d_%d",n,k)); |
642 |
|
hh_res_ieta[n][k] =new TH1F(filename.c_str(),filename.c_str(),171,-85,86); |
643 |
|
} |
647 |
|
string filename = string(Form("hh_statErr_ietaAbs_%d",n)); |
648 |
|
hh_statErr_ietaAbs[n] =new TH1F(filename.c_str(),filename.c_str(),85,1,86); |
649 |
|
} |
650 |
< |
|
650 |
> |
TH1F *hh_statErr_ietaTTAbs[50]; |
651 |
> |
for(int n=0; n< int(inputfileStat.size()); n++){ |
652 |
> |
string filename = string(Form("hh_statErr_ietaTTAbs_%d",n)); |
653 |
> |
hh_statErr_ietaTTAbs[n] =new TH1F(filename.c_str(),filename.c_str(),17,xbinLow1); |
654 |
> |
} |
655 |
|
|
656 |
|
TH1F *hh_statErr_ietaAbs_period[50]; //pi0&eta combined for each period |
657 |
|
for(int j=0; j< nIC; j++){ |
663 |
|
///using MC-based forumula + 0.5/1 % sys. |
664 |
|
// 7.4/resolution * 17 /sqrt(N) * sqrt( 1+ 1.8/sob) + 0.5/1% |
665 |
|
|
666 |
< |
|
663 |
< |
for(int j=0; j< int(inputfileStat.size());j++){ |
666 |
> |
for(int j=0; j< int(inputfileStat.size());j++){ |
667 |
|
string filename = inputfileStat[j]; |
668 |
|
TFile *f1 = new TFile(filename.c_str(),"read"); |
669 |
|
for(int k=0;k<4;k++){ |
676 |
|
|
677 |
|
hh_res_ieta[j][k]->Add(hhtmp); |
678 |
|
} |
679 |
+ |
|
680 |
+ |
if( f1->Get("hh_res_ietaTTAbs_0") !=0){ |
681 |
+ |
TH1F *htmp1 = (TH1F*)f1->Get("hh_res_ietaTTAbs_0"); |
682 |
+ |
TH1F *htmp2 = (TH1F*)f1->Get("hh_res_ietaTTAbs_1"); |
683 |
+ |
TH1F *htmp3 = (TH1F*)f1->Get("hh_res_ietaTTAbs_2"); |
684 |
+ |
TH1F *htmp4 = (TH1F*)f1->Get("hh_res_ietaTTAbs_3"); |
685 |
+ |
for(int b=1; b<= 17; b++){ |
686 |
+ |
float m0 = htmp1->GetBinContent(b); |
687 |
+ |
float sig = htmp3->GetBinContent(b); |
688 |
+ |
float sb = htmp4->GetBinContent(b); |
689 |
+ |
float n = htmp2->GetBinContent(b)/ (360*5*2*2); |
690 |
+ |
float statErr = (sig/m0*100)/7.4 * 17/sqrt(n) * sqrt( 1+ 1.8/sb); |
691 |
+ |
hh_statErr_ietaTTAbs[j]->SetBinContent(b,statErr); |
692 |
+ |
} |
693 |
+ |
} |
694 |
+ |
|
695 |
|
} |
696 |
+ |
|
697 |
+ |
|
698 |
|
|
699 |
|
|
700 |
|
for(int j=0; j< int(inputfileStat.size());j++){ |
709 |
|
return; |
710 |
|
} |
711 |
|
|
712 |
< |
float statErr = reso/7.4 * 17/sqrt(npiz) * sqrt( 1+ 1.8/sob); |
712 |
> |
float statErr = (reso*100)/7.4 * 17/sqrt(npiz) * sqrt( 1+ 1.8/sob); |
713 |
> |
|
714 |
> |
cout<<"statErr " << reso <<" "<< npiz <<" "<< sob <<" "<< statErr <<endl; |
715 |
> |
|
716 |
|
hh_statErr_ietaAbs[j]->SetBinContent(n,statErr); |
717 |
|
} |
718 |
|
} |
719 |
|
|
720 |
+ |
//return; |
721 |
+ |
|
722 |
|
|
723 |
|
///the combined IC from all ICs |
724 |
|
ofstream txtout("interCalibConstants.combinedPi0EtaAllPeriod.EcalBarrel.txt",ios::out); |
1001 |
|
|
1002 |
|
|
1003 |
|
//now use MC-predicted precision |
1004 |
< |
statErr = hh_res_ieta[n][4]->GetBinContent(87+abs(ieta)-1); |
1004 |
> |
statErr = hh_statErr_ietaAbs[n]->GetBinContent(abs(ieta)); |
1005 |
|
|
1006 |
|
float sigma = sqrt( statErr * statErr + sysErr * sysErr); |
1007 |
|
|
1058 |
|
float statErr = sqrt( 1./ sumStatErr2 ); |
1059 |
|
statErr_allCombined[b-1] = statErr; |
1060 |
|
|
1061 |
< |
cout<<" statErr_allCombined " << b <<" "<< statErr_allCombined[b-1]*100 << " % "<<endl; |
1061 |
> |
cout<<" statErr_allCombined " << b <<" "<< statErr_allCombined[b-1] << " % "<<endl; |
1062 |
|
|
1063 |
|
} |
1064 |
|
|
1182 |
|
if(abs(ieta)>=60) sysErr = 1; |
1183 |
|
|
1184 |
|
float icErr = sysErr; |
1185 |
< |
float statErr = statErr_allCombined[ietaTTAbs]; |
1185 |
> |
float statErr = statErr_allCombined[abs(ieta)-1]; |
1186 |
|
icErr = sqrt(sysErr *sysErr + statErr * statErr); |
1187 |
|
icErr /=100; |
1188 |
|
|