9 #include <TEfficiency.h> 10 #include <TGraphAsymmErrors.h> 22 std::cout <<
"welcome to garana!" <<
std::endl;
24 std::cout <<
"you must specify a root file to analyze" <<
std::endl;
29 std::cout <<
"too many arguments! ignoring all file names except" 42 TH1F* hnue =
new TH1F(
"hnue",htitle.c_str(),10,0,10);
46 TH1F* hg4 =
new TH1F(
"hg4",htitle.c_str(),10,0,3);
47 TH1F* hg4_efrac =
new TH1F(
"hg4_efrac",
"Fraction of Incident #nu Energy; E_{G4particle}/E_{#nu};",50,0,1);
48 TH1F* hg4_eprot =
new TH1F(
"hg4_eprot",
"primary protons;KE [MeV];",20,0,10);
49 TH1F* hg4_nprot =
new TH1F(
"hg4_nprot",
";proton multiplicity;",20,0,20);
52 TH2F* h_recotrk_vtx_xy =
new TH2F(
"h_recotrk_vtx_xy",
";reco vertex x [cm]; reco vertex y [cm]", 20, -250, 250, 20, -400, 100);
53 TH2F* h_recotrk_vtx_zy =
new TH2F(
"h_recotrk_vtx_zy",
";reco vertex z [cm]; reco vertex y [cm]", 20, 1200, 1800, 20, -400, 100);
54 TH2F* h_recotrk_vtx_xz =
new TH2F(
"h_recotrk_vtx_xz",
";reco vertex x [cm]; reco vertex z [cm]", 20, -250, 250, 20, 1200, 1800);
56 TH2F* h_recovtx_vtx_xy =
new TH2F(
"h_recovtx_vtx_xy",
";reco vertex x [cm]; reco vertex y [cm]", 20, -250, 250, 20, -400, 100);
57 TH2F* h_recovtx_vtx_zy =
new TH2F(
"h_recovtx_vtx_zy",
";reco vertex z [cm]; reco vertex y [cm]", 20, 1200, 1800, 20, -400, 100);
58 TH2F* h_recovtx_vtx_xz =
new TH2F(
"h_recovtx_vtx_xz",
";reco vertex x [cm]; reco vertex z [cm]", 20, -250, 250, 20, 1200, 1800);
60 TEfficiency* eff_reco_prot_integ =
new TEfficiency(
"eff_reco_prot_integ",
"",1,0,1);
61 TEfficiency* eff_reco_prot_tprot =
new TEfficiency(
"eff_reco_prot_tprot",
"proton reconstruction efficiency; proton KE [MeV]; " 62 "#epsilon_{reco}",40,0,2);
73 for(
size_t ientry=0; ientry<tm->
NEntries(); ientry++){
78 cout <<
"gen stuff" <<
endl;
80 for(
size_t i=0; i<gen->
NGen(); i++){
82 hnue->Fill(gen->
NuP(i)->E());
89 cout <<
"g4 stuff" <<
endl;
92 for(
size_t i=0; i<g4->
NSim(); i++){
99 hg4_eprot->Fill(1.e3*(g4->
SimMomEnter(i)->at(0)->E()-0.938272));
102 eff_reco_prot_integ->Fill(matchedtracks->size()>0, 0.5);
103 eff_reco_prot_tprot->Fill(matchedtracks->size()>0, 1e3*(g4->
SimMomEnter(i)->at(0)->E()-0.938272));
108 hg4_nprot->Fill(nprot);
110 cout <<
"reco stuff" <<
endl;
113 for(
size_t itrk=0; itrk<reco->
NTrack(); itrk++) {
122 for(
size_t ivtx=0; ivtx<reco->
NVertex(); ivtx++) {
124 h_recovtx_vtx_xy->Fill(vtx->X(), vtx->Y());
125 h_recovtx_vtx_zy->Fill(vtx->Z(), vtx->Y());
126 h_recovtx_vtx_xz->Fill(vtx->X(), vtx->Z());
133 cout <<
"proton reconstruction efficiency: " << eff_reco_prot_integ->GetEfficiency(1) <<
endl;
135 auto c =
new TCanvas();
138 c->SaveAs(outname.c_str());
140 auto cg4 =
new TCanvas();
142 outname =
"testg4hist_"+*header->
TreeType()+
".png";
143 cg4->SaveAs(outname.c_str());
145 outname =
"g4_efrac_of_nu_"+*header->
TreeType()+
".png";
146 auto cg4_efrac =
new TCanvas();
148 cg4_efrac->SaveAs(outname.c_str());
150 outname =
"g4_nproton_"+*header->
TreeType()+
".png";
151 auto cg4_nprot =
new TCanvas();
153 cg4_nprot->SaveAs(outname.c_str());
155 outname =
"g4_eproton_"+*header->
TreeType()+
".png";
156 auto cg4_eprot =
new TCanvas();
157 hg4_eprot->Draw(
"e0hist");
158 cg4_eprot->SaveAs(outname.c_str());
160 TCanvas* c_recotrk_vtx_xy =
new TCanvas(
"c_recotrk_vtx_xy",
"reco track vertex: X-Y");
161 h_recotrk_vtx_xy->Draw(
"colz");
162 h_recovtx_vtx_xy->Draw(
"same");
163 c_recotrk_vtx_xy->SaveAs(
"reco_trk_vtx_xy.png");
165 TCanvas* c_recotrk_vtx_zy =
new TCanvas(
"c_recotrk_vtx_zy",
"reco track vertex: Z-Y");
166 h_recotrk_vtx_zy->Draw(
"colz");
167 h_recovtx_vtx_zy->Draw(
"same*");
168 c_recotrk_vtx_zy->SaveAs(
"reco_trk_vtx_zy.png");
170 TCanvas* c_recotrk_vtx_xz =
new TCanvas(
"c_recotrk_vtx_xz",
"reco track vertex: X-Y");
171 h_recotrk_vtx_xz->Draw(
"colz");
172 h_recovtx_vtx_xz->Draw(
"same*");
173 c_recotrk_vtx_xz->SaveAs(
"reco_trk_vtx_xz.png");
175 TCanvas* c_recovtx_vtx_xy =
new TCanvas(
"c_recovtx_vtx_xy",
"reco vertex: X-Y");
176 h_recovtx_vtx_xy->Draw(
"colz");
177 c_recovtx_vtx_xy->SaveAs(
"reco_vtx_vtx_xy.png");
179 TCanvas* c_recovtx_vtx_zy =
new TCanvas(
"c_recovtx_vtx_zy",
"reco vertex: Z-Y");
180 h_recovtx_vtx_zy->Draw(
"colz");
181 c_recovtx_vtx_zy->SaveAs(
"reco_vtx_vtx_zy.png");
183 TCanvas* c_recovtx_vtx_xz =
new TCanvas(
"c_recovtx_vtx_xz",
"reco vertex: X-Y");
184 h_recovtx_vtx_xz->Draw(
"colz");
185 c_recovtx_vtx_xz->SaveAs(
"reco_vtx_vtx_xz.png");
187 TCanvas* c_reco_peff_tp =
new TCanvas();
188 eff_reco_prot_tprot->Draw();
189 c_reco_peff_tp->Update();
190 auto g = eff_reco_prot_tprot->GetPaintedGraph();
191 g->GetYaxis()->SetRangeUser(0,1);
192 g->SetMarkerStyle(8);
193 g->SetMarkerColor(kBlue);
197 c_reco_peff_tp->SaveAs(
"reco_proton_eff_tproton.png");
210 delete h_recotrk_vtx_xy;
211 delete h_recotrk_vtx_zy;
212 delete h_recotrk_vtx_xz;
213 delete h_recovtx_vtx_xy;
214 delete h_recovtx_vtx_zy;
215 delete h_recovtx_vtx_xz;
216 delete c_recotrk_vtx_xy;
217 delete c_recotrk_vtx_zy;
218 delete c_recotrk_vtx_xz;
219 delete c_recovtx_vtx_xy;
220 delete c_recovtx_vtx_zy;
221 delete c_recovtx_vtx_xz;
virtual const UInt_t NSim() const =0
number of particles
static constexpr double g
virtual const Int_t PDG(const UInt_t &iparticle) const =0
particle PDG code
UInt_t const G4ParticleToGTruth(const UInt_t &ig4p) const
virtual const UInt_t NGen() const =0
virtual const TLorentzVector * GetVertex(const size_t &ivertex) const =0
vertex 4-position for vertex with index ivertex
virtual const vector< const TLorentzVector * > * SimMomEnter(const UInt_t &iparticle) const =0
particle 4-momentum at entry point, all regions
virtual const size_t NVertex() const =0
number of vertices in this event
int main(int argc, char *argv[])
virtual const TLorentzVector * NuP(const UInt_t &igen)=0
initial neutrino 4-momentum
virtual const size_t NTrack() const =0
number of tracks in this event
virtual const bool IsPrimary(const UInt_t &iparticle) const =0
did particle come from generator?
const vector< UInt_t > * G4ParticleToTracks(const UInt_t &ig4p) const
virtual const TLorentzVector * TrackVertex(const size_t &itrack) const =0
4-position of track's assumed start point
HeaderTree * GetHeaderTree() const
G4Tree * GetG4Tree() const
RecoTree * GetRecoTree() const
UInt_t const & NEntries() const
GenTree * GetGenTree() const
void GetEntry(const UInt_t &ientry)
QTextStream & endl(QTextStream &s)
virtual const Bool_t IsGenie(const UInt_t &igen) const =0