1 #define Read_bcal_hadronic_eff2_cxx
73 gStyle->SetPalette(1,0);
74 gStyle->SetOptStat(111111);
75 gStyle->SetOptFit(111111);
76 gStyle->SetPadRightMargin(0.15);
77 gStyle->SetPadLeftMargin(0.15);
78 gStyle->SetPadBottomMargin(0.15);
80 TString option = GetOption();
83 TObjArray *tokens = option.Tokenize(
" ");
84 Int_t ntokens = tokens->GetEntries();
86 cout <<
"*** Begin: Number of entries=" << ntokens << endl;
91 filerun = ((TObjString*)tokens->At(0))->GetString();
92 layer = ((TObjString*)tokens->At(1))->GetString().Atoi();
93 cout <<
"Begin: filerun=" <<
filerun <<
" layer=" <<
layer << endl;
103 h1_pid_pdg =
new TH1F(
"PID_PDG",
"PID_PDG", 2*nbins,-3000,3000);
105 h1_layer_proj =
new TH1F(
"h1_layer_proj",
"h1_layer_proj",2*nbins,0,200);
106 h1_layer_up =
new TH1F(
"h1_layer_up",
"h1_layer_up",2*nbins,0,200);
107 h1_layer_down =
new TH1F(
"h1_layer_down",
"h1_layer_down",2*nbins,0,200);
112 h1_layer_up_rand =
new TH1F(
"h1_layer_up_rand",
"h1_layer_up_rand",2*nbins,0,200);
113 h1_layer_down_rand =
new TH1F(
"h1_layer_down_rand",
"h1_layer_down_rand",2*nbins,0,200);
115 h1_eff_up =
new TH1F(
"h1_eff_up",
"h1_eff_up",2*nbins,0,200);
116 h1_eff_down =
new TH1F(
"h1_eff_down",
"h1_eff_down",2*nbins,0,200);
117 h1_eff_up_temp =
new TH1F(
"h1_eff_up_temp",
"h1_eff_up_temp",2*nbins,0,200);
118 h1_eff_down_temp =
new TH1F(
"h1_eff_down_temp",
"h1_eff_down_temp",2*nbins,0,200);
120 h1_diff_up =
new TH1F(
"h1_diff_up",
"h1_diff_up",100,-50,50);
121 h1_diff_down =
new TH1F(
"h1_diff_down",
"h1_diff_down",100,-50,50);
127 h1_mom_proj =
new TH1F(
"h1_mom_proj",
"h1_mom_proj",2*nbins,0,4);
128 h1_mom_up =
new TH1F(
"h1_mom_up",
"h1_mom_up",2*nbins,0,4);
129 h1_mom_down =
new TH1F(
"h1_mom_down",
"h1_mom_down",2*nbins,0,4);
134 h1_mom_up_rand =
new TH1F(
"h1_mom_up_rand",
"h1_mom_up_rand",2*nbins,0,4);
135 h1_mom_down_rand =
new TH1F(
"h1_mom_down_rand",
"h1_mom_down_rand",2*nbins,0,4);
137 h1_eff_mom_up =
new TH1F(
"h1_eff_mom_up",
"h1_eff_mom_up",2*nbins,0,4);
138 h1_eff_mom_down =
new TH1F(
"h1_eff_mom_down",
"h1_eff_mom_down",2*nbins,0,4);
142 h1_z_proj =
new TH1F(
"h1_z_proj",
"h1_z_proj",2*nbins,0,500);
143 h1_z_up =
new TH1F(
"h1_z_up",
"h1_z_up",2*nbins,0,500);
144 h1_z_down =
new TH1F(
"h1_z_down",
"h1_z_down",2*nbins,0,500);
145 h1_z_up_rand_left =
new TH1F(
"h1_z_up_rand_left",
"h1_z_up_rand_left",2*nbins,0,500);
147 h1_z_up_rand_right =
new TH1F(
"h1_z_up_rand_right",
"h1_z_up_rand_right",2*nbins,0,500);
149 h1_z_up_rand =
new TH1F(
"h1_z_up_rand",
"h1_z_up_rand",2*nbins,0,500);
150 h1_z_down_rand =
new TH1F(
"h1_z_down_rand",
"h1_z_down_rand",2*nbins,0,500);
152 h1_eff_z_up =
new TH1F(
"h1_eff_z_up",
"h1_eff_z_up",2*nbins,0,500);
153 h1_eff_z_down =
new TH1F(
"h1_eff_z_down",
"h1_eff_z_down",2*nbins,0,500);
154 h1_eff_z_up_temp =
new TH1F(
"h1_eff_z_up_temp",
"h1_eff_z_up_temp",2*nbins,0,500);
155 h1_eff_z_down_temp =
new TH1F(
"h1_eff_z__down_temp",
"h1_eff_z_down_temp",2*nbins,0,500);
157 h1_Evis_proj =
new TH1F(
"h1_Evis_proj",
"h1_Evis_proj",2*nbins,0,0.5);
158 h1_Evis_up =
new TH1F(
"h1_Evis_up",
"h1_Evis_up",2*nbins,0,0.5);
159 h1_Evis_down =
new TH1F(
"h1_Evis_down",
"h1_Evis_down",2*nbins,0,0.5);
164 h1_Evis_up_rand =
new TH1F(
"h1_Evis_up_rand",
"h1_Evis_up_rand",2*nbins,0,0.5);
165 h1_Evis_down_rand =
new TH1F(
"h1_Evis_down_rand",
"h1_Evis_down_rand",2*nbins,0,0.5);
167 h1_eff_Evis_up =
new TH1F(
"h1_eff_Evis_up",
"h1_eff_Evis_up",2*nbins,0,0.5);
168 h1_eff_Evis_down =
new TH1F(
"h1_eff_Evis_down",
"h1_eff_Evis_down",2*nbins,0,0.5);
217 TString filebase =
"/cache/halld/RunPeriod-2016-02/recon/ver01/tree_bcal_hadronic_eff/"+
filerun+
"/tree_bcal_hadronic_eff_";
233 TString option = GetOption();
258 Int_t ProjectedBCALSectors_Layer;
259 Int_t NearestBCALSectors_Layer_Upstream;
260 Int_t NearestBCALSectors_Layer_Downstream;
292 ProjectedBCALSectors_Layer = 0;
297 updiff4 = up4 - (proj4-1)%192 -1;
298 downdiff4 = down4 - (proj4-1)%192 -1;
299 if (proj4 && up4 && down4 && fabs(updiff4) <=
coinc_cut && fabs(downdiff4) <=
coinc_cut) {
315 cout <<
"*** Read_bcal_hadronic_eff: illegal layer=" <<
layer << endl;
337 Double_t diff_down = 1000.;
338 Double_t diff_up = 1000.;
339 Double_t diff_down_rand_left = 1000.;
340 Double_t diff_up_rand_left = 1000.;
341 Double_t diff_down_rand_right = 1000.;
342 Double_t diff_up_rand_right = 1000.;
343 Int_t subtr = (ProjectedBCALSectors_Layer-1)%192 +1;
344 Int_t subtr_rand = (ProjectedBCALSectors_Layer+
rand_offset-1)%192 +1;
345 if (subtr_rand <=0) subtr_rand += 192;
347 if (ProjectedBCALSectors_Layer && (subtr > 0)) {
348 diff_down = NearestBCALSectors_Layer_Downstream - (ProjectedBCALSectors_Layer-1)%192 -1;
349 diff_up = NearestBCALSectors_Layer_Upstream - (ProjectedBCALSectors_Layer-1)%192 -1;
355 if (ProjectedBCALSectors_Layer && (subtr_rand > 0)) {
356 diff_down_rand_left = NearestBCALSectors_Layer_Downstream - (ProjectedBCALSectors_Layer+
rand_offset-1)%192 -1;
357 diff_up_rand_left = NearestBCALSectors_Layer_Upstream - (ProjectedBCALSectors_Layer+
rand_offset-1)%192 -1 ;
358 diff_down_rand_right = NearestBCALSectors_Layer_Downstream - (ProjectedBCALSectors_Layer-
rand_offset-1)%192 -1;
359 diff_up_rand_right = NearestBCALSectors_Layer_Upstream - (ProjectedBCALSectors_Layer-
rand_offset-1)%192 -1;
368 if (ProjectedBCALSectors_Layer && subtr && subtr_rand) {
375 if (NearestBCALSectors_Layer_Downstream && ((fabs(diff_down)<=
coinc_cut) || fabs(fabs(diff_down)-192)<=
coinc_cut) ){
383 if (NearestBCALSectors_Layer_Downstream && (fabs(diff_down_rand_left)<=
coinc_cut || fabs(fabs(diff_down_rand_left)-192)<=
coinc_cut) ){
390 if (NearestBCALSectors_Layer_Downstream && (fabs(diff_down_rand_right)<=
coinc_cut || fabs(fabs(diff_down_rand_right)-192)<=
coinc_cut) ){
398 if (NearestBCALSectors_Layer_Upstream && (fabs(diff_up) <=
coinc_cut || fabs(fabs(diff_up)-192)<=
coinc_cut) ){
406 if (NearestBCALSectors_Layer_Upstream && (fabs(diff_up_rand_left) <=
coinc_cut || fabs(fabs(diff_up_rand_left)-192)<=
coinc_cut) ){
413 if (NearestBCALSectors_Layer_Upstream && (fabs(diff_up_rand_right) <=
coinc_cut || fabs(fabs(diff_up_rand_right)-192)<=
coinc_cut) ){
443 TCanvas *
c0 =
new TCanvas(
"c0",
"c0",200,10,1000,700);
451 Double_t
ymax = 10000;
517 TCanvas *
c1 =
new TCanvas(
"c1",
"c1",200,10,1000,700);
593 TCanvas *
c2 =
new TCanvas(
"c2",
"c2",200,10,1000,700);
615 cout <<
" ave=" << rand_sum_up <<
" left=" << rand_sum_up_left <<
" right=" << rand_sum_up_right << endl;
637 cout <<
" ave=" << rand_sum_down <<
" left=" << rand_sum_down_left <<
" right=" << rand_sum_down_right << endl;
659 h1_eff_up->GetXaxis()->SetTitleSize(0.05);
660 h1_eff_up->GetYaxis()->SetTitleSize(0.05);
661 h1_eff_up->GetXaxis()->SetTitle(
"eff_up");
684 TLatex *
t1 =
new TLatex(0.2,0.95,
estring);
685 t1->SetTextSize(0.04);
688 Double_t count_up_diff =
count_up - rand_sum_up;
689 Double_t count_down_diff =
count_down - rand_sum_down;
690 cout <<
" ave=" << rand_sum_up <<
" left=" << rand_sum_up_left <<
" right=" << rand_sum_up_right << endl;
691 cout <<
" ave2=" << rand_sum_down <<
" left2=" << rand_sum_down_left <<
" right2=" << rand_sum_down_right << endl;
692 cout <<
" up_temp_diff=" << up_temp_diff <<
" down_temp_diff=" << down_temp_diff << endl;
694 cout << endl << endl << endl <<
"count_proj=" <<
count_proj <<
" count_up=" <<
count_up <<
" count_down=" <<
count_down <<
" count_down_diff=" << count_down_diff <<
" count_up_diff=" << count_up_diff <<
" ratio_down=" <<
700 t1->DrawLatex(0.2,0.90,
estring);
703 t1->DrawLatex(0.2,0.85,
estring);
706 t1->DrawLatex(0.2,0.75,
estring);
709 t1->DrawLatex(0.2,0.70,
estring);
712 t1->DrawLatex(0.2,0.65,
estring);
715 t1->DrawLatex(0.2,0.6,
estring);
718 t1->DrawLatex(0.2,0.55,
estring);
721 TCanvas *
c3 =
new TCanvas(
"c3",
"c3",200,10,1000,700);
732 h1_mom_proj->GetXaxis()->SetTitle(
"mom_proj (GeV)");
743 cout <<
" ave=" << mom_rand_sum_up <<
" left=" << mom_rand_sum_up_left <<
" right=" << mom_rand_sum_up_right << endl;
749 h1_mom_up->GetXaxis()->SetTitleSize(0.05);
750 h1_mom_up->GetYaxis()->SetTitleSize(0.05);
751 h1_mom_up->GetXaxis()->SetTitle(
"mom_up (GeV)");
764 cout <<
" ave=" << mom_rand_sum_down <<
" left=" << mom_rand_sum_down_left <<
" right=" << mom_rand_sum_down_right << endl;
771 h1_mom_down->GetXaxis()->SetTitle(
"mom_down (GeV)");
809 t1->DrawLatex(0.2,0.95,
estring);
810 t1->SetTextSize(0.04);
813 Double_t mom_count_up_diff =
count_up - mom_rand_sum_up;
814 Double_t mom_count_down_diff =
count_down - mom_rand_sum_down;
815 cout << endl << endl << endl <<
"count_proj=" <<
count_proj <<
" count_up=" <<
count_up <<
" count_down=" <<
count_down <<
" mom_count_down_diff=" << mom_count_down_diff <<
" mom_count_up_diff=" << mom_count_up_diff <<
" ratio_down=" <<
821 t1->DrawLatex(0.2,0.90,
estring);
824 t1->DrawLatex(0.2,0.85,
estring);
827 t1->DrawLatex(0.2,0.75,
estring);
830 t1->DrawLatex(0.2,0.70,
estring);
831 sprintf (
estring,
"Downstream counts= %.0f\n",mom_count_down_diff);
833 t1->DrawLatex(0.2,0.65,
estring);
836 t1->DrawLatex(0.2,0.6,
estring);
839 t1->DrawLatex(0.2,0.55,
estring);
842 TCanvas *
c4 =
new TCanvas(
"c4",
"c4",200,10,1000,700);
851 h1_z_proj->GetXaxis()->SetTitleSize(0.05);
852 h1_z_proj->GetYaxis()->SetTitleSize(0.05);
853 h1_z_proj->GetXaxis()->SetTitle(
"z_proj (cm)");
864 cout <<
" ave=" << z_rand_sum_up <<
" left=" << z_rand_sum_up_left <<
" right=" << z_rand_sum_up_right << endl;
870 h1_z_up->GetXaxis()->SetTitleSize(0.05);
871 h1_z_up->GetYaxis()->SetTitleSize(0.05);
872 h1_z_up->GetXaxis()->SetTitle(
"z_up (cm)");
885 cout <<
" ave=" << z_rand_sum_down <<
" left=" << z_rand_sum_down_left <<
" right=" << z_rand_sum_down_right << endl;
890 h1_z_down->GetXaxis()->SetTitleSize(0.05);
891 h1_z_down->GetYaxis()->SetTitleSize(0.05);
892 h1_z_down->GetXaxis()->SetTitle(
"z_down (cm)");
908 h1_eff_z_up->GetXaxis()->SetTitle(
"eff_z_up (cm)");
930 t1->DrawLatex(0.2,0.95,
estring);
931 t1->SetTextSize(0.04);
934 Double_t z_count_up_diff =
count_up - z_rand_sum_up;
935 Double_t z_count_down_diff =
count_down - z_rand_sum_down;
936 cout << endl << endl << endl <<
"count_proj=" <<
count_proj <<
" count_up=" <<
count_up <<
" count_down=" <<
count_down <<
" z_count_down_diff=" << z_count_down_diff <<
" z_count_up_diff=" << z_count_up_diff <<
" ratio_down=" <<
942 t1->DrawLatex(0.2,0.90,
estring);
945 t1->DrawLatex(0.2,0.85,
estring);
948 t1->DrawLatex(0.2,0.75,
estring);
951 t1->DrawLatex(0.2,0.70,
estring);
954 t1->DrawLatex(0.2,0.65,
estring);
957 t1->DrawLatex(0.2,0.6,
estring);
960 t1->DrawLatex(0.2,0.55,
estring);
963 TCanvas *
c5 =
new TCanvas(
"c5",
"c5",200,10,1000,700);
985 cout <<
" ave=" << Evis_rand_sum_up <<
" left=" << Evis_rand_sum_up_left <<
" right=" << Evis_rand_sum_up_right << endl;
993 h1_Evis_up->GetXaxis()->SetTitle(
"Evis_up (GeV)");
1006 cout <<
" ave=" << Evis_rand_sum_down <<
" left=" << Evis_rand_sum_down_left <<
" right=" << Evis_rand_sum_down_right << endl;
1051 t1->DrawLatex(0.2,0.95,
estring);
1052 t1->SetTextSize(0.04);
1055 Double_t Evis_count_up_diff =
count_up - Evis_rand_sum_up;
1056 Double_t Evis_count_down_diff =
count_down - Evis_rand_sum_down;
1057 cout << endl << endl << endl <<
"count_proj=" <<
count_proj <<
" count_up=" <<
count_up <<
" count_down=" <<
count_down <<
" Evis_count_down_diff=" << Evis_count_down_diff <<
" Evis_count_up_diff=" << Evis_count_up_diff <<
" ratio_down=" <<
1058 Evis_count_down_diff/
count_proj <<
" ratio_up=" << Evis_count_up_diff/
count_proj << endl << endl;
1063 t1->DrawLatex(0.2,0.90,
estring);
1066 t1->DrawLatex(0.2,0.85,
estring);
1069 t1->DrawLatex(0.2,0.75,
estring);
1072 t1->DrawLatex(0.2,0.70,
estring);
1073 sprintf (
estring,
"Downstream counts= %.0f\n",Evis_count_down_diff);
1075 t1->DrawLatex(0.2,0.65,
estring);
1078 t1->DrawLatex(0.2,0.6,
estring);
1081 t1->DrawLatex(0.2,0.55,
estring);
1086 TString outhist_name =
"root/"+
filename+
"_out.root";
1087 TFile *outhist =
new TFile(outhist_name,
"recreate");
1104 cout <<
"Opening file: " << outfile.Data() << endl;
1107 filedat.open (outfile.Data(), ios::out);
1110 filedat <<
" count_proj= " <<
count_proj <<
" count_up_diff= " << count_up_diff <<
" count_down_diff= " << count_down_diff <<
" eff_up= "
1112 filedat <<
" count_proj= " <<
count_proj <<
" mom_count_up_diff= " << mom_count_up_diff <<
" mom_count_down_diff= " << mom_count_down_diff <<
" mom_eff_up= "
1114 filedat <<
" count_proj= " <<
count_proj <<
" z_count_up_diff= " << z_count_up_diff <<
" z_count_down_diff= " << z_count_down_diff <<
" z_eff_up= "
1116 filedat <<
" count_proj= " <<
count_proj <<
" Evis_count_up_diff= " << Evis_count_up_diff <<
" Evis_count_down_diff= " << Evis_count_down_diff <<
" Evis_eff_up= "
1120 c0->SaveAs(
"pdf/"+
filename+
".pdf(");
1121 c1->SaveAs(
"pdf/"+
filename+
".pdf");
1122 c2->SaveAs(
"pdf/"+
filename+
".pdf");
1123 c3->SaveAs(
"pdf/"+
filename+
".pdf");
1124 c4->SaveAs(
"pdf/"+
filename+
".pdf");
1125 c5->SaveAs(
"pdf/"+
filename+
".pdf)");
Float_t NearestBCALEnergy_Layer1_Downstream
virtual Bool_t Process(Long64_t entry)
TH1F * h1_z_down_rand_left
TH1F * h1_mom_down_rand_left
sprintf(text,"Post KinFit Cut")
TH1F * h1_mom_up_rand_left
UChar_t ProjectedBCALSectors_Layer3
TH1F * h1_mom_up_rand_right
TH1F * h1_eff_Evis_down_temp
TH1F * h1_NearestBCALSectors_Layer_Upstream
UChar_t NearestBCALSectors_Layer2_Downstream
TH1F * h1_diff_up_rand_right
Int_t PID_PDG
pointer to the analyzed TTree or TChain
TH1F * h1_Evis_down_rand_left
UChar_t NearestBCALSectors_Layer3_Upstream
TH1F * h1_Evis_up_rand_right
UChar_t NearestBCALSectors_Layer2_Upstream
virtual void SlaveTerminate()
TH1F * h1_mom_down_rand_right
virtual void SlaveBegin(TTree *tree)
TH1F * h1_layer_up_rand_right
Float_t ProjectedBCALHitZ
TH1F * h1_z_up_rand_right
Float_t TrackDeltaPhiToShower
TH1F * h1_eff_z_down_temp
TH1F * h1_eff_Evis_up_temp
UChar_t ProjectedBCALSectors_Layer4
virtual void Begin(TTree *tree)
TH1F * h1_TrackDeltaPhiToShower
TH1F * h1_NearestBCALSectors_Layer_Downstream
UChar_t NearestBCALSectors_Layer3_Downstream
TH1F * h1_ProjectedBCALSectors_Layer
UChar_t NearestBCALSectors_Layer4_Downstream
TH1F * h1_layer_down_rand_right
TH1F * h1_diff_down_rand_right
TH1F * h1_eff_mom_down_temp
TH1F * h1_layer_down_rand
TH1F * h1_diff_down_rand_left
TH1F * h1_layer_up_rand_left
TH1F * h1_diff_up_rand_left
Float_t TrackDeltaZToShower
TH1F * h1_TrackDeltaZToShower
UChar_t NearestBCALSectors_Layer4_Upstream
TH1F * h1_layer_down_rand_left
Float_t NearestBCALEnergy_Layer3_Downstream
TH1F * h1_Evis_up_rand_left
TH1F * h1_eff_mom_up_temp
printf("string=%s", string)
TH1F * h1_Evis_down_rand_right
UChar_t NearestBCALSectors_Layer1_Downstream
UChar_t ProjectedBCALSectors_Layer2
TH1F * h1_z_down_rand_right
UChar_t NearestBCALSectors_Layer1_Upstream
Float_t NearestBCALEnergy_Layer2_Downstream
Float_t NearestBCALEnergy_Layer4_Downstream
UChar_t ProjectedBCALSectors_Layer1