15 #include <TPolyLine.h>
19 #include <TLorentzVector.h>
20 #include <TEfficiency.h>
21 #include <TGraphAsymmErrors.h>
31 int nlayers = n_maps_layer+n_intt_layer+n_tpc_layer;
32 static const int nmissed = 30;
36 double quality_cut = 3.0;
39 TH2D * hEoverP_cemc[2];
40 hEoverP_cemc[0] =
new TH2D(
"hEoverP0_cemc",
"",200, 0, 20, 200, 0, 2.0);
41 hEoverP_cemc[0]->SetMarkerStyle(20);
42 hEoverP_cemc[0]->SetMarkerSize(0.5);
43 hEoverP_cemc[1] =
new TH2D(
"hEoverP1_cemc",
"",200, 0, 20, 200, 0, 2.0);
44 hEoverP_cemc[1]->SetMarkerStyle(20);
45 hEoverP_cemc[1]->SetMarkerSize(0.5);
48 int n_embed_rtrack = 0;
52 for(
int i=0;
i<1000;
i++)
57 TChain* ntp_track =
new TChain(
"ntp_track",
"reco tracks");
58 TChain*
ntp_gtrack =
new TChain(
"ntp_gtrack",
"g4 tracks");
59 TChain* ntp_vertex =
new TChain(
"ntp_vertex",
"events");
60 TChain *ntp_cluster =
new TChain(
"ntp_cluster",
"clusters");
66 sprintf(name,
"/sphenix/user/frawley/latest/macros/macros/g4simulations/eval_output/g4svtx_eval_%i.root_g4svtx_eval.root",
i);
68 cout <<
"Adding file number " <<
i <<
" with name " << name << endl;
70 ntp_vertex->Add(name);
72 ntp_gtrack->Add(name);
75 if(!ntp_gtrack->GetEntries())
79 cout <<
" ntp_vertex entries: " << ntp_vertex->GetEntries()
80 <<
" ntp_gtrack entries: " << ntp_gtrack->GetEntries()
81 <<
" ntp_track entries: " << ntp_track->GetEntries()
92 for(
int iev=0;iev<ntp_vertex->GetEntries();iev++)
94 if(verbose) cout <<
" iev = " << iev <<
" nr " << nr << endl;
96 int recoget = ntp_vertex->GetEntry(iev);
99 cout <<
"Failed to get ntp_vertex entry " << iev << endl;
104 cout <<
"Get event " << iev <<
" with vertex x " <<
evx
105 <<
" vertex y " <<
evy <<
" vertex z " <<
evz
111 for(
int ir=nr;ir<nr+
ntracks;ir++)
113 int recoget = ntp_track->GetEntry(ir);
116 if(verbose) cout <<
"Failed to get ntp_track entry " << ir << endl;
119 if(verbose > 0) cout <<
" ir = " << ir <<
" rtrackid " <<
rtrackid <<
" revent " <<
revent
127 cout <<
" --- skip because rgnhits too small " << endl;
133 if(verbose > 0) cout <<
" --- failed quality cut - rejected " << endl;
139 if(verbose) cout <<
"skip because failed z vertex cut with rvz = " <<
rvz <<
" evz = " <<
evz << endl;
145 if(verbose) cout <<
"skip because dca2d is nan" << endl;
151 if(verbose) cout <<
"skip because failed dca2d cut " << endl;
165 double EoverP_cemc =
cemc_e / rmom;
166 cout <<
" reta " << reta <<
" rmom " << rmom <<
" EoverP " << EoverP_cemc << endl;
169 hEoverP_cemc[0]->Fill(rmom, EoverP_cemc);
171 hEoverP_cemc[1]->Fill(rmom, EoverP_cemc);
176 if(verbose > 0) cout <<
" Done with tracks loop: n_embed_rtrack = " << n_embed_rtrack <<
" naccept = " << naccept << endl;
192 TCanvas *cep_cemc =
new TCanvas(
"cep_cemc",
"",5,5,800,500);
193 cep_cemc->Divide(2,1);
196 hEoverP_cemc[0]->Draw();
199 hEoverP_cemc[1]->Draw();
201 TCanvas *cproj_cemc =
new TCanvas(
"cproj_cemc",
"",20,20,1400,800);
202 cproj_cemc->Divide(3,2);
206 for(
int ip=0;ip<np;ip++)
208 cproj_cemc->cd(ip+1);
210 double plo = ip * dp;
211 double phi = ip * dp + dp;
212 int binlo = hEoverP_cemc[0]->GetXaxis()->FindBin(plo);
213 int binhi = hEoverP_cemc[0]->GetXaxis()->FindBin(phi);
216 sprintf(label,
"p = %.1f - %.1f GeV/c",plo, phi);
217 TH1D *
h =
new TH1D(
"h",label, 200, 0 , 2.0);
218 hEoverP_cemc[0]->ProjectionY(
"h",binlo,binhi);
219 h->GetXaxis()->SetTitle(
"p_{T} (GeV/c)");
220 h->GetXaxis()->SetTitle(
"E/p for CEMC");
221 h->GetXaxis()->SetTitleOffset(1.0);