All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
analyze_MC.cxx
Go to the documentation of this file.
6 
7 namespace single_photon
8 {
9 
10  //analyze_Geant4.h
11  void AnalyzeGeant4( const std::vector<art::Ptr<simb::MCParticle>> &mcParticleVector, var_all& vars){
12 
13 
14  std::vector<int> spacers = Printer_header({"#MCP"," pdg", " Status"," trkID"," Mother"," Process", " Process_End"," Energy", " Vertex(x, "," y, "," z )"});
15  for(size_t j=0;j< mcParticleVector.size();j++){
16 
17  const art::Ptr<simb::MCParticle> mcp = mcParticleVector[j];
18  // std::cout<<"PARG: "<<j<<" PDG "<<mcp->PdgCode()<<" Status "<<mcp->StatusCode()<<" trackid: "<<mcp->TrackId()<<" Mothe "<<mcp->Mother()<<" Process "<<mcp->Process()<<" EndProcess "<<mcp->EndProcess()<<" Energy "<<mcp->E()<<" start ("<<mcp->Vx()<<","<<mcp->Vy()<<","<<mcp->Vz()<<")"<<std::endl;
19 
21  std::to_string(j),
22  std::to_string(mcp->PdgCode()),
23  std::to_string(mcp->StatusCode()),
24  std::to_string(mcp->TrackId()),
25  std::to_string(mcp->Mother()),
26  mcp->Process(),
27  mcp->EndProcess(),
28  std::to_string(mcp->E()),
29  std::to_string(mcp->Vx()),
30  std::to_string(mcp->Vy()),
31  std::to_string(mcp->Vz())
32  },
33  spacers);
34 
35  vars.m_geant4_pdg.push_back(mcp->PdgCode());
36  vars.m_geant4_trackid.push_back(mcp->TrackId());
37  vars.m_geant4_statuscode.push_back(mcp->StatusCode());
38  vars.m_geant4_mother.push_back(mcp->Mother());
39  vars.m_geant4_E.push_back(mcp->E());
40  vars.m_geant4_mass.push_back(mcp->Mass());
41  vars.m_geant4_px.push_back(mcp->Px());
42  vars.m_geant4_py.push_back(mcp->Py());
43  vars.m_geant4_pz.push_back(mcp->Pz());
44  vars.m_geant4_vx.push_back(mcp->Vx());
45  vars.m_geant4_vy.push_back(mcp->Vy());
46  vars.m_geant4_vz.push_back(mcp->Vz());
47  vars.m_geant4_end_process.push_back(mcp->EndProcess());
48  vars.m_geant4_process.push_back(mcp->Process());
49  vars.m_geant4_costheta.push_back(vars.m_geant4_pz.back()/sqrt(pow(vars.m_geant4_pz.back(),2)+pow(vars.m_geant4_px.back(),2)+pow(vars.m_geant4_py.back(),2)));
50  vars.m_geant4_dx.push_back(mcp->Px()/sqrt(pow(vars.m_geant4_pz.back(),2)+pow(vars.m_geant4_px.back(),2)+pow(vars.m_geant4_py.back(),2)));
51  vars.m_geant4_dy.push_back(mcp->Py()/sqrt(pow(vars.m_geant4_pz.back(),2)+pow(vars.m_geant4_px.back(),2)+pow(vars.m_geant4_py.back(),2)));
52  vars.m_geant4_dz.push_back(mcp->Pz()/sqrt(pow(vars.m_geant4_pz.back(),2)+pow(vars.m_geant4_px.back(),2)+pow(vars.m_geant4_py.back(),2)));
53 
54  if(j>2)break;
55  }
56 
57  }
58 
59  //analyze_EventWeight.h
60  void AnalyzeEventWeight(art::Event const & e, var_all& vars){
61 
62  art::Handle< std::vector<simb::MCFlux> > mcFluxHandle;
63  e.getByLabel("generator", mcFluxHandle);
64  if (!mcFluxHandle.isValid()) return;
65  std::vector< art::Ptr<simb::MCFlux> > mcFluxVec;
66  art::fill_ptr_vector(mcFluxVec, mcFluxHandle);
67  if (mcFluxVec.size() == 0){
68  std::cout << ">> No MCFlux information" << std::endl;
69  return;
70  }
71 
72  art::Handle< std::vector<simb::MCTruth> > mcTruthHandle;
73  e.getByLabel("generator", mcTruthHandle);
74  if (!mcTruthHandle.isValid()) return;
75  std::vector< art::Ptr<simb::MCTruth> > mcTruthVec;
76  art::fill_ptr_vector(mcTruthVec, mcTruthHandle);
77  if (mcTruthVec.size() == 0){
78  std::cout << ">> No MCTruth information" << std::endl;
79  return;
80  }
81 
82  art::Handle< std::vector< simb::GTruth > > gTruthHandle;
83  e.getByLabel("generator", gTruthHandle);
84  if (!gTruthHandle.isValid()) return;
85  std::vector< art::Ptr<simb::GTruth> > gTruthVec;
86  art::fill_ptr_vector(gTruthVec, gTruthHandle);
87  if (gTruthVec.size() == 0){
88  std::cout << ">> No GTruth information" << std::endl;
89  return;
90  }
91 
92  const art::Ptr<simb::MCFlux> mcFlux = mcFluxVec.at(0);
93  const art::Ptr<simb::MCTruth> mcTruth = mcTruthVec.at(0);
94  const simb::MCParticle& nu = mcTruth->GetNeutrino().Nu();
95  const art::Ptr<simb::GTruth> gTruth = gTruthVec.at(0);
96 
97  vars.m_run_number_eventweight = e.run();
98  vars.m_subrun_number_eventweight = e.subRun();
99  vars.m_event_number_eventweight = e.event();
100 
101  // possibly the wrong variables, but let's see for now...
102  //vars.m_mcflux_evtno = mcFlux->fevtno;
103  vars.m_mcflux_nu_pos_x = nu.Vx();
104  vars.m_mcflux_nu_pos_y = nu.Vy();
105  vars.m_mcflux_nu_pos_z = nu.Vz();
106  vars.m_mcflux_nu_mom_x = nu.Px();
107  vars.m_mcflux_nu_mom_y = nu.Py();
108  vars.m_mcflux_nu_mom_z = nu.Pz();
109  vars.m_mcflux_nu_mom_E = nu.E();
110  vars.m_mcflux_ntype = mcFlux->fntype;
111  vars.m_mcflux_ptype = mcFlux->fptype;
112  vars.m_mcflux_nimpwt = mcFlux->fnimpwt;
113  vars.m_mcflux_dk2gen = mcFlux->fdk2gen;
114  vars.m_mcflux_nenergyn = mcFlux->fnenergyn;
115  vars.m_mcflux_tpx = mcFlux->ftpx;
116  vars.m_mcflux_tpy = mcFlux->ftpy;
117  vars.m_mcflux_tpz = mcFlux->ftpz;
118  vars.m_mcflux_tptype = mcFlux->ftptype;
119  vars.m_mcflux_vx = mcFlux->fvx;
120  vars.m_mcflux_vy = mcFlux->fvy;
121  vars.m_mcflux_vz = mcFlux->fvz;
122 
123  // loop MCParticle info for vars.m_mctruth object
124 
125  vars.m_mctruth_nparticles = mcTruth->NParticles();
126 
127  for (int i = 0; i < vars.m_mctruth_nparticles; i++){
128 
129  const simb::MCParticle& mcParticle = mcTruth->GetParticle(i);
130 
131  vars.m_mctruth_particles_track_Id[i] = mcParticle.TrackId();
132  vars.m_mctruth_particles_pdg_code[i] = mcParticle.PdgCode();
133  vars.m_mctruth_particles_mother[i] = mcParticle.Mother();
134  vars.m_mctruth_particles_status_code[i] = mcParticle.StatusCode();
135  vars.m_mctruth_particles_num_daughters[i] = mcParticle.NumberDaughters();
136 
137  for (int j = 0; j < vars.m_mctruth_particles_num_daughters[i]; j++){
138 
139  const simb::MCParticle& daughterMcParticle = mcTruth->GetParticle(j);
140  vars.m_mctruth_particles_daughters[i][j] = daughterMcParticle.TrackId();
141 
142  }
143 
144  vars.m_mctruth_particles_Gvx[i] = mcParticle.Gvx();
145  vars.m_mctruth_particles_Gvy[i] = mcParticle.Gvy();
146  vars.m_mctruth_particles_Gvz[i] = mcParticle.Gvz();
147  vars.m_mctruth_particles_Gvt[i] = mcParticle.Gvt();
148  vars.m_mctruth_particles_px0[i] = mcParticle.Px(0);
149  vars.m_mctruth_particles_py0[i] = mcParticle.Py(0);
150  vars.m_mctruth_particles_pz0[i] = mcParticle.Pz(0);
151  vars.m_mctruth_particles_e0[i] = mcParticle.E(0);
152  vars.m_mctruth_particles_rescatter[i] = mcParticle.Rescatter();
153  vars.m_mctruth_particles_polx[i] = mcParticle.Polarization().X();
154  vars.m_mctruth_particles_poly[i] = mcParticle.Polarization().Y();
155  vars.m_mctruth_particles_polz[i] = mcParticle.Polarization().Z();
156  }
157 
158  const simb::MCNeutrino& mcNeutrino = mcTruth->GetNeutrino();
159 
160  vars.m_mctruth_neutrino_ccnc = mcNeutrino.CCNC();
161  vars.m_mctruth_neutrino_mode = mcNeutrino.Mode();
162  vars.m_mctruth_neutrino_interaction_type = mcNeutrino.InteractionType();
163  vars.m_mctruth_neutrino_target = mcNeutrino.Target();
164  vars.m_mctruth_neutrino_nucleon = mcNeutrino.HitNuc();
165  vars.m_mctruth_neutrino_quark = mcNeutrino.HitQuark();
166  vars.m_mctruth_neutrino_w = mcNeutrino.W();
167  vars.m_mctruth_neutrino_x = mcNeutrino.X();
168  vars.m_mctruth_neutrino_y = mcNeutrino.Y();
169  vars.m_mctruth_neutrino_qsqr = mcNeutrino.QSqr();
170 
171  vars.m_gtruth_is_sea_quark = gTruth->fIsSeaQuark;
172  vars.m_gtruth_tgt_pdg = gTruth->ftgtPDG;
173  vars.m_gtruth_tgt_A = gTruth->ftgtA;
174  vars.m_gtruth_tgt_Z = gTruth->ftgtZ;
175  vars.m_gtruth_tgt_p4_x = gTruth->fTgtP4.X();
176  vars.m_gtruth_tgt_p4_y = gTruth->fTgtP4.Y();
177  vars.m_gtruth_tgt_p4_z = gTruth->fTgtP4.Z();
178  vars.m_gtruth_tgt_p4_E = gTruth->fTgtP4.E();
179 
180  vars.m_gtruth_weight = gTruth->fweight;
181  vars.m_gtruth_probability = gTruth->fprobability;
182  vars.m_gtruth_xsec = gTruth->fXsec;
183  vars.m_gtruth_diff_xsec = gTruth->fDiffXsec;
184  vars.m_gtruth_gphase_space = gTruth->fGPhaseSpace;
185 
186  vars.m_gtruth_vertex_x = gTruth->fVertex.X();
187  vars.m_gtruth_vertex_y = gTruth->fVertex.Y();
188  vars.m_gtruth_vertex_z = gTruth->fVertex.Z();
189  vars.m_gtruth_vertex_T = gTruth->fVertex.T();
190  vars.m_gtruth_gscatter = gTruth->fGscatter;
191  vars.m_gtruth_gint = gTruth->fGint;
192  vars.m_gtruth_res_num = gTruth->fResNum;
193  vars.m_gtruth_num_piplus = gTruth->fNumPiPlus;
194  vars.m_gtruth_num_pi0 = gTruth->fNumPi0;
195  vars.m_gtruth_num_piminus = gTruth->fNumPiMinus;
196  vars.m_gtruth_num_proton = gTruth->fNumProton;
197  vars.m_gtruth_num_neutron = gTruth->fNumNeutron;
198  vars.m_gtruth_is_charm = gTruth->fIsCharm;
199  vars.m_gtruth_is_strange = gTruth->fIsStrange;
200  vars.m_gtruth_decay_mode = gTruth->fDecayMode;
201  vars.m_gtruth_strange_hadron_pdg = gTruth->fStrangeHadronPdg;
202  vars.m_gtruth_charm_hadron_pdg = gTruth->fCharmHadronPdg;
203  vars.m_gtruth_gx = gTruth->fgX;
204  vars.m_gtruth_gy = gTruth->fgY;
205  vars.m_gtruth_gt = gTruth->fgT;
206  vars.m_gtruth_gw = gTruth->fgW;
207  vars.m_gtruth_gQ2 = gTruth->fgQ2;
208  vars.m_gtruth_gq2 = gTruth->fgq2;
209  vars.m_gtruth_probe_pdg = gTruth->fProbePDG;
210  vars.m_gtruth_probe_p4_x = gTruth->fProbeP4.X();
211  vars.m_gtruth_probe_p4_y = gTruth->fProbeP4.Y();
212  vars.m_gtruth_probe_p4_z = gTruth->fProbeP4.Z();
213  vars.m_gtruth_probe_p4_E = gTruth->fProbeP4.E();
214  vars.m_gtruth_hit_nuc_p4_x = gTruth->fHitNucP4.X();
215  vars.m_gtruth_hit_nuc_p4_y = gTruth->fHitNucP4.Y();
216  vars.m_gtruth_hit_nuc_p4_z = gTruth->fHitNucP4.Z();
217  vars.m_gtruth_hit_nuc_p4_E = gTruth->fHitNucP4.E();
218  vars.m_gtruth_hit_nuc_pos = gTruth->fHitNucPos;
219  vars.m_gtruth_fs_had_syst_p4_x = gTruth->fFShadSystP4.X();
220  vars.m_gtruth_fs_had_syst_p4_y = gTruth->fFShadSystP4.Y();
221  vars.m_gtruth_fs_had_syst_p4_z = gTruth->fFShadSystP4.Z();
222  vars.m_gtruth_fs_had_syst_p4_E = gTruth->fFShadSystP4.E();
223 
224  //moved to inside singlphoontmodule.cc for filter reasons
225  //eventweight_tree->Fill();
226  std::cout<<"SinglePhoton::AnalyzeEventWeight-eventweight_tree filled"<<std::endl;
227  }
228 
229 
230  //analyze_MCTruth.h
231  //if 1g1p
232  //is there at least 1 reco track and shower
233  //if there yes, are they in the same slice
234  //if yes, what is the slice score?
235  //if yes, was it a cosmic slice?
236  //if yes is that the neutrino slice?
237  //if they are in different slices
238  //was the shower/track:
239  //in the neutrino slice?
240  //in a cosmic slice?
241 
242  //if 1g0p
243  //if there is 1 shower
244  //what is the slice id? slice score? cosmic?
245  //if missing, not-recoed
246 
247  //if missing atleast 1shower, not recoed
248 
249 
250  //for a given signal def (`ncdelta` for now) , finds the MCParticles in event
251  //loops over association between reco tracks/showers to get associated slice(s)
252  //can also look at things like shower energy, conversion length, etc.
253  void AnalyzeRecoMCSlices(std::string signal_def,
254  std::vector<PandoraPFParticle> all_PPFPs,
255  std::map<int, art::Ptr<simb::MCParticle>> & MCParticleToTrackIDMap,
256  std::map<art::Ptr<recob::Shower>, art::Ptr<simb::MCParticle> > & showerToMCParticleMap,
257  std::map<art::Ptr<recob::Track>, art::Ptr<simb::MCParticle> > &trackToMCParticleMap,
258  var_all& vars,
259  para_all& paras){
260 
261  for(size_t index=0; index< all_PPFPs.size(); ++index){
262  PandoraPFParticle* temp_ppfp = &all_PPFPs[index];
263  if(!temp_ppfp->get_IsNuSlice()) continue;
264  vars.m_reco_slice_num_pfps[temp_ppfp->get_SliceID()]++;//GetPFPsPerSlice(PFPToSliceIdMap); //the total number of PFP's per slice
265  vars.m_reco_slice_num_showers[temp_ppfp->get_SliceID()]+=temp_ppfp->get_HasShower();
266  vars.m_reco_slice_num_tracks [temp_ppfp->get_SliceID()]+=temp_ppfp->get_HasTrack();
267  }
268 
269 
270  //first check if in the event there's a match to a given signal
271  if(signal_def == "ncdelta"){
272  //@para updated in the AnalyzeMCTruths function @ analyze_MCTruth.h
273  std::cout<<"AnalyzeSlice()\t||\t looking for signal def "<<signal_def<<", vars.m_mctruth_is_delta_radiative = "<<vars.m_mctruth_is_delta_radiative<<std::endl;
274 
275  std::vector<int> matched_shower_ids;
276  //first look for sim showers
277  for (unsigned int j = 0; j< vars.m_sim_shower_parent_pdg.size(); j++){
278  int parent= vars.m_sim_shower_parent_pdg[j];
279  int pdg = vars.m_sim_shower_pdg[j];
280 
281  //if this sim shower is a photon and it's primary (parent pdg is -1)
282  if(parent == -1 && pdg ==22){
283  //first check that this particle isn't alread saved
284  //use map from track ID to get MCP
285  //if this shower is matched to a recob:shower
286  if (vars.m_sim_shower_matched[j] > 0 && vars.m_reco_shower_energy_max[j] >20){
287  int matched_shower_id = vars.m_sim_shower_trackID[j];
288 
289 
290  //if this shower isn't already stored
291  if (std::find(matched_shower_ids.begin(), matched_shower_ids.end(), matched_shower_id) == matched_shower_ids.end()){
292  matched_shower_ids.push_back(matched_shower_id);
294  //vars.m_matched_signal_shower_conversion_length;
295  vars.m_matched_signal_shower_true_E.push_back(vars.m_sim_shower_energy[j]);
297  int id = vars.m_reco_shower_sliceId[j];
298  std::cout<<"found matched photon shower in slice "<<id<<" with vars.m_sim_shower_energy[j] = "<<vars.m_sim_shower_energy[j]<<std::endl;
299 
300  vars.m_matched_signal_shower_sliceId.push_back(id);
301 
302 
305  // num track/shower in slice here is in reverse order
308  // std::cout<<"found signal photon shower pdg"<< vars.m_sim_shower_pdg[j]<<"and is in neutrino slice = "<< vars.m_sim_shower_is_nuslice[j]<<std::endl;
309 
310  }//if not already stored
311  }//if matched to a reco shower >20MeV
312  }//if it's a photon from the neutrino interaction
313  }//for all sim showers
314 
316 
317  //NEXT, same procedure for tracks
318  std::vector<int> matched_track_ids;
319  for (unsigned int k = 0; k< vars.m_sim_track_parent_pdg.size(); k++){
320  int parent= vars.m_sim_track_parent_pdg[k];
321  int pdg = vars.m_sim_track_pdg[k];
322 
323  int matched_track_id = vars.m_sim_track_trackID[k];
324 
325  //if this sim track is a proton and it's primary (parent pdg is -1)
326  if((parent == -1 ||parent == 12 || parent ==14 ) && pdg == 2212){
327 
328  if (vars.m_sim_track_matched[k] > 0){
329 
330  if (std::find(matched_track_ids.begin(), matched_track_ids.end(), matched_track_id) == matched_track_ids.end()){
331  matched_track_ids.push_back(matched_track_id);
332 
333 
334  // vars.m_matched_signal_track_overlay_fraction.push_back(vars.m_sim_track_overlay_fraction[j]);
335  vars.m_matched_signal_track_true_E.push_back(vars.m_sim_track_energy[k]);
340 
341  int id = vars.m_reco_track_sliceId[k];
344 
345  }
346 
347  }//if matched
348  }//if proton from neutrino interaction
349  }//for all sim tracks
351  }//end of "ncdelta" scenario
352 
353  //brief summary
355  if (vars.m_matched_signal_track_num > 1) vars.m_multiple_matched_tracks = true;
356  if (vars.m_matched_signal_shower_num == 0) vars.m_no_matched_showers = true;
357 
358  //check if either 1g1p or 1g0p topology
359  if (vars.m_matched_signal_shower_num ==1 && vars.m_matched_signal_track_num ==1){//1g1p
360  //check if same slice
361  vars.m_is_matched_1g1p = true;
363  vars.m_reco_1g1p_is_same_slice = true;
366  } else{
367  vars.m_reco_1g1p_is_multiple_slices = true;
368  }
369  }else if(vars.m_matched_signal_shower_num ==1 && vars.m_matched_signal_track_num ==0){//1g0p
372  vars.m_is_matched_1g0p = true;
373 
374  }
375  }//findslice
376 
377  //This only look at MCTruch info. Reco matching create sivars.m_shower/track for pairing up MCTruth to Reco objects;
378  void AnalyzeMCTruths(std::vector<art::Ptr<simb::MCTruth>> & mcTruthVector , std::vector<art::Ptr<simb::MCParticle>> & mcParticleVector, var_all& vars, para_all& paras){
379 
380  std::map<int,std::string> is_delta_map = {
381  {2224,"Delta++"},
382  {2214,"Delta+"},
383  {1114,"Delta-"},
384  {2114,"Delta0"},
385  {-2224,"Anti-Delta++"},
386  {-2214,"Anti-Delta+"},
387  {-1114,"Anti-Delta-"},
388  {-2114,"Anti-Delta0"}};
389 
390  vars.m_mctruth_num = mcTruthVector.size();
391  if(g_is_verbose) std::cout<<"# of simb::MCTruth: "<<vars.m_mctruth_num<<std::endl;
392  if(vars.m_mctruth_num >1){
393  std::cout<<"AnalyzeMCTruths()\t||\t WARNING There is more than 1 MCTruth neutrino interaction. Just running over the first simb::MCTruth."<<std::endl;
394  }else if(vars.m_mctruth_num==0){
395  std::cout<<"AnalyzeMCTruths()\t||\t WARNING There is 0 MCTruth neutrino interaction. Break simb::MCTruth."<<std::endl;
396  }
397 
398  //one mctruth per event. contains list of all particles
399 
400  std::cout<<std::endl;
401  std::vector<int> spacers = Printer_header({" NuPdg"," CC=0"," TruthVertex(x,"," y, ",", z )"});
402  for(int i=0; i<std::min(1,vars.m_mctruth_num); i++){
403  const art::Ptr<simb::MCTruth> truth = mcTruthVector[i];
404 
405 
406  vars.m_mctruth_origin = truth->Origin();
407  // if(g_is_verbose) std::cout<<"Getting origin "<<truth->Origin()<<std::endl;
408 
409  if(!truth->NeutrinoSet()){
410  if(g_is_verbose) std::cout<<"Warning, no neutrino set skipping. "<<std::endl;
411  }else{
412  // if(g_is_verbose) std::cout<<"Getting origin "<<truth->Origin()<<std::endl;
413  vars.m_mctruth_ccnc = truth->GetNeutrino().CCNC();
414  // if(g_is_verbose) std::cout<<"Getting ccnc "<<truth->GetNeutrino().CCNC()<<std::endl;
415  vars.m_mctruth_mode = truth->GetNeutrino().Mode();
416  // if(g_is_verbose) std::cout<<"Getting Mode"<<std::endl;
417  vars.m_mctruth_interaction_type = truth->GetNeutrino().InteractionType();
418  // if(g_is_verbose) std::cout<<"Getting Type"<<std::endl;
419  vars.m_mctruth_qsqr = truth->GetNeutrino().QSqr();
420  // if(g_is_verbose) std::cout<<"Getting Q"<<std::endl;
421  vars.m_mctruth_nu_pdg = truth->GetNeutrino().Nu().PdgCode();
422  // if(g_is_verbose) std::cout<<"Getting E"<<std::endl;
423  vars.m_mctruth_nu_E = truth->GetNeutrino().Nu().E();
424  // if(g_is_verbose) std::cout<<"Getting pdg"<<std::endl;
425  vars.m_mctruth_lepton_pdg = truth->GetNeutrino().Lepton().PdgCode();
426  // if(g_is_verbose) std::cout<<"Getting pdg lepton"<<std::endl;
427  vars.m_mctruth_lepton_E = truth->GetNeutrino().Lepton().E();
428  // if(g_is_verbose) std::cout<<"Getting lepton E"<<std::endl;
429 
430  // if(g_is_verbose) std::cout<<"Getting SC corrected vertex position"<<std::endl;
431  std::vector<double> corrected(3);
432  // get corrected lepton position
433  spacecharge_correction( truth->GetNeutrino().Lepton(),corrected);
434 
435  vars.m_mctruth_nu_vertex_x = corrected[0];
436  vars.m_mctruth_nu_vertex_y = corrected[1];
437  vars.m_mctruth_nu_vertex_z = corrected[2];
439 
440  //std::vector<int> spacers = Printer_header({"NuPdg","CC=0","TruthVertex(x,"," y, ",", z )"});
444  std::to_string(corrected[0]),
445  std::to_string(corrected[1]),
446  std::to_string(corrected[2])
447  },spacers);
448 
449  }
450 
451 
452 
453  vars.m_mctruth_num_daughter_particles = truth->NParticles(); //MCTruth_NParticles
454 
455 
456  if(g_is_verbose) std::cout<<"\nThis MCTruth has "<<truth->NParticles()<<" daughters "<<std::endl;
457  std::vector<int> spacers = Printer_header({" pdg"," TrkID"," MotherID"," Status"," Energy"});
458 
459 
460 
461 
462  //some temp variables to see if its 1g1p or 1g1n
463  int tmp_n_photons_from_delta = 0;
464  int tmp_n_protons_from_delta = 0;
465  int tmp_n_neutrons_from_delta = 0;
466 
467 
469 
470  for(int j=0; j< vars.m_mctruth_num_daughter_particles; j++){
471 
472  const simb::MCParticle par = truth->GetParticle(j);
473  vars.m_mctruth_daughters_pdg[j] = par.PdgCode();
474  vars.m_mctruth_daughters_E[j] = par.E();
475 
476  vars.m_mctruth_daughters_status_code[j] = par.StatusCode();
477  vars.m_mctruth_daughters_trackID[j] = par.TrackId();
478  vars.m_mctruth_daughters_mother_trackID[j] = par.Mother();
479  vars.m_mctruth_daughters_px[j] = par.Px();
480  vars.m_mctruth_daughters_py[j] = par.Py();
481  vars.m_mctruth_daughters_pz[j] = par.Pz();
482  vars.m_mctruth_daughters_startx[j] = par.Vx();
483  vars.m_mctruth_daughters_starty[j] = par.Vy();
484  vars.m_mctruth_daughters_startz[j] = par.Vz();
485  vars.m_mctruth_daughters_time[j] = par.T();
486  vars.m_mctruth_daughters_endx[j] = par.EndX();
487  vars.m_mctruth_daughters_endy[j] = par.EndY();
488  vars.m_mctruth_daughters_endz[j] = par.EndZ();
489  vars.m_mctruth_daughters_endtime[j] = par.EndT();
490  vars.m_mctruth_daughters_process[j] = par.Process(); //Process() and EndProcess() return string
491  vars.m_mctruth_daughters_end_process[j] = par.EndProcess();
492 
493  if(paras.s_is_textgen) continue; //quick hack, fix in files
494 
495  switch(vars.m_mctruth_daughters_pdg[j]){
496  case(22): // if it's a gamma
497  {
498  if(par.StatusCode() == 1){
500  vars.m_mctruth_exiting_photon_mother_trackID.push_back(par.Mother());
501  vars.m_mctruth_exiting_photon_trackID.push_back(par.TrackId());
502  vars.m_mctruth_exiting_photon_energy.push_back(par.E());
503  vars.m_mctruth_exiting_photon_px.push_back(par.Px());
504  vars.m_mctruth_exiting_photon_py.push_back(par.Py());
505  vars.m_mctruth_exiting_photon_pz.push_back(par.Pz());
506  }
507  // if(g_is_verbose) std::cout<<"AnalyzeMCTruths()\t||\t Photon "<<par.PdgCode()<<" (id: "<<par.TrackId()<<") with mother trackID: "<<par.Mother()<<". Status Code: "<<par.StatusCode()<<" and photon energy "<<par.E()<<std::endl;
508 
509  //if its mother is a delta with statuscode 3, and it has status code 14, then its the internal product of the delta decay.
510  if((par.StatusCode()==1 || par.StatusCode()==14 )){
511  const simb::MCParticle mother = truth->GetParticle(par.Mother());
512 
513  if(is_delta_map.count(mother.PdgCode())>0 && mother.StatusCode()==3){
514  vars.m_mctruth_delta_photon_energy = par.E();
515  tmp_n_photons_from_delta ++;
517  }
518  }
519  }
520  break;
521  case(111): // if it's a pi0
522  {
523  // Make sure the pi0 actually exits the nucleus
524  if (par.StatusCode() == 1) {
525  vars.m_mctruth_exiting_pi0_E.push_back(par.E());
526  vars.m_mctruth_exiting_pi0_mom.push_back(sqrt(pow(par.Px(),2)+pow(par.Py(),2)+pow(par.Pz(),2)));
527  vars.m_mctruth_exiting_pi0_px.push_back(par.Px());
528  vars.m_mctruth_exiting_pi0_py.push_back(par.Py());
529  vars.m_mctruth_exiting_pi0_pz.push_back(par.Pz());
531  }
532  break;
533  }
534  case(211):
535  case(-211): // it's pi+ or pi-
536  if (par.StatusCode() == 1) {
538  }
539  break;
540  case(2212): // if it's a proton
541  {
542  if(par.StatusCode() == 1){
544  vars.m_mctruth_exiting_proton_mother_trackID.push_back(par.Mother());
545  vars.m_mctruth_exiting_proton_trackID.push_back(par.TrackId());
546  vars.m_mctruth_exiting_proton_energy.push_back(par.E());
547  vars.m_mctruth_exiting_proton_px.push_back(par.Px());
548  vars.m_mctruth_exiting_proton_py.push_back(par.Py());
549  vars.m_mctruth_exiting_proton_pz.push_back(par.Pz());
550  }
551 
552 
553  // if(g_is_verbose) std::cout<<"SingleProton::AnalyzeMCTruths()\t||\t Proton "<<par.PdgCode()<<" (id: "<<par.TrackId()<<") with mother trackID: "<<par.Mother()<<". Status Code: "<<par.StatusCode()<<" and proton energy "<<par.E()<<std::endl;
554 
555 
556  //if its mother is a delta with statuscode 3, and it has status code 14, then its the internal product of the delta decay.
557  if(par.StatusCode()==14 ){
558 
559  const simb::MCParticle mother = truth->GetParticle(par.Mother());
560  if(is_delta_map.count(mother.PdgCode())>0 && mother.StatusCode()==3){
561  vars.m_mctruth_delta_proton_energy = par.E();
562  tmp_n_protons_from_delta ++;
563  }
564  }
565 
566 
567  break;
568  }
569  case(2112): // if it's a neutron
570  {
571 
572  vars.m_mctruth_num_exiting_neutrons++; // Guanqun: neutron always exits the nucleus? should check it
573  vars.m_mctruth_exiting_neutron_mother_trackID.push_back(par.Mother());
574  vars.m_mctruth_exiting_neutron_trackID.push_back(par.TrackId());
575  vars.m_mctruth_exiting_neutron_energy.push_back(par.E());
576  vars.m_mctruth_exiting_neutron_px.push_back(par.Px());
577  vars.m_mctruth_exiting_neutron_py.push_back(par.Py());
578  vars.m_mctruth_exiting_neutron_pz.push_back(par.Pz());
579 
580  // if(g_is_verbose) std::cout<<"SingleProton::AnalyzeMCTruths()\t||\t Neutron "<<par.PdgCode()<<" (id: "<<par.TrackId()<<") with mother trackID: "<<par.Mother()<<". Status Code: "<<par.StatusCode()<<" and neutron energy "<<par.E()<<std::endl;
581 
582  //if its mother is a delta with statuscode 3, and it has status code 14, then its the internal product of the delta decay.
583  if(par.StatusCode()==14){
584  const simb::MCParticle mother = truth->GetParticle(par.Mother());
585  if(is_delta_map.count(mother.PdgCode())>0 && mother.StatusCode()==3){
586  vars.m_mctruth_delta_neutron_energy = par.E();
587  tmp_n_neutrons_from_delta ++;
588  }
589  }
590  }
591 
592  break;
593  case(-2224):
594  case(2224):
595  if(par.StatusCode() == 1){ vars.m_mctruth_num_exiting_deltapp++; }
596  break;
597  case(-2214):
598  case(2214)://delta +
599  case(-1114):
600  case(1114): // if it's delta-
601  if(par.StatusCode() == 1){ vars.m_mctruth_num_exiting_deltapm++; }
602  break;
603  case(-2114):
604  case(2114): // if it's delta0
605  if(par.StatusCode() == 1){
607  vars.m_mctruth_exiting_delta0_num_daughters.push_back(par.NumberDaughters());
608  // if(g_is_verbose) std::cout<<"AnalyzeMCTruths()\t||\t Delta0 "<<par.PdgCode()<<" (id: "<<par.TrackId()<<") with "<<vars.m_mctruth_exiting_delta0_num_daughters.back()<<" daughters. StatusCode "<<par.StatusCode()<<std::endl;
609  }
610  break;
611  default:
612  break;
613  }
614 
615  // if(g_is_verbose) std::cout<<"SingleProton::AnalyzeMCTruths()\t||\t Neutron "<<par.PdgCode()<<" (id: "<<par.TrackId()<<") with mother trackID: "<<par.Mother()<<". Status Code: "<<par.StatusCode()<<" and neutron energy "<<par.E()<<std::endl;
617  {std::to_string(par.PdgCode()),
618  std::to_string(par.TrackId()),
619  std::to_string(par.Mother()),
620  std::to_string(par.StatusCode()),
621  std::to_string(par.E())
622  },spacers);
623  } // end of vars.m_mctruth_num_daughter_particles loop
624 
625  if(paras.s_is_textgen) continue; //quick hack, fix in files
626 
627  for(size_t p=0; p< vars.m_mctruth_exiting_proton_energy.size(); p++){
630  }
631  }
632 
633 
634 
635  std::cout<<"AnalyzeMCTruths()\t||\t This event is ";
636  if(tmp_n_photons_from_delta==1 && tmp_n_protons_from_delta==1){
638  std::cout<<"a 1g1p delta radiative event"<<std::endl;
639  }else if(tmp_n_photons_from_delta==1 && tmp_n_neutrons_from_delta==1){
641  std::cout<<"a 1g1n delta radiative event"<<std::endl;
642  }else{
643  std::cout<<"NOT a 1g1p or 1g1n delta radiative decay"<<std::endl;;
644  }
645 
646  //Now for FSI exiting particles!
649 
650 
651  //second loop for some dauhter info
652  // status codes!
653  // 0 initial state
654  // 1 stable final state
655  // 2 intermediate state
656  // 3 decayed state
657  // 11 Nucleon target
658  // 14 hadron in the nucleas
659 
660  // So if a final_state_particle has a status(3) delta in its history its "from" a delta.
661  //first we loop over all 14's to see which have a direct mother delta. [done above]
662  //so first we loop over all state 1 (exiting) to see what a LArTPC sees (post FSI)
663  for (unsigned int p = 0; p < vars.m_mctruth_exiting_photon_energy.size(); p++){
664  // paras.s_exiting_photon_energy_threshold is read from pset
667 
668  }//if g above threshold
669  }
670 
671  //if it's a true delta radiative event, check the energies
672 
673 
674 
675  if (vars.m_mctruth_is_delta_radiative==true){//if ncdelta
676  for (unsigned int p = 0; p < vars.m_mctruth_exiting_photon_energy.size(); p++){
677  std::cout<<"AnalyzeMCTruths()\t||\tLooking at exiting photon with energy "<<vars.m_mctruth_exiting_photon_energy[p]<<std::endl;
679  vars.m_mctruth_is_reconstructable_1g0p = true; // Guanqun: just means now we have a reconstructable shower, but we don't know if there is a reconstructed nucleon or not yet.
680 
681  }//if g above threshold
682  }//for all exiting g
683  for(unsigned int pr = 0; pr < vars.m_mctruth_exiting_proton_energy.size(); pr++){
685  //if it's already 1g1p then we've found a 1g2p which we aren't counting
686  // Guanqun: limit to only 1 reconstructable proton?
687  if( vars.m_mctruth_is_reconstructable_1g1p == true && vars.m_mctruth_is_reconstructable_1g0p == false){
689  }
690  //if there's a photon then it's actually a 1g1p
691  if( vars.m_mctruth_is_reconstructable_1g0p == true && vars.m_mctruth_is_reconstructable_1g1p == false){
694  }
695  std::cout<<"AnalyzeMCTruths()\t||\tChecking proton with energy "<<vars.m_mctruth_exiting_proton_energy[pr]<<", is 1g1p/1g0p= "<< vars.m_mctruth_is_reconstructable_1g1p<<"/"<< vars.m_mctruth_is_reconstructable_1g0p<<std::endl;
696  }//if p above threshold
697  }//for all exiting p
698 
699  }//if ncdelta
700 
701 
702  //So for all photons that have status code 1 i.e all exiting ones...
703  for(int p =0; p < vars.m_mctruth_num_exiting_photons; ++p){
704  const simb::MCParticle mother = truth->GetParticle(vars.m_mctruth_exiting_photon_mother_trackID[p]);
705 
706  std::cout<<"AnalyzeMCTruths()\t||\t -- gamma ("<<vars.m_mctruth_exiting_photon_trackID[p]<<") of status_code 1.. "<<std::endl;
707  std::cout<<"AnalyzeMCTruths()\t||\t ---- with mother "<<mother.PdgCode()<<" ("<<vars.m_mctruth_exiting_photon_mother_trackID[p]<<") status_code "<<mother.StatusCode()<<std::endl;
708  simb::MCParticle nth_mother = mother;
709  int n_generation = 2;
710 
711  // Guanqun: why not consider its first-generation mother?
712  // for a photon exiting nucleus, its first mother is always also a photon (photon exits the nucleus, it becomes another photon..)
713  while(nth_mother.StatusCode() != 0 || n_generation < 4){
714 
715  if(nth_mother.Mother()<0) break;
716  nth_mother = truth->GetParticle(nth_mother.Mother());
717  std::cout<<"AnalyzeMCTruths()\t||\t ---- and "<<n_generation<<"-mother "<<nth_mother.PdgCode()<<" ("<<nth_mother.TrackId()<<") and status_code "<<nth_mother.StatusCode()<<std::endl;
718  if( is_delta_map.count(nth_mother.PdgCode())>0 && nth_mother.StatusCode()==3){
719  std::cout<<"AnalyzeMCTruths()\t||\t ------ Defintely From a Delta Decay! : "<<is_delta_map[nth_mother.PdgCode()]<<std::endl;
721  }
722  n_generation++;
723  }
724  }
725 
726  //So for all protons that have status code 1 i.e all exiting ones...
727  for(int p =0; p < vars.m_mctruth_num_exiting_protons; ++p){
728  const simb::MCParticle mother = truth->GetParticle(vars.m_mctruth_exiting_proton_mother_trackID[p]);
729 
730  if(g_is_verbose){
731  std::cout<<"AnalyzeMCTruths()\t||\t -- proton ("<<vars.m_mctruth_exiting_proton_trackID[p]<<") of status_code 1.. "<<std::endl;
732  std::cout<<"AnalyzeMCTruths()\t||\t ---- with mother "<<mother.PdgCode()<<" ("<<vars.m_mctruth_exiting_proton_mother_trackID[p]<<") status_code "<<mother.StatusCode()<<std::endl;
733  }
734  simb::MCParticle nth_mother = mother;
735  int n_generation = 2;
736 
737  while(nth_mother.StatusCode() != 0 && n_generation < 4){
738  if(nth_mother.Mother()<0) break;
739  nth_mother = truth->GetParticle(nth_mother.Mother());
740  if(g_is_verbose) std::cout<<"AnalyzeMCTruths()\t||\t ---- and "<<n_generation<<"-mother "<<nth_mother.PdgCode()<<" ("<<nth_mother.TrackId()<<") and status_code "<<nth_mother.StatusCode()<<std::endl;
741  if(is_delta_map.count(nth_mother.PdgCode())>0 && nth_mother.StatusCode()==3){
742  if(g_is_verbose) std::cout<<"AnalyzeMCTruths()\t||\t ------ Defintely From a Delta Decay! : "<<is_delta_map[nth_mother.PdgCode()]<<std::endl;
744  }
745  n_generation++;
746  }
747 
748 
749  }
750 
751 
752  if(g_is_verbose){
753  std::cout<<"AnalyzeMCTruths()\t||\t This is a CCNC: "<<vars.m_mctruth_ccnc<<" event with a nu_pdg: "<<vars.m_mctruth_nu_pdg<<" and "<<vars.m_mctruth_num_daughter_particles<<" exiting particles."<<std::endl;
754  std::cout<<"AnalyzeMCTruths()\t||\t With "<<vars.m_mctruth_num_exiting_pi0<<" Pi0, "<<vars.m_mctruth_num_exiting_pipm<<" Pi+/-, "<<vars.m_mctruth_num_exiting_protons<<" Protons, "<<vars.m_mctruth_num_exiting_neutrons<<" neutrons and "<<vars.m_mctruth_num_exiting_delta0<<" delta0, "<<vars.m_mctruth_num_exiting_deltapm<<" deltapm, "<<vars.m_mctruth_num_exiting_deltapp<<" Deltas++"<<std::endl;
755  }
756 
757  }// end of MCtruth loo
758 
759  //make a stupid temp map
760  std::map<size_t,size_t> mymap;
761  for(size_t k = 0; k < mcParticleVector.size(); k++){
762  const art::Ptr<simb::MCParticle> mcp = mcParticleVector[k];
763  mymap[mcp->TrackId()] = k;
764  }
765 
766 
767  //Just some VERY hacky pi^0 photon stuff
768  int npi0check = 0;
769  for(size_t k = 0; k < mcParticleVector.size(); k++){
770  const art::Ptr<simb::MCParticle> mcp = mcParticleVector[k];
771 
772  if(false) std::cout << k << " Mother:"<< mcp->Mother() << " pdgcode: " << mcp->PdgCode() << " trkid: " << mcp->TrackId() << " statuscode: " << mcp->StatusCode() << std::endl;
773 
774  // if it's a pi0, its mother trackID is 0 and it has two daughters
775  if(mcp->PdgCode() == 111 && mcp->Mother() == 0 && mcp->NumberDaughters()==2 ){
776  npi0check++;
777  // get its two daughters
778  const art::Ptr<simb::MCParticle> dau1 = mcParticleVector[mymap[mcp->Daughter(0)]];
779  const art::Ptr<simb::MCParticle> dau2 = mcParticleVector[mymap[mcp->Daughter(1)]];
780 
781  if(false) std::cout<<"On Dau1: "<<" Mother:"<< dau1->Mother()<<" pdgcode: "<<dau1->PdgCode()<<" trkid: "<<dau1->TrackId()<<" statuscode: "<<dau1->StatusCode()<<std::endl;
782  if(false) std::cout<<"On Dau2: "<<" Mother:"<< dau2->Mother()<<" pdgcode: "<<dau2->PdgCode()<<" trkid: "<<dau2->TrackId()<<" statuscode: "<<dau2->StatusCode()<<std::endl;
783 
784  double e1 = dau1->E();
785  double e2 = dau2->E();
786 
787  std::vector<double> raw_1_End ={dau1->EndX(), dau1->EndY(), dau1->EndZ()};
788  std::vector<double> raw_1_Start ={dau1->Vx(), dau1->Vy(), dau1->Vz()};
789 
790  std::vector<double> raw_2_End ={dau2->EndX(), dau2->EndY(), dau2->EndZ()};
791  std::vector<double> raw_2_Start ={dau2->Vx(), dau2->Vy(), dau2->Vz()};
792 
793  std::vector<double> corrected_1_start(3), corrected_2_start(3);
794  std::vector<double> corrected_1_end(3), corrected_2_end(3);
795 
796  spacecharge_correction(dau1, corrected_1_start, raw_1_Start);
797  spacecharge_correction(dau1, corrected_1_end, raw_1_End);
798 
799  spacecharge_correction(dau2, corrected_2_start, raw_2_Start);
800  spacecharge_correction(dau2, corrected_2_end, raw_2_End);
801 
802  for(int p1=0; p1<dau1->NumberDaughters();p1++){
803  auto dd = mcParticleVector[mymap[dau1->Daughter(p1)]];
804  std::cout<<"Post1 "<<dd->PdgCode()<<" "<<dd->TrackId()<<" "<<dd->StatusCode()<<" "<<dd->EndProcess()<<std::endl;
805  }
806 
807  for(int p1=0; p1<dau2->NumberDaughters();p1++){
808  auto dd = mcParticleVector[mymap[dau2->Daughter(p1)]];
809  std::cout<<"Post2 "<<dd->PdgCode()<<" "<<dd->TrackId()<<" "<<dd->StatusCode()<<" "<<dd->EndProcess()<<" "<<dd->E()<<std::endl;
810  }
811 
812  int exit1 = isInTPCActive(corrected_1_end, paras);
813  int exit2 = isInTPCActive(corrected_2_end, paras);
814 
815  if(e2<e1){
818  vars.m_mctruth_pi0_leading_photon_end_process = dau1->EndProcess();
819  vars.m_mctruth_pi0_subleading_photon_end_process = dau2->EndProcess();
820  vars.m_mctruth_pi0_leading_photon_start = corrected_1_start;
821  vars.m_mctruth_pi0_leading_photon_end = corrected_1_end;
822  vars.m_mctruth_pi0_subleading_photon_start = corrected_2_start;
823  vars.m_mctruth_pi0_subleading_photon_end = corrected_2_end;
824  //note: the order of subleading/leading photon is reversed// Fixed as of 2022 reprocess!
827  vars.m_mctruth_pi0_leading_photon_mom = {dau1->Px(),dau1->Py(),dau1->Pz()};
828  vars.m_mctruth_pi0_subleading_photon_mom = {dau2->Px(),dau2->Py(),dau2->Pz()};
829 
830  }else{
833  vars.m_mctruth_pi0_leading_photon_end_process = dau2->EndProcess();
834  vars.m_mctruth_pi0_subleading_photon_end_process = dau1->EndProcess();
835  vars.m_mctruth_pi0_leading_photon_start = corrected_2_start;
836  vars.m_mctruth_pi0_leading_photon_end = corrected_2_end;
837  vars.m_mctruth_pi0_subleading_photon_start = corrected_1_start;
838  vars.m_mctruth_pi0_subleading_photon_end = corrected_1_end;
841  vars.m_mctruth_pi0_subleading_photon_mom = {dau1->Px(),dau1->Py(),dau1->Pz()};
842  vars.m_mctruth_pi0_leading_photon_mom = {dau2->Px(),dau2->Py(),dau2->Pz()};
843 
844  }
845 
846  }
847  }
848 
849  if(npi0check>1) std::cout<<"WARNING WARNING!!!! there are "<<npi0check<<" Pi0's in this event in geant4 that come from the nucleas"<<std::endl;
850 
851  }//end of analyze this
852 
853 
854 }
std::vector< bool > m_matched_signal_track_is_clearcosmic
Definition: variables.h:1101
double m_gtruth_fs_had_syst_p4_z
Definition: variables.h:540
std::vector< double > m_mctruth_daughters_time
Definition: variables.h:917
std::vector< double > m_mctruth_exiting_photon_pz
Definition: variables.h:946
std::vector< double > m_mctruth_exiting_pi0_py
Definition: variables.h:970
std::vector< int > m_mctruth_daughters_status_code
Definition: variables.h:908
std::vector< int > m_mctruth_daughters_pdg
Definition: variables.h:906
double m_mctruth_particles_polx[100]
Definition: variables.h:479
double m_mctruth_particles_e0[100]
Definition: variables.h:477
std::vector< int > m_reco_slice_num_showers
Definition: variables.h:1075
std::vector< double > m_reco_shower_nuscore
Definition: variables.h:836
std::vector< double > m_mctruth_pi0_leading_photon_mom
Definition: variables.h:983
std::vector< int > m_mctruth_exiting_photon_from_delta_decay
Definition: variables.h:942
int m_mctruth_delta_radiative_1g1p_or_1g1n
Definition: variables.h:934
std::vector< bool > m_reco_shower_isclearcosmic
Definition: variables.h:837
var pdg
Definition: selectors.fcl:14
double m_gtruth_hit_nuc_p4_z
Definition: variables.h:535
std::vector< double > m_geant4_px
Definition: variables.h:178
double m_mctruth_particles_py0[100]
Definition: variables.h:475
std::vector< int > m_mctruth_exiting_proton_trackID
Definition: variables.h:948
double m_gtruth_hit_nuc_p4_E
Definition: variables.h:536
void AnalyzeEventWeight(art::Event const &e, var_all &vars)
Definition: analyze_MC.cxx:60
std::vector< double > m_mctruth_daughters_endz
Definition: variables.h:920
std::vector< double > m_geant4_dz
Definition: variables.h:186
int m_mctruth_particles_status_code[100]
Definition: variables.h:467
std::vector< int > m_geant4_statuscode
Definition: variables.h:175
double m_mctruth_leading_exiting_proton_energy
Definition: variables.h:932
std::vector< double > m_matched_signal_shower_overlay_fraction
Definition: variables.h:1086
std::vector< double > m_mctruth_pi0_subleading_photon_end
Definition: variables.h:979
double m_mctruth_particles_pz0[100]
Definition: variables.h:476
double m_mctruth_nu_vertex_y
Definition: variables.h:895
int m_mctruth_pi0_subleading_photon_exiting_TPC
Definition: variables.h:978
bool m_reco_1g1p_is_multiple_slices
Definition: variables.h:1114
double m_gtruth_fs_had_syst_p4_y
Definition: variables.h:539
std::vector< double > m_mctruth_exiting_photon_energy
Definition: variables.h:943
std::vector< double > m_geant4_dy
Definition: variables.h:185
pdgs p
Definition: selectors.fcl:22
double m_mctruth_reco_vertex_dist
Definition: variables.h:897
std::vector< double > m_mctruth_exiting_pi0_pz
Definition: variables.h:971
double m_mctruth_particles_poly[100]
Definition: variables.h:480
std::vector< double > m_mctruth_exiting_proton_pz
Definition: variables.h:954
std::vector< int > m_mctruth_daughters_mother_trackID
Definition: variables.h:910
double m_mctruth_particles_Gvt[100]
Definition: variables.h:473
int m_mctruth_neutrino_interaction_type
Definition: variables.h:484
std::vector< int > m_matched_signal_track_showers_in_slice
Definition: variables.h:1105
std::vector< double > m_mctruth_exiting_neutron_py
Definition: variables.h:961
std::vector< double > m_sim_track_energy
Definition: variables.h:694
std::vector< double > m_mctruth_exiting_pi0_mom
Definition: variables.h:968
std::vector< int > m_sim_track_parent_pdg
Definition: variables.h:698
std::vector< double > m_mctruth_exiting_proton_energy
Definition: variables.h:951
double m_mctruth_particles_px0[100]
Definition: variables.h:474
double m_mctruth_delta_photon_energy
Definition: variables.h:935
std::vector< int > m_sim_track_trackID
Definition: variables.h:713
void AnalyzeGeant4(const std::vector< art::Ptr< simb::MCParticle >> &mcParticleVector, var_all &vars)
Definition: analyze_MC.cxx:11
std::vector< double > m_mctruth_daughters_startz
Definition: variables.h:916
std::vector< int > m_mctruth_exiting_neutron_trackID
Definition: variables.h:956
std::vector< bool > m_reco_shower_is_nuslice
Definition: variables.h:838
std::vector< double > m_mctruth_pi0_subleading_photon_mom
Definition: variables.h:984
std::vector< int > m_mctruth_exiting_neutron_mother_trackID
Definition: variables.h:957
std::vector< int > m_matched_signal_shower_tracks_in_slice
Definition: variables.h:1093
std::vector< double > m_geant4_vx
Definition: variables.h:181
int m_mctruth_pi0_leading_photon_exiting_TPC
Definition: variables.h:977
std::vector< double > m_mctruth_exiting_proton_py
Definition: variables.h:953
std::vector< double > m_mctruth_exiting_photon_py
Definition: variables.h:945
bool m_mctruth_is_reconstructable_1g1p
Definition: variables.h:964
double m_mctruth_particles_Gvz[100]
Definition: variables.h:472
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
std::vector< int > m_mctruth_exiting_proton_mother_trackID
Definition: variables.h:949
int m_mctruth_num_daughter_particles
Definition: variables.h:905
std::vector< double > m_geant4_py
Definition: variables.h:179
double s_exiting_photon_energy_threshold
Definition: variables.h:160
std::vector< double > m_geant4_vy
Definition: variables.h:182
std::vector< double > m_matched_signal_track_nuscore
Definition: variables.h:1099
std::vector< bool > m_reco_track_is_nuslice
Definition: variables.h:685
std::vector< double > m_mctruth_daughters_pz
Definition: variables.h:913
std::vector< int > m_mctruth_exiting_proton_from_delta_decay
Definition: variables.h:950
std::vector< std::string > m_geant4_process
Definition: variables.h:187
std::vector< bool > m_matched_signal_shower_is_nuslice
Definition: variables.h:1092
std::vector< int > m_mctruth_exiting_delta0_num_daughters
Definition: variables.h:938
std::vector< int > Printer_header(std::vector< std::string > headings)
std::vector< int > m_reco_track_sliceId
Definition: variables.h:680
double m_gtruth_hit_nuc_p4_y
Definition: variables.h:534
std::vector< double > m_mctruth_daughters_py
Definition: variables.h:912
std::vector< int > m_matched_signal_track_tracks_in_slice
Definition: variables.h:1104
double m_mctruth_nu_vertex_x
Definition: variables.h:894
std::vector< double > m_reco_shower_energy_max
Definition: variables.h:988
std::vector< int > m_matched_signal_shower_showers_in_slice
Definition: variables.h:1094
std::vector< double > m_sim_shower_energy
Definition: variables.h:855
std::vector< int > m_sim_shower_matched
Definition: variables.h:853
std::vector< double > m_geant4_dx
Definition: variables.h:184
double m_mctruth_particles_Gvx[100]
Definition: variables.h:470
std::vector< double > m_reco_track_nuscore
Definition: variables.h:681
double m_gtruth_fs_had_syst_p4_E
Definition: variables.h:541
double m_mctruth_pi0_subleading_photon_energy
Definition: variables.h:975
int m_mctruth_particles_daughters[100][100]
Definition: variables.h:469
double m_mctruth_delta_proton_energy
Definition: variables.h:936
std::vector< double > m_mctruth_exiting_proton_px
Definition: variables.h:952
std::vector< double > m_mctruth_pi0_subleading_photon_start
Definition: variables.h:980
std::vector< double > m_mctruth_daughters_endx
Definition: variables.h:918
std::vector< double > m_geant4_pz
Definition: variables.h:180
std::vector< double > m_geant4_vz
Definition: variables.h:183
double m_gtruth_hit_nuc_p4_x
Definition: variables.h:533
std::vector< std::string > m_mctruth_daughters_process
Definition: variables.h:922
std::vector< int > m_sim_track_pdg
Definition: variables.h:697
std::vector< int > m_reco_shower_sliceId
Definition: variables.h:835
double m_mctruth_neutrino_qsqr
Definition: variables.h:491
bool isInTPCActive(std::vector< double > &vec, para_all &paras)
std::vector< int > m_reco_slice_num_pfps
Definition: variables.h:1074
int m_mctruth_num_reconstructable_protons
Definition: variables.h:963
int spacecharge_correction(const art::Ptr< simb::MCParticle > &mcparticle, std::vector< double > &corrected, std::vector< double > &input)
Definition: Processors.cxx:25
std::vector< double > m_geant4_E
Definition: variables.h:176
double s_exiting_proton_energy_threshold
Definition: variables.h:161
std::vector< double > m_mctruth_exiting_neutron_energy
Definition: variables.h:959
double m_mctruth_particles_Gvy[100]
Definition: variables.h:471
int m_mctruth_particles_mother[100]
Definition: variables.h:466
std::vector< double > m_sim_shower_overlay_fraction
Definition: variables.h:883
std::vector< int > m_matched_signal_shower_sliceId
Definition: variables.h:1090
std::vector< bool > m_matched_signal_track_is_nuslice
Definition: variables.h:1103
std::vector< int > m_sim_shower_trackID
Definition: variables.h:859
std::vector< double > m_mctruth_exiting_pi0_px
Definition: variables.h:969
std::vector< double > m_mctruth_daughters_endy
Definition: variables.h:919
std::vector< double > m_mctruth_pi0_leading_photon_start
Definition: variables.h:982
int m_mctruth_particles_rescatter[100]
Definition: variables.h:478
int m_mctruth_num_exiting_neutrons
Definition: variables.h:928
std::vector< std::string > m_geant4_end_process
Definition: variables.h:188
std::vector< double > m_matched_signal_shower_true_E
Definition: variables.h:1088
std::vector< double > m_mctruth_exiting_pi0_E
Definition: variables.h:967
int m_mctruth_particles_pdg_code[100]
Definition: variables.h:465
std::string m_mctruth_pi0_leading_photon_end_process
Definition: variables.h:974
std::vector< int > m_sim_shower_parent_pdg
Definition: variables.h:860
std::vector< bool > m_reco_track_isclearcosmic
Definition: variables.h:682
int m_mctruth_particles_track_Id[100]
Definition: variables.h:464
void Printer_content(std::vector< std::string > nums, std::vector< int > spacers)
std::string to_string(WindowPattern const &pattern)
std::vector< std::string > m_mctruth_daughters_end_process
Definition: variables.h:923
std::vector< double > m_mctruth_exiting_neutron_px
Definition: variables.h:960
std::vector< int > m_matched_signal_track_sliceId
Definition: variables.h:1100
std::string m_mctruth_pi0_subleading_photon_end_process
Definition: variables.h:976
double m_mctruth_pi0_leading_photon_energy
Definition: variables.h:973
do i e
int m_mctruth_particles_num_daughters[100]
Definition: variables.h:468
std::vector< int > m_sim_track_matched
Definition: variables.h:690
double m_gtruth_fs_had_syst_p4_x
Definition: variables.h:538
std::vector< int > m_mctruth_exiting_photon_mother_trackID
Definition: variables.h:941
std::vector< double > m_geant4_mass
Definition: variables.h:177
std::vector< int > m_sim_shower_pdg
Definition: variables.h:858
std::vector< double > m_mctruth_daughters_E
Definition: variables.h:907
std::vector< double > m_mctruth_daughters_starty
Definition: variables.h:915
std::vector< bool > m_matched_signal_shower_is_clearcosmic
Definition: variables.h:1091
std::vector< double > m_matched_signal_shower_nuscore
Definition: variables.h:1089
pdgs k
Definition: selectors.fcl:22
std::vector< double > m_mctruth_daughters_startx
Definition: variables.h:914
std::vector< int > m_geant4_pdg
Definition: variables.h:172
std::vector< double > m_mctruth_exiting_photon_px
Definition: variables.h:944
std::vector< int > m_reco_slice_num_tracks
Definition: variables.h:1076
std::vector< int > m_geant4_mother
Definition: variables.h:174
std::vector< double > m_geant4_costheta
Definition: variables.h:190
std::vector< double > m_mctruth_daughters_px
Definition: variables.h:911
std::vector< int > m_mctruth_daughters_trackID
Definition: variables.h:909
std::vector< double > m_mctruth_daughters_endtime
Definition: variables.h:921
BEGIN_PROLOG SN nu
double m_mctruth_particles_polz[100]
Definition: variables.h:481
double m_mctruth_delta_neutron_energy
Definition: variables.h:937
std::vector< int > m_mctruth_exiting_photon_trackID
Definition: variables.h:940
void AnalyzeMCTruths(std::vector< art::Ptr< simb::MCTruth >> &mcTruthVector, std::vector< art::Ptr< simb::MCParticle >> &mcParticleVector, var_all &vars, para_all &paras)
Definition: analyze_MC.cxx:378
std::vector< double > m_mctruth_exiting_neutron_pz
Definition: variables.h:962
physics pm2 e1
void AnalyzeRecoMCSlices(std::string signal_def, std::vector< PandoraPFParticle > all_PPFPs, std::map< int, art::Ptr< simb::MCParticle >> &MCParticleToTrackIDMap, std::map< art::Ptr< recob::Shower >, art::Ptr< simb::MCParticle > > &showerToMCParticleMap, std::map< art::Ptr< recob::Track >, art::Ptr< simb::MCParticle > > &trackToMCParticleMap, var_all &vars, para_all &paras)
Definition: analyze_MC.cxx:253
bool m_mctruth_is_reconstructable_1g0p
Definition: variables.h:965
std::vector< int > m_geant4_trackid
Definition: variables.h:173
physics associatedGroupsWithLeft p1
BEGIN_PROLOG could also be cout
double m_mctruth_nu_vertex_z
Definition: variables.h:896
std::vector< double > m_matched_signal_track_true_E
Definition: variables.h:1098
std::vector< double > m_mctruth_pi0_leading_photon_end
Definition: variables.h:981