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("calibres/deriveCalibConst.dflag2.pe1.step3.iter11.root"); |
236 |
> |
inputfileStat.push_back("calibres/deriveCalibConst.dflag3.pe2.step3.iter11.root"); |
237 |
> |
|
238 |
> |
|
239 |
|
|
240 |
|
ofstream txtoutTocheck("combinedCalibConstantv2.txt"); |
241 |
|
|
321 |
|
} |
322 |
|
} |
323 |
|
|
316 |
– |
cout<<"sddd" <<endl; |
324 |
|
|
325 |
|
|
326 |
|
TH1F *hh_c_ieta[50][170]; |
413 |
|
} |
414 |
|
} |
415 |
|
|
409 |
– |
cout<<"sdddd" <<endl; |
416 |
|
|
417 |
|
|
418 |
|
TH1F *hh_res_cietaAbs_period[50][3]; |
525 |
|
} |
526 |
|
} |
527 |
|
|
522 |
– |
cout<<"sddda" <<endl; |
523 |
– |
|
528 |
|
|
529 |
|
for(int j=0; j< nConstantSet; j++){ |
530 |
|
for(int k=0; k<3; k++){ |
571 |
|
TH1F *hh_res_diff_csmallietaTT[50][50][3]; |
572 |
|
TH1F *hh_res_diff_csmallietaTTAbs[50][50][3]; |
573 |
|
|
570 |
– |
cout<<"sdddb" <<endl; |
574 |
|
|
575 |
|
for(int n=0; n< nConstantSet; n++){ |
576 |
|
for(int k=n+1; k< nConstantSet; k++){ |
622 |
|
} |
623 |
|
} |
624 |
|
|
622 |
– |
cout<<"sddde" <<endl; |
625 |
|
|
626 |
|
TH2F *hh2_largeICdiff[50][50]; |
627 |
|
for(int n=0; n< nIC; n++){ |
631 |
|
} |
632 |
|
} |
633 |
|
TH2F *hh2_largeICdiff_all =new TH2F("hh2_largeICdiff_all","hh2_largeICdiff_all",171,-85,86,360,1,361); |
634 |
< |
|
633 |
< |
vector<string> inputfileStat; |
634 |
< |
inputfileStat.push_back("calibres1/deriveCalibConst.dflag2.pe1.step3.iter11.root"); |
635 |
< |
inputfileStat.push_back("calibres1/deriveCalibConst.dflag3.pe2.step3.iter11.root"); |
634 |
> |
|
635 |
|
|
636 |
|
|
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++){ |
659 |
|
hh_statErr_ietaAbs_period[j]=new TH1F(filename.c_str(),filename.c_str(),85,1,86); |
660 |
|
} |
661 |
|
|
659 |
– |
cout<<"sddf" <<endl; |
662 |
|
|
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 |
< |
|
665 |
< |
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 |
|
|
680 |
– |
cout<<"calc stat err " <<endl; |
699 |
|
|
700 |
|
for(int j=0; j< int(inputfileStat.size());j++){ |
701 |
|
|
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 |
|
|