From 8737720121e9fb4656f22df1fa55b345e2925b19 Mon Sep 17 00:00:00 2001 From: Christopher Dilks Date: Thu, 22 Sep 2022 21:12:33 -0400 Subject: [PATCH] fix: select on `track_source` in `AnalysisEcce` (#179) --- src/AnalysisEcce.cxx | 61 ++++++++++++++++++++++++-------------------- src/AnalysisEcce.h | 7 +++++ 2 files changed, 40 insertions(+), 28 deletions(-) diff --git a/src/AnalysisEcce.cxx b/src/AnalysisEcce.cxx index da60cee8..000f27cc 100644 --- a/src/AnalysisEcce.cxx +++ b/src/AnalysisEcce.cxx @@ -7,18 +7,20 @@ using std::cerr; using std::endl; AnalysisEcce::AnalysisEcce( - TString infileName_, - Double_t eleBeamEn_, - Double_t ionBeamEn_, - Double_t crossingAngle_, - TString outfilePrefix_ - ) : Analysis( - infileName_, - eleBeamEn_, - ionBeamEn_, - crossingAngle_, - outfilePrefix_ - ) { + TString infileName_, + Double_t eleBeamEn_, + Double_t ionBeamEn_, + Double_t crossingAngle_, + TString outfilePrefix_ + ) : Analysis( + infileName_, + eleBeamEn_, + ionBeamEn_, + crossingAngle_, + outfilePrefix_ + ), + trackSource(0) // default track source is "all tracks" +{ }; // destructor @@ -49,10 +51,10 @@ void AnalysisEcce::Execute() TTreeReaderArray hepmcp_status(tr, "hepmcp_status"); TTreeReaderArray hepmcp_PDG(tr, "hepmcp_PDG"); - TTreeReaderArray hepmcp_E(tr, "hepmcp_E"); - TTreeReaderArray hepmcp_psx(tr, "hepmcp_px"); - TTreeReaderArray hepmcp_psy(tr, "hepmcp_py"); - TTreeReaderArray hepmcp_psz(tr, "hepmcp_pz"); + TTreeReaderArray hepmcp_E(tr, "hepmcp_E"); + TTreeReaderArray hepmcp_psx(tr, "hepmcp_px"); + TTreeReaderArray hepmcp_psy(tr, "hepmcp_py"); + TTreeReaderArray hepmcp_psz(tr, "hepmcp_pz"); TTreeReaderArray hepmcp_BCID(tr, "hepmcp_BCID"); TTreeReaderArray hepmcp_m1(tr, "hepmcp_m1"); @@ -63,20 +65,21 @@ void AnalysisEcce::Execute() TTreeReaderArray mcpart_ID(tr, "mcpart_ID"); TTreeReaderArray mcpart_ID_parent(tr, "mcpart_ID_parent"); TTreeReaderArray mcpart_PDG(tr, "mcpart_PDG"); - TTreeReaderArray mcpart_E(tr, "mcpart_E"); - TTreeReaderArray mcpart_psx(tr, "mcpart_px"); - TTreeReaderArray mcpart_psy(tr, "mcpart_py"); - TTreeReaderArray mcpart_psz(tr, "mcpart_pz"); + TTreeReaderArray mcpart_E(tr, "mcpart_E"); + TTreeReaderArray mcpart_psx(tr, "mcpart_px"); + TTreeReaderArray mcpart_psy(tr, "mcpart_py"); + TTreeReaderArray mcpart_psz(tr, "mcpart_pz"); TTreeReaderArray mcpart_BCID(tr, "mcpart_BCID"); // Reco tracks - TTreeReaderArray tracks_id(tr, "tracks_ID"); // needs to be made an int eventually in actual EE code - TTreeReaderArray tracks_p_x(tr, "tracks_px"); - TTreeReaderArray tracks_p_y(tr, "tracks_py"); - TTreeReaderArray tracks_p_z(tr, "tracks_pz"); - TTreeReaderArray tracks_trueID(tr, "tracks_trueID"); - // TTreeReaderArray tracks_charge(tr, "tracks_charge"); + TTreeReaderArray tracks_id(tr, "tracks_ID"); // needs to be made an int eventually in actual EE code + TTreeReaderArray tracks_p_x(tr, "tracks_px"); + TTreeReaderArray tracks_p_y(tr, "tracks_py"); + TTreeReaderArray tracks_p_z(tr, "tracks_pz"); + TTreeReaderArray tracks_trueID(tr, "tracks_trueID"); + TTreeReaderArray tracks_source(tr, "tracks_source"); + // TTreeReaderArray tracks_charge(tr, "tracks_charge"); // calculate Q2 weights @@ -115,6 +118,7 @@ void AnalysisEcce::Execute() } for(int itrack=0; itrack1) cerr << "WARNING: found more than 1 reconstructed scattered electron in an event" << endl; + else if(recEleFound>1) cerr << "WARNING: found " << recEleFound << " (more than 1) reconstructed scattered electrons in an event" << endl; else numEle++; // subtract electron from hadronic final state variables diff --git a/src/AnalysisEcce.h b/src/AnalysisEcce.h index b4df8dfc..d4c1ba14 100644 --- a/src/AnalysisEcce.h +++ b/src/AnalysisEcce.h @@ -46,6 +46,13 @@ class AnalysisEcce : public Analysis void Execute() override; + // select which track source; can be set at the macro level + UShort_t trackSource; /* all = 0, + * inner = 1, + * silicon = 2, + * ttl = 3 + */ + ClassDefOverride(AnalysisEcce,1); };