All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Typedefs | Functions | Variables
single_photon Namespace Reference

Classes

class  PandoraPFParticle
 
struct  sss_score
 
class  TruncMean
 
struct  para_all
 
struct  var_all
 
class  SinglePhoton
 SinglePhoton class. More...
 

Typedefs

typedef art::ValidHandle
< std::vector
< recob::PFParticle > > 
PFParticleHandle
 
typedef std::vector< art::Ptr
< recob::PFParticle > > 
PFParticleVector
 
typedef std::vector< art::Ptr
< recob::Track > > 
TrackVector
 
typedef std::vector< art::Ptr
< recob::Shower > > 
ShowerVector
 
typedef std::map< size_t,
art::Ptr< recob::PFParticle > > 
PFParticleIdMap
 

Functions

std::vector< int > Printer_header (std::vector< std::string > headings)
 
void Printer_content (std::vector< std::string > nums, std::vector< int > spacers)
 
double dist_line_point (std::vector< double > &X1, std::vector< double > &X2, std::vector< double > &point)
 
double impact_paramater_shr (double x, double y, double z, art::Ptr< recob::Shower > &shr)
 
double implied_invar_mass (double vx, double vy, double vz, art::Ptr< recob::Shower > &s1, double E1, art::Ptr< recob::Shower > &s2, double E2)
 
double invar_mass (art::Ptr< recob::Shower > &s1, double E1, art::Ptr< recob::Shower > &s2, double E2)
 
double getMedian (std::vector< double > thisvector)
 
double getAmalgamateddEdx (double angle_wrt_plane0, double angle_wrt_plane1, double angle_wrt_plane2, double median_plane0, double median_plane1, double median_plane2, int plane0_nhits, int plane1_nhits, int plane2_nhits)
 
int getAmalgamateddEdxNHits (double amalgamateddEdx, double median_plane0, double median_plane1, double median_plane2, int plane0_nhits, int plane1_nhits, int plane2_nhits)
 
std::vector< std::vector
< double > > 
buildRectangle (std::vector< double > cluster_start, std::vector< double > cluster_axis, double width, double length)
 Calculates the four corners of a rectangle of given length and width around a cluster given the start point and axis direction. More...
 
template<typename T >
std::vector< size_t > sort_indexes (const std::vector< T > &v)
 
template<typename T >
std::vector< size_t > sort_indexes_rev (const std::vector< T > &v)
 
template<typename T >
bool marks_compare_vec_nonsense (std::vector< T > &v1, std::vector< T > &v2)
 
double calcWire (double Y, double Z, int plane, int fTPC, int fCryostat, geo::GeometryCore const &geo)
 
double getCoswrtWires (TVector3 shower_dir, TVector3 wire_dir)
 
double degToRad (double deg)
 
double radToDeg (double rad)
 
void PPFP_FindAncestor (std::vector< PandoraPFParticle > &PPFPs)
 
void PPFP_FindSliceIDandHits (std::vector< PandoraPFParticle > &PPFPs, art::Ptr< recob::Slice > slice, const std::vector< art::Ptr< recob::PFParticle > > PFP_in_slice, const std::vector< art::Ptr< recob::Hit > > Hit_inslice)
 
int DefineNuSlice (std::vector< PandoraPFParticle > &PPFPs)
 
PandoraPFParticlePPFP_GetPPFPFromShower (std::vector< PandoraPFParticle > &PPFPs, art::Ptr< recob::Shower > pShower)
 
PandoraPFParticlePPFP_GetPPFPFromTrack (std::vector< PandoraPFParticle > &PPFPs, art::Ptr< recob::Track > pTrack)
 
PandoraPFParticlePPFP_GetPPFPFromPFID (std::vector< PandoraPFParticle > &PPFPs, int id)
 
void AnalyzeGeant4 (const std::vector< art::Ptr< simb::MCParticle >> &mcParticleVector, var_all &vars)
 
void AnalyzeEventWeight (art::Event const &e, var_all &vars)
 
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)
 
void AnalyzeMCTruths (std::vector< art::Ptr< simb::MCTruth >> &mcTruthVector, std::vector< art::Ptr< simb::MCParticle >> &mcParticleVector, var_all &vars, para_all &paras)
 
void AnalyzeTracks (std::vector< PandoraPFParticle > all_PPFPs, const std::vector< art::Ptr< recob::Track >> &tracks, std::map< art::Ptr< recob::PFParticle >, std::vector< art::Ptr< recob::SpacePoint >>> &pfParticleToSpacePointsMap, std::map< int, art::Ptr< simb::MCParticle > > &MCParticleToTrackIdMap, std::map< int, double > &sliceIdToNuScoreMap, var_all &vars, para_all &paras)
 
void AnalyzeTrackCalo (const std::vector< art::Ptr< recob::Track >> &tracks, std::vector< PandoraPFParticle > all_PPFPs, var_all &vars, para_all &paras)
 
void CollectPID (std::vector< art::Ptr< recob::Track >> &tracks, std::vector< PandoraPFParticle > all_PPFPs, var_all &vars)
 
void AnalyzeFlashes (const std::vector< art::Ptr< recob::OpFlash >> &flashes, art::Handle< std::vector< sbn::crt::CRTHit >> crthit_h, double evt_timeGPS_nsec, std::map< art::Ptr< recob::OpFlash >, std::vector< art::Ptr< sbn::crt::CRTHit >>> crtvetoToFlashMap, var_all &vars, para_all &paras)
 
void AnalyzeShowers (std::vector< PandoraPFParticle > all_PPFPs, const std::vector< art::Ptr< recob::Shower >> &showers, std::map< art::Ptr< recob::Cluster >, std::vector< art::Ptr< recob::Hit >> > &clusterToHitMap, double triggeroffset, detinfo::DetectorPropertiesData const &theDetector, var_all &vars, para_all &paras)
 
void setTPCGeom (para_all &paras)
 
bool isInTPCActive (std::vector< double > &vec, para_all &paras)
 
double distToTPCActive (std::vector< double > &vec, para_all &paras)
 
double distToCPA (std::vector< double > &vec, para_all &paras)
 
int distToSCB (double &dist, std::vector< double > &vec, para_all &paras)
 
void ClearMeta (var_all &vars)
 : reset/clear data members More...
 
void CreateMetaBranches (var_all &vars)
 
void ClearIsolation (var_all &vars)
 
void CreateIsolationBranches (var_all &vars)
 
void ClearSecondShowers (var_all &vars)
 
void ClearSecondShowers3D (var_all &vars)
 
void ClearStubs (var_all &vars)
 
void CreateSecondShowerBranches (var_all &vars)
 
void CreateSecondShowerBranches3D (var_all &vars)
 
void CreateStubBranches (var_all &vars)
 
void ClearFlashes (var_all &vars)
 
void CreateFlashBranches (var_all &vars)
 
void ResizeFlashes (size_t size, var_all &vars)
 
void ClearTracks (var_all &vars)
 
void CreateTrackBranches (var_all &vars)
 
void ResizeTracks (size_t size, var_all &vars)
 
void ClearShowers (var_all &vars)
 
void CreateShowerBranches (var_all &vars)
 
void ResizeShowers (size_t size, var_all &vars)
 
void ClearMCTruths (var_all &vars)
 
void CreateMCTruthBranches (var_all &vars)
 
void ResizeMCTruths (size_t size, var_all &vars)
 
void ClearEventWeightBranches (var_all &vars)
 
void CreateEventWeightBranches (var_all &vars)
 
void ClearGeant4Branches (var_all &vars)
 : fill event weight related variables More...
 
void CreateGeant4Branches (var_all &vars)
 
void ClearSlices (var_all &vars)
 
void CreateSliceBranches (var_all &vars)
 
void ResizeSlices (size_t size, var_all &vars)
 
void Save_EventMeta (art::Event &evt, var_all &vars)
 
void Save_PFParticleInfo (std::vector< PandoraPFParticle > PPFPs, var_all &vars, para_all &paras)
 
void AnalyzeEventWeight (art::Event const &e)
 : fill event weight related variables More...
 
int spacecharge_correction (const art::Ptr< simb::MCParticle > &mcparticle, std::vector< double > &corrected, std::vector< double > &input)
 
int spacecharge_correction (const art::Ptr< simb::MCParticle > &mcparticle, std::vector< double > &corrected)
 
int spacecharge_correction (const simb::MCParticle &mcparticle, std::vector< double > &corrected)
 
void CollectMCParticles (const art::Event &evt, const std::string &label, std::map< art::Ptr< simb::MCTruth >, std::vector< art::Ptr< simb::MCParticle >>> &truthToParticles, std::map< art::Ptr< simb::MCParticle >, art::Ptr< simb::MCTruth >> &particlesToTruth, std::map< int, art::Ptr< simb::MCParticle > > &MCParticleToTrackIdMap, var_all &vars)
 
void CollectSimChannels (const art::Event &evt, const std::string &label, std::vector< art::Ptr< sim::SimChannel > > &simChannelVector)
 
void BuildMCParticleHitMaps (const art::Event &evt, const std::string &label, const std::vector< art::Ptr< recob::Hit >> &hitVector, std::map< art::Ptr< simb::MCParticle >, std::vector< art::Ptr< recob::Hit > > > &particlesToHits, std::map< art::Ptr< recob::Hit >, art::Ptr< simb::MCParticle > > &hitsToParticles, const lar_pandora::LArPandoraHelper::DaughterMode daughterMode, std::map< int, art::Ptr< simb::MCParticle > > &MCParticleToTrackIdMap, var_all &vars)
 
bool Pi0PreselectionFilter (var_all &vars, para_all &paras)
 
bool Pi0PreselectionFilter2g0p (var_all &vars, para_all &paras)
 
bool IsEventInList (int run, int subrun, int event, var_all &vars)
 
bool isInsidev2 (std::vector< double > thishit_pos, std::vector< std::vector< double >> rectangle, para_all &paras)
 
double CalcEShowerPlane (const std::vector< art::Ptr< recob::Hit >> &hits, int this_plane, para_all &paras)
 
double GetQHit (art::Ptr< recob::Hit > thishitptr, int plane, para_all &paras)
 
double QtoEConversion (double Q, para_all &paras)
 
std::vector< double > CalcdEdxFromdQdx (std::vector< double > dqdx, para_all &paras)
 
std::vector< double > CalcdQdxShower (const art::Ptr< recob::Shower > &shower, const std::vector< art::Ptr< recob::Cluster >> &clusters, std::map< art::Ptr< recob::Cluster >, std::vector< art::Ptr< recob::Hit >> > &clusterToHitMap, int plane, double triggeroffset, detinfo::DetectorPropertiesData const &theDetector, para_all &paras)
 
std::vector< double > getPitch (TVector3 shower_dir, para_all &paras)
 
double getMeanHitWidthPlane (std::vector< art::Ptr< recob::Hit >> hits, int this_plane)
 
int getNHitsPlane (std::vector< art::Ptr< recob::Hit >> hits, int this_plane)
 
double triangle_area (double a1, double a2, double b1, double b2, double c1, double c2)
 
int quick_delaunay_fit (int n, double *X, double *Y, int *num_triangles, double *area)
 
int delaunay_hit_wrapper (const std::vector< art::Ptr< recob::Hit >> &hits, std::vector< int > &num_hits, std::vector< int > &num_triangles, std::vector< double > &area, para_all &paras)
 
void RecoMCTracks (std::vector< PandoraPFParticle > all_PPFPs, const std::vector< art::Ptr< recob::Track >> &tracks, std::map< art::Ptr< recob::Track >, art::Ptr< simb::MCParticle > > &trackToMCParticleMap, std::map< art::Ptr< simb::MCParticle >, art::Ptr< simb::MCTruth >> &MCParticleToMCTruthMap, std::vector< art::Ptr< simb::MCParticle >> &mcParticleVector, std::map< int, art::Ptr< simb::MCParticle > > &MCParticleToTrackIdMap, std::vector< double > &vfrac, var_all &vars)
 
void showerRecoMCmatching (std::vector< PandoraPFParticle > all_PPFPs, std::vector< art::Ptr< recob::Shower >> &showerVector, std::map< art::Ptr< recob::Shower >, art::Ptr< simb::MCParticle >> &showerToMCParticleMap, art::FindManyP< simb::MCParticle, anab::BackTrackerHitMatchingData > &mcparticles_per_hit, std::vector< art::Ptr< simb::MCParticle >> &mcParticleVector, std::map< int, art::Ptr< simb::MCParticle > > &MCParticleToTrackIdMap, var_all &vars)
 
std::vector< double > trackRecoMCmatching (std::vector< art::Ptr< recob::Track >> &objectVector, std::map< art::Ptr< recob::Track >, art::Ptr< simb::MCParticle >> &objectToMCParticleMap, std::map< art::Ptr< recob::Track >, art::Ptr< recob::PFParticle >> &objectToPFParticleMap, std::map< art::Ptr< recob::PFParticle >, std::vector< art::Ptr< recob::Hit >> > &pfParticleToHitsMap, art::FindManyP< simb::MCParticle, anab::BackTrackerHitMatchingData > &mcparticles_per_hit, std::vector< art::Ptr< simb::MCParticle >> &mcParticleVector, var_all &vars)
 
int photoNuclearTesting (std::vector< art::Ptr< simb::MCParticle >> &mcParticleVector)
 
TGraph * GetNearestNpts (int p, int cl, std::vector< art::Ptr< recob::Hit >> &hitz, double vertex_wire, double vertex_tick, int Npts)
 
sss_score ScoreCluster (int p, int cl, std::vector< art::Ptr< recob::Hit >> &hits, double vertex_wire, double vertex_tick, const art::Ptr< recob::Shower > &shower)
 
int CompareToShowers (int p, int cl, std::vector< art::Ptr< recob::Hit >> &hitz, double vertex_wire, double vertex_tick, const std::vector< art::Ptr< recob::Shower >> &showers, std::map< art::Ptr< recob::Shower >, art::Ptr< recob::PFParticle >> &showerToPFParticleMap, const std::map< art::Ptr< recob::PFParticle >, std::vector< art::Ptr< recob::Hit >> > &pfParticleToHitsMap, double eps)
 
std::vector< double > SecondShowerMatching (std::vector< art::Ptr< recob::Hit >> &hitz, art::FindManyP< simb::MCParticle, anab::BackTrackerHitMatchingData > &mcparticles_per_hit, std::vector< art::Ptr< simb::MCParticle >> &mcParticleVector, std::map< int, art::Ptr< simb::MCParticle >> &MCParticleToTrackIdMap, var_all &vars)
 
void SecondShowerSearch3D (std::vector< art::Ptr< recob::Shower >> &showers, std::map< art::Ptr< recob::Shower >, art::Ptr< recob::PFParticle >> &NormalShowerToPFParticleMap, std::vector< art::Ptr< recob::Track >> &tracks, std::map< art::Ptr< recob::Track >, art::Ptr< recob::PFParticle >> &NormalTrackToPFParticleMap, art::Event const &evt, var_all &vars, para_all &paras)
 
void SimpleSecondShowerCluster (var_all &vars, para_all &paras)
 
std::pair< bool, std::vector
< double > > 
clusterCandidateOverlap (const std::vector< int > &candidate_indices, const std::vector< int > &cluster_planes, const std::vector< double > &cluster_max_ticks, const std::vector< double > &cluster_min_ticks)
 
std::pair< int, std::pair
< std::vector< std::vector
< double > >, std::vector
< double > > > 
GroupClusterCandidate (int num_clusters, const std::vector< int > &cluster_planes, const std::vector< double > &cluster_max_ticks, const std::vector< double > &cluster_min_ticks)
 
void IsolationStudy (std::vector< PandoraPFParticle > all_PPFPs, const std::vector< art::Ptr< recob::Track >> &tracks, const std::vector< art::Ptr< recob::Shower >> &showers, detinfo::DetectorPropertiesData const &theDetector, var_all &vars, para_all &paras)
 
bool map_max_fn (const std::pair< art::Ptr< recob::Hit >, double > p1, const std::pair< art::Ptr< recob::Hit >, double > p2)
 
bool map_min_fn (const std::pair< art::Ptr< recob::Hit >, double > p1, const std::pair< art::Ptr< recob::Hit >, double > p2)
 

Variables

bool g_is_verbose = true
 
static const double kINVALID_FLOAT = std::numeric_limits<double>::max()
 

Typedef Documentation

typedef art::ValidHandle< std::vector<recob::PFParticle> > single_photon::PFParticleHandle

Definition at line 40 of file variables.h.

typedef std::map< size_t, art::Ptr<recob::PFParticle> > single_photon::PFParticleIdMap

Definition at line 44 of file variables.h.

typedef std::vector< art::Ptr<recob::PFParticle> > single_photon::PFParticleVector

Definition at line 41 of file variables.h.

typedef std::vector< art::Ptr<recob::Shower> > single_photon::ShowerVector

Definition at line 43 of file variables.h.

typedef std::vector< art::Ptr<recob::Track> > single_photon::TrackVector

Definition at line 42 of file variables.h.

Function Documentation

void single_photon::AnalyzeEventWeight ( art::Event const &  e)

: fill event weight related variables

void single_photon::AnalyzeEventWeight ( art::Event const &  e,
var_all &  vars 
)

Definition at line 60 of file analyze_MC.cxx.

60  {
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  }
do i e
BEGIN_PROLOG SN nu
BEGIN_PROLOG could also be cout
void single_photon::AnalyzeFlashes ( const std::vector< art::Ptr< recob::OpFlash >> &  flashes,
art::Handle< std::vector< sbn::crt::CRTHit >>  crthit_h,
double  evt_timeGPS_nsec,
std::map< art::Ptr< recob::OpFlash >, std::vector< art::Ptr< sbn::crt::CRTHit >>>  crtvetoToFlashMap,
var_all &  vars,
para_all &  paras 
)

Definition at line 732 of file analyze_PandoraReco.cxx.

733  {
734 
735 
736  for(auto pair: crtvetoToFlashMap){
737  std::cout<<"for flash at time "<< pair.first->Time()<<" has "<< pair.second.size() << " associated CRT hits "<<std::endl;
738  if(pair.second.size() > 0){
739  for (auto hit: pair.second){
740  std::cout<<"---- associated CRT hit at time "<<hit->ts0_ns/1000. <<" with PE "<<hit->peshit<<std::endl;
741  vars.m_CRT_veto_hit_PE.push_back(hit->peshit);
742  }
743 
744  }
745  vars.m_CRT_veto_nhits = pair.second.size();//save the number of associated CRT veto hits
746  }
747 
748 
749  if(g_is_verbose) std::cout<<"AnalyzeFlashes()\t||\t Beginning analysis of recob::OpFlash\n";
750 
751  size_t flash_size = flashes.size();
752  for(size_t i = 0; i < flash_size; ++i) {
753 
754  art::Ptr<recob::OpFlash> const & flash = flashes[i];
755 
756  vars.m_reco_flash_total_pe[i]=(flash->TotalPE());
757  vars.m_reco_flash_time[i]=(flash->Time());
758  vars.m_reco_flash_time_width[i]=flash->TimeWidth();
759  vars.m_reco_flash_abs_time[i]=flash->AbsTime();
760  vars.m_reco_flash_frame[i]=flash->Frame();
761  vars.m_reco_flash_ycenter[i]=flash->YCenter();
762  vars.m_reco_flash_ywidth[i]=flash->YWidth();
763  vars.m_reco_flash_zcenter[i]=flash->ZCenter();
764  vars.m_reco_flash_zwidth[i]=flash->ZWidth();
765 
766  // paras.s_beamgate_flash_end/paras.s_beamgate_flash_start are read from pset
767  if(vars.m_reco_flash_time[i] <= paras.s_beamgate_flash_end && vars.m_reco_flash_time[i] >= paras.s_beamgate_flash_start){
768  vars.m_reco_num_flashes_in_beamgate++;
769  vars.m_reco_flash_total_pe_in_beamgate[i]=(flash->TotalPE());
770  vars.m_reco_flash_time_in_beamgate[i]=(flash->Time());
771  vars.m_reco_flash_ycenter_in_beamgate[i] = flash->YCenter();
772  vars.m_reco_flash_zcenter_in_beamgate[i] = flash->ZCenter();
773  }
774 
775  }
776 
777  if(g_is_verbose) std::cout<<"AnalyzeFlashes()\t||\t Finished. There was "<<flash_size<<" flashes with: "<<vars.m_reco_num_flashes_in_beamgate<<" in the beamgate defined by: "<<paras.s_beamgate_flash_start<<" <-> "<<paras.s_beamgate_flash_end<<std::endl;
778 
779  //fill these values only for events that have CRT information - run3 G and later
780  //code taken from ubcrt/UBCRTCosmicFilter/UBCRTCosmicFilter_module.cc
781  if(paras.s_runCRT){
782  if (vars.m_reco_num_flashes_in_beamgate == 1){ //fill only if there's a flash in the beamgate
783 
784  int _nCRThits_in_event = crthit_h->size();
785 
786  double _dt_abs = 100000.0;
787  // double _within_resolution = 0;
788  double _beam_flash_time = vars.m_reco_flash_time_in_beamgate[0]; // Guanqun: why use index 0?
789 
790  // Loop over the CRT hits.
791  for (int j = 0; j < _nCRThits_in_event; j++)
792  {
793  /*
794  if (verbose)
795  std::cout << "\t Time of the CRT Hit wrt the event timestamp = " << ((crthit_h->at(j).ts0_ns - evt_timeGPS_nsec + fDTOffset) / 1000.) << " us." << std::endl;
796  */
797  double _crt_time_temp = ((crthit_h->at(j).ts0_ns - evt_timeGPS_nsec + paras.s_DTOffset) / 1000.);
798 
799  // Fill the vector variables.
800  vars.m_CRT_hits_time.push_back(_crt_time_temp);
801  vars.m_CRT_hits_PE.push_back(crthit_h->at(j).peshit);
802  vars.m_CRT_hits_x.push_back(crthit_h->at(j).x_pos);
803  vars.m_CRT_hits_y.push_back(crthit_h->at(j).y_pos);
804  vars.m_CRT_hits_z.push_back(crthit_h->at(j).z_pos);
805 
806  if (fabs(_beam_flash_time - _crt_time_temp) < _dt_abs)
807  {
808  _dt_abs = fabs(_beam_flash_time - _crt_time_temp);
809  vars.m_CRT_dt = _beam_flash_time - _crt_time_temp;
810  vars.m_CRT_min_hit_time = _crt_time_temp;
811  // set 'within_resolution' to 'true' and break the loop if 'closest_crt_diff' is less than fResolution.
812  if (_dt_abs < paras.s_Resolution)
813  {
814  //_within_resolution = 1;
815  // Set the position information and the intensity of the CRT hit.
816  vars.m_CRT_min_hit_PE = crthit_h->at(j).peshit;
817  vars.m_CRT_min_hit_x = crthit_h->at(j).x_pos;
818  vars.m_CRT_min_hit_y = crthit_h->at(j).y_pos;
819  vars.m_CRT_min_hit_z = crthit_h->at(j).z_pos;
820 
821 
822  // if (verbose)
823  // {
824  std::cout << "CRT hit PE = " << vars.m_CRT_min_hit_PE << " PEs." << std::endl;
825  std::cout << "CRT hit x = " << vars.m_CRT_min_hit_x << " cm." << std::endl;
826  std::cout << "CRT hit y = " << vars.m_CRT_min_hit_y << " cm." << std::endl;
827  std::cout << "CRT hit z = " << vars.m_CRT_min_hit_z << " cm." << std::endl;
828  // }
829  break;
830  }
831  } // End of conditional for closest CRT hit time.
832  } // End of loop over CRT hits.
833  } //if there is 1 flash in beamgate
834  }//if runCRT
835  }//analyze flashes
process_name hit
Definition: cheaterreco.fcl:51
BEGIN_PROLOG could also be cout
void single_photon::AnalyzeGeant4 ( const std::vector< art::Ptr< simb::MCParticle >> &  mcParticleVector,
var_all &  vars 
)

Definition at line 11 of file analyze_MC.cxx.

11  {
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  }
std::vector< int > Printer_header(std::vector< std::string > headings)
void Printer_content(std::vector< std::string > nums, std::vector< int > spacers)
std::string to_string(WindowPattern const &pattern)
void single_photon::AnalyzeMCTruths ( std::vector< art::Ptr< simb::MCTruth >> &  mcTruthVector,
std::vector< art::Ptr< simb::MCParticle >> &  mcParticleVector,
var_all &  vars,
para_all &  paras 
)

Definition at line 378 of file analyze_MC.cxx.

378  {
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];
438  vars.m_mctruth_reco_vertex_dist = sqrt(pow (vars.m_mctruth_nu_vertex_x-vars.m_vertex_pos_x,2)+pow (vars.m_mctruth_nu_vertex_y-vars.m_vertex_pos_y,2)+pow (vars.m_mctruth_nu_vertex_z-vars.m_vertex_pos_z,2));
439 
440  //std::vector<int> spacers = Printer_header({"NuPdg","CC=0","TruthVertex(x,"," y, ",", z )"});
442  {std::to_string(vars.m_mctruth_nu_pdg),
443  std::to_string(vars.m_mctruth_ccnc),
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 
468  vars.m_mctruth_leading_exiting_proton_energy = -9999;
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){
499  vars.m_mctruth_num_exiting_photons++;
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 ++;
516  vars.m_mctruth_is_delta_radiative++;
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());
530  vars.m_mctruth_num_exiting_pi0++;
531  }
532  break;
533  }
534  case(211):
535  case(-211): // it's pi+ or pi-
536  if (par.StatusCode() == 1) {
537  vars.m_mctruth_num_exiting_pipm++;
538  }
539  break;
540  case(2212): // if it's a proton
541  {
542  if(par.StatusCode() == 1){
543  vars.m_mctruth_num_exiting_protons++;
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){
606  vars.m_mctruth_num_exiting_delta0++;
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++){
628  if( vars.m_mctruth_exiting_proton_energy[p] > vars.m_mctruth_leading_exiting_proton_energy ){
629  vars.m_mctruth_leading_exiting_proton_energy = vars.m_mctruth_exiting_proton_energy[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){
637  vars.m_mctruth_delta_radiative_1g1p_or_1g1n = 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){
640  vars.m_mctruth_delta_radiative_1g1p_or_1g1n = 0;
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!
647  vars.m_mctruth_exiting_photon_from_delta_decay.resize(vars.m_mctruth_num_exiting_photons,0);
648  vars.m_mctruth_exiting_proton_from_delta_decay.resize(vars.m_mctruth_num_exiting_protons,0);
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
665  if ( vars.m_mctruth_exiting_photon_energy[p] > paras.s_exiting_photon_energy_threshold){
666  vars.m_mctruth_num_reconstructable_protons++;
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;
678  if ( vars.m_mctruth_exiting_photon_energy[p] > paras.s_exiting_photon_energy_threshold){
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++){
684  if ( vars.m_mctruth_exiting_proton_energy[pr]> paras.s_exiting_proton_energy_threshold){
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){
688  vars.m_mctruth_is_reconstructable_1g1p = 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){
692  vars.m_mctruth_is_reconstructable_1g1p = true;
693  vars.m_mctruth_is_reconstructable_1g0p = 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;
720  vars.m_mctruth_exiting_photon_from_delta_decay[p] = 1;
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;
743  vars.m_mctruth_exiting_proton_from_delta_decay[p] = 1;
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){
816  vars.m_mctruth_pi0_leading_photon_energy = e1;
817  vars.m_mctruth_pi0_subleading_photon_energy = e2;
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!
825  vars.m_mctruth_pi0_leading_photon_exiting_TPC =exit1;
826  vars.m_mctruth_pi0_subleading_photon_exiting_TPC = exit2;
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{
831  vars.m_mctruth_pi0_leading_photon_energy = e2;
832  vars.m_mctruth_pi0_subleading_photon_energy = e1;
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;
839  vars.m_mctruth_pi0_leading_photon_exiting_TPC = exit2;
840  vars.m_mctruth_pi0_subleading_photon_exiting_TPC = exit1;
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
pdgs p
Definition: selectors.fcl:22
std::vector< int > Printer_header(std::vector< std::string > headings)
bool isInTPCActive(std::vector< double > &vec, para_all &paras)
int spacecharge_correction(const art::Ptr< simb::MCParticle > &mcparticle, std::vector< double > &corrected, std::vector< double > &input)
Definition: Processors.cxx:25
void Printer_content(std::vector< std::string > nums, std::vector< int > spacers)
std::string to_string(WindowPattern const &pattern)
pdgs k
Definition: selectors.fcl:22
physics pm2 e1
physics associatedGroupsWithLeft p1
BEGIN_PROLOG could also be cout
void single_photon::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 at line 253 of file analyze_MC.cxx.

259  {
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);
293  vars.m_matched_signal_shower_overlay_fraction.push_back(vars.m_sim_shower_overlay_fraction[j]);
294  //vars.m_matched_signal_shower_conversion_length;
295  vars.m_matched_signal_shower_true_E.push_back(vars.m_sim_shower_energy[j]);
296  vars.m_matched_signal_shower_nuscore.push_back( vars.m_reco_shower_nuscore[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 
303  vars.m_matched_signal_shower_is_clearcosmic.push_back( vars.m_reco_shower_isclearcosmic[j]);
304  vars.m_matched_signal_shower_is_nuslice.push_back(vars.m_reco_shower_is_nuslice[j]);
305  // num track/shower in slice here is in reverse order
306  vars.m_matched_signal_shower_tracks_in_slice.push_back( vars.m_reco_slice_num_showers[id]);
307  vars.m_matched_signal_shower_showers_in_slice.push_back(vars.m_reco_slice_num_tracks[id]);
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 
315  vars.m_matched_signal_shower_num = vars.m_matched_signal_shower_true_E.size();
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]);
336  vars.m_matched_signal_track_nuscore.push_back( vars.m_reco_track_nuscore[k]);
337  vars.m_matched_signal_track_sliceId.push_back(vars.m_reco_track_sliceId[k]);
338  vars.m_matched_signal_track_is_clearcosmic.push_back( vars.m_reco_track_isclearcosmic[k]);
339  vars.m_matched_signal_track_is_nuslice.push_back(vars.m_reco_track_is_nuslice[k]);
340 
341  int id = vars.m_reco_track_sliceId[k];
342  vars.m_matched_signal_track_tracks_in_slice.push_back(vars.m_reco_slice_num_tracks[ id]);
343  vars.m_matched_signal_track_showers_in_slice.push_back(vars.m_reco_slice_num_showers[ id]);
344 
345  }
346 
347  }//if matched
348  }//if proton from neutrino interaction
349  }//for all sim tracks
350  vars.m_matched_signal_track_num = vars.m_matched_signal_track_true_E.size();
351  }//end of "ncdelta" scenario
352 
353  //brief summary
354  if (vars.m_matched_signal_shower_num > 1) vars.m_multiple_matched_showers = true;
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;
362  if ( vars.m_matched_signal_track_sliceId[0] == vars.m_matched_signal_shower_sliceId[0]){
363  vars.m_reco_1g1p_is_same_slice = true;
364  vars.m_reco_1g1p_is_nuslice = vars.m_matched_signal_shower_is_nuslice[0];
365  vars.m_reco_1g1p_nuscore = vars.m_matched_signal_shower_nuscore[0];
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
370  vars.m_reco_1g0p_is_nuslice = vars.m_matched_signal_shower_is_nuslice[0];
371  vars.m_reco_1g0p_nuscore = vars.m_matched_signal_shower_nuscore[0];
372  vars.m_is_matched_1g0p = true;
373 
374  }
375  }//findslice
var pdg
Definition: selectors.fcl:14
pdgs k
Definition: selectors.fcl:22
BEGIN_PROLOG could also be cout
void single_photon::AnalyzeShowers ( std::vector< PandoraPFParticle >  all_PPFPs,
const std::vector< art::Ptr< recob::Shower >> &  showers,
std::map< art::Ptr< recob::Cluster >, std::vector< art::Ptr< recob::Hit >> > &  clusterToHitMap,
double  triggeroffset,
detinfo::DetectorPropertiesData const &  theDetector,
var_all &  vars,
para_all &  paras 
)

Definition at line 841 of file analyze_PandoraReco.cxx.

848  {
849  // if(g_is_verbose) std::cout<<"AnalyzeShowers()\t||\t Begininning recob::Shower analysis suite"<<std::endl;;
850 
851  int i_shr = 0;
852 
853  std::vector<int> spacers = Printer_header({"Slice"," pfpID"," Start(x, "," y, "," z )"," trackscore"," pdg"});
854  for (ShowerVector::const_iterator iter = showers.begin(), iterEnd = showers.end(); iter != iterEnd; ++iter)
855  {
856 
857 
858  const art::Ptr<recob::Shower> shower = *iter;
859  // const art::Ptr<recob::PFParticle> pfp = showerToPFParticleMap[shower];
860  PandoraPFParticle* ppfp = PPFP_GetPPFPFromShower(all_PPFPs, shower);
861 
862  const art::Ptr<recob::PFParticle> pfp = ppfp->pPFParticle;
863 
864  art::Ptr<recob::Shower> shower3d;
865  vars.m_reco_shower3d_exists[i_shr] = 0;
866  shower3d = shower;
867 
868  const std::vector<art::Ptr<recob::Hit>> hits = ppfp->pPFPHits;
869  const std::vector<art::Ptr<recob::Cluster>> clusters = ppfp->pClusters;
870 
871  //int vars.m_shrid = shower->ID(); This is an used variable, always -999
872  double tem_length = shower->Length();
873  double tem_open_angle = shower->OpenAngle();
874 
875  TVector3 shr_start = shower->ShowerStart();
876  TVector3 shr_dir = shower->Direction();
877 
878  TVector3 shr3d_start = shower3d->ShowerStart();
879  TVector3 shr3d_dir = shower3d->Direction();
880 
881  // if(g_is_verbose) std::cout<<"AnalyzeShowers()\t||\t On Shower: "<<i_shr<<" which has length: "<<tem_length<<""<<std::endl;;
882 
883  vars.m_reco_shower_startx[i_shr] = shr_start.X();
884  vars.m_reco_shower_starty[i_shr] = shr_start.Y();
885  vars.m_reco_shower_startz[i_shr] = shr_start.Z();
886 
887 
888  std::vector<double> hstart = {vars.m_reco_shower_startx[i_shr],vars.m_reco_shower_starty[i_shr],vars.m_reco_shower_startz[i_shr]};
889  vars.m_reco_shower_start_dist_to_active_TPC[i_shr] = distToTPCActive(hstart, paras);
890  vars.m_reco_shower_start_dist_to_CPA[i_shr] = distToCPA(hstart, paras);
891  vars.m_reco_shower_start_in_SCB[i_shr] = distToSCB(vars.m_reco_shower_start_dist_to_SCB[i_shr],hstart, paras);
892 
893  vars.m_reco_shower_dirx[i_shr] = shr_dir.X();
894  vars.m_reco_shower_diry[i_shr] = shr_dir.Y();
895  vars.m_reco_shower_dirz[i_shr] = shr_dir.Z();
896  vars.m_reco_shower_length[i_shr] = tem_length;
897  vars.m_reco_shower_openingangle[i_shr] = tem_open_angle;
898 
899  vars.m_reco_shower3d_startx[i_shr] = shr3d_start.X();
900  vars.m_reco_shower3d_starty[i_shr] = shr3d_start.Y();
901  vars.m_reco_shower3d_startz[i_shr] = shr3d_start.Z();
902  vars.m_reco_shower3d_dirx[i_shr] = shr3d_dir.X();
903  vars.m_reco_shower3d_diry[i_shr] = shr3d_dir.Y();
904  vars.m_reco_shower3d_dirz[i_shr] = shr3d_dir.Z();
905  vars.m_reco_shower3d_length[i_shr] = shower3d->Length();
906  vars.m_reco_shower3d_openingangle[i_shr] = shower3d->OpenAngle();
907 
908 
909  vars.m_reco_shower_conversion_distance[i_shr] = sqrt( pow(shr_start.X()-vars.m_vertex_pos_x,2)+pow(shr_start.Y()-vars.m_vertex_pos_y,2)+ pow(shr_start.Z()-vars.m_vertex_pos_z,2) );
910  vars.m_reco_shower3d_conversion_distance[i_shr] = sqrt( pow(shr3d_start.X()-vars.m_vertex_pos_x,2)+pow(shr3d_start.Y()-vars.m_vertex_pos_y,2)+ pow(shr3d_start.Z()-vars.m_vertex_pos_z,2) );
911 
912  //pandroa shower
913  std::vector<double> shr_ts = {shr_start.X(), shr_start.Y(), shr_start.Z()};
914  std::vector<double> shr_te = {shr_start.X()-shr_dir.X(),shr_start.Y()-shr_dir.Y(),shr_start.Z()-shr_dir.Z()};
915  std::vector<double> shr_tv = {vars.m_vertex_pos_x,vars.m_vertex_pos_y,vars.m_vertex_pos_z};
916 
917  vars.m_reco_shower_impact_parameter[i_shr] = dist_line_point(shr_ts,shr_te,shr_tv );
918  vars.m_reco_shower_implied_dirx[i_shr] = shr_start.X()-vars.m_vertex_pos_x;;
919  vars.m_reco_shower_implied_diry[i_shr] = shr_start.Y()-vars.m_vertex_pos_y;
920  vars.m_reco_shower_implied_dirz[i_shr] = shr_start.Z()-vars.m_vertex_pos_z;
921 
922  double norm = sqrt(pow(vars.m_reco_shower_implied_dirx[i_shr],2)+pow(vars.m_reco_shower_implied_diry[i_shr],2)+pow(vars.m_reco_shower_implied_dirz[i_shr],2));
923  vars.m_reco_shower_implied_dirx[i_shr] = vars.m_reco_shower_implied_dirx[i_shr]/norm;
924  vars.m_reco_shower_implied_diry[i_shr] = vars.m_reco_shower_implied_diry[i_shr]/norm;
925  vars.m_reco_shower_implied_dirz[i_shr] = vars.m_reco_shower_implied_dirz[i_shr]/norm;
926 
927  //now 3D shower
928  std::vector<double> shr3d_ts = {shr3d_start.X(), shr3d_start.Y(), shr3d_start.Z()};
929  std::vector<double> shr3d_te = {shr3d_start.X()-shr3d_dir.X(),shr3d_start.Y()-shr3d_dir.Y(),shr3d_start.Z()-shr3d_dir.Z()};
930  std::vector<double> shr3d_tv = {vars.m_vertex_pos_x,vars.m_vertex_pos_y,vars.m_vertex_pos_z};
931 
932  vars.m_reco_shower3d_impact_parameter[i_shr] = dist_line_point(shr3d_ts,shr3d_te,shr3d_tv );
933  vars.m_reco_shower3d_implied_dirx[i_shr] = shr3d_start.X()-vars.m_vertex_pos_x;;
934  vars.m_reco_shower3d_implied_diry[i_shr] = shr3d_start.Y()-vars.m_vertex_pos_y;
935  vars.m_reco_shower3d_implied_dirz[i_shr] = shr3d_start.Z()-vars.m_vertex_pos_z;
936 
937  double shr3d_norm = sqrt(pow(vars.m_reco_shower3d_implied_dirx[i_shr],2)+pow(vars.m_reco_shower3d_implied_diry[i_shr],2)+pow(vars.m_reco_shower3d_implied_dirz[i_shr],2));
938  vars.m_reco_shower3d_implied_dirx[i_shr] = vars.m_reco_shower3d_implied_dirx[i_shr]/shr3d_norm;
939  vars.m_reco_shower3d_implied_diry[i_shr] = vars.m_reco_shower3d_implied_diry[i_shr]/shr3d_norm;
940  vars.m_reco_shower3d_implied_dirz[i_shr] = vars.m_reco_shower3d_implied_dirz[i_shr]/shr3d_norm;
941 
942 
943  vars.m_reco_shower_theta_yz[i_shr] = atan2(vars.m_reco_shower_diry[i_shr],vars.m_reco_shower_dirz[i_shr]);
944  vars.m_reco_shower_phi_yx[i_shr] = atan2(vars.m_reco_shower_diry[i_shr],vars.m_reco_shower_dirx[i_shr]);
945 
946  vars.m_reco_shower3d_theta_yz[i_shr] = atan2(vars.m_reco_shower3d_diry[i_shr],vars.m_reco_shower3d_dirz[i_shr]);
947  vars.m_reco_shower3d_phi_yx[i_shr] = atan2(vars.m_reco_shower3d_diry[i_shr],vars.m_reco_shower3d_dirx[i_shr]);
948 
949 
950  // vars.m_reco_shower_start_to_nearest_dead_wire_plane0[i_shr] = distanceToNearestDeadWire(0, vars.m_reco_shower_starty[i_shr], vars.m_reco_shower_startz[i_shr],geom, bad_channel_list_fixed_mcc9);
951  // vars.m_reco_shower_start_to_nearest_dead_wire_plane1[i_shr] = distanceToNearestDeadWire(1, vars.m_reco_shower_starty[i_shr], vars.m_reco_shower_startz[i_shr],geom, bad_channel_list_fixed_mcc9);
952  // vars.m_reco_shower_start_to_nearest_dead_wire_plane2[i_shr] = distanceToNearestDeadWire(2, vars.m_reco_shower_starty[i_shr], vars.m_reco_shower_startz[i_shr],geom, bad_channel_list_fixed_mcc9);
953  std::vector<int> t_num(3,0); // num of triangles on each plane
954  std::vector<int> t_numhits(3,0); // num of hits on each plane
955  std::vector<double> t_area(3,0.0);
956 
957  //Right, this basically loops over all hits in all planes and for each plane forms the Delaunay triangilization of it and calculates the 2D area inscribed by the convex hull
958  // if(g_is_verbose) std::cout<<"AnalyzeShowers()\t||\t Starting Delaunay Triangleization"<<std::endl;;
959 
960  //auto start = std::chrono::high_resolution_clock::now();
961  delaunay_hit_wrapper(hits, t_numhits, t_num, t_area, paras);
962 
963  //auto finish = std::chrono::high_resolution_clock::now();
964  //auto microseconds = std::chrono::duration_cast<std::chrono::milliseconds>(finish-start);
965  //if(g_is_verbose) std::cout<<"AnalyzeShowers()\t||\t Finished Delaunay Triangleization. It took "<< microseconds.count() << "ms and found "<<t_num[0]+t_num[1]+t_num[2]<<" triangles"<<std::endl;;
966 
967  vars.m_reco_shower_delaunay_num_triangles_plane0[i_shr] = t_num[0];
968  vars.m_reco_shower_delaunay_num_triangles_plane1[i_shr] = t_num[1];
969  vars.m_reco_shower_delaunay_num_triangles_plane2[i_shr] = t_num[2];
970 
971  vars.m_reco_shower_delaunay_area_plane0[i_shr] = t_area[0];
972  vars.m_reco_shower_delaunay_area_plane1[i_shr] = t_area[1];
973  vars.m_reco_shower_delaunay_area_plane2[i_shr] = t_area[2];
974 
975  vars.m_reco_shower_num_hits_plane0[i_shr] = t_numhits[0];
976  vars.m_reco_shower_num_hits_plane1[i_shr] = t_numhits[1];
977  vars.m_reco_shower_num_hits_plane2[i_shr] = t_numhits[2];
978  //-------------- Calorimetry 3D --------------------
979 
980 
981  const std::vector< double > shr3d_energy = shower3d->Energy();
982  const std::vector< double > shr3d_dEdx = shower3d->dEdx();
983  //const int shr3d_bestplane = shower3d->best_plane();
984 
985  // std::cout<<"SHOWER3D_ENERGY: best plane: "<<shr3d_bestplane<<std::endl;
986  //for(auto &en:shr3d_energy){
987  // std::cout<<en<<" ";
988  //}
989  if(shr3d_energy.size()==3){
990  vars.m_reco_shower3d_energy_plane0[i_shr] = shr3d_energy[0];
991  vars.m_reco_shower3d_energy_plane1[i_shr] = shr3d_energy[1];
992  vars.m_reco_shower3d_energy_plane2[i_shr] = shr3d_energy[2];
993  }else{
994  vars.m_reco_shower3d_energy_plane0[i_shr] =-99;
995  vars.m_reco_shower3d_energy_plane1[i_shr] =-99;
996  vars.m_reco_shower3d_energy_plane2[i_shr] =-999;
997  }
998 
999  // std::cout<<std::endl<<"SHOWER3D_DEDX: "<<std::endl;
1000  //for(auto &dedx: shr3d_dEdx){
1001  // std::cout<<dedx<<" ";
1002  //}
1003  if(shr3d_dEdx.size()==3){
1004  vars.m_reco_shower3d_dEdx_plane0[i_shr] = shr3d_dEdx[0];
1005  vars.m_reco_shower3d_dEdx_plane1[i_shr] = shr3d_dEdx[1];
1006  vars.m_reco_shower3d_dEdx_plane2[i_shr] = shr3d_dEdx[2];
1007  }else{
1008  vars.m_reco_shower3d_dEdx_plane0[i_shr] =-99;
1009  vars.m_reco_shower3d_dEdx_plane1[i_shr] =-99;
1010  vars.m_reco_shower3d_dEdx_plane2[i_shr] =-999;
1011  }
1012 
1013 
1014  //------------- calorimetry ------------
1015  vars.m_reco_shower_energy_plane0[i_shr] = CalcEShowerPlane(hits, 0, paras);
1016  vars.m_reco_shower_energy_plane1[i_shr] = CalcEShowerPlane(hits, 1, paras);
1017  vars.m_reco_shower_energy_plane2[i_shr] = CalcEShowerPlane(hits, 2, paras);
1018 
1019  vars.m_reco_shower_energy_max[i_shr] = std::max( vars.m_reco_shower_energy_plane0[i_shr], std::max( vars.m_reco_shower_energy_plane1[i_shr] , vars.m_reco_shower_energy_plane2[i_shr]));
1020 
1021  vars.m_reco_shower_plane0_nhits[i_shr] = getNHitsPlane(hits, 0);
1022  vars.m_reco_shower_plane1_nhits[i_shr] = getNHitsPlane(hits, 1);
1023  vars.m_reco_shower_plane2_nhits[i_shr] = getNHitsPlane(hits, 2);
1024 
1025  vars.m_reco_shower_plane0_meanRMS[i_shr] = getMeanHitWidthPlane(hits, 0);
1026  vars.m_reco_shower_plane1_meanRMS[i_shr] = getMeanHitWidthPlane(hits, 1);
1027  vars.m_reco_shower_plane2_meanRMS[i_shr] = getMeanHitWidthPlane(hits, 2);
1028 
1029 
1030  //currently only run on 1 shower events
1031  if(showers.size()==1){
1032  for(auto &h: hits){
1033 
1034  int plane= h->View();
1035  int wire = h->WireID().Wire;
1036  int tick = h->PeakTime();
1037 
1038  vars.m_reco_shower_hit_tick.push_back(tick);
1039  vars.m_reco_shower_hit_plane.push_back(plane);
1040  vars.m_reco_shower_hit_wire.push_back(wire);
1041  }
1042  }
1043 
1044 
1045  //std::cout<<"The energy on each plane is 0: "<< vars.m_reco_shower_energy_plane0[i_shr]<<", 1: "<< vars.m_reco_shower_energy_plane1[i_shr]<<", 2: "<< vars.m_reco_shower_energy_plane2[i_shr]<<std::endl;
1046 
1047 
1048  vars.m_reco_shower_dQdx_plane0[i_shr] = CalcdQdxShower(shower,clusters, clusterToHitMap, 0 , triggeroffset, theDetector, paras);
1049  vars.m_reco_shower_dQdx_plane1[i_shr] = CalcdQdxShower(shower,clusters, clusterToHitMap, 1 , triggeroffset, theDetector, paras);
1050  vars.m_reco_shower_dQdx_plane2[i_shr] = CalcdQdxShower(shower,clusters, clusterToHitMap, 2 , triggeroffset, theDetector, paras);
1051  vars.m_reco_shower_dEdx_plane0[i_shr] = CalcdEdxFromdQdx(vars.m_reco_shower_dQdx_plane0[i_shr], paras);
1052  vars.m_reco_shower_dEdx_plane1[i_shr] = CalcdEdxFromdQdx(vars.m_reco_shower_dQdx_plane1[i_shr], paras);
1053 
1054  vars.m_reco_shower_dEdx_plane2[i_shr] = CalcdEdxFromdQdx(vars.m_reco_shower_dQdx_plane2[i_shr], paras);
1055 
1056  vars.m_reco_shower_dEdx_plane0_median[i_shr] = getMedian(vars.m_reco_shower_dEdx_plane0[i_shr]);
1057  vars.m_reco_shower_dEdx_plane1_median[i_shr] = getMedian(vars.m_reco_shower_dEdx_plane1[i_shr]);
1058  vars.m_reco_shower_dEdx_plane2_median[i_shr] = getMedian(vars.m_reco_shower_dEdx_plane2[i_shr]);
1059 
1060 
1061  std::vector< double > reco_shr_angles_wrt_wires;
1062  for (geo::PlaneGeo const& plane: paras.s_geom->IteratePlanes()) {
1063  //6 planes in SBND
1064  //WireAngleToVertical : 30 ,150,90,150,30 ,90
1065  //ub wire angles : 30 ,150,90 (respected to beam,z)
1066  //Pitch : 0.3,0.3,0.3,0.3,0.3,0.3
1067 
1068  const double angToVert(paras.s_geom->WireAngleToVertical(plane.View(), plane.ID())+0.5*M_PI);//wire angle respected to z + pi/2
1069 
1070  TVector3 wire_vector;
1071  if(abs(angToVert) < 1e-9 ){
1072  wire_vector = {0,0,1};
1073  } else{
1074  wire_vector = { 0 , sin(angToVert) ,cos(angToVert) };
1075  }
1076 
1077  // std::cout<<" Angle "<<angToVert<<" Get Vec y="<<wire_vector[1]<< " z= "<<wire_vector[2]<<std::endl;
1078  reco_shr_angles_wrt_wires.push_back( abs(0.5*M_PI-acos(wire_vector.Dot(shr_dir))) );
1079 
1080  if(reco_shr_angles_wrt_wires.size()==3) break;
1081  }
1082  vars.m_reco_shower_angle_wrt_wires_plane0[i_shr] = reco_shr_angles_wrt_wires[0];
1083  vars.m_reco_shower_angle_wrt_wires_plane1[i_shr] = reco_shr_angles_wrt_wires[1];
1084  vars.m_reco_shower_angle_wrt_wires_plane2[i_shr] = reco_shr_angles_wrt_wires[2];
1085 
1086  vars.m_reco_shower_dQdx_plane0_median[i_shr] = getMedian(vars.m_reco_shower_dQdx_plane0[i_shr]);
1087  vars.m_reco_shower_dQdx_plane1_median[i_shr] = getMedian(vars.m_reco_shower_dQdx_plane1[i_shr]);
1088  vars.m_reco_shower_dQdx_plane2_median[i_shr] = getMedian(vars.m_reco_shower_dQdx_plane2[i_shr]);
1089 
1090 
1091 
1092  vars.m_reco_shower_dEdx_plane0_mean[i_shr] = std::accumulate(vars.m_reco_shower_dEdx_plane0[i_shr].begin(), vars.m_reco_shower_dEdx_plane0[i_shr].end(), 0.0)/((double)vars.m_reco_shower_dEdx_plane0[i_shr].size());
1093  vars.m_reco_shower_dEdx_plane1_mean[i_shr] = std::accumulate(vars.m_reco_shower_dEdx_plane1[i_shr].begin(), vars.m_reco_shower_dEdx_plane1[i_shr].end(), 0.0)/((double)vars.m_reco_shower_dEdx_plane1[i_shr].size());
1094  vars.m_reco_shower_dEdx_plane2_mean[i_shr] = std::accumulate(vars.m_reco_shower_dEdx_plane2[i_shr].begin(), vars.m_reco_shower_dEdx_plane2[i_shr].end(), 0.0)/((double)vars.m_reco_shower_dEdx_plane2[i_shr].size());
1095 
1096  auto maxp0 = std::max_element(vars.m_reco_shower_dEdx_plane0[i_shr].begin(), vars.m_reco_shower_dEdx_plane0[i_shr].end());
1097  auto maxp1 = std::max_element(vars.m_reco_shower_dEdx_plane1[i_shr].begin(), vars.m_reco_shower_dEdx_plane1[i_shr].end());
1098  auto maxp2 = std::max_element(vars.m_reco_shower_dEdx_plane2[i_shr].begin(), vars.m_reco_shower_dEdx_plane2[i_shr].end());
1099  auto minp0 = std::min_element(vars.m_reco_shower_dEdx_plane0[i_shr].begin(), vars.m_reco_shower_dEdx_plane0[i_shr].end());
1100  auto minp1 = std::min_element(vars.m_reco_shower_dEdx_plane1[i_shr].begin(), vars.m_reco_shower_dEdx_plane1[i_shr].end());
1101  auto minp2 = std::min_element(vars.m_reco_shower_dEdx_plane2[i_shr].begin(), vars.m_reco_shower_dEdx_plane2[i_shr].end());
1102 
1103 
1104  if(maxp0 == vars.m_reco_shower_dEdx_plane0[i_shr].end()){
1105  vars.m_reco_shower_dEdx_plane0_max[i_shr] = -999;
1106  }else{
1107  vars.m_reco_shower_dEdx_plane0_max[i_shr] = *maxp0;
1108  }
1109 
1110  if(maxp1 == vars.m_reco_shower_dEdx_plane1[i_shr].end()){
1111  vars.m_reco_shower_dEdx_plane1_max[i_shr] = -999;
1112  }else{
1113  vars.m_reco_shower_dEdx_plane1_max[i_shr] = *maxp1;
1114  }
1115 
1116  if(maxp2 == vars.m_reco_shower_dEdx_plane2[i_shr].end()){
1117  vars.m_reco_shower_dEdx_plane2_max[i_shr] = -999;
1118  }else{
1119  vars.m_reco_shower_dEdx_plane2_max[i_shr] = *maxp2;
1120  }
1121 
1122 
1123  if(minp0 == vars.m_reco_shower_dEdx_plane0[i_shr].end()){
1124  vars.m_reco_shower_dEdx_plane0_min[i_shr] = -999;
1125  }else{
1126  vars.m_reco_shower_dEdx_plane0_min[i_shr] = *minp0;
1127  }
1128 
1129  if(minp1 == vars.m_reco_shower_dEdx_plane1[i_shr].end()){
1130  vars.m_reco_shower_dEdx_plane1_min[i_shr] = -999;
1131  }else{
1132  vars.m_reco_shower_dEdx_plane1_min[i_shr] = *minp1;
1133  }
1134 
1135  if(minp2 == vars.m_reco_shower_dEdx_plane2[i_shr].end()){
1136  vars.m_reco_shower_dEdx_plane2_min[i_shr] = -999;
1137  }else{
1138  vars.m_reco_shower_dEdx_plane2_min[i_shr] = *minp2;
1139  }
1140 
1141 
1142  vars.m_reco_shower_dEdx_plane0_nhits[i_shr] = vars.m_reco_shower_dEdx_plane0[i_shr].size();
1143  vars.m_reco_shower_dEdx_plane1_nhits[i_shr] = vars.m_reco_shower_dEdx_plane1[i_shr].size();
1144  vars.m_reco_shower_dEdx_plane2_nhits[i_shr] = vars.m_reco_shower_dEdx_plane2[i_shr].size();
1145 
1146  vars.m_reco_shower_dEdx_amalgamated[i_shr] = getAmalgamateddEdx(
1147  vars.m_reco_shower_angle_wrt_wires_plane0[i_shr],
1148  vars.m_reco_shower_angle_wrt_wires_plane1[i_shr],
1149  vars.m_reco_shower_angle_wrt_wires_plane2[i_shr],
1150  vars.m_reco_shower_dEdx_plane0_median[i_shr],
1151  vars.m_reco_shower_dEdx_plane1_median[i_shr],
1152  vars.m_reco_shower_dEdx_plane2_median[i_shr],
1153  vars.m_reco_shower_dEdx_plane0_nhits[i_shr],
1154  vars.m_reco_shower_dEdx_plane1_nhits[i_shr],
1155  vars.m_reco_shower_dEdx_plane2_nhits[i_shr] );
1156 
1157  vars.m_reco_shower_dEdx_amalgamated_nhits[i_shr] = getAmalgamateddEdxNHits(
1158  vars.m_reco_shower_dEdx_amalgamated[i_shr],
1159  vars.m_reco_shower_dEdx_plane0_median[i_shr],
1160  vars.m_reco_shower_dEdx_plane1_median[i_shr],
1161  vars.m_reco_shower_dEdx_plane2_median[i_shr],
1162  vars.m_reco_shower_dEdx_plane0_nhits[i_shr],
1163  vars.m_reco_shower_dEdx_plane1_nhits[i_shr],
1164  vars.m_reco_shower_dEdx_plane2_nhits[i_shr] );
1165 
1166  //-------------- Flashes : Was there a flash in the beavars.m_time and if so was it near in Z? --------------------
1167  double zmin = vars.m_reco_shower_startz[i_shr];
1168  double zmax = zmin + vars.m_reco_shower_dirz[i_shr]*vars.m_reco_shower_length[i_shr];
1169  if(zmin > zmax) std::swap(zmin, zmax);
1170 
1171  double ymin = vars.m_reco_shower_starty[i_shr];
1172  double ymax = zmin + vars.m_reco_shower_diry[i_shr]*vars.m_reco_shower_length[i_shr];
1173  if(ymin > ymax) std::swap(ymin, ymax);
1174 
1175  //Code property of Gray Yarbrough (all rights reserved)
1176  //int optical_flash_in_beamgate_counter=0;
1177  double shortest_dist_to_flash_z=DBL_MAX;
1178  double shortest_dist_to_flash_y=DBL_MAX;
1179  double shortest_dist_to_flash_yz=DBL_MAX;
1180  //-999 my nonsenese int can change
1181  int shortest_dist_to_flash_index_z=-999;
1182  int shortest_dist_to_flash_index_y=-999;
1183  int shortest_dist_to_flash_index_yz=-999;
1184 
1185  // if(g_is_verbose) std::cout<<"AnalyzeShowers()\t||\tnumber of flashes: "<< vars.m_reco_num_flashes<< ""<<std::endl;;
1186  for(int i_flash = 0; i_flash < vars.m_reco_num_flashes; ++i_flash) {
1187 
1188  double const zcenter=vars.m_reco_flash_zcenter[i_flash];
1189  // if(g_is_verbose) std::cout<< "AnalyzeShowers()\t||\tflash z center:" <<vars.m_reco_flash_zcenter[i_flash]<< ""<<std::endl;;
1190  double const ycenter=vars.m_reco_flash_ycenter[i_flash];
1191  // if(g_is_verbose) std::cout<< "AnaluzeShowers()\t||\tflash y center:" <<vars.m_reco_flash_ycenter[i_flash]<< ""<<std::endl;;
1192 
1193  //z plane
1194  double dist_z=DBL_MAX;
1195  if(zcenter < zmin) {
1196  dist_z = zmin - zcenter;
1197  }
1198  else if(zcenter > zmax) {
1199  dist_z = zcenter - zmax;
1200  }
1201  else {
1202  dist_z = 0;
1203  }
1204  if(dist_z < shortest_dist_to_flash_z){
1205  shortest_dist_to_flash_z = dist_z;
1206  shortest_dist_to_flash_index_z=i_flash;
1207  }
1208 
1209 
1210  //y plane
1211 
1212  double dist_y=DBL_MAX;
1213  if(ycenter < ymin) {
1214  dist_y = ymin - ycenter;
1215  }
1216  else if(ycenter > ymax) {
1217  dist_y = ycenter - ymax;
1218  }
1219  else {
1220  dist_y= 0;
1221  }
1222  if(dist_y < shortest_dist_to_flash_y){
1223  shortest_dist_to_flash_y = dist_y;
1224  shortest_dist_to_flash_index_y=i_flash;
1225  }
1226 
1227  double dist_yz=DBL_MAX;
1228  dist_yz=std::sqrt(dist_y*dist_y+dist_z*dist_z);
1229  if(dist_yz<shortest_dist_to_flash_yz){
1230  shortest_dist_to_flash_yz = dist_yz;
1231  shortest_dist_to_flash_index_yz=i_flash;
1232  }
1233 
1234  }
1235 
1236 
1237  //assume setting to nonsense value
1238  if(vars.m_reco_num_flashes_in_beamgate == 0) shortest_dist_to_flash_z = -2;
1239  vars.m_reco_shower_flash_shortest_distz[i_shr]=shortest_dist_to_flash_z;
1240  vars.m_reco_shower_flash_shortest_index_z[i_shr]=shortest_dist_to_flash_index_z;
1241 
1242  if(vars.m_reco_num_flashes_in_beamgate == 0) shortest_dist_to_flash_y = -2;
1243  vars.m_reco_shower_flash_shortest_disty[i_shr]=shortest_dist_to_flash_y;
1244  vars.m_reco_shower_flash_shortest_index_y[i_shr]=shortest_dist_to_flash_index_y;
1245  vars.m_reco_shower_flash_shortest_distyz[i_shr]=shortest_dist_to_flash_yz;
1246  vars.m_reco_shower_flash_shortest_index_yz[i_shr]=shortest_dist_to_flash_index_yz;
1247  if(vars.m_reco_num_flashes_in_beamgate == 0) shortest_dist_to_flash_yz = -2;
1248 
1249  //end optical flash code
1250 
1251 
1252  vars.m_reco_shower_num_daughters[i_shr] = pfp->NumDaughters(); //corresponding PFParticle
1253  // std::cout<<" CHECK numebr "<<vars.m_reco_shower_num_daughters[i_shr]<<std::endl;
1254  if(vars.m_reco_shower_num_daughters[i_shr]>0){
1255  //currently just look at 1 daughter
1256  //vars.m_reco_shower_daughter_trackscore[i_shr] = PFPToTrackScoreMap[pfParticleMap[pfp->Daughters().front()]];
1257  int pfp_size = all_PPFPs.size();
1258  for(int index = 0; index < pfp_size; index++){
1259  // std::cout<<"CHECK Compare "<<pfp->Daughters().front()<<
1260  // " "<<all_PPFPs[index].pPFParticle->Self()<<std::endl;
1261  if( (pfp->Daughters().front()) == all_PPFPs[index].pPFParticle->Self()){
1262  vars.m_reco_shower_daughter_trackscore[i_shr] = all_PPFPs[index].get_TrackScore();
1263  break;
1264  }
1265  }
1266  }
1267 
1268 
1269  //------------and finally some slice info-----------------
1270 
1271  vars.m_reco_shower_sliceId[i_shr] = ppfp->get_SliceID();//PFPToSliceIdMap[pfp];
1272  vars.m_reco_shower_nuscore[i_shr] = ppfp->get_NuScore();//sliceIdToNuScoreMap[ vars.m_reco_shower_sliceId[i_shr]] ;
1273  vars.m_reco_shower_isclearcosmic[i_shr] = ppfp->get_IsClearCosmic();//PFPToClearCosmicMap[pfp];
1274  vars.m_reco_shower_is_nuslice[i_shr] = ppfp->get_IsNuSlice();//PFPToNuSliceMap[pfp];
1275 
1276  vars.m_reco_shower_trackscore[i_shr] = ppfp->get_TrackScore();
1277  vars.m_reco_shower_pfparticle_pdg[i_shr] = ppfp->get_PdgCode();
1278 
1279  // if ( vars.m_reco_shower_sliceId[i_shr] >0) std::cout<<"AnalyzeShowers()\t||\t On Shower: "<<i_shr<<". Pfp id = "<< pfp->Self()<<". The slice id for this shower is "<< vars.m_reco_shower_sliceId[i_shr]<<", the neutrino score for this slice is "<< vars.m_reco_shower_nuscore[i_shr]<<", and is_nuslice = "<< vars.m_reco_shower_is_nuslice[i_shr]<<". The track score is : "<< vars.m_reco_shower_trackscore[i_shr]<<std::endl;
1280 
1281  i_shr++;
1282 
1283  //std::vector<int> spacers = Printer_header({"Slice","pfpID","Start(x, "," y, ",", z )", "trackScore", "Pdg"});
1285  {std::to_string(ppfp->get_SliceID()),
1286  std::to_string(ppfp->get_PFParticleID()),
1287  std::to_string(shr_start.X()),
1288  std::to_string(shr_start.Y()),
1289  std::to_string(shr_start.Z()),
1290  std::to_string(ppfp->get_TrackScore()),
1291  std::to_string(ppfp->get_PdgCode())
1292  },spacers);
1293 
1294  }
1295 
1296  //Lets sort and order the showers
1297  vars.m_reco_shower_ordered_energy_index = sort_indexes(vars.m_reco_shower_energy_max);
1298  }
std::vector< double > CalcdEdxFromdQdx(std::vector< double > dqdx, para_all &paras)
Definition: Processors.cxx:342
int getNHitsPlane(std::vector< art::Ptr< recob::Hit >> hits, int this_plane)
Definition: Processors.cxx:472
int getAmalgamateddEdxNHits(double amalgamateddEdx, double median_plane0, double median_plane1, double median_plane2, int plane0_nhits, int plane1_nhits, int plane2_nhits)
std::vector< size_t > sort_indexes(const std::vector< T > &v)
Definition: helper_math.h:20
int delaunay_hit_wrapper(const std::vector< art::Ptr< recob::Hit >> &hits, std::vector< int > &num_hits, std::vector< int > &num_triangles, std::vector< double > &area, para_all &paras)
Definition: Processors.cxx:520
double dist_line_point(std::vector< double > &X1, std::vector< double > &X2, std::vector< double > &point)
Definition: helper_math.cxx:8
process_name shower
Definition: cheaterreco.fcl:51
while getopts h
T abs(T value)
std::vector< int > Printer_header(std::vector< std::string > headings)
double getMeanHitWidthPlane(std::vector< art::Ptr< recob::Hit >> hits, int this_plane)
Definition: Processors.cxx:454
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
Definition: PlaneGeo.h:82
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:75
int distToSCB(double &dist, std::vector< double > &vec, para_all &paras)
double distToCPA(std::vector< double > &vec, para_all &paras)
std::vector< double > CalcdQdxShower(const art::Ptr< recob::Shower > &shower, const std::vector< art::Ptr< recob::Cluster >> &clusters, std::map< art::Ptr< recob::Cluster >, std::vector< art::Ptr< recob::Hit >> > &clusterToHitMap, int plane, double triggeroffset, detinfo::DetectorPropertiesData const &theDetector, para_all &paras)
Definition: Processors.cxx:354
auto norm(Vector const &v)
Return norm of the specified vector.
double CalcEShowerPlane(const std::vector< art::Ptr< recob::Hit >> &hits, int this_plane, para_all &paras)
Definition: Processors.cxx:293
double getAmalgamateddEdx(double angle_wrt_plane0, double angle_wrt_plane1, double angle_wrt_plane2, double median_plane0, double median_plane1, double median_plane2, int plane0_nhits, int plane1_nhits, int plane2_nhits)
void Printer_content(std::vector< std::string > nums, std::vector< int > spacers)
std::string to_string(WindowPattern const &pattern)
PandoraPFParticle * PPFP_GetPPFPFromShower(std::vector< PandoraPFParticle > &PPFPs, art::Ptr< recob::Shower > pShower)
do i e
double getMedian(std::vector< double > thisvector)
Definition: helper_math.cxx:88
double distToTPCActive(std::vector< double > &vec, para_all &paras)
void single_photon::AnalyzeTrackCalo ( const std::vector< art::Ptr< recob::Track >> &  tracks,
std::vector< PandoraPFParticle >  all_PPFPs,
var_all &  vars,
para_all &  paras 
)

Definition at line 216 of file analyze_PandoraReco.cxx.

216  {
217 
218  if(g_is_verbose) std::cout<<"CollectCalo(recob::Track)\t||\t Starting calo module for recob::Track"<<std::endl;;
219 
220  for(size_t i_trk = 0; i_trk<tracks.size(); ++i_trk){
221  const art::Ptr<recob::Track> track = tracks[i_trk];
222  PandoraPFParticle* ppfp = PPFP_GetPPFPFromTrack(all_PPFPs, track);
223  std::vector<art::Ptr<anab::Calorimetry>> Calos = ppfp->get_Calorimetries();
224 
225  if(Calos.size()!=3){
226  std::cout<<"Singlephoton::Tracks\t||\tERROR!! ERROR!!! anab::Calorimetery vector is not of length 3!!! "<<Calos.size()<<". Skipping this track!!"<<std::endl;
227  continue;
228  }
229  //if(trackToCaloMap[track].size()!=3){
230  // std::cout<<"Singlephoton::Tracks\t||\tERROR!! ERROR!!! anab::Calorimetery vector is not of length 3!!! "<<trackToCaloMap[track].size()<<". Skipping this track!!"<<std::endl;
231  // continue;
232  //}
233 
234  const art::Ptr<anab::Calorimetry> calo_p0 = Calos[0];
235  const art::Ptr<anab::Calorimetry> calo_p1 = Calos[1];
236  const art::Ptr<anab::Calorimetry> calo_p2 = Calos[2];
237 
238 
239  size_t calo_length_p0 = calo_p0->dEdx().size();
240  size_t calo_length_p1 = calo_p1->dEdx().size();
241  size_t calo_length_p2 = calo_p2->dEdx().size();
242 
243  TruncMean tm_p0;
244  TruncMean tm_p1;
245  TruncMean tm_p2;
246 
247  std::vector<double> trunc_dEdx_p0;
248  std::vector<double> res_range_good_p0;
249  std::vector<double> dEdx_good_p0;
250 
251  std::vector<double> trunc_dEdx_p1;
252  std::vector<double> res_range_good_p1;
253  std::vector<double> dEdx_good_p1;
254 
255  std::vector<double> trunc_dEdx_p2;
256  std::vector<double> res_range_good_p2;
257  std::vector<double> dEdx_good_p2;
258 
259  vars.m_reco_track_num_calo_hits_p0[i_trk] = (int)calo_length_p0;
260  vars.m_reco_track_num_calo_hits_p1[i_trk] = (int)calo_length_p1;
261  vars.m_reco_track_num_calo_hits_p2[i_trk] = (int)calo_length_p2;
262 
263  vars.m_reco_track_best_calo_plane[i_trk]=-1;
264 
265  // guanqun: vectors have been clear and resized, so probably not need to reset their values?
266  vars.m_reco_track_good_calo_p0[i_trk] = 0;
267  vars.m_reco_track_mean_dEdx_p0[i_trk] = 0.0;
268  vars.m_reco_track_mean_dEdx_start_half_p0[i_trk] = 0.0;
269  vars.m_reco_track_mean_dEdx_end_half_p0[i_trk] = 0.0;
270  vars.m_reco_track_mean_trunc_dEdx_p0[i_trk] = 0.0;
271  vars.m_reco_track_mean_trunc_dEdx_start_half_p0[i_trk] = 0.0;
272  vars.m_reco_track_mean_trunc_dEdx_end_half_p0[i_trk] = 0.0;
273  vars.m_reco_track_trunc_PIDA_p0[i_trk] = 0.0;
274 
275  vars.m_reco_track_good_calo_p1[i_trk] = 0;
276  vars.m_reco_track_mean_dEdx_p1[i_trk] = 0.0;
277  vars.m_reco_track_mean_dEdx_start_half_p1[i_trk] = 0.0;
278  vars.m_reco_track_mean_dEdx_end_half_p1[i_trk] = 0.0;
279  vars.m_reco_track_mean_trunc_dEdx_p1[i_trk] = 0.0;
280  vars.m_reco_track_mean_trunc_dEdx_start_half_p1[i_trk] = 0.0;
281  vars.m_reco_track_mean_trunc_dEdx_end_half_p1[i_trk] = 0.0;
282  vars.m_reco_track_trunc_PIDA_p1[i_trk] = 0.0;
283 
284  vars.m_reco_track_good_calo_p2[i_trk] = 0;
285  vars.m_reco_track_mean_dEdx_p2[i_trk] = 0.0;
286  vars.m_reco_track_mean_dEdx_start_half_p2[i_trk] = 0.0;
287  vars.m_reco_track_mean_dEdx_end_half_p2[i_trk] = 0.0;
288  vars.m_reco_track_mean_trunc_dEdx_p2[i_trk] = 0.0;
289  vars.m_reco_track_mean_trunc_dEdx_start_half_p2[i_trk] = 0.0;
290  vars.m_reco_track_mean_trunc_dEdx_end_half_p2[i_trk] = 0.0;
291  vars.m_reco_track_trunc_PIDA_p2[i_trk] = 0.0;
292 
293 
294 
295  //First off look over ALL points
296  //--------------------------------- plane 0 ----------- Induction
297  for (size_t k = 0; k < calo_length_p0; ++k) {
298  double res_range = calo_p0->ResidualRange()[k]; //ResidualRange() returns range from end of track
299  double dEdx = calo_p0->dEdx()[k];
300 
301  vars.m_reco_track_mean_dEdx_p0[i_trk] += dEdx;
302  if(k <= calo_length_p0/2){
303  vars.m_reco_track_mean_dEdx_start_half_p0[i_trk]+=dEdx;
304  }else{
305  vars.m_reco_track_mean_dEdx_end_half_p0[i_trk]+=dEdx;
306  }
307 
308  bool is_sensible = dEdx < paras.s_track_calo_max_dEdx;
309  bool is_nan =dEdx != dEdx; // != has higher precedence than =
310  bool is_inf = std::isinf(dEdx);
311  bool is_nonzero = dEdx> paras.s_track_calo_min_dEdx;
312 
313  if(is_sensible && !is_nan && !is_inf && is_nonzero && k != 0 && k != calo_length_p0-1){
314  res_range_good_p0.push_back(res_range);
315  dEdx_good_p0.push_back(dEdx);
316  }
317 
318  // std::cout<<"\t"<<k<<" "<<calo->dEdx()[k]<<" "<<calo->ResidualRange()[k]<<" "<< ""<<std::endl;;
319  }// End of first loop.
320 
321  vars.m_reco_track_good_calo_p0[i_trk] = 0;
322  if(res_range_good_p0.size() >= paras.s_track_calo_min_dEdx_hits){
323  vars.m_reco_track_good_calo_p0[i_trk] = res_range_good_p0.size();
324 
325  //The radius we truncate over is going to be the max of either 1/frac of a track or 2x the minimuvars.m_dx in the res_range
326  double tenth_track = std::max(res_range_good_p0.front(), res_range_good_p0.back())/paras.s_track_calo_trunc_fraction;
327  double min_dx = 999;
328  for(int j = res_range_good_p0.size()-1; j>1; j--){
329  double dx = fabs(res_range_good_p0[j]-res_range_good_p0[j-1]);
330  if(dx < min_dx) min_dx = dx;
331  }
332  double rad = std::max( min_dx*2, tenth_track);
333 
334  //Calculate the residual range
335  tm_p0.setRadius(rad);
336  tm_p0.CalcTruncMeanProfile(res_range_good_p0,dEdx_good_p0, trunc_dEdx_p0);
337 
338  double pida_sum_trunc=0.0;
339  //Calculate the mean truncated mean dEdx
340  for(size_t k=0; k< trunc_dEdx_p0.size(); k++){
341  double dEdx = trunc_dEdx_p0[k];
342  vars.m_reco_track_mean_trunc_dEdx_p0[i_trk] += dEdx;
343  if(k <= trunc_dEdx_p0.size()/2){
344  vars.m_reco_track_mean_trunc_dEdx_start_half_p0[i_trk]+=dEdx;
345  }else{
346  vars.m_reco_track_mean_trunc_dEdx_end_half_p0[i_trk]+=dEdx;
347  }
348 
349 
350  if(trunc_dEdx_p0[k] != trunc_dEdx_p0[k] || std::isinf(trunc_dEdx_p0[k]) || trunc_dEdx_p0[k]<0){
351  std::cout<<"Truncated dedx is either inf or nan (or negative) @ "<<k<<" "<<trunc_dEdx_p0[k]<<std::endl;
352  std::cout<<"Vector Length : "<<trunc_dEdx_p0.size()<<std::endl;
353  std::cout<<"i\t range \t dedx \t trunc dedx"<<std::endl;
354  //for(int m=0; m<trunc_dEdx.size(); m++){
355  // std::cout<<m<<"\t"<<c_resrange.at(m)<<" "<<c_dEdx.at(m)<<" "<<trunc_dEdx.at(m)<<std::endl;
356  //}
357  std::cout<<"Using Radius: "<<rad<<std::endl;
358  //exit(EXIT_FAILURE);
359  vars.m_reco_track_good_calo_p0[i_trk] = 0;
360  }
361 
362  // dEdx/pow(residual_range, -0.42) is the constant A in residual range formula
363  pida_sum_trunc += trunc_dEdx_p0[k]/(pow(res_range_good_p0[k],-0.42));
364  }
365  vars.m_reco_track_trunc_PIDA_p0[i_trk] = pida_sum_trunc;
366  vars.m_reco_track_resrange_p0[i_trk] = res_range_good_p0;
367  vars.m_reco_track_trunc_dEdx_p0[i_trk] = trunc_dEdx_p0;
368  vars.m_reco_track_dEdx_p0[i_trk] = dEdx_good_p0;
369 
370  //std::cout<<"the residual range at the start is "<<res_range_good[0]<<std::endl;
371  }
372 
373  vars.m_reco_track_mean_dEdx_p0[i_trk] *=1.0/((double)calo_length_p0);
374  vars.m_reco_track_mean_dEdx_start_half_p0[i_trk] *=2.0/((double)calo_length_p0);
375  vars.m_reco_track_mean_dEdx_end_half_p0[i_trk] *=2.0/((double)calo_length_p0);
376  vars.m_reco_track_mean_trunc_dEdx_p0[i_trk] *=1.0/((double)trunc_dEdx_p0.size());
377  vars.m_reco_track_mean_trunc_dEdx_start_half_p0[i_trk] *=2.0/((double)trunc_dEdx_p0.size());
378  vars.m_reco_track_mean_trunc_dEdx_end_half_p0[i_trk] *=2.0/((double)trunc_dEdx_p0.size());
379  vars.m_reco_track_trunc_PIDA_p0[i_trk] *=1.0/((double)trunc_dEdx_p0.size());
380 
381  //First off look over ALL points
382  //--------------------------------- plane 1 ----------- Induction
383  for (size_t k = 0; k < calo_length_p1; ++k) {
384  double res_range = calo_p1->ResidualRange()[k];
385  double dEdx = calo_p1->dEdx()[k];
386 
387  vars.m_reco_track_mean_dEdx_p1[i_trk] += dEdx;
388  if(k <= calo_length_p1/2){
389  vars.m_reco_track_mean_dEdx_start_half_p1[i_trk]+=dEdx;
390  }else{
391  vars.m_reco_track_mean_dEdx_end_half_p1[i_trk]+=dEdx;
392  }
393 
394  bool is_sensible = dEdx < paras.s_track_calo_max_dEdx;
395  bool is_nan =dEdx != dEdx;
396  bool is_inf = std::isinf(dEdx);
397  bool is_nonzero = dEdx> paras.s_track_calo_min_dEdx;
398 
399  if(is_sensible && !is_nan && !is_inf && is_nonzero && k != 0 && k != calo_length_p1-1){
400  res_range_good_p1.push_back(res_range);
401  dEdx_good_p1.push_back(dEdx);
402  }
403 
404  // std::cout<<"\t"<<k<<" "<<calo->dEdx()[k]<<" "<<calo->ResidualRange()[k]<<" "<< ""<<std::endl;;
405  }// End of first loop.
406 
407  vars.m_reco_track_good_calo_p1[i_trk] = 0;
408  if(res_range_good_p1.size() >= paras.s_track_calo_min_dEdx_hits){
409  vars.m_reco_track_good_calo_p1[i_trk] = res_range_good_p1.size();
410 
411  //The radius we truncate over is going to be the max of either 1/frac of a track or 2x the minimuvars.m_dx in the res_range
412  double tenth_track = std::max(res_range_good_p1.front(), res_range_good_p1.back())/paras.s_track_calo_trunc_fraction;
413  double min_dx = 999;
414  for(int j = res_range_good_p1.size()-1; j>1; j--){
415  double dx = fabs(res_range_good_p1[j]-res_range_good_p1[j-1]);
416  if(dx < min_dx) min_dx = dx;
417  }
418  double rad = std::max( min_dx*2, tenth_track);
419 
420  //Calculate the residual range
421  tm_p1.setRadius(rad);
422  tm_p1.CalcTruncMeanProfile(res_range_good_p1,dEdx_good_p1, trunc_dEdx_p1);
423 
424  double pida_sum_trunc=0.0;
425  //Calculate the mean truncated mean dEdx
426  for(size_t k=0; k< trunc_dEdx_p1.size(); k++){
427  double dEdx = trunc_dEdx_p1[k];
428  vars.m_reco_track_mean_trunc_dEdx_p1[i_trk] += dEdx;
429  if(k <= trunc_dEdx_p1.size()/2){
430  vars.m_reco_track_mean_trunc_dEdx_start_half_p1[i_trk]+=dEdx;
431  }else{
432  vars.m_reco_track_mean_trunc_dEdx_end_half_p1[i_trk]+=dEdx;
433  }
434 
435 
436  if(trunc_dEdx_p1[k] != trunc_dEdx_p1[k] || std::isinf(trunc_dEdx_p1[k]) || trunc_dEdx_p1[k]<0){
437  std::cout<<"Truncated dedx is either inf or nan (or negative) @ "<<k<<" "<<trunc_dEdx_p1[k]<<std::endl;
438  std::cout<<"Vector Length : "<<trunc_dEdx_p1.size()<<std::endl;
439  std::cout<<"i\t range \t dedx \t trunc dedx"<<std::endl;
440  //for(int m=0; m<trunc_dEdx.size(); m++){
441  // std::cout<<m<<"\t"<<c_resrange.at(m)<<" "<<c_dEdx.at(m)<<" "<<trunc_dEdx.at(m)<<std::endl;
442  //}
443  std::cout<<"Using Radius: "<<rad<<std::endl;
444  //exit(EXIT_FAILURE);
445  vars.m_reco_track_good_calo_p1[i_trk] = 0;
446  }
447 
448  pida_sum_trunc += trunc_dEdx_p1[k]/(pow(res_range_good_p1[k],-0.42));
449  }
450  vars.m_reco_track_trunc_PIDA_p1[i_trk] = pida_sum_trunc;
451  vars.m_reco_track_resrange_p1[i_trk] = res_range_good_p1;
452  vars.m_reco_track_trunc_dEdx_p1[i_trk] = trunc_dEdx_p1;
453  vars.m_reco_track_dEdx_p1[i_trk] = dEdx_good_p1;
454 
455  //std::cout<<"the residual range at the start is "<<res_range_good[0]<<std::endl;
456  }
457 
458  vars.m_reco_track_mean_dEdx_p1[i_trk] *=1.0/((double)calo_length_p1);
459  vars.m_reco_track_mean_dEdx_start_half_p1[i_trk] *=2.0/((double)calo_length_p1);
460  vars.m_reco_track_mean_dEdx_end_half_p1[i_trk] *=2.0/((double)calo_length_p1);
461  vars.m_reco_track_mean_trunc_dEdx_p1[i_trk] *=1.0/((double)trunc_dEdx_p1.size());
462  vars.m_reco_track_mean_trunc_dEdx_start_half_p1[i_trk] *=2.0/((double)trunc_dEdx_p1.size());
463  vars.m_reco_track_mean_trunc_dEdx_end_half_p1[i_trk] *=2.0/((double)trunc_dEdx_p1.size());
464  vars.m_reco_track_trunc_PIDA_p1[i_trk] *=1.0/((double)trunc_dEdx_p1.size());
465 
466  //First off look over ALL points
467  //--------------------------------- plane 2 ----------- Collection
468  for (size_t k = 0; k < calo_length_p2; ++k) {
469  double res_range = calo_p2->ResidualRange()[k];
470  double dEdx = calo_p2->dEdx()[k];
471 
472  vars.m_reco_track_mean_dEdx_p2[i_trk] += dEdx;
473  if(k <= calo_length_p2/2){
474  vars.m_reco_track_mean_dEdx_start_half_p2[i_trk]+=dEdx;
475  }else{
476  vars.m_reco_track_mean_dEdx_end_half_p2[i_trk]+=dEdx;
477  }
478 
479  bool is_sensible = dEdx < paras.s_track_calo_max_dEdx;
480  bool is_nan =dEdx != dEdx;
481  bool is_inf = std::isinf(dEdx);
482  bool is_nonzero = dEdx> paras.s_track_calo_min_dEdx;
483 
484  if(is_sensible && !is_nan && !is_inf && is_nonzero && k != 0 && k != calo_length_p2-1){
485  res_range_good_p2.push_back(res_range);
486  dEdx_good_p2.push_back(dEdx);
487  }
488 
489  // std::cout<<"\t"<<k<<" "<<calo->dEdx()[k]<<" "<<calo->ResidualRange()[k]<<" "<< ""<<std::endl;;
490  }// End of first loop.
491 
492  vars.m_reco_track_good_calo_p2[i_trk] = 0;
493  if(res_range_good_p2.size() >= paras.s_track_calo_min_dEdx_hits){
494  vars.m_reco_track_good_calo_p2[i_trk] = res_range_good_p2.size();
495 
496  //The radius we truncate over is going to be the max of either 1/frac of a track or 2x the minimuvars.m_dx in the res_range
497  double tenth_track = std::max(res_range_good_p2.front(), res_range_good_p2.back())/paras.s_track_calo_trunc_fraction;
498  double min_dx = 999;
499  for(int j = res_range_good_p2.size()-1; j>1; j--){
500  double dx = fabs(res_range_good_p2[j]-res_range_good_p2[j-1]);
501  if(dx < min_dx) min_dx = dx;
502  }
503  double rad = std::max( min_dx*2, tenth_track);
504 
505  //Calculate the residual range
506  tm_p2.setRadius(rad);
507  tm_p2.CalcTruncMeanProfile(res_range_good_p2,dEdx_good_p2, trunc_dEdx_p2);
508 
509  double pida_sum_trunc=0.0;
510  //Calculate the mean truncated mean dEdx
511  for(size_t k=0; k< trunc_dEdx_p2.size(); k++){
512  double dEdx = trunc_dEdx_p2[k];
513  vars.m_reco_track_mean_trunc_dEdx_p2[i_trk] += dEdx;
514  if(k <= trunc_dEdx_p2.size()/2){
515  vars.m_reco_track_mean_trunc_dEdx_start_half_p2[i_trk]+=dEdx;
516  }else{
517  vars.m_reco_track_mean_trunc_dEdx_end_half_p2[i_trk]+=dEdx;
518  }
519 
520 
521  if(trunc_dEdx_p2[k] != trunc_dEdx_p2[k] || std::isinf(trunc_dEdx_p2[k]) || trunc_dEdx_p2[k]<0){
522  std::cout<<"Truncated dedx is either inf or nan (or negative) @ "<<k<<" "<<trunc_dEdx_p2[k]<<std::endl;
523  std::cout<<"Vector Length : "<<trunc_dEdx_p2.size()<<std::endl;
524  std::cout<<"i\t range \t dedx \t trunc dedx"<<std::endl;
525  //for(int m=0; m<trunc_dEdx.size(); m++){
526  // std::cout<<m<<"\t"<<c_resrange.at(m)<<" "<<c_dEdx.at(m)<<" "<<trunc_dEdx.at(m)<<std::endl;
527  //}
528  std::cout<<"Using Radius: "<<rad<<std::endl;
529  //exit(EXIT_FAILURE);
530  vars.m_reco_track_good_calo_p2[i_trk] = 0;
531  }
532 
533  pida_sum_trunc += trunc_dEdx_p2[k]/(pow(res_range_good_p2[k],-0.42));
534  }
535  vars.m_reco_track_trunc_PIDA_p2[i_trk] = pida_sum_trunc;
536  vars.m_reco_track_resrange_p2[i_trk] = res_range_good_p2;
537  vars.m_reco_track_trunc_dEdx_p2[i_trk] = trunc_dEdx_p2;
538  vars.m_reco_track_dEdx_p2[i_trk] = dEdx_good_p2;
539 
540  //std::cout<<"the residual range at the start is "<<res_range_good[0]<<std::endl;
541  }
542 
543  vars.m_reco_track_mean_dEdx_p2[i_trk] *=1.0/((double)calo_length_p2);
544  vars.m_reco_track_mean_dEdx_start_half_p2[i_trk] *=2.0/((double)calo_length_p2);
545  vars.m_reco_track_mean_dEdx_end_half_p2[i_trk] *=2.0/((double)calo_length_p2);
546  vars.m_reco_track_mean_trunc_dEdx_p2[i_trk] *=1.0/((double)trunc_dEdx_p2.size());
547  vars.m_reco_track_mean_trunc_dEdx_start_half_p2[i_trk] *=2.0/((double)trunc_dEdx_p2.size());
548  vars.m_reco_track_mean_trunc_dEdx_end_half_p2[i_trk] *=2.0/((double)trunc_dEdx_p2.size());
549  vars.m_reco_track_trunc_PIDA_p2[i_trk] *=1.0/((double)trunc_dEdx_p2.size());
550 
551 
552  //************************ Now
553  //lets pick one as a default?
554 
555  if(vars.m_reco_track_good_calo_p2[i_trk]!=0){
556  vars.m_reco_track_best_calo_plane[i_trk] = 2;
557 
558  vars.m_reco_track_mean_dEdx_best_plane[i_trk] = vars.m_reco_track_mean_dEdx_p2[i_trk];
559  vars.m_reco_track_mean_dEdx_start_half_best_plane[i_trk] = vars.m_reco_track_mean_dEdx_start_half_p2[i_trk];
560  vars.m_reco_track_mean_dEdx_end_half_best_plane[i_trk] = vars.m_reco_track_mean_dEdx_end_half_p2[i_trk];
561  vars.m_reco_track_good_calo_best_plane[i_trk] = vars.m_reco_track_good_calo_p2[i_trk];
562  vars.m_reco_track_trunc_dEdx_best_plane[i_trk] = vars.m_reco_track_trunc_dEdx_p2[i_trk];
563  vars.m_reco_track_mean_trunc_dEdx_best_plane[i_trk] = vars.m_reco_track_mean_trunc_dEdx_p2[i_trk];
564  vars.m_reco_track_mean_trunc_dEdx_start_half_best_plane[i_trk] = vars.m_reco_track_mean_trunc_dEdx_start_half_p2[i_trk];
565  vars.m_reco_track_mean_trunc_dEdx_end_half_best_plane[i_trk] = vars.m_reco_track_mean_trunc_dEdx_end_half_p2[i_trk];
566  vars.m_reco_track_trunc_PIDA_best_plane[i_trk] = vars.m_reco_track_trunc_PIDA_p2[i_trk];
567  vars.m_reco_track_resrange_best_plane[i_trk] = vars.m_reco_track_resrange_p2[i_trk];
568  vars.m_reco_track_dEdx_best_plane [i_trk] = vars.m_reco_track_dEdx_p2[i_trk];
569 
570  }else if(vars.m_reco_track_good_calo_p0[i_trk] > vars.m_reco_track_good_calo_p1[i_trk] ){
571  vars.m_reco_track_best_calo_plane[i_trk] = 0;
572 
573  vars.m_reco_track_mean_dEdx_best_plane[i_trk] = vars.m_reco_track_mean_dEdx_p0[i_trk];
574  vars.m_reco_track_mean_dEdx_start_half_best_plane[i_trk] = vars.m_reco_track_mean_dEdx_start_half_p0[i_trk];
575  vars.m_reco_track_mean_dEdx_end_half_best_plane[i_trk] = vars.m_reco_track_mean_dEdx_end_half_p0[i_trk];
576  vars.m_reco_track_good_calo_best_plane[i_trk] = vars.m_reco_track_good_calo_p0[i_trk];
577  vars.m_reco_track_trunc_dEdx_best_plane[i_trk] = vars.m_reco_track_trunc_dEdx_p0[i_trk];
578  vars.m_reco_track_mean_trunc_dEdx_best_plane[i_trk] = vars.m_reco_track_mean_trunc_dEdx_p0[i_trk];
579  vars.m_reco_track_mean_trunc_dEdx_start_half_best_plane[i_trk] = vars.m_reco_track_mean_trunc_dEdx_start_half_p0[i_trk];
580  vars.m_reco_track_mean_trunc_dEdx_end_half_best_plane[i_trk] = vars.m_reco_track_mean_trunc_dEdx_end_half_p0[i_trk];
581  vars.m_reco_track_trunc_PIDA_best_plane[i_trk] = vars.m_reco_track_trunc_PIDA_p0[i_trk];
582  vars.m_reco_track_resrange_best_plane[i_trk] = vars.m_reco_track_resrange_p0[i_trk];
583  vars.m_reco_track_dEdx_best_plane [i_trk] = vars.m_reco_track_dEdx_p0[i_trk];
584 
585 
586  }else if(vars.m_reco_track_good_calo_p1[i_trk]!=0){
587  vars.m_reco_track_best_calo_plane[i_trk] = 1;
588 
589  vars.m_reco_track_mean_dEdx_best_plane[i_trk] = vars.m_reco_track_mean_dEdx_p1[i_trk];
590  vars.m_reco_track_mean_dEdx_start_half_best_plane[i_trk] = vars.m_reco_track_mean_dEdx_start_half_p1[i_trk];
591  vars.m_reco_track_mean_dEdx_end_half_best_plane[i_trk] = vars.m_reco_track_mean_dEdx_end_half_p1[i_trk];
592  vars.m_reco_track_good_calo_best_plane[i_trk] = vars.m_reco_track_good_calo_p1[i_trk];
593  vars.m_reco_track_trunc_dEdx_best_plane[i_trk] = vars.m_reco_track_trunc_dEdx_p1[i_trk];
594  vars.m_reco_track_mean_trunc_dEdx_best_plane[i_trk] = vars.m_reco_track_mean_trunc_dEdx_p1[i_trk];
595  vars.m_reco_track_mean_trunc_dEdx_start_half_best_plane[i_trk] = vars.m_reco_track_mean_trunc_dEdx_start_half_p1[i_trk];
596  vars.m_reco_track_mean_trunc_dEdx_end_half_best_plane[i_trk] = vars.m_reco_track_mean_trunc_dEdx_end_half_p1[i_trk];
597  vars.m_reco_track_trunc_PIDA_best_plane[i_trk] = vars.m_reco_track_trunc_PIDA_p1[i_trk];
598  vars.m_reco_track_resrange_best_plane[i_trk] = vars.m_reco_track_resrange_p1[i_trk];
599  vars.m_reco_track_dEdx_best_plane [i_trk] = vars.m_reco_track_dEdx_p1[i_trk];
600 
601 
602 
603  }else{
604  vars.m_reco_track_best_calo_plane[i_trk] = -1;
605  }
606 
607 
608  }
609  }
process_name use argoneut_mc_hitfinder track
void setRadius(const float &rad)
Set the smearing radius over which to take hits for truncated mean computaton.
PandoraPFParticle * PPFP_GetPPFPFromTrack(std::vector< PandoraPFParticle > &PPFPs, art::Ptr< recob::Track > pTrack)
float dEdx(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, TP3D &tp3d)
Definition: PFPUtils.cxx:2687
void CalcTruncMeanProfile(const std::vector< float > &rr_v, const std::vector< float > &dq_v, std::vector< float > &dq_trunc_v, const float &nsigma=1)
Given residual range and dq vectors return truncated local dq. Input vectors are assumed to be match ...
pdgs k
Definition: selectors.fcl:22
BEGIN_PROLOG could also be cout
void single_photon::AnalyzeTracks ( std::vector< PandoraPFParticle >  all_PPFPs,
const std::vector< art::Ptr< recob::Track >> &  tracks,
std::map< art::Ptr< recob::PFParticle >, std::vector< art::Ptr< recob::SpacePoint >>> &  pfParticleToSpacePointsMap,
std::map< int, art::Ptr< simb::MCParticle > > &  MCParticleToTrackIdMap,
std::map< int, double > &  sliceIdToNuScoreMap,
var_all &  vars,
para_all &  paras 
)

Definition at line 24 of file analyze_PandoraReco.cxx.

31  {
32 
33 
34  if(g_is_verbose) std::cout<<"AnalyzeTracks()\t||\t Starting recob::Track analysis"<<std::endl;;
35 
36  int i_trk=0;
37 
38 
39  //const double adc2eU(5.1e-3);
40  //const double adc2eV(5.2e-3);
41  // const double adc2eW(5.4e-3);
42 
43 
44  // const double tau(theDetector->ElectronLifetime());
45 
46 
47  //loop over each recob::Track
48  for (TrackVector::const_iterator iter = tracks.begin(), iterEnd = tracks.end(); iter != iterEnd; ++iter)
49  {
50 
51  const art::Ptr<recob::Track> track = *iter;
52  // const art::Ptr<recob::PFParticle> pfp = trackToNuPFParticleMap[track];
53  PandoraPFParticle* ppfp = PPFP_GetPPFPFromTrack(all_PPFPs, track);
54  const art::Ptr<recob::PFParticle> pfp = ppfp->pPFParticle;
55 
56  const std::vector< art::Ptr<recob::SpacePoint> > trk_spacepoints = pfParticleToSpacePointsMap[pfp];
57  const std::vector<art::Ptr<recob::Hit>> trk_hits = ppfp->pPFPHits;//pfParticleToHitsMap[pfp];
58 
59  int m_trkid = track->ID();
60  double tem_length = track->Length();
61  auto tem_trk_dir = track->Direction(); // type of vars.m_trk_dir: a std::pair of two 3D vector
62  //first: direction of first point, second: direction of the end of track
63 
64  if(g_is_verbose) std::cout<<"AnalyzeTracks()\t||\t On Track: "<<i_trk<<" with TrackID: "<<m_trkid<<" and length: "<<tem_length<<""<<std::endl;;
65 
66  vars.m_reco_track_calo_energy_plane0[i_trk] = CalcEShowerPlane(trk_hits, 0, paras);
67  vars.m_reco_track_calo_energy_plane1[i_trk] = CalcEShowerPlane(trk_hits, 1, paras);
68  vars.m_reco_track_calo_energy_plane2[i_trk] = CalcEShowerPlane(trk_hits, 2, paras);
69  vars.m_reco_track_calo_energy_max[i_trk] = std::max( vars.m_reco_track_calo_energy_plane2[i_trk], std::max(vars.m_reco_track_calo_energy_plane0[i_trk],vars.m_reco_track_calo_energy_plane1[i_trk]));
70 
71  vars.m_reco_track_num_spacepoints[i_trk] = (int)trk_spacepoints.size();
72 
73 
74  vars.m_reco_track_startx[i_trk]= track->Start().X();
75  vars.m_reco_track_starty[i_trk]= track->Start().Y();
76  vars.m_reco_track_startz[i_trk]= track->Start().Z();
77 
78  vars.m_reco_track_length[i_trk] =tem_length;
79  vars.m_reco_track_dirx[i_trk] = tem_trk_dir.first.X();
80  vars.m_reco_track_diry[i_trk] = tem_trk_dir.first.Y();
81  vars.m_reco_track_dirz[i_trk] = tem_trk_dir.first.Z();
82 
83  vars.m_reco_track_endx[i_trk] = track->End().X();
84  vars.m_reco_track_endy[i_trk]= track->End().Y();
85  vars.m_reco_track_endz[i_trk]= track->End().Z();
86 
87  std::vector<double> hend = {vars.m_reco_track_endx[i_trk],vars.m_reco_track_endy[i_trk],vars.m_reco_track_endz[i_trk]};
88  std::vector<double> hstart = {vars.m_reco_track_startx[i_trk],vars.m_reco_track_starty[i_trk],vars.m_reco_track_startz[i_trk]};
89 
90  vars.m_reco_track_end_dist_to_active_TPC[i_trk] = distToTPCActive(hend, paras);
91  vars.m_reco_track_start_dist_to_active_TPC[i_trk] = distToTPCActive(hstart, paras);
92 
93  vars.m_reco_track_end_dist_to_CPA[i_trk] = distToCPA(hend, paras);
94  vars.m_reco_track_start_dist_to_CPA[i_trk] = distToCPA(hstart, paras);
95 
96  vars.m_reco_track_end_in_SCB[i_trk] = distToSCB(vars.m_reco_track_end_dist_to_SCB[i_trk],hend, paras);
97  vars.m_reco_track_start_in_SCB[i_trk] = distToSCB(vars.m_reco_track_start_dist_to_SCB[i_trk],hstart, paras);
98 
99 
100  vars.m_reco_track_theta_yz[i_trk] = atan2(vars.m_reco_track_diry[i_trk],vars.m_reco_track_dirz[i_trk]);
101  vars.m_reco_track_phi_yx[i_trk] = atan2(vars.m_reco_track_diry[i_trk],vars.m_reco_track_dirx[i_trk]);
102 
103  std::vector<double> tmp_trk_start = {vars.m_reco_track_startx[i_trk],vars.m_reco_track_starty[i_trk],vars.m_reco_track_startz[i_trk]};
104  std::vector<double> tmp_trk_end = {vars.m_reco_track_endx[i_trk],vars.m_reco_track_endy[i_trk],vars.m_reco_track_endz[i_trk]};
105  double max_dist_from_line = -9999999;
106 
107  vars.m_reco_track_spacepoint_chi[i_trk] = 0.0;
108  //Principal componant analysis of SPACEPOINTS and not trajectory points. Will add a few things here in future.
109 
110  if(g_is_verbose) std::cout<<"AnalyzeTracks()\t||\t Beginining PCA analysis of track"<<std::endl;;
111 
112  TPrincipal* principal;
113  principal = new TPrincipal(3,"ND");
114  for(int x = 0; x < vars.m_reco_track_num_spacepoints[i_trk]; x++){
115  // get the position of spacepoint in xyz
116  std::vector<double> tmp_spacepoints = {trk_spacepoints[x]->XYZ()[0],trk_spacepoints[x]->XYZ()[1] , trk_spacepoints[x]->XYZ()[2]};
117  principal->AddRow(&tmp_spacepoints[0]);
118 
119  // distance between track direction and spacepoint
120  double dist = dist_line_point(tmp_trk_start,tmp_trk_end,tmp_spacepoints);
121  if(dist> max_dist_from_line) max_dist_from_line = dist;
122  vars.m_reco_track_spacepoint_chi[i_trk] += dist*dist;
123  }
124  vars.m_reco_track_spacepoint_max_dist[i_trk]= max_dist_from_line;
125 
126  principal->MakePrincipals();
127  TVectorD * eigen = (TVectorD*) principal->GetEigenValues();
128 
129  vars.m_reco_track_spacepoint_principal0[i_trk]=(*eigen)(0);
130  vars.m_reco_track_spacepoint_principal1[i_trk]=(*eigen)(1);
131  vars.m_reco_track_spacepoint_principal2[i_trk]=(*eigen)(2);
132 
133  delete principal;
134 
135  if(g_is_verbose) std::cout<<"AnalyzeTracks()\t||\t Completed PCA analysis of track. Primary componant: "<<vars.m_reco_track_spacepoint_principal0.back()<<""<<std::endl;;
136 
137  //range based energy calculation assuming
138 
139  if(paras.s_run_pi0_filter){
140  // assume this track is a proton track, get its energy
141  vars.m_reco_track_proton_kinetic_energy[i_trk] = -9999;
142  }else{
143  //WARNING, extra input is needed for the proton track energy;
144  // vars.m_reco_track_proton_kinetic_energy[i_trk] = proton_length2energy_tgraph.Eval(tem_length)/1000.0;
145  }
146 
147  if(tem_length == 0.0) vars.m_reco_track_proton_kinetic_energy[i_trk]=0.0;
148 
149  // Dead Wire Approximity
150  // vars.m_reco_track_end_to_nearest_dead_wire_plane0[i_trk] = distanceToNearestDeadWire(0, vars.m_reco_track_endy[i_trk], vars.m_reco_track_endz[i_trk],geom,bad_channel_list_fixed_mcc9);
151  // vars.m_reco_track_end_to_nearest_dead_wire_plane1[i_trk] = distanceToNearestDeadWire(1, vars.m_reco_track_endy[i_trk], vars.m_reco_track_endz[i_trk],geom,bad_channel_list_fixed_mcc9);
152  // vars.m_reco_track_end_to_nearest_dead_wire_plane2[i_trk] = distanceToNearestDeadWire(2, vars.m_reco_track_endy[i_trk], vars.m_reco_track_endz[i_trk],geom,bad_channel_list_fixed_mcc9);
153 
154  vars.m_reco_track_sliceId[i_trk] = ppfp->get_SliceID();//PFPToSliceIdMap[pfp];
155  // Guanqun: how do you make sure the sliceId is positive, not -1, as for cosmic tracks?
156  // sliceIdToNuScoreMap seems to only have sliceID:nuScore pairs for these with actual nuScores.
157  vars.m_reco_track_nuscore[i_trk] = sliceIdToNuScoreMap[ vars.m_reco_track_sliceId[i_trk]] ;
158  vars.m_reco_track_isclearcosmic[i_trk] = ppfp->get_IsClearCosmic();//PFPToClearCosmicMap[pfp];
159 
160  //std::cout<<"checking track nuslice"<<std::endl;
161  // std::cout<<"is nuslice for track with pfp "<<pfp->Self()<<" is: "<<PFPToNuSliceMap[pfp]<<std::endl;
162  vars.m_reco_track_is_nuslice[i_trk] = ppfp->get_IsNuSlice();//PFPToNuSliceMap[pfp];
163 
164  vars.m_reco_track_num_daughters[i_trk] = pfp->NumDaughters();
165  if(vars.m_reco_track_num_daughters[i_trk]>0){
166  //currently just look at 1 daughter
167  // vars.m_reco_track_daughter_trackscore[i_trk] = PFPToTrackScoreMap[pfParticleMap[pfp->Daughters().front()]];
168  int pfp_size = all_PPFPs.size();
169  for(int index = 0; index < pfp_size; index++){
170  if( (pfp->Daughters().front()) == all_PPFPs[index].pPFParticle->Self()){
171  vars.m_reco_track_daughter_trackscore[i_trk] = all_PPFPs[index].get_TrackScore();
172  break;
173  }
174  }
175 
176  }
177 
178  vars.m_reco_track_trackscore[i_trk] = ppfp->get_TrackScore();
179  vars.m_reco_track_pfparticle_pdg[i_trk] = ppfp->get_PdgCode();
180 
181  // vars.m_reco_track_trackscore[i_trk] = PFPToTrackScoreMap[pfp];
182  // if ( PFPToTrackScoreMap.find(pfp) != PFPToTrackScoreMap.end() ) {
183  // vars.m_reco_track_trackscore[i_trk] = PFPToTrackScoreMap[pfp];
184  // vars.m_reco_track_pfparticle_pdg[i_trk] = pfp->PdgCode();
185  // } else{
186  // vars.m_reco_track_trackscore[i_trk] = -999;
187  // vars.m_reco_track_pfparticle_pdg[i_trk] = -999;
188  // }
189 
190  //A loop over the trajectory points
191  size_t const traj_size = track->CountValidPoints();
192  vars.m_reco_track_num_trajpoints[i_trk] = (int)traj_size;
193 
194  for(unsigned int p = 0; p < traj_size; ++p) {
195  //recob::Track::TrajectoryPoint_t const & trajp = track->TrajectoryPoint(j);
196  //recob::Track::Point_t const & pos = trajp.position;
197  //recob::Track::Vector_t const & mom = trajp.momentum;
198 
199  }
200 
201 
202  i_trk++;
203 
204  } // end of recob::Track loop
205 
206  //Lets sort and order the showers
207  vars.m_reco_track_ordered_energy_index = sort_indexes(vars.m_reco_track_proton_kinetic_energy);
208  vars.m_reco_track_ordered_displacement_index = sort_indexes(vars.m_reco_track_length);
209 
210 
211  if(g_is_verbose) std::cout<<"AnalyzeTracks()\t||\t Finished."<<std::endl;;
212  }
process_name opflash particleana ie x
pdgs p
Definition: selectors.fcl:22
std::vector< size_t > sort_indexes(const std::vector< T > &v)
Definition: helper_math.h:20
process_name use argoneut_mc_hitfinder track
double dist_line_point(std::vector< double > &X1, std::vector< double > &X2, std::vector< double > &point)
Definition: helper_math.cxx:8
int distToSCB(double &dist, std::vector< double > &vec, para_all &paras)
double distToCPA(std::vector< double > &vec, para_all &paras)
PandoraPFParticle * PPFP_GetPPFPFromTrack(std::vector< PandoraPFParticle > &PPFPs, art::Ptr< recob::Track > pTrack)
double CalcEShowerPlane(const std::vector< art::Ptr< recob::Hit >> &hits, int this_plane, para_all &paras)
Definition: Processors.cxx:293
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
double distToTPCActive(std::vector< double > &vec, para_all &paras)
BEGIN_PROLOG could also be cout
void single_photon::BuildMCParticleHitMaps ( const art::Event &  evt,
const std::string &  label,
const std::vector< art::Ptr< recob::Hit >> &  hitVector,
std::map< art::Ptr< simb::MCParticle >, std::vector< art::Ptr< recob::Hit > > > &  particlesToHits,
std::map< art::Ptr< recob::Hit >, art::Ptr< simb::MCParticle > > &  hitsToParticles,
const lar_pandora::LArPandoraHelper::DaughterMode  daughterMode,
std::map< int, art::Ptr< simb::MCParticle > > &  MCParticleToTrackIdMap,
var_all &  vars 
)

Definition at line 160 of file Processors.cxx.

168  {
169  std::vector< art::Ptr<sim::SimChannel> > simChannelVector;
170  std::map< art::Ptr<simb::MCTruth>, std::vector<art::Ptr<simb::MCParticle>> > truthToParticles;
171  std::map< art::Ptr<simb::MCParticle>, art::Ptr<simb::MCTruth> > particlesToTruth;
172  std::map< art::Ptr<recob::Hit>, std::vector< sim::TrackIDE > > hitsToTrackIDEs;
173 
174  CollectSimChannels(evt, label, simChannelVector);
175  CollectMCParticles(evt, label, truthToParticles, particlesToTruth, MCParticleToTrackIdMap, vars);
176 
177  //Collect the links from reconstructed hits to their true energy deposits.
178  lar_pandora::LArPandoraHelper::BuildMCParticleHitMaps(evt, hitVector, simChannelVector, hitsToTrackIDEs);
179  //Build mapping between Hits and MCParticles, starting from Hit/TrackIDE/MCParticle information
180  lar_pandora::LArPandoraHelper::BuildMCParticleHitMaps(hitsToTrackIDEs, truthToParticles, particlesToHits, hitsToParticles, daughterMode);
181 
182 
183  }
void CollectMCParticles(const art::Event &evt, const std::string &label, std::map< art::Ptr< simb::MCTruth >, std::vector< art::Ptr< simb::MCParticle >>> &truthToParticles, std::map< art::Ptr< simb::MCParticle >, art::Ptr< simb::MCTruth >> &particlesToTruth, std::map< int, art::Ptr< simb::MCParticle > > &MCParticleToTrackIdMap, var_all &vars)
Definition: Processors.cxx:96
void CollectSimChannels(const art::Event &evt, const std::string &label, std::vector< art::Ptr< sim::SimChannel > > &simChannelVector)
Definition: Processors.cxx:134
TCEvent evt
Definition: DataStructs.cxx:8
static void BuildMCParticleHitMaps(const art::Event &evt, const HitVector &hitVector, const SimChannelVector &simChannelVector, HitsToTrackIDEs &hitsToTrackIDEs)
Collect the links from reconstructed hits to their true energy deposits.
std::vector< std::vector< double > > single_photon::buildRectangle ( std::vector< double >  cluster_start,
std::vector< double >  cluster_axis,
double  width,
double  length 
)

Calculates the four corners of a rectangle of given length and width around a cluster given the start point and axis direction.

Parameters
cluster_start- the start position of a cluster in CM
cluster_axis- calculated from the cluster end minus the cluster start
width- typically ~1cm
length- typically a few cm

Definition at line 164 of file helper_math.cxx.

164  {
165  std::vector<std::vector<double>> corners;
166 
167  //get the axis perpedicular to the cluster axis
168  double perp_axis[2] = {-cluster_axis[1], cluster_axis[0]};
169 
170  //create a vector for each corner of the rectangle on the plane
171  //c1 = bottom left corner
172  std::vector<double> c1 = {cluster_start[0] + perp_axis[0] * width / 2, cluster_start[1] + perp_axis[1] * width / 2};
173  //c2 = top left corner
174  std::vector<double> c2 = {c1[0] + cluster_axis[0] * length, c1[1] + cluster_axis[1] * length};
175  //c3 = bottom right corner
176  std::vector<double> c3 = {cluster_start[0] - perp_axis[0] * width / 2, cluster_start[1] - perp_axis[1] * width / 2};
177  //c4 = top right corner
178  std::vector<double> c4 ={c3[0] + cluster_axis[0] * length, c3[1] + cluster_axis[1] * length};
179 
180  //save each of the vectors
181  corners.push_back(c1);
182  corners.push_back(c2);
183  corners.push_back(c4);
184  corners.push_back(c3);
185  return corners;
186  }
std::vector< double > single_photon::CalcdEdxFromdQdx ( std::vector< double >  dqdx,
para_all &  paras 
)

Definition at line 342 of file Processors.cxx.

342  {
343  int n = dqdx.size();
344  std::vector<double> dedx(n,0.0);
345  for (int i = 0; i < n; i++){
346  //std::cout<<"The dQ/dx is "<<dqdx[i]<<std::endl;
347  dedx[i] = QtoEConversion(dqdx[i], paras);
348  //std::cout<<"The dE/dx is "<<dedx[i]<<std::endl;
349  }
350  return dedx;
351  }
double QtoEConversion(double Q, para_all &paras)
Definition: Processors.cxx:334
std::vector< double > single_photon::CalcdQdxShower ( const art::Ptr< recob::Shower > &  shower,
const std::vector< art::Ptr< recob::Cluster >> &  clusters,
std::map< art::Ptr< recob::Cluster >, std::vector< art::Ptr< recob::Hit >> > &  clusterToHitMap,
int  plane,
double  triggeroffset,
detinfo::DetectorPropertiesData const &  theDetector,
para_all &  paras 
)

Definition at line 354 of file Processors.cxx.

361  {
362 
363  //if(g_is_verbose) std::cout<<"AnalyzeShowers() \t||\t The number of clusters in this shower is "<<clusters.size()<<std::endl;
364  std::vector<double> dqdx;
365 
366  //get the 3D shower direction
367  //note: in previous versions of the code there was a check to fix cases where the shower direction was inverted - this hasn't been implemented
368  TVector3 shower_dir(shower->Direction().X(), shower->Direction().Y(),shower->Direction().Z());
369 
370  //calculate the pitch for this plane
371  //CHECK upgradable, see ./Calibration/TrackCaloSkimmer_module.cc line 746
372  double pitch = getPitch(shower_dir, paras)[plane];
373 
374  if(g_is_verbose) std::cout<<"AnalyzeShowers() \t||\t The pitch between the shower and plane "<<plane<<" is "<<pitch<<std::endl;
375 
376  //for all the clusters in the shower
377  for (const art::Ptr<recob::Cluster> &thiscluster: clusters){
378  //keep only clusters on the plane
379  if(thiscluster->View() != plane) continue;
380 
381  //calculate the cluster direction
382  std::vector<double> cluster_axis = {cos(thiscluster->StartAngle()), sin(thiscluster->StartAngle())};
383 
384  //get the cluster start and and in CM
385  //std::cout<<"for plane/tpc/cryo:"<<plane<<"/"<<paras.s_TPC<<"/"<<paras.s_Cryostat<<", fXTicksOffset: "<<theDetector->GetXTicksOffset(plane, paras.s_TPC, paras.s_Cryostat)<<" fXTicksCoefficient: "<<theDetector->GetXTicksCoefficient(paras.s_TPC, paras.s_Cryostat)<<std::endl;
386 
387  //convert the cluster start and end positions to time and wire coordinates
388  std::vector<double> cluster_start = {thiscluster->StartWire() * paras.s_wire_spacing,(thiscluster->StartTick() - triggeroffset)* paras._time2cm};
389  std::vector<double> cluster_end = {thiscluster->EndWire() * paras.s_wire_spacing,(thiscluster->EndTick() - triggeroffset)* paras._time2cm };
390 
391  //check that the cluster has non-zero length
392  double length = sqrt(pow(cluster_end[0] - cluster_start[0], 2) + pow(cluster_end[1] - cluster_start[1], 2));
393  //if(g_is_verbose) std::cout<<"AnalyzeShowers() \t||\t The cluster length is "<<length<<std::endl;
394  if (length <= 0){
395  std::cout<<"skipping cluster on plane "<<plane<<", length = "<<length<<std::endl;
396  continue;
397  }
398 
399 
400  //draw a rectangle around the cluster axis
401  std::vector<std::vector<double>> rectangle = buildRectangle(cluster_start, cluster_axis, paras.s_width_dqdx_box, paras.s_length_dqdx_box);
402 
403  //get all the hits for this cluster
404  std::vector<art::Ptr<recob::Hit>> hits = clusterToHitMap[thiscluster];
405 
406  //for each hit in the cluster
407  for (art::Ptr<recob::Hit> &thishit: hits){
408  //get the hit position in cm from the wire and time
409  std::vector<double> thishit_pos ={thishit->WireID().Wire * paras.s_wire_spacing, (thishit->PeakTime() - triggeroffset)* paras._time2cm};
410 
411  //check if inside the box
412  bool v2 = isInsidev2(thishit_pos, rectangle, paras);
413  if (v2){
414  double q = GetQHit(thishit, plane, paras);
415  double this_dqdx = q/pitch;
416  dqdx.push_back(this_dqdx);
417  }//if hit falls inside the box
418 
419  }//for each hit inthe cluster
420  }//for each cluster
421  return dqdx;
422  }
bool isInsidev2(std::vector< double > thishit_pos, std::vector< std::vector< double >> rectangle, para_all &paras)
Definition: Processors.cxx:234
process_name shower
Definition: cheaterreco.fcl:51
std::vector< std::vector< double > > buildRectangle(std::vector< double > cluster_start, std::vector< double > cluster_axis, double width, double length)
Calculates the four corners of a rectangle of given length and width around a cluster given the start...
std::vector< double > getPitch(TVector3 shower_dir, para_all &paras)
Definition: Processors.cxx:424
double GetQHit(art::Ptr< recob::Hit > thishitptr, int plane, para_all &paras)
Definition: Processors.cxx:317
BEGIN_PROLOG could also be cout
double single_photon::CalcEShowerPlane ( const std::vector< art::Ptr< recob::Hit >> &  hits,
int  this_plane,
para_all &  paras 
)

Definition at line 293 of file Processors.cxx.

293  {
294  double energy = 0.;
295 
296  //for each hit in the shower
297  for (auto &thishitptr : hits){
298  //check the plane
299  int plane= thishitptr->View();
300 
301  //skip invalid planes
302  if (plane != this_plane ) continue;
303 
304  //calc the energy of the hit
305  double E = QtoEConversion(GetQHit(thishitptr, plane, paras), paras);
306  //add the energy to the plane
307  energy += E;
308  }//for each hit
309 
310  return energy;
311 
312  }
process_name E
double GetQHit(art::Ptr< recob::Hit > thishitptr, int plane, para_all &paras)
Definition: Processors.cxx:317
double QtoEConversion(double Q, para_all &paras)
Definition: Processors.cxx:334
double single_photon::calcWire ( double  Y,
double  Z,
int  plane,
int  fTPC,
int  fCryostat,
geo::GeometryCore const &  geo 
)
inline

Definition at line 54 of file helper_math.h.

54  {
55  double wire = geo.WireCoordinate(Y, Z, plane, fTPC, fCryostat);
56  return wire;
57  }
void single_photon::ClearEventWeightBranches ( var_all &  vars)

Definition at line 1783 of file init_branches.cxx.

1783  {
1784  vars.m_mcflux_nu_pos_x=-9999;
1785  vars.m_mcflux_nu_pos_y=-9999;
1786  vars.m_mcflux_nu_pos_z=-9999;
1787  vars.m_mcflux_nu_mom_x=-9999;
1788  vars.m_mcflux_nu_mom_y=-9999;
1789  vars.m_mcflux_nu_mom_z=-9999;
1790  vars.m_mcflux_nu_mom_z=-9999;
1791  vars.m_mcflux_nu_mom_E=-9999;
1792  vars.m_mcflux_ntype=0;
1793  vars.m_mcflux_ptype=0;
1794  vars.m_mcflux_nimpwt=-9999;
1795  vars.m_mcflux_dk2gen=-9999;
1796  vars.m_mcflux_nenergyn=-9999;
1797  vars.m_mcflux_tpx=-9999;
1798  vars.m_mcflux_tpy=-9999;
1799  vars.m_mcflux_tpz=-9999;
1800  vars.m_mcflux_vx=-9999;
1801  vars.m_mcflux_vy=-9999;
1802  vars.m_mcflux_vz=-9999;
1803  vars.m_mcflux_tptype=0;
1804  vars.m_mctruth_nparticles=0;
1805 // vars.fmcweight.clear();
1806 
1807  //vars.m_mctruth_particles_track_ID[];
1808  //vars.m_mctruth_particles_pdg_code[];
1809  //vars.m_mctruth_particles_mother[];
1810  //vars.m_mctruth_particles_status_code[];
1811  //vars.m_mctruth_particles_num_daughters[]; //other similar variables
1812  //vars.m_mctruth_particles_daughters[];
1813  //vars.m_mctruth_particles_Gvx.clear();
1814  //vars.m_mctruth_particles_Gvy.clear();
1815  //vars.m_mctruth_particles_Gvz.clear();
1816  //vars.m_mctruth_particles_Gvt.clear();
1817  //vars.m_mctruth_particles_px0.clear();
1818  //vars.m_mctruth_particles_py0.clear();
1819  //vars.m_mctruth_particles_pz0.clear();
1820  //vars.m_mctruth_particles_e0.clear();
1821  ////int vars.m_mctruth_particles_rescatter.clear();
1822  //vars.m_mctruth_particles_polx.clear();
1823  //vars.m_mctruth_particles_poly.clear();
1824  //vars.m_mctruth_particles_polz.clear();
1825 
1826  //int vars.m_mctruth_neutrino_CCNC;
1827  //int vars.m_mctruth_neutrino_mode: "vars.m_mctruth_neutrino_mode" //declared in mctruth vars
1828  //vars.m_mctruth_neutrino_interactionType: "vars.m_mctruth_neutrino_interactionType"
1829  //int vars.m_mctruth_neutrino_target.clear();
1830  //int vars.m_mctruth_neutrino_nucleon.clear();
1831  //int vars.m_mctruth_neutrino_quark.clear();
1832  //vars.m_mctruth_neutrino_w.clear();
1833  //vars.m_mctruth_neutrino_x.clear();
1834  //vars.m_mctruth_neutrino_y.clear();
1835  //vars.m_mctruth_neutrino_QSqr: "vars.m_mctruth_neutrino_QSqr"
1836  vars.m_gtruth_is_sea_quark=false;
1837  vars.m_gtruth_tgt_pdg=0;
1838  vars.m_gtruth_tgt_Z = -9999;
1839  vars.m_gtruth_tgt_A = -9999;
1840  vars.m_gtruth_tgt_p4_x = -9999;
1841  vars.m_gtruth_tgt_p4_y = -9999;
1842  vars.m_gtruth_tgt_p4_z = -9999;
1843  vars.m_gtruth_tgt_p4_E = -9999;
1844  vars.m_gtruth_weight=-9999;
1845  vars.m_gtruth_probability=-9999;
1846  vars.m_gtruth_xsec=-9999;
1847  vars.m_gtruth_diff_xsec=-9999;
1848  vars.m_gtruth_gphase_space=-9999;
1849  vars.m_gtruth_vertex_x=-9999;
1850  vars.m_gtruth_vertex_y=-9999;
1851  vars.m_gtruth_vertex_z=-9999;
1852  vars.m_gtruth_vertex_T=-9999;
1853  vars.m_gtruth_gscatter=-9999;
1854  vars.m_gtruth_gint=-9999;
1855  vars.m_gtruth_res_num=-9999;
1856  vars.m_gtruth_num_piplus=-9999;
1857  vars.m_gtruth_num_pi0=-9999;
1858  vars.m_gtruth_num_piminus=-9999;
1859  vars.m_gtruth_num_proton=-9999;
1860  vars.m_gtruth_num_neutron=-9999;
1861  vars.m_gtruth_is_charm=false;
1862  vars.m_gtruth_is_strange=false;
1863  vars.m_gtruth_charm_hadron_pdg = -9999;
1864  vars.m_gtruth_strange_hadron_pdg = -9999;
1865  vars.m_gtruth_decay_mode = -9999;
1866  vars.m_gtruth_gx=-9999;
1867  vars.m_gtruth_gy=-9999;
1868  vars.m_gtruth_gy=-9999;
1869  vars.m_gtruth_gt=-9999;
1870  vars.m_gtruth_gw=-9999;
1871  vars.m_gtruth_gQ2=-9999;
1872  vars.m_gtruth_gq2=-9999;
1873  vars.m_gtruth_probe_pdg=0;
1874  vars.m_gtruth_probe_p4_x=-9999;
1875  vars.m_gtruth_probe_p4_y=-9999;
1876  vars.m_gtruth_probe_p4_z=-9999;
1877  vars.m_gtruth_probe_p4_E=-9999;
1878  vars.m_gtruth_hit_nuc_p4_x=-9999;
1879  vars.m_gtruth_hit_nuc_p4_y=-9999;
1880  vars.m_gtruth_hit_nuc_p4_z=-9999;
1881  vars.m_gtruth_hit_nuc_p4_E=-9999;
1882  vars.m_gtruth_hit_nuc_pos=-9999;
1883  vars.m_gtruth_fs_had_syst_p4_x=-9999;
1884  vars.m_gtruth_fs_had_syst_p4_y=-9999;
1885  vars.m_gtruth_fs_had_syst_p4_z=-9999;
1886  vars.m_gtruth_fs_had_syst_p4_E=-9999;
1887  }
void single_photon::ClearFlashes ( var_all &  vars)

Definition at line 412 of file init_branches.cxx.

412  {
413  vars.m_reco_num_flashes =0;
414  vars.m_reco_num_flashes_in_beamgate =0;
415  vars.m_reco_flash_total_pe.clear();
416  vars.m_reco_flash_time.clear();
417  vars.m_reco_flash_time_width.clear();
418  vars.m_reco_flash_abs_time.clear();
419  vars.m_reco_flash_frame.clear();
420  vars.m_reco_flash_ycenter.clear();
421  vars.m_reco_flash_ywidth.clear();
422  vars.m_reco_flash_zcenter.clear();
423  vars.m_reco_flash_zwidth.clear();
424  vars.m_reco_flash_total_pe_in_beamgate.clear();
425  vars.m_reco_flash_time_in_beamgate.clear();
426  vars.m_reco_flash_ycenter_in_beamgate.clear();
427  vars.m_reco_flash_zcenter_in_beamgate.clear();
428  vars.m_CRT_veto_nhits = -999;
429  vars.m_CRT_veto_hit_PE.clear();
430  vars.m_CRT_min_hit_time = -999;
431  vars.m_CRT_min_hit_PE = -999;
432  vars.m_CRT_min_hit_x = -999;
433  vars.m_CRT_min_hit_y = -999;
434  vars.m_CRT_min_hit_z = -999;
435  vars.m_CRT_hits_time.clear();
436  vars.m_CRT_hits_PE.clear();
437  vars.m_CRT_hits_x.clear();
438  vars.m_CRT_hits_y.clear();
439  vars.m_CRT_hits_z.clear();
440  vars.m_CRT_dt = -999;
441 
442  }
void single_photon::ClearGeant4Branches ( var_all &  vars)

: fill event weight related variables

Definition at line 2001 of file init_branches.cxx.

2001  {
2002 
2003  vars.m_geant4_pdg.clear();
2004  vars.m_geant4_trackid.clear();
2005  vars.m_geant4_mother.clear();
2006  vars.m_geant4_statuscode.clear();
2007  vars.m_geant4_E.clear();
2008  vars.m_geant4_mass.clear();
2009  vars.m_geant4_px.clear();
2010  vars.m_geant4_py.clear();
2011  vars.m_geant4_pz.clear();
2012  vars.m_geant4_dx.clear();
2013  vars.m_geant4_dy.clear();
2014  vars.m_geant4_dz.clear();
2015 
2016  vars.m_geant4_vx.clear();
2017  vars.m_geant4_vy.clear();
2018  vars.m_geant4_vz.clear();
2019  vars.m_geant4_process.clear();
2020  vars.m_geant4_end_process.clear();
2021 
2022  vars.m_geant4_costheta.clear();
2023  }
void single_photon::ClearIsolation ( var_all &  vars)

Definition at line 101 of file init_branches.cxx.

101  {
102  vars.m_isolation_min_dist_trk_shr.clear();
103  vars.m_isolation_min_dist_trk_unassoc.clear();
104 
105  vars.m_isolation_num_shr_hits_win_1cm_trk.clear();
106  vars.m_isolation_num_shr_hits_win_2cm_trk.clear();
107  vars.m_isolation_num_shr_hits_win_5cm_trk.clear();
108  vars.m_isolation_num_shr_hits_win_10cm_trk.clear();
109 
110  vars.m_isolation_num_unassoc_hits_win_1cm_trk.clear();
111  vars.m_isolation_num_unassoc_hits_win_2cm_trk.clear();
112  vars.m_isolation_num_unassoc_hits_win_5cm_trk.clear();
113  vars.m_isolation_num_unassoc_hits_win_10cm_trk.clear();
114 
115  vars.m_isolation_nearest_shr_hit_to_trk_wire.clear();
116  vars.m_isolation_nearest_shr_hit_to_trk_time.clear();
117 
118  vars.m_isolation_nearest_unassoc_hit_to_trk_wire.clear();
119  vars.m_isolation_nearest_unassoc_hit_to_trk_time.clear();
120  }
void single_photon::ClearMCTruths ( var_all &  vars)

Definition at line 1548 of file init_branches.cxx.

1548  {
1549  vars.m_mctruth_num = 0;
1550  vars.m_mctruth_origin = -99;
1551  vars.m_mctruth_mode = -99;
1552  vars.m_mctruth_interaction_type = -99;
1553  vars.m_mctruth_nu_vertex_x = -9999;
1554  vars.m_mctruth_nu_vertex_y = -9999;
1555  vars.m_mctruth_nu_vertex_z = -9999;
1556  vars.m_mctruth_reco_vertex_dist = -9999;
1557  vars.m_mctruth_ccnc = -99;
1558  vars.m_mctruth_qsqr = -99;
1559  vars.m_mctruth_nu_E = -99;
1560  vars.m_mctruth_nu_pdg = 0;
1561  vars.m_mctruth_lepton_pdg = 0;
1562  vars.m_mctruth_num_daughter_particles = -99;
1563  vars.m_mctruth_daughters_pdg.clear();
1564  vars.m_mctruth_daughters_E.clear();
1565 
1566  vars.m_mctruth_daughters_status_code.clear();
1567  vars.m_mctruth_daughters_trackID.clear();
1568  vars.m_mctruth_daughters_mother_trackID.clear();
1569  vars.m_mctruth_daughters_px.clear();
1570  vars.m_mctruth_daughters_py.clear();
1571  vars.m_mctruth_daughters_pz.clear();
1572  vars.m_mctruth_daughters_startx.clear();
1573  vars.m_mctruth_daughters_starty.clear();
1574  vars.m_mctruth_daughters_startz.clear();
1575  vars.m_mctruth_daughters_time.clear();
1576  vars.m_mctruth_daughters_endx.clear();
1577  vars.m_mctruth_daughters_endy.clear();
1578  vars.m_mctruth_daughters_endz.clear();
1579  vars.m_mctruth_daughters_endtime.clear();
1580  vars.m_mctruth_daughters_process.clear();
1581  vars.m_mctruth_daughters_end_process.clear();
1582 
1583 
1584  vars.m_mctruth_is_delta_radiative = 0;
1585  vars.m_mctruth_delta_radiative_1g1p_or_1g1n = -999;
1586 
1587  vars.m_mctruth_delta_photon_energy=-999;
1588  vars.m_mctruth_delta_proton_energy=-999;
1589  vars.m_mctruth_delta_neutron_energy=-999;
1590 
1591  vars.m_mctruth_num_exiting_photons =0;
1592  vars.m_mctruth_num_exiting_protons =0;
1593  vars.m_mctruth_num_exiting_pi0 =0;
1594  vars.m_mctruth_num_exiting_pipm =0;
1595  vars.m_mctruth_num_exiting_neutrons=0;
1596  vars.m_mctruth_num_exiting_delta0=0;
1597  vars.m_mctruth_num_exiting_deltapm=0;
1598  vars.m_mctruth_num_exiting_deltapp=0;
1599 
1600  vars.m_mctruth_num_reconstructable_protons = 0;
1601 
1602  vars.m_mctruth_is_reconstructable_1g1p = 0;
1603  vars.m_mctruth_is_reconstructable_1g0p = 0;
1604 
1605  vars.m_mctruth_leading_exiting_proton_energy = -9999;
1606 
1607  vars.m_mctruth_exiting_pi0_E.clear();
1608  vars.m_mctruth_exiting_pi0_mom.clear();
1609  vars.m_mctruth_exiting_pi0_px.clear();
1610  vars.m_mctruth_exiting_pi0_py.clear();
1611  vars.m_mctruth_exiting_pi0_pz.clear();
1612 
1613  vars.m_mctruth_pi0_leading_photon_energy = -9999;
1614  vars.m_mctruth_pi0_subleading_photon_energy = -9999;
1615  vars.m_mctruth_pi0_leading_photon_end_process = "none";
1616  vars.m_mctruth_pi0_subleading_photon_end_process = "none";
1617  vars.m_mctruth_pi0_leading_photon_end = {-9999,-9999,-9999};
1618  vars.m_mctruth_pi0_leading_photon_start = {-9999,-9999,-9999};
1619  vars.m_mctruth_pi0_subleading_photon_end = {-9999,-9999,-9999};
1620  vars.m_mctruth_pi0_subleading_photon_start = {-9999,-9999,-9999};
1621  vars.m_mctruth_pi0_leading_photon_exiting_TPC = -999;
1622  vars.m_mctruth_pi0_subleading_photon_exiting_TPC = -999;
1623  vars.m_mctruth_pi0_leading_photon_mom = {-9999,-9999,-9999};
1624  vars.m_mctruth_pi0_subleading_photon_mom = {-9999,-9999,-9999};
1625 
1626  vars.m_mctruth_exiting_delta0_num_daughters.clear();
1627 
1628  vars.m_mctruth_exiting_photon_mother_trackID.clear();
1629  vars.m_mctruth_exiting_photon_trackID.clear();
1630  vars.m_mctruth_exiting_photon_from_delta_decay.clear();
1631  vars.m_mctruth_exiting_photon_energy.clear();
1632  vars.m_mctruth_exiting_photon_px.clear();
1633  vars.m_mctruth_exiting_photon_py.clear();
1634  vars.m_mctruth_exiting_photon_pz.clear();
1635 
1636  vars.m_mctruth_exiting_proton_mother_trackID.clear();
1637  vars.m_mctruth_exiting_proton_trackID.clear();
1638  vars.m_mctruth_exiting_proton_from_delta_decay.clear();
1639  vars.m_mctruth_exiting_proton_energy.clear();
1640  vars.m_mctruth_exiting_proton_px.clear();
1641  vars.m_mctruth_exiting_proton_py.clear();
1642  vars.m_mctruth_exiting_proton_pz.clear();
1643 
1644  vars.m_mctruth_exiting_neutron_mother_trackID.clear();
1645  vars.m_mctruth_exiting_neutron_trackID.clear();
1646  vars.m_mctruth_exiting_neutron_from_delta_decay.clear();
1647  vars.m_mctruth_exiting_neutron_energy.clear();
1648  vars.m_mctruth_exiting_neutron_px.clear();
1649  vars.m_mctruth_exiting_neutron_py.clear();
1650  vars.m_mctruth_exiting_neutron_pz.clear();
1651  }
void single_photon::ClearMeta ( var_all &  vars)

: reset/clear data members

Definition at line 9 of file init_branches.cxx.

9  {
10  //------------ Event related Variables -------------
11  vars.m_event_number = -99;
12  vars.m_subrun_number = -99;
13  vars.m_run_number = -99;
14  vars.m_test_matched_hits = 0;
15 
16  vars.m_pot_per_event = 0;
17  vars.m_pot_per_subrun = vars.m_subrun_pot;
18  vars.m_number_of_events_in_subrun = 0;
19 
20  vars.m_genie_spline_weight = 1.0;
21 
22  //------------ Vertex related Variables -------------
23  vars.m_reco_vertex_size = 0;
24  vars.m_vertex_pos_x=-99999;
25  vars.m_vertex_pos_y=-99999;
26  vars.m_vertex_pos_z=-99999;
27  vars.m_vertex_pos_tick=-9999;
28  vars.m_vertex_pos_wire_p0=-9999;
29  vars.m_vertex_pos_wire_p1=-9999;
30  vars.m_vertex_pos_wire_p2=-9999;
31  vars.m_reco_vertex_in_SCB = -9999;
32  vars.m_reco_vertex_dist_to_SCB = -9999;
33  vars.m_reco_vertex_dist_to_active_TPC= -9999;
34  vars.m_reco_vertex_dist_to_CPA= -9999;
35 
36 // vars.m_reco_vertex_to_nearest_dead_wire_plane0=-99999;
37 // vars.m_reco_vertex_to_nearest_dead_wire_plane1=-99999;
38 // vars.m_reco_vertex_to_nearest_dead_wire_plane2=-99999;
39 
40  vars.m_reco_slice_objects = 0;
41  }
void single_photon::ClearSecondShowers ( var_all &  vars)

Definition at line 146 of file init_branches.cxx.

146  {
147  vars.m_sss_num_unassociated_hits=0;
148  vars.m_sss_num_unassociated_hits_below_threshold=0;
149  vars.m_sss_num_associated_hits=0;
150 
151  vars.m_sss_num_candidates = 0;
152 
153  vars.m_sss_candidate_in_nu_slice.clear();
154  vars.m_sss_candidate_num_hits.clear();
155  vars.m_sss_candidate_num_wires.clear();
156  vars.m_sss_candidate_num_ticks.clear();
157  vars.m_sss_candidate_plane.clear();
158  vars.m_sss_candidate_PCA.clear();
159  vars.m_sss_candidate_mean_ADC.clear();
160  vars.m_sss_candidate_ADC_RMS.clear();
161  vars.m_sss_candidate_impact_parameter.clear();
162  vars.m_sss_candidate_fit_slope.clear();
163  vars.m_sss_candidate_veto_score.clear();
164  vars.m_sss_candidate_fit_constant.clear();
165  vars.m_sss_candidate_mean_tick.clear();
166  vars.m_sss_candidate_max_tick.clear();
167  vars.m_sss_candidate_min_tick.clear();
168  vars.m_sss_candidate_min_wire.clear();
169  vars.m_sss_candidate_max_wire.clear();
170  vars.m_sss_candidate_mean_wire.clear();
171  vars.m_sss_candidate_min_dist.clear();
172  vars.m_sss_candidate_wire_tick_based_length.clear();
173  vars.m_sss_candidate_energy.clear();
174  vars.m_sss_candidate_angle_to_shower.clear();
175  vars.m_sss_candidate_closest_neighbour.clear();
176  vars.m_sss_candidate_matched.clear();
177  vars.m_sss_candidate_matched_energy_fraction_best_plane.clear();
178  vars.m_sss_candidate_pdg.clear();
179  vars.m_sss_candidate_parent_pdg.clear();
180  vars.m_sss_candidate_trackid.clear();
181  vars.m_sss_candidate_true_energy.clear();
182  vars.m_sss_candidate_overlay_fraction.clear();
183  vars.m_sss_candidate_remerge.clear();
184  }
void single_photon::ClearSecondShowers3D ( var_all &  vars)

Definition at line 186 of file init_branches.cxx.

186  {
187 
188  vars.m_sss3d_num_showers = 0;
189  vars.m_sss3d_shower_start_x.clear();
190  vars.m_sss3d_shower_start_y.clear();
191  vars.m_sss3d_shower_start_z.clear();
192  vars.m_sss3d_shower_dir_x.clear();
193  vars.m_sss3d_shower_dir_y.clear();
194  vars.m_sss3d_shower_dir_z.clear();
195  vars.m_sss3d_shower_length.clear();
196  vars.m_sss3d_shower_conversion_dist.clear();
197  vars.m_sss3d_shower_invariant_mass.clear();
198  vars.m_sss3d_shower_implied_invariant_mass.clear();
199  vars.m_sss3d_shower_impact_parameter.clear();
200  vars.m_sss3d_shower_energy_max.clear();
201  vars.m_sss3d_shower_score.clear();
202  vars.m_sss3d_slice_nu.clear();
203  vars.m_sss3d_slice_clear_cosmic.clear();
204  vars.m_sss3d_shower_ioc_ratio.clear();
205  }
void single_photon::ClearShowers ( var_all &  vars)

Definition at line 991 of file init_branches.cxx.

991  {
992  vars.m_reco_asso_showers=0;
993  vars.m_reco_shower_num_daughters.clear();
994  vars.m_reco_shower_daughter_trackscore.clear();
995 
996  vars.m_reco_shower3d_exists.clear();
997 
998  vars.m_reco_shower3d_startx.clear();
999  vars.m_reco_shower3d_starty.clear();
1000  vars.m_reco_shower3d_startz.clear();
1001  vars.m_reco_shower3d_dirx.clear();
1002  vars.m_reco_shower3d_diry.clear();
1003  vars.m_reco_shower3d_dirz.clear();
1004  vars.m_reco_shower3d_theta_yz.clear();
1005  vars.m_reco_shower3d_phi_yx.clear();
1006  vars.m_reco_shower3d_conversion_distance.clear();
1007  vars.m_reco_shower3d_impact_parameter.clear();
1008  vars.m_reco_shower3d_implied_dirx.clear();
1009  vars.m_reco_shower3d_implied_diry.clear();
1010  vars.m_reco_shower3d_implied_dirz.clear();
1011  vars.m_reco_shower3d_openingangle.clear();
1012  vars.m_reco_shower3d_length.clear();
1013 
1014  vars.m_reco_shower3d_energy_plane0.clear();
1015  vars.m_reco_shower3d_energy_plane1.clear();
1016  vars.m_reco_shower3d_energy_plane2.clear();
1017  vars.m_reco_shower3d_dEdx_plane0.clear();
1018  vars.m_reco_shower3d_dEdx_plane1.clear();
1019  vars.m_reco_shower3d_dEdx_plane2.clear();
1020 
1021 
1022  vars.m_reco_shower_startx.clear();
1023  vars.m_reco_shower_starty.clear();
1024  vars.m_reco_shower_start_dist_to_active_TPC.clear();
1025  vars.m_reco_shower_start_dist_to_CPA.clear();
1026  vars.m_reco_shower_start_dist_to_SCB.clear();
1027  vars.m_reco_shower_start_in_SCB.clear();
1028  vars.m_reco_shower_end_dist_to_active_TPC.clear();
1029  vars.m_reco_shower_end_dist_to_SCB.clear();
1030 
1031  vars.m_reco_shower_dirx.clear();
1032  vars.m_reco_shower_diry.clear();
1033  vars.m_reco_shower_dirz.clear();
1034  vars.m_reco_shower_theta_yz.clear();
1035  vars.m_reco_shower_phi_yx.clear();
1036  vars.m_reco_shower_conversion_distance.clear();
1037  vars.m_reco_shower_impact_parameter.clear();
1038  vars.m_reco_shower_implied_dirx.clear();
1039  vars.m_reco_shower_implied_diry.clear();
1040  vars.m_reco_shower_implied_dirz.clear();
1041  vars.m_reco_shower_openingangle.clear();
1042  vars.m_reco_shower_length.clear();
1043  vars.m_reco_shower_delaunay_num_triangles_plane0.clear();
1044  vars.m_reco_shower_delaunay_num_triangles_plane1.clear();
1045  vars.m_reco_shower_delaunay_num_triangles_plane2.clear();
1046  vars.m_reco_shower_num_hits_plane0.clear();
1047  vars.m_reco_shower_num_hits_plane1.clear();
1048  vars.m_reco_shower_num_hits_plane2.clear();
1049  vars.m_reco_shower_delaunay_area_plane0.clear();
1050  vars.m_reco_shower_delaunay_area_plane1.clear();
1051  vars.m_reco_shower_delaunay_area_plane2.clear();
1052 
1053  vars.m_reco_shower_kalman_exists.clear();
1054  vars.m_reco_shower_kalman_median_dEdx_plane0.clear();
1055  vars.m_reco_shower_kalman_median_dEdx_plane1.clear();
1056  vars.m_reco_shower_kalman_median_dEdx_plane2.clear();
1057  vars.m_reco_shower_kalman_median_dEdx_allplane.clear();
1058  vars.m_reco_shower_kalman_mean_dEdx_plane0.clear();
1059  vars.m_reco_shower_kalman_mean_dEdx_plane1.clear();
1060  vars.m_reco_shower_kalman_mean_dEdx_plane2.clear();
1061 
1062  vars.m_sim_shower_energy.clear();
1063  vars.m_sim_shower_matched.clear();
1064  vars.m_sim_shower_kinetic_energy.clear();
1065  vars.m_sim_shower_mass.clear();
1066  vars.m_sim_shower_pdg.clear();
1067  vars.m_sim_shower_trackID.clear();
1068  vars.m_sim_shower_parent_pdg.clear();
1069  vars.m_sim_shower_parent_trackID.clear();
1070  vars.m_sim_shower_origin.clear();
1071  vars.m_sim_shower_process.clear();
1072  vars.m_sim_shower_end_process.clear();
1073  vars.m_sim_shower_start_x.clear();
1074  vars.m_sim_shower_start_y.clear();
1075  vars.m_sim_shower_start_z.clear();
1076  vars.m_sim_shower_vertex_x.clear();
1077  vars.m_sim_shower_vertex_y.clear();
1078  vars.m_sim_shower_vertex_z.clear();
1079  vars.m_sim_shower_is_true_shower.clear();
1080  vars.m_sim_shower_best_matched_plane.clear();
1081  vars.m_sim_shower_matched_energy_fraction_plane0.clear();
1082  vars.m_sim_shower_matched_energy_fraction_plane1.clear();
1083  vars.m_sim_shower_matched_energy_fraction_plane2.clear();
1084  vars.m_sim_shower_overlay_fraction.clear();
1085  vars.m_sim_shower_px.clear();
1086  vars.m_sim_shower_py.clear();
1087  vars.m_sim_shower_pz.clear();
1088  vars.m_sim_shower_sliceId.clear();
1089  vars.m_sim_shower_nuscore.clear();
1090  vars.m_sim_shower_isclearcosmic.clear();
1091  vars.m_sim_shower_is_nuslice.clear();
1092 
1093 
1094 
1095  vars.m_reco_shower_ordered_energy_index.clear();
1096  vars.m_reco_shower_energy_max.clear();
1097  vars.m_reco_shower_energy_plane0.clear();
1098  vars.m_reco_shower_energy_plane1.clear();
1099  vars.m_reco_shower_energy_plane2.clear();
1100 
1101  vars.m_reco_shower_reclustered_energy_plane0.clear();
1102  vars.m_reco_shower_reclustered_energy_plane1.clear();
1103  vars.m_reco_shower_reclustered_energy_plane2.clear();
1104  vars.m_reco_shower_reclustered_energy_max.clear();
1105 
1106  vars.m_reco_shower_plane0_nhits.clear();
1107  vars.m_reco_shower_plane1_nhits.clear();
1108  vars.m_reco_shower_plane2_nhits.clear();
1109  vars.m_reco_shower_plane0_meanRMS.clear();
1110  vars.m_reco_shower_plane1_meanRMS.clear();
1111  vars.m_reco_shower_plane2_meanRMS.clear();
1112 
1113  vars.m_reco_shower_hit_tick.clear();
1114  vars.m_reco_shower_hit_wire.clear();
1115  vars.m_reco_shower_hit_plane.clear();
1116  vars.m_reco_shower_spacepoint_x.clear();
1117  vars.m_reco_shower_spacepoint_y.clear();
1118  vars.m_reco_shower_spacepoint_z.clear();
1119 
1120 
1121  vars.m_reco_shower_dQdx_plane0.clear();
1122  vars.m_reco_shower_dQdx_plane2.clear();
1123  vars.m_reco_shower_dQdx_plane2.clear();
1124  vars.m_reco_shower_dEdx_plane0.clear();
1125  vars.m_reco_shower_dEdx_plane1.clear();
1126  vars.m_reco_shower_dEdx_plane2.clear();
1127  vars.m_reco_shower_dEdx_plane0_median.clear();
1128  vars.m_reco_shower_dEdx_plane1_median.clear();
1129  vars.m_reco_shower_dEdx_plane2_median.clear();
1130 
1131  vars.m_reco_shower_angle_wrt_wires_plane0.clear();
1132  vars.m_reco_shower_angle_wrt_wires_plane1.clear();
1133  vars.m_reco_shower_angle_wrt_wires_plane2.clear();
1134 
1135  vars.m_reco_shower_dEdx_amalgamated.clear();
1136  vars.m_reco_shower_dEdx_amalgamated_nhits.clear();
1137 
1138 
1139  vars.m_reco_shower_dQdx_plane0_median.clear();
1140  vars.m_reco_shower_dQdx_plane1_median.clear();
1141  vars.m_reco_shower_dQdx_plane2_median.clear();
1142 
1143  vars.m_reco_shower_dEdx_plane0_mean.clear();
1144  vars.m_reco_shower_dEdx_plane1_mean.clear();
1145  vars.m_reco_shower_dEdx_plane2_mean.clear();
1146  vars.m_reco_shower_dEdx_plane0_max.clear();
1147  vars.m_reco_shower_dEdx_plane1_max.clear();
1148  vars.m_reco_shower_dEdx_plane2_max.clear();
1149  vars.m_reco_shower_dEdx_plane0_min.clear();
1150  vars.m_reco_shower_dEdx_plane1_min.clear();
1151  vars.m_reco_shower_dEdx_plane2_min.clear();
1152 
1153  vars.m_reco_shower_dEdx_plane0_nhits.clear();
1154  vars.m_reco_shower_dEdx_plane1_nhits.clear();
1155  vars.m_reco_shower_dEdx_plane2_nhits.clear();
1156 
1157 // vars.m_reco_shower_start_to_nearest_dead_wire_plane0.clear();
1158 // vars.m_reco_shower_start_to_nearest_dead_wire_plane1.clear();
1159 // vars.m_reco_shower_start_to_nearest_dead_wire_plane2.clear();
1160 
1161  vars.m_reco_shower_flash_shortest_distz.clear();
1162  vars.m_reco_shower_flash_shortest_index_z.clear();
1163  vars.m_reco_shower_flash_shortest_disty.clear();
1164  vars.m_reco_shower_flash_shortest_index_y.clear();
1165 
1166  vars.m_reco_shower_flash_shortest_distyz.clear();
1167  vars.m_reco_shower_flash_shortest_index_yz.clear();
1168 
1169  vars.m_reco_shower_sliceId.clear();
1170  vars.m_reco_shower_nuscore.clear();
1171  vars.m_reco_shower_isclearcosmic.clear();
1172  vars.m_reco_shower_is_nuslice.clear();
1173  vars.m_reco_shower_trackscore.clear();
1174  vars.m_reco_shower_pfparticle_pdg.clear();
1175 
1176  }
void single_photon::ClearSlices ( var_all &  vars)

Definition at line 2050 of file init_branches.cxx.

2050  {
2051  vars.m_reco_slice_num = 0;
2052  vars.m_reco_slice_nuscore.clear();
2053  vars.m_matched_signal_shower_overlay_fraction.clear();
2054  //std::vector<double> vars.m_matched_signal_shower_conversion_length;
2055  vars.m_matched_signal_shower_true_E.clear();
2056  vars.m_matched_signal_shower_nuscore.clear();
2057  vars.m_matched_signal_shower_sliceId.clear();
2058  vars.m_matched_signal_shower_is_clearcosmic.clear();
2059  vars.m_matched_signal_shower_num = 0;
2060  vars.m_matched_signal_shower_is_nuslice.clear();
2061  vars.m_matched_signal_shower_tracks_in_slice.clear();
2062  vars.m_matched_signal_shower_showers_in_slice.clear();
2063 
2064  vars.m_reco_slice_num_pfps.clear();
2065  vars.m_reco_slice_num_showers.clear();
2066  vars.m_reco_slice_num_tracks.clear();
2067 
2068 
2069  vars.m_matched_signal_track_true_E.clear();
2070  vars.m_matched_signal_track_nuscore.clear();
2071  vars.m_matched_signal_track_sliceId.clear();
2072  vars.m_matched_signal_track_is_clearcosmic.clear();
2073  vars.m_matched_signal_track_is_nuslice.clear();
2074  vars.m_matched_signal_track_tracks_in_slice.clear();
2075  vars.m_matched_signal_track_showers_in_slice.clear();
2076 
2077 
2078  vars.m_matched_signal_track_num = 0;
2079 
2080 
2081  //int vars.m_matched_signal_total_num_slices;
2082 
2083  vars.m_reco_1g1p_is_same_slice = false;
2084  vars.m_reco_1g1p_is_multiple_slices = false;
2085  vars.m_reco_1g1p_is_nuslice = false;
2086  vars.m_reco_1g0p_is_nuslice = false;
2087  vars.m_reco_1g1p_nuscore = -999;
2088  vars.m_reco_1g0p_nuscore = -999;
2089  vars.m_is_matched_1g1p = false;
2090  vars.m_is_matched_1g0p = false;
2091  vars.m_no_matched_showers = false;
2092  vars.m_multiple_matched_showers = false;
2093  vars.m_multiple_matched_tracks = false;
2094 
2095 
2096  /* vars.m_reco_slice_shower_num_matched_signal = -999;
2097  vars.m_reco_slice_track_num_matched_signal = -999;
2098  vars.m_reco_slice_shower_matched_sliceId.clear();
2099  vars.m_reco_slice_track_matched_sliceId.clear();
2100  vars.m_reco_slice_shower_matched_energy.clear();
2101  vars.m_reco_slice_track_matched_energy.clear();
2102  vars.m_reco_slice_shower_matched_conversion.clear();
2103  vars.m_reco_slice_shower_matched_overlay_frac.clear();
2104  */
2105  }
void single_photon::ClearStubs ( var_all &  vars)

Definition at line 207 of file init_branches.cxx.

207  {
208  vars.m_trackstub_num_unassociated_hits = 0;
209  vars.m_trackstub_unassociated_hits_below_threshold = 0;
210  vars.m_trackstub_associated_hits=0;
211  vars.m_trackstub_num_candidates=0;
212  vars.m_trackstub_candidate_in_nu_slice.clear();
213  vars.m_trackstub_candidate_num_hits.clear();
214  vars.m_trackstub_candidate_num_wires.clear();
215  vars.m_trackstub_candidate_num_ticks.clear();
216  vars.m_trackstub_candidate_plane.clear();
217  vars.m_trackstub_candidate_PCA.clear();
218  vars.m_trackstub_candidate_mean_ADC.clear();
219  vars.m_trackstub_candidate_ADC_RMS.clear();
220  vars.m_trackstub_candidate_veto_score.clear();
221  vars.m_trackstub_candidate_mean_tick.clear();
222  vars.m_trackstub_candidate_max_tick.clear();
223  vars.m_trackstub_candidate_min_tick.clear();
224  vars.m_trackstub_candidate_min_wire.clear();
225  vars.m_trackstub_candidate_max_wire.clear();
226  vars.m_trackstub_candidate_mean_wire.clear();
227  vars.m_trackstub_candidate_min_dist.clear();
228  vars.m_trackstub_candidate_min_impact_parameter_to_shower.clear();
229  vars.m_trackstub_candidate_min_conversion_dist_to_shower_start.clear();
230  vars.m_trackstub_candidate_min_ioc_to_shower_start.clear();
231  vars.m_trackstub_candidate_ioc_based_length.clear();
232  vars.m_trackstub_candidate_wire_tick_based_length.clear();
233  vars.m_trackstub_candidate_mean_ADC_first_half.clear();
234  vars.m_trackstub_candidate_mean_ADC_second_half.clear();
235  vars.m_trackstub_candidate_mean_ADC_first_to_second_ratio.clear();
236  vars.m_trackstub_candidate_track_angle_wrt_shower_direction.clear();
237  vars.m_trackstub_candidate_linear_fit_chi2.clear();
238  vars.m_trackstub_candidate_energy.clear();
239  vars.m_trackstub_candidate_remerge.clear();
240  vars.m_trackstub_candidate_matched.clear();
241  vars.m_trackstub_candidate_matched_energy_fraction_best_plane.clear();
242  vars.m_trackstub_candidate_pdg.clear();
243  vars.m_trackstub_candidate_parent_pdg.clear();
244  vars.m_trackstub_candidate_trackid.clear();
245  vars.m_trackstub_candidate_true_energy.clear();
246  vars.m_trackstub_candidate_overlay_fraction.clear();
247 
248  vars.m_trackstub_num_candidate_groups = 0;
249  vars.m_grouped_trackstub_candidate_indices.clear();
250  vars.m_trackstub_candidate_group_timeoverlap_fraction.clear();
251  }
void single_photon::ClearTracks ( var_all &  vars)

Definition at line 502 of file init_branches.cxx.

502  {
503  vars.m_reco_asso_tracks=0;
504  vars.m_reco_track_length.clear();
505  vars.m_reco_track_num_daughters.clear();
506  vars.m_reco_track_daughter_trackscore.clear();
507  vars.m_reco_track_dirx.clear();
508  vars.m_reco_track_diry.clear();
509  vars.m_reco_track_dirz.clear();
510  vars.m_reco_track_startx.clear();
511  vars.m_reco_track_starty.clear();
512  vars.m_reco_track_startz.clear();
513  vars.m_reco_track_endx.clear();
514  vars.m_reco_track_endy.clear();
515  vars.m_reco_track_endz.clear();
516  vars.m_reco_track_end_dist_to_active_TPC.clear();
517  vars.m_reco_track_start_dist_to_active_TPC.clear();
518  vars.m_reco_track_end_dist_to_CPA.clear();
519  vars.m_reco_track_start_dist_to_CPA.clear();
520  vars.m_reco_track_end_dist_to_SCB.clear();
521  vars.m_reco_track_start_dist_to_SCB.clear();
522  vars.m_reco_track_end_in_SCB.clear();
523  vars.m_reco_track_start_in_SCB.clear();
524 
525  vars.m_reco_track_theta_yz.clear();
526  vars.m_reco_track_phi_yx.clear();
527 
528  vars.m_reco_track_calo_energy_plane0.clear();
529  vars.m_reco_track_calo_energy_plane1.clear();
530  vars.m_reco_track_calo_energy_plane2.clear();
531  vars.m_reco_track_calo_energy_max.clear();
532 
533  vars.m_reco_track_num_trajpoints.clear();
534  vars.m_reco_track_num_spacepoints.clear();
535  vars.m_reco_track_proton_kinetic_energy.clear();
536  vars.m_reco_track_ordered_energy_index.clear();
537  vars.m_reco_track_ordered_displacement_index.clear();
538 
539  vars.m_reco_track_spacepoint_principal0.clear();
540  vars.m_reco_track_spacepoint_principal1.clear();
541  vars.m_reco_track_spacepoint_principal2.clear();
542 
543  vars.m_reco_track_spacepoint_chi.clear();
544  vars.m_reco_track_spacepoint_max_dist.clear();
545 
546  vars.m_reco_track_best_calo_plane.clear();
547 
548  vars.m_reco_track_mean_dEdx_best_plane.clear();
549  vars.m_reco_track_mean_dEdx_start_half_best_plane.clear();
550  vars.m_reco_track_mean_dEdx_end_half_best_plane.clear();
551  vars.m_reco_track_good_calo_best_plane.clear();
552  vars.m_reco_track_trunc_dEdx_best_plane.clear();
553  vars.m_reco_track_mean_trunc_dEdx_best_plane.clear();
554  vars.m_reco_track_mean_trunc_dEdx_start_half_best_plane.clear();
555  vars.m_reco_track_mean_trunc_dEdx_end_half_best_plane.clear();
556  vars.m_reco_track_trunc_PIDA_best_plane.clear();
557  vars.m_reco_track_resrange_best_plane.clear();
558  vars.m_reco_track_dEdx_best_plane.clear();
559 
560 
561  vars.m_reco_track_mean_dEdx_p0.clear();
562  vars.m_reco_track_mean_dEdx_start_half_p0.clear();
563  vars.m_reco_track_mean_dEdx_end_half_p0.clear();
564  vars.m_reco_track_good_calo_p0.clear();
565  vars.m_reco_track_trunc_dEdx_p0.clear();
566  vars.m_reco_track_mean_trunc_dEdx_p0.clear();
567  vars.m_reco_track_mean_trunc_dEdx_start_half_p0.clear();
568  vars.m_reco_track_mean_trunc_dEdx_end_half_p0.clear();
569  vars.m_reco_track_trunc_PIDA_p0.clear();
570  vars.m_reco_track_resrange_p0.clear();
571  vars.m_reco_track_dEdx_p0.clear();
572 
573  vars.m_reco_track_mean_dEdx_p1.clear();
574  vars.m_reco_track_mean_dEdx_start_half_p1.clear();
575  vars.m_reco_track_mean_dEdx_end_half_p1.clear();
576  vars.m_reco_track_good_calo_p1.clear();
577  vars.m_reco_track_trunc_dEdx_p1.clear();
578  vars.m_reco_track_mean_trunc_dEdx_p1.clear();
579  vars.m_reco_track_mean_trunc_dEdx_start_half_p1.clear();
580  vars.m_reco_track_mean_trunc_dEdx_end_half_p1.clear();
581  vars.m_reco_track_trunc_PIDA_p1.clear();
582  vars.m_reco_track_resrange_p1.clear();
583  vars.m_reco_track_dEdx_p1.clear();
584 
585  vars.m_reco_track_mean_dEdx_p2.clear();
586  vars.m_reco_track_mean_dEdx_start_half_p2.clear();
587  vars.m_reco_track_mean_dEdx_end_half_p2.clear();
588  vars.m_reco_track_good_calo_p2.clear();
589  vars.m_reco_track_trunc_dEdx_p2.clear();
590  vars.m_reco_track_mean_trunc_dEdx_p2.clear();
591  vars.m_reco_track_mean_trunc_dEdx_start_half_p2.clear();
592  vars.m_reco_track_mean_trunc_dEdx_end_half_p2.clear();
593  vars.m_reco_track_trunc_PIDA_p2.clear();
594  vars.m_reco_track_resrange_p2.clear();
595  vars.m_reco_track_dEdx_p2.clear();
596 
597  vars.m_reco_track_num_calo_hits_p1.clear();
598  vars.m_reco_track_num_calo_hits_p0.clear();
599  vars.m_reco_track_num_calo_hits_p2.clear();
600 
601  vars.m_sim_track_matched.clear();
602  vars.m_sim_track_overlay_fraction.clear();
603  vars.m_sim_track_energy.clear();
604  vars.m_sim_track_kinetic_energy.clear();
605  vars.m_sim_track_mass.clear();
606  vars.m_sim_track_pdg.clear();
607  vars.m_sim_track_origin.clear();
608  vars.m_sim_track_parent_pdg.clear();
609  vars.m_sim_track_process.clear();
610  vars.m_sim_track_startx.clear();
611  vars.m_sim_track_starty.clear();
612  vars.m_sim_track_startz.clear();
613  vars.m_sim_track_endx.clear();
614  vars.m_sim_track_endy.clear();
615  vars.m_sim_track_endz.clear();
616  vars.m_sim_track_length.clear();
617 
618  vars.m_sim_track_px.clear();
619  vars.m_sim_track_py.clear();
620  vars.m_sim_track_pz.clear();
621  vars.m_sim_track_trackID.clear();
622 
623  // PID
624  vars.m_reco_track_pid_bragg_likelihood_mu_plane0.clear();
625  vars.m_reco_track_pid_bragg_likelihood_mu_plane1.clear();
626  vars.m_reco_track_pid_bragg_likelihood_mu_plane2.clear();
627  vars.m_reco_track_pid_bragg_likelihood_p_plane0.clear();
628  vars.m_reco_track_pid_bragg_likelihood_p_plane1.clear();
629  vars.m_reco_track_pid_bragg_likelihood_p_plane2.clear();
630  vars.m_reco_track_pid_bragg_likelihood_mip_plane0.clear();
631  vars.m_reco_track_pid_bragg_likelihood_mip_plane1.clear();
632  vars.m_reco_track_pid_bragg_likelihood_mip_plane2.clear();
633  vars.m_reco_track_pid_chi2_mu_plane0.clear();
634  vars.m_reco_track_pid_chi2_mu_plane1.clear();
635  vars.m_reco_track_pid_chi2_mu_plane2.clear();
636  vars.m_reco_track_pid_chi2_p_plane0.clear();
637  vars.m_reco_track_pid_chi2_p_plane1.clear();
638  vars.m_reco_track_pid_chi2_p_plane2.clear();
639  vars.m_reco_track_pid_pida_plane0.clear();
640  vars.m_reco_track_pid_pida_plane1.clear();
641  vars.m_reco_track_pid_pida_plane2.clear();
642  vars.m_reco_track_pid_three_plane_proton_pid.clear();
643 
644 // vars.m_reco_track_end_to_nearest_dead_wire_plane0.clear();
645 // vars.m_reco_track_end_to_nearest_dead_wire_plane1.clear();
646 // vars.m_reco_track_end_to_nearest_dead_wire_plane2.clear();
647 
648  vars.m_reco_track_sliceId.clear();
649  vars.m_reco_track_nuscore.clear();
650  vars.m_reco_track_isclearcosmic.clear();
651  vars.m_reco_track_trackscore.clear();
652  vars.m_reco_track_pfparticle_pdg.clear();
653  vars.m_reco_track_is_nuslice.clear();
654 
655  vars.m_sim_track_sliceId.clear();
656  vars.m_sim_track_nuscore.clear();
657  vars.m_sim_track_isclearcosmic.clear();
658  }
std::pair< bool, std::vector< double > > single_photon::clusterCandidateOverlap ( const std::vector< int > &  candidate_indices,
const std::vector< int > &  cluster_planes,
const std::vector< double > &  cluster_max_ticks,
const std::vector< double > &  cluster_min_ticks 
)

Definition at line 998 of file second_shower_search.cxx.

998  {
999 
1000  size_t size = candidate_indices.size();
1001  if(size == 0){
1002  throw std::runtime_error("clusterCandidateOverlap: No cluster candidates to analyze time overlap for..");
1003  }
1004 
1005  // at most 3 cluster indices (for 3 planes)
1006  std::vector<int> planes;
1007  std::vector<double> max_ticks;
1008  std::vector<double> min_ticks;
1009  std::vector<double> tick_length;
1010 
1011  for(auto i : candidate_indices){
1012  planes.push_back(cluster_planes[i]);
1013 
1014  max_ticks.push_back(cluster_max_ticks[i]);
1015  min_ticks.push_back(cluster_min_ticks[i]);
1016  tick_length.push_back(cluster_max_ticks[i] - cluster_min_ticks[i]);
1017  }
1018 
1019 
1020  //if candidates are not on different planes
1021  if( size == 2 && planes[0] == planes[1])
1022  return {false, std::vector<double>(2, -1.0)};
1023  if( size == 3 && (planes[0] == planes[1] || planes[1] == planes[2] || planes[0] == planes[2]))
1024  return {false, std::vector<double>(3, -1.0)};
1025 
1026  //calculate the overlapping tick-span
1027  double tick_overlap = DBL_MAX;
1028 
1029  //can be simplied as picking the minimum max_tick and maximum min_tick and do the subtraction
1030  for(auto max_e : max_ticks)
1031  for(auto min_e : min_ticks)
1032  if(max_e - min_e < tick_overlap)
1033  tick_overlap = max_e - min_e;
1034 
1035  // if tick overlap is negative, meaning these clusters are not overlapping
1036  if(tick_overlap < 0)
1037  return {false, std::vector<double>(size, -1.0)};
1038  else{
1039  std::vector<double> overlap_fraction;
1040  for(auto l: tick_length){
1041  overlap_fraction.push_back( l==0? 1.0 : tick_overlap/l);
1042  }
1043  return {true, overlap_fraction};
1044  }
1045  }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
BEGIN_PROLOG Z planes
void single_photon::CollectMCParticles ( const art::Event &  evt,
const std::string &  label,
std::map< art::Ptr< simb::MCTruth >, std::vector< art::Ptr< simb::MCParticle >>> &  truthToParticles,
std::map< art::Ptr< simb::MCParticle >, art::Ptr< simb::MCTruth >> &  particlesToTruth,
std::map< int, art::Ptr< simb::MCParticle > > &  MCParticleToTrackIdMap,
var_all &  vars 
)

Definition at line 96 of file Processors.cxx.

102  {
103 
104  // if (evt.isRealData())
105  // throw cet::exception("LArPandora") << " PandoraCollector::CollectMCParticles --- Trying to access MC truth from real data ";
106 
107  art::Handle< std::vector< simb::MCParticle> > theParticles;
108  evt.getByLabel(label, theParticles);
109 
110  if (!theParticles.isValid())
111  {
112  mf::LogDebug("LArPandora") << " Failed to find MC particles... " << std::endl;
113  return;
114  }
115  else
116  {
117  mf::LogDebug("LArPandora") << " Found: " << theParticles->size() << " MC particles " << std::endl;
118  }
119 
120  art::FindOneP<simb::MCTruth> theTruthAssns(theParticles, evt, label);
121 
122  for (unsigned int i = 0, iEnd = theParticles->size(); i < iEnd; ++i)
123  {
124  const art::Ptr<simb::MCParticle> particle(theParticles, i);
125  const art::Ptr<simb::MCTruth> truth(theTruthAssns.at(i));
126  truthToParticles[truth].push_back(particle);
127  particlesToTruth[particle] = truth;
128  MCParticleToTrackIdMap[particle->TrackId()] = particle;
129  }
130 
131  // std::cout<<"CollectMCParticles() \t||\t the number of MCParticles in the event is "<<theParticles->size()<<std::endl;
132  }
TCEvent evt
Definition: DataStructs.cxx:8
void single_photon::CollectPID ( std::vector< art::Ptr< recob::Track >> &  tracks,
std::vector< PandoraPFParticle >  all_PPFPs,
var_all &  vars 
)

Definition at line 613 of file analyze_PandoraReco.cxx.

614  {
615 
616  for(size_t i_trk=0; i_trk<tracks.size(); ++i_trk){
617  art::Ptr<recob::Track> track = tracks[i_trk];
618 
619  PandoraPFParticle* ppfp = PPFP_GetPPFPFromTrack(all_PPFPs, track);
620  art::Ptr<anab::ParticleID> pid = ppfp->get_ParticleID();//trackToPIDMap[track];
621  if (!ppfp->get_HasPID()) {
622  std::cout << "[analyze_Tracks] bad PID object" << std::endl;
623  continue;
624  }
625 
626  // For each PID object, create vector of PID scores for each algorithm
627  // Loop over this and get scores for algorithm of choice
628  // But first, prepare garbage values, just in case
629  std::vector<anab::sParticleIDAlgScores> AlgScoresVec = pid->ParticleIDAlgScores();
630  double pidScore_BL_mu_plane0 = -999;
631  double pidScore_BL_mu_plane1 = -999;
632  double pidScore_BL_mu_plane2 = -999;
633  double pidScore_BL_p_plane0 = -999;
634  double pidScore_BL_p_plane1 = -999;
635  double pidScore_BL_p_plane2 = -999;
636  double pidScore_BL_mip_plane0 = -999;
637  double pidScore_BL_mip_plane1 = -999;
638  double pidScore_BL_mip_plane2 = -999;
639  double pidScore_PIDA_plane0 = -999;
640  double pidScore_PIDA_plane1 = -999;
641  double pidScore_PIDA_plane2 = -999;
642  double pidScore_chi2_mu_plane0 = -999;
643  double pidScore_chi2_mu_plane1 = -999;
644  double pidScore_chi2_mu_plane2 = -999;
645  double pidScore_chi2_p_plane0 = -999;
646  double pidScore_chi2_p_plane1 = -999;
647  double pidScore_chi2_p_plane2 = -999;
648  double pidScore_three_plane_proton = -999;
649 
650  //int planeid = 2;
651  for (size_t i_algscore=0; i_algscore<AlgScoresVec.size(); i_algscore++) {
652 
653  anab::sParticleIDAlgScores AlgScore = AlgScoresVec.at(i_algscore);
654  //int planeid = UBPID::uB_getSinglePlane(AlgScore.fPlaneID);
655  int planeid = 0;//CHECK UBPID::uB_getSinglePlane(AlgScore.fPlaneMask);
656  std::cout<<"WARNING: planeid is not set properly; so please check if you think this section matters"<<std::endl;
657  /*
658  if (planeid != 2){
659  std::cout << "[ParticleIDValidation] Not using information for plane "
660  << planeid << " (using plane 2 calorimetry only)" << std::endl;
661  continue;
662  }
663  */
664  if (AlgScore.fAlgName == "BraggPeakLLH" && anab::kVariableType(AlgScore.fVariableType) == anab::kLikelihood){
665  if (TMath::Abs(AlgScore.fAssumedPdg == 13)) {
666  if (planeid == 0) pidScore_BL_mu_plane0 = AlgScore.fValue; //AlgScore.fValue: value produced by algorithm
667  if (planeid == 1) pidScore_BL_mu_plane1 = AlgScore.fValue;
668  if (planeid == 2) pidScore_BL_mu_plane2 = AlgScore.fValue;
669  }
670  if (TMath::Abs(AlgScore.fAssumedPdg == 2212)) {
671  if (planeid == 0) pidScore_BL_p_plane0 = AlgScore.fValue;
672  if (planeid == 1) pidScore_BL_p_plane1 = AlgScore.fValue;
673  if (planeid == 2) pidScore_BL_p_plane2 = AlgScore.fValue;
674  }
675  if (TMath::Abs(AlgScore.fAssumedPdg == 0)) {
676  if (planeid == 0) pidScore_BL_mip_plane0 = AlgScore.fValue;
677  if (planeid == 1) pidScore_BL_mip_plane1 = AlgScore.fValue;
678  if (planeid == 2) pidScore_BL_mip_plane2 = AlgScore.fValue;
679  }
680  }
681  if (AlgScore.fAlgName == "Chi2" && anab::kVariableType(AlgScore.fVariableType) == anab::kGOF){
682  if (TMath::Abs(AlgScore.fAssumedPdg == 13)) {
683  if (planeid == 0) pidScore_chi2_mu_plane0 = AlgScore.fValue;
684  if (planeid == 1) pidScore_chi2_mu_plane1 = AlgScore.fValue;
685  if (planeid == 2) pidScore_chi2_mu_plane2 = AlgScore.fValue;
686  }
687  if (TMath::Abs(AlgScore.fAssumedPdg == 2212)) {
688  if (planeid == 0) pidScore_chi2_p_plane0 = AlgScore.fValue;
689  if (planeid == 1) pidScore_chi2_p_plane1 = AlgScore.fValue;
690  if (planeid == 2) pidScore_chi2_p_plane2 = AlgScore.fValue;
691  }
692  }
693  if (AlgScore.fAlgName == "PIDA_mean" && anab::kVariableType(AlgScore.fVariableType) == anab::kPIDA){
694  if (planeid == 0) pidScore_PIDA_plane0 = AlgScore.fValue;
695  if (planeid == 1) pidScore_PIDA_plane1 = AlgScore.fValue;
696  if (planeid == 2) pidScore_PIDA_plane2 = AlgScore.fValue;
697  }
698  //CHECK if (AlgScore.fAlgName == "ThreePlaneProtonPID" && anab::kVariableType(AlgScore.fVariableType) == anab::kLikelihood && TMath::Abs(AlgScore.fAssumedPdg) == 2212 && AlgScore.fPlaneMask == UBPID::uB_SinglePlaneGetBitset(2) ){}
699  if (AlgScore.fAlgName == "ThreePlaneProtonPID" && anab::kVariableType(AlgScore.fVariableType) == anab::kLikelihood && TMath::Abs(AlgScore.fAssumedPdg) == 2212 && AlgScore.fPlaneMask == 0 ){
700  //if (AlgScore.fAlgName == "ThreePlaneProtonPID" && anab::kVariableType(AlgScore.fVariableType) == anab::kLikelihood && TMath::Abs(AlgScore.fAssumedPdg) == 2212 && AlgScore.fPlaneMask == UBPID::uB_SinglePlaneGetBitset(2) && anab::kTrackDir(AlgScore.fTrackDir) == anab::kForward){}
701  pidScore_three_plane_proton = AlgScore.fValue;
702  }
703  } // end looping over AlgScoresVec
704 
705  vars.m_reco_track_pid_bragg_likelihood_mu_plane0[i_trk] = pidScore_BL_mu_plane0;
706  vars.m_reco_track_pid_bragg_likelihood_mu_plane1[i_trk] = pidScore_BL_mu_plane1;
707  vars.m_reco_track_pid_bragg_likelihood_mu_plane2[i_trk] = pidScore_BL_mu_plane2;
708  vars.m_reco_track_pid_bragg_likelihood_p_plane0[i_trk] = pidScore_BL_p_plane0;
709  vars.m_reco_track_pid_bragg_likelihood_p_plane1[i_trk] = pidScore_BL_p_plane1;
710  vars.m_reco_track_pid_bragg_likelihood_p_plane2[i_trk] = pidScore_BL_p_plane2;
711  vars.m_reco_track_pid_bragg_likelihood_mip_plane0[i_trk] = pidScore_BL_mip_plane0;
712  vars.m_reco_track_pid_bragg_likelihood_mip_plane1[i_trk] = pidScore_BL_mip_plane1;
713  vars.m_reco_track_pid_bragg_likelihood_mip_plane2[i_trk] = pidScore_BL_mip_plane2;
714  vars.m_reco_track_pid_chi2_mu_plane0[i_trk] = pidScore_chi2_mu_plane0;
715  vars.m_reco_track_pid_chi2_mu_plane1[i_trk] = pidScore_chi2_mu_plane1;
716  vars.m_reco_track_pid_chi2_mu_plane2[i_trk] = pidScore_chi2_mu_plane2;
717  vars.m_reco_track_pid_chi2_p_plane0[i_trk] = pidScore_chi2_p_plane0;
718  vars.m_reco_track_pid_chi2_p_plane1[i_trk] = pidScore_chi2_p_plane1;
719  vars.m_reco_track_pid_chi2_p_plane2[i_trk] = pidScore_chi2_p_plane2;
720  vars.m_reco_track_pid_pida_plane0[i_trk] = pidScore_PIDA_plane0;
721  vars.m_reco_track_pid_pida_plane1[i_trk] = pidScore_PIDA_plane1;
722  vars.m_reco_track_pid_pida_plane2[i_trk] = pidScore_PIDA_plane2;
723  vars.m_reco_track_pid_three_plane_proton_pid[i_trk] = pidScore_three_plane_proton;
724 
725  }
726  return;
727  }
process_name use argoneut_mc_hitfinder track
float fValue
Result of Particle ID algorithm/test.
Definition: ParticleID.h:28
std::bitset< 8 > fPlaneMask
Bitset for PlaneID used by algorithm, allowing for multiple planes and up to 8 total planes...
Definition: ParticleID.h:29
std::string fAlgName
&lt; determined particle ID
Definition: ParticleID.h:23
kVariableType fVariableType
Variable type enum: defined in ParticleID_VariableTypeEnums.h. Set to kNotSet by default.
Definition: ParticleID.h:24
PandoraPFParticle * PPFP_GetPPFPFromTrack(std::vector< PandoraPFParticle > &PPFPs, art::Ptr< recob::Track > pTrack)
BEGIN_PROLOG could also be cout
int fAssumedPdg
PDG of particle hypothesis assumed by algorithm, if applicable. Set to 0 by default.
Definition: ParticleID.h:27
void single_photon::CollectSimChannels ( const art::Event &  evt,
const std::string &  label,
std::vector< art::Ptr< sim::SimChannel > > &  simChannelVector 
)

Definition at line 134 of file Processors.cxx.

135  {
136  if (evt.isRealData())
137  throw cet::exception("LArPandora") << " PandoraCollector::CollectSimChannels --- Trying to access MC truth from real data ";
138 
139  art::Handle< std::vector<sim::SimChannel> > theSimChannels;
140  evt.getByLabel(label, theSimChannels);
141 
142  if (!theSimChannels.isValid())
143  {
144  mf::LogDebug("LArPandora") << " Failed to find sim channels... " << std::endl;
145  return;
146  }
147  else
148  {
149  mf::LogDebug("LArPandora") << " Found: " << theSimChannels->size() << " SimChannels " << std::endl;
150  }
151 
152  for (unsigned int i = 0; i < theSimChannels->size(); ++i)
153  {
154  const art::Ptr<sim::SimChannel> channel(theSimChannels, i);
155  simChannelVector.push_back(channel);
156  }
157  }
TCEvent evt
Definition: DataStructs.cxx:8
int single_photon::CompareToShowers ( int  p,
int  cl,
std::vector< art::Ptr< recob::Hit >> &  hitz,
double  vertex_wire,
double  vertex_tick,
const std::vector< art::Ptr< recob::Shower >> &  showers,
std::map< art::Ptr< recob::Shower >, art::Ptr< recob::PFParticle >> &  showerToPFParticleMap,
const std::map< art::Ptr< recob::PFParticle >, std::vector< art::Ptr< recob::Hit >> > &  pfParticleToHitsMap,
double  eps 
)

Definition at line 205 of file second_shower_search.cxx.

206  {
207 
208 
209  for(size_t s =0; s< showers.size(); s++){
210  art::Ptr<recob::Shower> shower = showers[s];
211  art::Ptr<recob::PFParticle> pfp = showerToPFParticleMap.at(shower);
212  std::vector<art::Ptr<recob::Hit>> showerhits = pfParticleToHitsMap.at(pfp);
213 
214  bool in_primary_shower = false;
215  for(size_t h = 0; h< hitz.size(); h++){
216  auto hit = hitz[h];
217  double h_wire = (double)hit->WireID().Wire;
218  double h_tick = (double)hit->PeakTime();
219 
220 
221  for(auto &sh: showerhits){
222 
223  if(sh->View() != hit->View()) continue;
224 
225  double sh_wire = (double)sh->WireID().Wire;
226  double sh_tick = (double)sh->PeakTime();
227 
228 
229  double dist = sqrt(pow(sh_wire*0.3-h_wire*0.3,2)+pow(sh_tick/25.0-h_tick/25.0,2));
230 
231  if(dist<=eps){
232  in_primary_shower = true;
233  return (int)s;
234  }
235 
236  }
237 
238  }
239 
240  if(in_primary_shower){
241  return (int)s;
242  }
243  }
244 
245 
246  return -1;
247  }
process_name hit
Definition: cheaterreco.fcl:51
process_name shower
Definition: cheaterreco.fcl:51
while getopts h
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
void single_photon::CreateEventWeightBranches ( var_all &  vars)

Definition at line 1889 of file init_branches.cxx.

1889  {
1890  //-----------------run info
1891  vars.eventweight_tree->Branch("run", &vars.m_run_number_eventweight);
1892  vars.eventweight_tree->Branch("subrun", &vars.m_subrun_number_eventweight);
1893  vars.eventweight_tree->Branch("event", &vars.m_event_number_eventweight);
1894  //------------------mcflux
1895  vars.eventweight_tree->Branch("MCFlux_NuPosX", &vars.m_mcflux_nu_pos_x );
1896  vars.eventweight_tree->Branch("MCFlux_NuPosY", &vars.m_mcflux_nu_pos_y );
1897  vars.eventweight_tree->Branch("MCFlux_NuPosZ", &vars.m_mcflux_nu_pos_z );
1898  vars.eventweight_tree->Branch("MCFlux_NuMomX", &vars.m_mcflux_nu_mom_x);
1899  vars.eventweight_tree->Branch("MCFlux_NuMomY", &vars.m_mcflux_nu_mom_y );
1900  vars.eventweight_tree->Branch("MCFlux_NuMomZ", &vars.m_mcflux_nu_mom_z);
1901  vars.eventweight_tree->Branch("MCFlux_NuMomE", &vars.m_mcflux_nu_mom_E);
1902  vars.eventweight_tree->Branch("MCFlux_ntype", &vars.m_mcflux_ntype );
1903  vars.eventweight_tree->Branch("MCFlux_ptype", &vars.m_mcflux_ptype );
1904  vars.eventweight_tree->Branch("MCFlux_nimpwt", &vars.m_mcflux_nimpwt );
1905  vars.eventweight_tree->Branch("MCFlux_dk2gen", &vars.m_mcflux_dk2gen );
1906  vars.eventweight_tree->Branch("MCFlux_nenergyn", &vars.m_mcflux_nenergyn);
1907  vars.eventweight_tree->Branch("MCFlux_tpx", &vars.m_mcflux_tpx );
1908  vars.eventweight_tree->Branch("MCFlux_tpy", &vars.m_mcflux_tpy );
1909  vars.eventweight_tree->Branch("MCFlux_tpz", &vars.m_mcflux_tpz );
1910  vars.eventweight_tree->Branch("MCFlux_vx", &vars.m_mcflux_vx);
1911  vars.eventweight_tree->Branch("MCFlux_vy", &vars.m_mcflux_vy );
1912  vars.eventweight_tree->Branch("MCFlux_vz", &vars.m_mcflux_vz );
1913  vars.eventweight_tree->Branch("MCFlux_tptype", & vars.m_mcflux_tptype );
1914  //---------------mctruth
1915  vars.eventweight_tree->Branch("MCTruth_NParticles", &vars.m_mctruth_nparticles);
1916  //vars.eventweight_tree->Branch("MCTruth_particles_TrackId", &vars.m_mctruth_particles_track_Id, "vars.m_mctruth_particles_track_Id[vars.m_mctruth_nparticles]/I" );
1917  vars.eventweight_tree->Branch("MCTruth_particles_TrackId", &vars.m_mctruth_particles_track_Id, "MCTruth_particles_TrackId[MCTruth_NParticles]/I" );
1918  //vars.eventweight_tree->Branch("MCTruth_particles_TrackId", &vars.m_mctruth_particles_track_Id);
1919  vars.eventweight_tree->Branch("MCTruth_particles_PdgCode", &vars.m_mctruth_particles_pdg_code, "MCTruth_particles_PdgCode[MCTruth_NParticles]/I" );
1920  vars.eventweight_tree->Branch("MCTruth_particles_Mother", &vars.m_mctruth_particles_mother, "MCTruth_particles_Mother[MCTruth_NParticles]/I" );
1921  vars.eventweight_tree->Branch("MCTruth_particles_StatusCode", &vars.m_mctruth_particles_status_code, "MCTruth_particles_StatusCode[MCTruth_NParticles]/I");
1922  vars.eventweight_tree->Branch("MCTruth_particles_NumberDaughters", &vars.m_mctruth_particles_num_daughters ,"MCTruth_particles_NumberDaughters[MCTruth_NParticles]/I" );
1923  vars.eventweight_tree->Branch("MCTruth_particles_Daughters", &vars.m_mctruth_particles_daughters,"MCTruth_particles_Daughters[MCTruth_NParticles][100]" );
1924  vars.eventweight_tree->Branch("MCTruth_particles_Gvx", &vars.m_mctruth_particles_Gvx,"MCTruth_particles_Gvx[MCTruth_NParticles]/D");
1925  vars.eventweight_tree->Branch("MCTruth_particles_Gvy", &vars.m_mctruth_particles_Gvy,"MCTruth_particles_Gvy[MCTruth_NParticles]/D" );
1926  vars.eventweight_tree->Branch("MCTruth_particles_Gvz", &vars.m_mctruth_particles_Gvz,"MCTruth_particles_Gvz[MCTruth_NParticles]/D" );
1927  vars.eventweight_tree->Branch("MCTruth_particles_Gvt", &vars.m_mctruth_particles_Gvt,"MCTruth_particles_Gvt[MCTruth_NParticles]/D" );
1928  vars.eventweight_tree->Branch("MCTruth_particles_px0", &vars.m_mctruth_particles_px0, "MCTruth_particles_px0[MCTruth_NParticles]/D" );
1929  vars.eventweight_tree->Branch("MCTruth_particles_py0", &vars.m_mctruth_particles_py0, "MCTruth_particles_py0[MCTruth_NParticles]/D" );
1930  vars.eventweight_tree->Branch("MCTruth_particles_pz0", &vars.m_mctruth_particles_pz0, "MCTruth_particles_pz0[MCTruth_NParticles]/D" );
1931  vars.eventweight_tree->Branch("MCTruth_particles_e0", &vars.m_mctruth_particles_e0, "MCTruth_particles_e0[MCTruth_NParticles]/D" );
1932  vars.eventweight_tree->Branch("MCTruth_particles_Rescatter", &vars.m_mctruth_particles_rescatter,"MCTruth_particles_Rescatter[MCTruth_NParticles]/I" );
1933  vars.eventweight_tree->Branch("MCTruth_particles_polx", &vars.m_mctruth_particles_polx, "MCTruth_particles_polx[MCTruth_NParticles]/D" );
1934  vars.eventweight_tree->Branch("MCTruth_particles_poly", &vars.m_mctruth_particles_poly, "MCTruth_particles_poly[MCTruth_NParticles]/D" );
1935  vars.eventweight_tree->Branch("MCTruth_particles_polz", &vars.m_mctruth_particles_polz, "MCTruth_particles_polz[MCTruth_NParticles]/D");
1936  vars.eventweight_tree->Branch("MCTruth_neutrino_CCNC", &vars.m_mctruth_neutrino_ccnc );
1937  vars.eventweight_tree->Branch("MCTruth_neutrino_mode", &vars.m_mctruth_neutrino_mode );
1938  vars.eventweight_tree->Branch("MCTruth_neutrino_interactionType", &vars.m_mctruth_neutrino_interaction_type );
1939  vars.eventweight_tree->Branch("MCTruth_neutrino_target", &vars.m_mctruth_neutrino_target );
1940  vars.eventweight_tree->Branch("MCTruth_neutrino_nucleon", &vars.m_mctruth_neutrino_nucleon );
1941  vars.eventweight_tree->Branch("MCTruth_neutrino_quark", &vars.m_mctruth_neutrino_quark );
1942  vars.eventweight_tree->Branch("MCTruth_neutrino_W", &vars.m_mctruth_neutrino_w );
1943  vars.eventweight_tree->Branch("MCTruth_neutrino_X", &vars.m_mctruth_neutrino_x );
1944  vars.eventweight_tree->Branch("MCTruth_neutrino_Y", &vars.m_mctruth_neutrino_y );
1945  vars.eventweight_tree->Branch("MCTruth_neutrino_QSqr", &vars.m_mctruth_neutrino_qsqr );
1946 
1947  //---------------------gtruth
1948  vars.eventweight_tree->Branch("GTruth_IsSeaQuark", &vars.m_gtruth_is_sea_quark );
1949  vars.eventweight_tree->Branch("GTruth_tgtPDG", &vars.m_gtruth_tgt_pdg );
1950  vars.eventweight_tree->Branch("GTruth_tgtA", &vars.m_gtruth_tgt_A );
1951  vars.eventweight_tree->Branch("GTruth_tgtZ", &vars.m_gtruth_tgt_Z );
1952  vars.eventweight_tree->Branch("GTruth_TgtP4x", &vars.m_gtruth_tgt_p4_x );
1953  vars.eventweight_tree->Branch("GTruth_TgtP4y", &vars.m_gtruth_tgt_p4_y );
1954  vars.eventweight_tree->Branch("GTruth_TgtP4z", &vars.m_gtruth_tgt_p4_z );
1955  vars.eventweight_tree->Branch("GTruth_TgtP4E", &vars.m_gtruth_tgt_p4_E );
1956  vars.eventweight_tree->Branch("GTruth_weight", &vars.m_gtruth_weight );
1957  vars.eventweight_tree->Branch("GTruth_probability", &vars.m_gtruth_probability );
1958  vars.eventweight_tree->Branch("GTruth_Xsec", &vars.m_gtruth_xsec );
1959  vars.eventweight_tree->Branch("GTruth_DiffXsec", &vars.m_gtruth_diff_xsec );
1960  vars.eventweight_tree->Branch("GTruth_GPhaseSpace", &vars.m_gtruth_gphase_space );
1961  vars.eventweight_tree->Branch("GTruth_vertexX", &vars.m_gtruth_vertex_x );
1962  vars.eventweight_tree->Branch("GTruth_vertexY", &vars.m_gtruth_vertex_y );
1963  vars.eventweight_tree->Branch("GTruth_vertexZ", &vars.m_gtruth_vertex_z );
1964  vars.eventweight_tree->Branch("GTruth_vertexT", &vars.m_gtruth_vertex_T );
1965  vars.eventweight_tree->Branch("GTruth_Gscatter", &vars.m_gtruth_gscatter );
1966  vars.eventweight_tree->Branch("GTruth_Gint", &vars.m_gtruth_gint );
1967  vars.eventweight_tree->Branch("GTruth_ResNum", &vars.m_gtruth_res_num);
1968  vars.eventweight_tree->Branch("GTruth_NumPiPlus", &vars.m_gtruth_num_piplus);
1969  vars.eventweight_tree->Branch("GTruth_NumPi0", &vars.m_gtruth_num_pi0);
1970  vars.eventweight_tree->Branch("GTruth_NumPiMinus", &vars.m_gtruth_num_piminus);
1971  vars.eventweight_tree->Branch("GTruth_NumProton", &vars.m_gtruth_num_proton );
1972  vars.eventweight_tree->Branch("GTruth_NumNeutron", &vars.m_gtruth_num_neutron );
1973  vars.eventweight_tree->Branch("GTruth_IsCharm", &vars.m_gtruth_is_charm );
1974  vars.eventweight_tree->Branch("GTruth_IsStrange", &vars.m_gtruth_is_strange );
1975  vars.eventweight_tree->Branch("GTruth_StrangeHadronPDG", &vars.m_gtruth_strange_hadron_pdg );
1976  vars.eventweight_tree->Branch("GTruth_CharmHadronPDG", &vars.m_gtruth_charm_hadron_pdg );
1977  vars.eventweight_tree->Branch("GTruth_DecayMode",&vars.m_gtruth_decay_mode);
1978  vars.eventweight_tree->Branch("GTruth_gX", &vars.m_gtruth_gx );
1979  vars.eventweight_tree->Branch("GTruth_gY", &vars.m_gtruth_gy );
1980  vars.eventweight_tree->Branch("GTruth_gT", &vars.m_gtruth_gt );
1981  vars.eventweight_tree->Branch("GTruth_gW", &vars.m_gtruth_gw );
1982  vars.eventweight_tree->Branch("GTruth_gQ2", &vars.m_gtruth_gQ2 );
1983  vars.eventweight_tree->Branch("GTruth_gq2", &vars.m_gtruth_gq2 );
1984  vars.eventweight_tree->Branch("GTruth_ProbePDG", &vars.m_gtruth_probe_pdg );
1985  vars.eventweight_tree->Branch("GTruth_ProbeP4x", &vars.m_gtruth_probe_p4_x );
1986  vars.eventweight_tree->Branch("GTruth_ProbeP4y", &vars.m_gtruth_probe_p4_y );
1987  vars.eventweight_tree->Branch("GTruth_ProbeP4z", &vars.m_gtruth_probe_p4_z );
1988  vars.eventweight_tree->Branch("GTruth_ProbeP4E", &vars.m_gtruth_probe_p4_E );
1989  vars.eventweight_tree->Branch("GTruth_HitNucP4x", &vars.m_gtruth_hit_nuc_p4_x );
1990  vars.eventweight_tree->Branch("GTruth_HitNucP4y", &vars.m_gtruth_hit_nuc_p4_y );
1991  vars.eventweight_tree->Branch("GTruth_HitNucP4z", &vars.m_gtruth_hit_nuc_p4_z );
1992  vars.eventweight_tree->Branch("GTruth_HitNucP4E", &vars.m_gtruth_hit_nuc_p4_E );
1993  vars.eventweight_tree->Branch("GTruth_HitNucPos", &vars.m_gtruth_hit_nuc_pos );
1994  vars.eventweight_tree->Branch("GTruth_FShadSystP4x", &vars.m_gtruth_fs_had_syst_p4_x );
1995  vars.eventweight_tree->Branch("GTruth_FShadSystP4y", &vars.m_gtruth_fs_had_syst_p4_y );
1996  vars.eventweight_tree->Branch("GTruth_FShadSystP4z", &vars.m_gtruth_fs_had_syst_p4_z );
1997  vars.eventweight_tree->Branch("GTruth_FShadSystP4E", &vars.m_gtruth_fs_had_syst_p4_E );
1998  }
void single_photon::CreateFlashBranches ( var_all &  vars)

Definition at line 444 of file init_branches.cxx.

444  {
445 // vars.vertex_tree->Branch("beamgate_flash_start",&vars.m_beamgate_flash_start,"beamgate_flash_start/D");
446 // vars.vertex_tree->Branch("beamgate_flash_end",&vars.m_beamgate_flash_end,"beamgate_flash_end/D");
447  vars.vertex_tree->Branch("reco_num_flashes",&vars.m_reco_num_flashes,"reco_num_flashes/I");
448  vars.vertex_tree->Branch("reco_num_flashes_in_beamgate",&vars.m_reco_num_flashes_in_beamgate,"reco_num_flashes_in_beamgate/I");
449  vars.vertex_tree->Branch("reco_flash_total_pe", &vars.m_reco_flash_total_pe);
450  vars.vertex_tree->Branch("reco_flash_time", &vars.m_reco_flash_time);
451  vars.vertex_tree->Branch("reco_flash_time_width",&vars.m_reco_flash_time_width);
452  vars.vertex_tree->Branch("reco_flash_abs_time",&vars.m_reco_flash_abs_time);
453  vars.vertex_tree->Branch("reco_flash_frame",&vars.m_reco_flash_frame);
454  vars.vertex_tree->Branch("reco_flash_ycenter",&vars.m_reco_flash_ycenter);
455  vars.vertex_tree->Branch("reco_flash_ywidth",&vars.m_reco_flash_ywidth);
456  vars.vertex_tree->Branch("reco_flash_zcenter",&vars.m_reco_flash_zcenter);
457  vars.vertex_tree->Branch("reco_flash_zwidth",&vars.m_reco_flash_zwidth);
458  vars.vertex_tree->Branch("reco_flash_total_pe_in_beamgate", &vars.m_reco_flash_total_pe_in_beamgate);
459  vars.vertex_tree->Branch("reco_flash_time_in_beamgate", &vars.m_reco_flash_time_in_beamgate);
460  vars.vertex_tree->Branch("reco_flash_ycenter_in_beamgate",&vars.m_reco_flash_ycenter_in_beamgate);
461  vars.vertex_tree->Branch("reco_flash_zcenter_in_beamgate",&vars.m_reco_flash_zcenter_in_beamgate);
462 
463  vars.vertex_tree->Branch("CRT_veto_nhits",&vars.m_CRT_veto_nhits,"CRT_veto_nhits/I");
464  vars.vertex_tree->Branch("CRT_veto_hit_PE",&vars.m_CRT_veto_hit_PE);
465  vars.vertex_tree->Branch("CRT_dt",& vars.m_CRT_dt," CRT_dt/D");
466  vars.vertex_tree->Branch("CRT_min_hit_time",&vars.m_CRT_min_hit_time,"CRT_min_hit_time/D");
467  vars.vertex_tree->Branch("CRT_min_hit_PE",&vars.m_CRT_min_hit_PE,"CRT_min_hit_PE/D");
468  vars.vertex_tree->Branch("CRT_min_hit_x",&vars.m_CRT_min_hit_x,"CRT_min_hit_x/D");
469  vars.vertex_tree->Branch("CRT_min_hit_y",&vars.m_CRT_min_hit_y,"CRT_min_hit_y/D");
470  vars.vertex_tree->Branch("CRT_min_hit_z",&vars.m_CRT_min_hit_z,"CRT_min_hit_z/D");
471  vars.vertex_tree->Branch("CRT_hits_time",&vars.m_CRT_hits_time);
472  vars.vertex_tree->Branch("CRT_hits_PE",&vars.m_CRT_hits_PE);
473  vars.vertex_tree->Branch("CRT_hits_x",&vars.m_CRT_hits_x);
474  vars.vertex_tree->Branch("CRT_hits_y",&vars.m_CRT_hits_y);
475  vars.vertex_tree->Branch("CRT_hits_z",&vars.m_CRT_hits_z);
476  }
void single_photon::CreateGeant4Branches ( var_all &  vars)

Definition at line 2025 of file init_branches.cxx.

2025  {
2026  vars.geant4_tree->Branch("geant4_pdg",&vars.m_geant4_pdg);
2027  vars.geant4_tree->Branch("geant4_trackid",&vars.m_geant4_trackid);
2028  vars.geant4_tree->Branch("geant4_mother",&vars.m_geant4_mother);
2029  vars.geant4_tree->Branch("geant4_statuscode",&vars.m_geant4_statuscode);
2030  vars.geant4_tree->Branch("geant4_E",&vars.m_geant4_E);
2031  vars.geant4_tree->Branch("geant4_mass",&vars.m_geant4_mass);
2032  vars.geant4_tree->Branch("geant4_px", &vars.m_geant4_px);
2033  vars.geant4_tree->Branch("geant4_py", &vars.m_geant4_py);
2034  vars.geant4_tree->Branch("geant4_pz", &vars.m_geant4_pz);
2035 
2036  vars.geant4_tree->Branch("geant4_dx", &vars.m_geant4_dx);
2037  vars.geant4_tree->Branch("geant4_dy", &vars.m_geant4_dy);
2038  vars.geant4_tree->Branch("geant4_dz", &vars.m_geant4_dz);
2039 
2040  vars.geant4_tree->Branch("geant4_vx", &vars.m_geant4_vx);
2041  vars.geant4_tree->Branch("geant4_vy", &vars.m_geant4_vy);
2042  vars.geant4_tree->Branch("geant4_vz", &vars.m_geant4_vz);
2043  vars.geant4_tree->Branch("geant4_costheta",&vars.m_geant4_costheta);
2044 
2045  vars.geant4_tree->Branch("geant4_end_process", &vars.m_geant4_end_process);
2046  vars.geant4_tree->Branch("geant4_process", &vars.m_geant4_process);
2047  }
void single_photon::CreateIsolationBranches ( var_all &  vars)

Definition at line 122 of file init_branches.cxx.

122  {
123  vars.vertex_tree->Branch("isolation_min_dist_trk_shr", &vars.m_isolation_min_dist_trk_shr);
124  vars.vertex_tree->Branch("isolation_min_dist_trk_unassoc", &vars.m_isolation_min_dist_trk_unassoc);
125 
126  vars.vertex_tree->Branch("isolation_num_shr_hits_win_1cm_trk", &vars.m_isolation_num_shr_hits_win_1cm_trk);
127  vars.vertex_tree->Branch("isolation_num_shr_hits_win_2cm_trk", &vars.m_isolation_num_shr_hits_win_2cm_trk);
128  vars.vertex_tree->Branch("isolation_num_shr_hits_win_5cm_trk", &vars.m_isolation_num_shr_hits_win_5cm_trk);
129  vars.vertex_tree->Branch("isolation_num_shr_hits_win_10cm_trk", &vars.m_isolation_num_shr_hits_win_10cm_trk);
130 
131  vars.vertex_tree->Branch("isolation_num_unassoc_hits_win_1cm_trk", &vars.m_isolation_num_unassoc_hits_win_1cm_trk);
132  vars.vertex_tree->Branch("isolation_num_unassoc_hits_win_2cm_trk", &vars.m_isolation_num_unassoc_hits_win_2cm_trk);
133  vars.vertex_tree->Branch("isolation_num_unassoc_hits_win_5cm_trk", &vars.m_isolation_num_unassoc_hits_win_5cm_trk);
134  vars.vertex_tree->Branch("isolation_num_unassoc_hits_win_10cm_trk", &vars.m_isolation_num_unassoc_hits_win_10cm_trk);
135 
136 
137  vars.vertex_tree->Branch("isolation_nearest_shr_hit_to_trk_wire", &vars.m_isolation_nearest_shr_hit_to_trk_wire);
138  vars.vertex_tree->Branch("isolation_nearest_shr_hit_to_trk_time", &vars.m_isolation_nearest_shr_hit_to_trk_time);
139 
140  vars.vertex_tree->Branch("isolation_nearest_unassoc_hit_to_trk_wire", &vars.m_isolation_nearest_unassoc_hit_to_trk_wire);
141  vars.vertex_tree->Branch("isolation_nearest_unassoc_hit_to_trk_time", &vars.m_isolation_nearest_unassoc_hit_to_trk_time);
142 
143  }
void single_photon::CreateMCTruthBranches ( var_all &  vars)

Definition at line 1653 of file init_branches.cxx.

1653  {
1654  vars.vertex_tree->Branch("mctruth_num",&vars.m_mctruth_num);
1655  vars.vertex_tree->Branch("mctruth_origin",&vars.m_mctruth_origin);
1656  vars.vertex_tree->Branch("mctruth_nu_pdg",&vars.m_mctruth_nu_pdg);
1657  vars.vertex_tree->Branch("mctruth_nu_E",&vars.m_mctruth_nu_E);
1658 
1659  vars.vertex_tree->Branch("mctruth_nu_vertex_x",&vars.m_mctruth_nu_vertex_x);
1660  vars.vertex_tree->Branch("mctruth_nu_vertex_y",&vars.m_mctruth_nu_vertex_y);
1661  vars.vertex_tree->Branch("mctruth_nu_vertex_z",&vars.m_mctruth_nu_vertex_z);
1662  vars.vertex_tree->Branch("mctruth_reco_vertex_dist",&vars.m_mctruth_reco_vertex_dist);
1663 
1664  vars.vertex_tree->Branch("mctruth_lepton_pdg",&vars.m_mctruth_lepton_pdg);
1665  vars.vertex_tree->Branch("mctruth_lepton_E",&vars.m_mctruth_lepton_E);
1666  vars.vertex_tree->Branch("mctruth_mode",&vars.m_mctruth_mode);
1667  vars.vertex_tree->Branch("mctruth_qsqr",&vars.m_mctruth_qsqr);
1668  vars.vertex_tree->Branch("mctruth_cc_or_nc",&vars.m_mctruth_ccnc);
1669  vars.vertex_tree->Branch("mctruth_interaction_type",&vars.m_mctruth_interaction_type);
1670 
1671  vars.vertex_tree->Branch("mctruth_num_daughter_particles",&vars.m_mctruth_num_daughter_particles);
1672  vars.vertex_tree->Branch("mctruth_daughters_pdg",&vars.m_mctruth_daughters_pdg);
1673  vars.vertex_tree->Branch("mctruth_daughters_E",&vars.m_mctruth_daughters_E);
1674  vars.vertex_tree->Branch("mctruth_daughters_status_code",&vars.m_mctruth_daughters_status_code);
1675  vars.vertex_tree->Branch("mctruth_daughters_trackID",&vars.m_mctruth_daughters_trackID);
1676  vars.vertex_tree->Branch("mctruth_daughters_mother_trackID",&vars.m_mctruth_daughters_mother_trackID);
1677  vars.vertex_tree->Branch("mctruth_daughters_px",&vars.m_mctruth_daughters_px);
1678  vars.vertex_tree->Branch("mctruth_daughters_py",&vars.m_mctruth_daughters_py);
1679  vars.vertex_tree->Branch("mctruth_daughters_pz",&vars.m_mctruth_daughters_pz);
1680  vars.vertex_tree->Branch("mctruth_daughters_startx",&vars.m_mctruth_daughters_startx);
1681  vars.vertex_tree->Branch("mctruth_daughters_starty",&vars.m_mctruth_daughters_starty);
1682  vars.vertex_tree->Branch("mctruth_daughters_startz",&vars.m_mctruth_daughters_startz);
1683  vars.vertex_tree->Branch("mctruth_daughters_time",&vars.m_mctruth_daughters_time);
1684  vars.vertex_tree->Branch("mctruth_daughters_endx",&vars.m_mctruth_daughters_endx);
1685  vars.vertex_tree->Branch("mctruth_daughters_endy",&vars.m_mctruth_daughters_endy);
1686  vars.vertex_tree->Branch("mctruth_daughters_endz",&vars.m_mctruth_daughters_endz);
1687  vars.vertex_tree->Branch("mctruth_daughters_endtime",&vars.m_mctruth_daughters_endtime);
1688  vars.vertex_tree->Branch("mctruth_daughters_process",&vars.m_mctruth_daughters_process);
1689  vars.vertex_tree->Branch("mctruth_daughters_end_process",&vars.m_mctruth_daughters_end_process);
1690 
1691 
1692 
1693 
1694  vars.vertex_tree->Branch("mctruth_num_exiting_protons",&vars.m_mctruth_num_exiting_protons);
1695  vars.vertex_tree->Branch("mctruth_num_exiting_photons",&vars.m_mctruth_num_exiting_photons);
1696  vars.vertex_tree->Branch("mctruth_num_exiting_neutrons",&vars.m_mctruth_num_exiting_neutrons);
1697  vars.vertex_tree->Branch("mctruth_num_exiting_pi0",&vars.m_mctruth_num_exiting_pi0);
1698  vars.vertex_tree->Branch("mctruth_num_exiting_pipm",&vars.m_mctruth_num_exiting_pipm);
1699  vars.vertex_tree->Branch("mctruth_num_exiting_delta0",&vars.m_mctruth_num_exiting_delta0);
1700  vars.vertex_tree->Branch("mctruth_num_exiting_deltapm",&vars.m_mctruth_num_exiting_deltapm);
1701  vars.vertex_tree->Branch("mctruth_num_exiting_deltapp",&vars.m_mctruth_num_exiting_deltapp);
1702 
1703  vars.vertex_tree->Branch("mctruth_leading_exiting_proton_energy",&vars.m_mctruth_leading_exiting_proton_energy);
1704  vars.vertex_tree->Branch("mctruth_is_delta_radiative",&vars.m_mctruth_is_delta_radiative);
1705  vars.vertex_tree->Branch("mctruth_delta_radiative_1g1p_or_1g1n",&vars.m_mctruth_delta_radiative_1g1p_or_1g1n);
1706  vars.vertex_tree->Branch("mctruth_delta_photon_energy",&vars.m_mctruth_delta_photon_energy);
1707  vars.vertex_tree->Branch("mctruth_delta_proton_energy",&vars.m_mctruth_delta_proton_energy);
1708  vars.vertex_tree->Branch("mctruth_delta_neutron_energy",&vars.m_mctruth_delta_neutron_energy);
1709  vars.vertex_tree->Branch("mctruth_exiting_delta0_num_daughters",&vars.m_mctruth_exiting_delta0_num_daughters);
1710 
1711  vars.vertex_tree->Branch("mctruth_exiting_photon_trackID",&vars.m_mctruth_exiting_photon_trackID);
1712  vars.vertex_tree->Branch("mctruth_exiting_photon_mother_trackID",&vars.m_mctruth_exiting_photon_mother_trackID);
1713  vars.vertex_tree->Branch("mctruth_exiting_photon_from_delta_decay",&vars.m_mctruth_exiting_photon_from_delta_decay);
1714  vars.vertex_tree->Branch("mctruth_exiting_photon_energy",&vars.m_mctruth_exiting_photon_energy);
1715  vars.vertex_tree->Branch("mctruth_exiting_photon_px",&vars.m_mctruth_exiting_photon_px);
1716  vars.vertex_tree->Branch("mctruth_exiting_photon_py",&vars.m_mctruth_exiting_photon_py);
1717  vars.vertex_tree->Branch("mctruth_exiting_photon_pz",&vars.m_mctruth_exiting_photon_pz);
1718 
1719  vars.vertex_tree->Branch("mctruth_exiting_proton_trackID",&vars.m_mctruth_exiting_proton_trackID);
1720  vars.vertex_tree->Branch("mctruth_exiting_proton_mother_trackID",&vars.m_mctruth_exiting_proton_mother_trackID);
1721  vars.vertex_tree->Branch("mctruth_exiting_proton_from_delta_decay",&vars.m_mctruth_exiting_proton_from_delta_decay);
1722  vars.vertex_tree->Branch("mctruth_exiting_proton_energy",&vars.m_mctruth_exiting_proton_energy);
1723  vars.vertex_tree->Branch("mctruth_exiting_proton_px",&vars.m_mctruth_exiting_proton_px);
1724  vars.vertex_tree->Branch("mctruth_exiting_proton_py",&vars.m_mctruth_exiting_proton_py);
1725  vars.vertex_tree->Branch("mctruth_exiting_proton_pz",&vars.m_mctruth_exiting_proton_pz);
1726 
1727  vars.vertex_tree->Branch("mctruth_exiting_neutron_trackID",&vars.m_mctruth_exiting_neutron_trackID);
1728  vars.vertex_tree->Branch("mctruth_exiting_neutron_mother_trackID",&vars.m_mctruth_exiting_neutron_mother_trackID);
1729  vars.vertex_tree->Branch("mctruth_exiting_neutron_from_delta_decay",&vars.m_mctruth_exiting_neutron_from_delta_decay);
1730  vars.vertex_tree->Branch("mctruth_exiting_neutron_energy",&vars.m_mctruth_exiting_neutron_energy);
1731  vars.vertex_tree->Branch("mctruth_exiting_neutron_px",&vars.m_mctruth_exiting_neutron_px);
1732  vars.vertex_tree->Branch("mctruth_exiting_neutron_py",&vars.m_mctruth_exiting_neutron_py);
1733  vars.vertex_tree->Branch("mctruth_exiting_neutron_pz",&vars.m_mctruth_exiting_neutron_pz);
1734 
1735 
1736  vars.vertex_tree->Branch("mctruth_is_reconstructable_1g1p",&vars.m_mctruth_is_reconstructable_1g1p);
1737 
1738  vars.vertex_tree->Branch("mctruth_is_reconstructable_1g1p",&vars.m_mctruth_is_reconstructable_1g1p);
1739  vars.vertex_tree->Branch("mctruth_num_reconstructable_protons",&vars.m_mctruth_num_reconstructable_protons);
1740 
1741  vars.vertex_tree->Branch("mctruth_pi0_leading_photon_energy",&vars.m_mctruth_pi0_leading_photon_energy);
1742  vars.vertex_tree->Branch("mctruth_pi0_leading_photon_mom",&vars.m_mctruth_pi0_leading_photon_mom);
1743  vars.vertex_tree->Branch("mctruth_pi0_leading_photon_start",&vars.m_mctruth_pi0_leading_photon_start);
1744  vars.vertex_tree->Branch("mctruth_pi0_leading_photon_end",&vars.m_mctruth_pi0_leading_photon_end);
1745  vars.vertex_tree->Branch("mctruth_pi0_leading_photon_exiting_TPC",&vars.m_mctruth_pi0_leading_photon_exiting_TPC);
1746  vars.vertex_tree->Branch("mctruth_pi0_subleading_photon_energy",&vars.m_mctruth_pi0_subleading_photon_energy);
1747  vars.vertex_tree->Branch("mctruth_pi0_subleading_photon_mom",&vars.m_mctruth_pi0_subleading_photon_mom);
1748  vars.vertex_tree->Branch("mctruth_pi0_subleading_photon_end_process",&vars.m_mctruth_pi0_subleading_photon_end_process);
1749  vars.vertex_tree->Branch("mctruth_pi0_subleading_photon_start",&vars.m_mctruth_pi0_subleading_photon_start);
1750  vars.vertex_tree->Branch("mctruth_pi0_subleading_photon_end",&vars.m_mctruth_pi0_subleading_photon_end);
1751  vars.vertex_tree->Branch("mctruth_pi0_subleading_photon_exiting_TPC",&vars.m_mctruth_pi0_subleading_photon_exiting_TPC);
1752 
1753 
1754  vars.vertex_tree->Branch("mctruth_exiting_pi0_E",&vars.m_mctruth_exiting_pi0_E);
1755  vars.vertex_tree->Branch("mctruth_exiting_pi0_mom",&vars.m_mctruth_exiting_pi0_mom);
1756  vars.vertex_tree->Branch("mctruth_exiting_pi0_px",&vars.m_mctruth_exiting_pi0_px);
1757  vars.vertex_tree->Branch("mctruth_exiting_pi0_py",&vars.m_mctruth_exiting_pi0_py);
1758  vars.vertex_tree->Branch("mctruth_exiting_pi0_pz",&vars.m_mctruth_exiting_pi0_pz);
1759  }
void single_photon::CreateMetaBranches ( var_all &  vars)

Definition at line 44 of file init_branches.cxx.

44  {
45 
46  //true_eventweight_tree
47 // vars.true_eventweight_tree->Branch("mcweight", "std::map<std::string, std::vector<double>>",&vars.fmcweight);
48 
49  //run_subrun_tree
50  vars.run_subrun_tree->Branch("run",&vars.m_run,"run/I");
51  vars.run_subrun_tree->Branch("subrun",&vars.m_subrun,"subrun/I");
52  vars.run_subrun_tree->Branch("subrun_pot",&vars.m_subrun_pot,"subrun_pot/D");
53  vars.run_subrun_tree->Branch("subrun_counts",&vars.m_subrun_counts,"subrun_counts/I");
54 
55  //pot_tree
56  vars.pot_tree->Branch("number_of_events",&vars.m_number_of_events,"number_of_events/I");
57  vars.pot_tree->Branch("number_of_vertices",&vars.m_number_of_vertices,"number_of_vertices/I");
58  vars.pot_tree->Branch("POT",&vars.m_pot_count,"POT/D");
59 
60  //vars.vertex_tree -- part of it
61  // --------------------- Event Related variables ------------
62  vars.vertex_tree->Branch("run_number", &vars.m_run_number, "run_number/I");
63  vars.vertex_tree->Branch("subrun_number", &vars.m_subrun_number, "subrun_number/I");
64  vars.vertex_tree->Branch("event_number", &vars.m_event_number, "event_number/I");
65 
66  vars.vertex_tree->Branch("pot_per_event",&vars.m_pot_per_event,"pot_per_event/D");
67  vars.vertex_tree->Branch("pot_per_subrun",&vars.m_pot_per_subrun,"pot_per_subrun/D");
68  vars.vertex_tree->Branch("number_of_events_in_subrun",&vars.m_number_of_events_in_subrun,"number_of_events_in_subrun/D");
69 
70 
71  vars.vertex_tree->Branch("genie_spline_weight", &vars.m_genie_spline_weight, "genie_spline_weight/D");
72  vars.vertex_tree->Branch("genie_CV_tune_weight", &vars.m_genie_CV_tune_weight, "genie_CV_tune_weight/D");
73 
74  vars.vertex_tree->Branch("photonu_weight_low", &vars.m_photonu_weight_low, "photonu_weight_low/D");
75  vars.vertex_tree->Branch("photonu_weight_high", &vars.m_photonu_weight_high, "photonu_weight_high/D");
76 
77  vars.vertex_tree->Branch("test_matched_hits", &vars.m_test_matched_hits, "test_matched_hits/I");
78 
79  // --------------------- Vertex Related variables ------------
80  vars.vertex_tree->Branch("reco_vertex_size", &vars.m_reco_vertex_size);
81  vars.vertex_tree->Branch("reco_vertex_x", &vars.m_vertex_pos_x);
82  vars.vertex_tree->Branch("reco_vertex_y", &vars.m_vertex_pos_y);
83  vars.vertex_tree->Branch("reco_vertex_z", &vars.m_vertex_pos_z);
84  vars.vertex_tree->Branch("reco_vertex_in_SCB", &vars.m_reco_vertex_in_SCB);
85  vars.vertex_tree->Branch("reco_vertex_dist_to_SCB",&vars.m_reco_vertex_dist_to_SCB);
86  vars.vertex_tree->Branch("reco_vertex_dist_to_active_TPC",&vars.m_reco_vertex_dist_to_active_TPC);
87  vars.vertex_tree->Branch("reco_vertex_dist_to_CPA",&vars.m_reco_vertex_dist_to_CPA);
88 // vars.vertex_tree->Branch("reco_vertex_to_nearest_dead_wire_plane0",&vars.m_reco_vertex_to_nearest_dead_wire_plane0);
89 // vars.vertex_tree->Branch("reco_vertex_to_nearest_dead_wire_plane1",&vars.m_reco_vertex_to_nearest_dead_wire_plane1);
90 // vars.vertex_tree->Branch("reco_vertex_to_nearest_dead_wire_plane2",&vars.m_reco_vertex_to_nearest_dead_wire_plane2);
91 
92  vars.vertex_tree->Branch("reco_slice_objects", &vars.m_reco_slice_objects, "reco_slice_objects/I");
93 
94  vars.vertex_tree->Branch("vars.m_flash_optfltr_pe_beam",&vars.m_flash_optfltr_pe_beam);
95  vars.vertex_tree->Branch("vars.m_flash_optfltr_pe_veto",&vars.m_flash_optfltr_pe_veto);
96  vars.vertex_tree->Branch("vars.m_flash_optfltr_pe_veto_tot",&vars.m_flash_optfltr_pe_veto_tot);
97  vars.vertex_tree->Branch("vars.m_flash_optfltr_pe_beavars.m_tot",&vars.m_flash_optfltr_pe_beam_tot);
98  }
void single_photon::CreateSecondShowerBranches ( var_all &  vars)

Definition at line 253 of file init_branches.cxx.

253  {
254  vars.vertex_tree->Branch("sss_num_unassociated_hits",&vars.m_sss_num_unassociated_hits,"sss_num_unassociated_hits/I");
255  vars.vertex_tree->Branch("sss_num_unassociated_hits_below_threshold",&vars.m_sss_num_unassociated_hits_below_threshold,"sss_num_unassociated_hits_below_threshold/I");
256  vars.vertex_tree->Branch("sss_num_associated_hits",&vars.m_sss_num_associated_hits,"sss_num_associated_hits/I");
257 
258  vars.vertex_tree->Branch("sss_num_candidates",&vars.m_sss_num_candidates,"sss_num_candidates/I");
259  vars.vertex_tree->Branch("sss_candidate_veto_score",&vars.m_sss_candidate_veto_score);
260  vars.vertex_tree->Branch("sss_candidate_in_nu_slice", &vars.m_sss_candidate_in_nu_slice);
261  vars.vertex_tree->Branch("sss_candidate_num_hits",&vars.m_sss_candidate_num_hits);
262  vars.vertex_tree->Branch("sss_candidate_num_wires",&vars.m_sss_candidate_num_wires);
263  vars.vertex_tree->Branch("sss_candidate_num_ticks",&vars.m_sss_candidate_num_ticks);
264  vars.vertex_tree->Branch("sss_candidate_plane",&vars.m_sss_candidate_plane);
265  vars.vertex_tree->Branch("sss_candidate_PCA",&vars.m_sss_candidate_PCA);
266  vars.vertex_tree->Branch("sss_candidate_mean_ADC",&vars.m_sss_candidate_mean_ADC);
267  vars.vertex_tree->Branch("sss_candidate_ADC_RMS", &vars.m_sss_candidate_ADC_RMS);
268  vars.vertex_tree->Branch("sss_candidate_impact_parameter",&vars.m_sss_candidate_impact_parameter);
269  vars.vertex_tree->Branch("sss_candidate_fit_slope",&vars.m_sss_candidate_fit_slope);
270  vars.vertex_tree->Branch("sss_candidate_fit_constant",&vars.m_sss_candidate_fit_constant);
271  vars.vertex_tree->Branch("sss_candidate_mean_tick",&vars.m_sss_candidate_mean_tick);
272  vars.vertex_tree->Branch("sss_candidate_max_tick",&vars.m_sss_candidate_max_tick);
273  vars.vertex_tree->Branch("sss_candidate_min_tick",&vars.m_sss_candidate_min_tick);
274  vars.vertex_tree->Branch("sss_candidate_mean_wire",&vars.m_sss_candidate_mean_wire);
275  vars.vertex_tree->Branch("sss_candidate_max_wire",&vars.m_sss_candidate_max_wire);
276  vars.vertex_tree->Branch("sss_candidate_min_wire",&vars.m_sss_candidate_min_wire);
277  vars.vertex_tree->Branch("sss_candidate_min_dist",&vars.m_sss_candidate_min_dist);
278  vars.vertex_tree->Branch("sss_candidate_wire_tick_based_length", &vars.m_sss_candidate_wire_tick_based_length);
279  vars.vertex_tree->Branch("sss_candidate_energy",&vars.m_sss_candidate_energy);
280  vars.vertex_tree->Branch("sss_candidate_angle_to_shower",&vars.m_sss_candidate_angle_to_shower);
281  vars.vertex_tree->Branch("sss_candidate_closest_neighbour",&vars.m_sss_candidate_closest_neighbour);
282  vars.vertex_tree->Branch("sss_candidate_remerge",&vars.m_sss_candidate_remerge);
283 
284  vars.vertex_tree->Branch("sss_candidate_matched",&vars.m_sss_candidate_matched);
285  vars.vertex_tree->Branch("sss_candidate_pdg",&vars.m_sss_candidate_pdg);
286  vars.vertex_tree->Branch("sss_candidate_parent_pdg",&vars.m_sss_candidate_parent_pdg);
287  vars.vertex_tree->Branch("sss_candidate_trackid",&vars.m_sss_candidate_trackid);
288  vars.vertex_tree->Branch("sss_candidate_true_energy", &vars.m_sss_candidate_true_energy);
289  vars.vertex_tree->Branch("sss_candidate_overlay_fraction",&vars.m_sss_candidate_overlay_fraction);
290  vars.vertex_tree->Branch("sss_candidate_matched_energy_fraction_best_plane", &vars.m_sss_candidate_matched_energy_fraction_best_plane);
291 
292 
293  vars.vertex_tree->Branch("sss3d_ioc_ranked_en",&vars.m_sss3d_ioc_ranked_en);
294  vars.vertex_tree->Branch("sss3d_ioc_ranked_conv",&vars.m_sss3d_ioc_ranked_conv);
295  vars.vertex_tree->Branch("sss3d_ioc_ranked_invar",&vars.m_sss3d_ioc_ranked_invar);
296  vars.vertex_tree->Branch("sss3d_ioc_ranked_implied_invar",&vars.m_sss3d_ioc_ranked_implied_invar);
297  vars.vertex_tree->Branch("sss3d_ioc_ranked_ioc",&vars.m_sss3d_ioc_ranked_ioc);
298  vars.vertex_tree->Branch("sss3d_ioc_ranked_opang",&vars.m_sss3d_ioc_ranked_opang);
299  vars.vertex_tree->Branch("sss3d_ioc_ranked_implied_opang",&vars.m_sss3d_ioc_ranked_implied_opang);
300  vars.vertex_tree->Branch("sss3d_ioc_ranked_id",&vars.m_sss3d_ioc_ranked_id);
301 
302  vars.vertex_tree->Branch("sss3d_invar_ranked_en",&vars.m_sss3d_invar_ranked_en);
303  vars.vertex_tree->Branch("sss3d_invar_ranked_conv",&vars.m_sss3d_invar_ranked_conv);
304  vars.vertex_tree->Branch("sss3d_invar_ranked_invar",&vars.m_sss3d_invar_ranked_invar);
305  vars.vertex_tree->Branch("sss3d_invar_ranked_implied_invar",&vars.m_sss3d_invar_ranked_implied_invar);
306  vars.vertex_tree->Branch("sss3d_invar_ranked_ioc",&vars.m_sss3d_invar_ranked_ioc);
307  vars.vertex_tree->Branch("sss3d_invar_ranked_opang",&vars.m_sss3d_invar_ranked_opang);
308  vars.vertex_tree->Branch("sss3d_invar_ranked_implied_opang",&vars.m_sss3d_invar_ranked_implied_opang);
309  vars.vertex_tree->Branch("sss3d_invar_ranked_id",&vars.m_sss3d_invar_ranked_id);
310 
311 
312  vars.vertex_tree->Branch("sss2d_ioc_ranked_en",&vars.m_sss2d_ioc_ranked_en);
313  vars.vertex_tree->Branch("sss2d_ioc_ranked_conv",&vars.m_sss2d_ioc_ranked_conv);
314  vars.vertex_tree->Branch("sss2d_ioc_ranked_ioc",&vars.m_sss2d_ioc_ranked_ioc);
315  vars.vertex_tree->Branch("sss2d_ioc_ranked_pca",&vars.m_sss2d_ioc_ranked_pca);
316  vars.vertex_tree->Branch("sss2d_ioc_ranked_invar",&vars.m_sss2d_ioc_ranked_invar);
317  vars.vertex_tree->Branch("sss2d_ioc_ranked_angle_to_shower",&vars.m_sss2d_ioc_ranked_angle_to_shower);
318  vars.vertex_tree->Branch("sss2d_ioc_ranked_num_planes",&vars.m_sss2d_ioc_ranked_num_planes);
319 
320  vars.vertex_tree->Branch("sss2d_invar_ranked_en",&vars.m_sss2d_invar_ranked_en);
321  vars.vertex_tree->Branch("sss2d_invar_ranked_conv",&vars.m_sss2d_invar_ranked_conv);
322  vars.vertex_tree->Branch("sss2d_invar_ranked_ioc",&vars.m_sss2d_invar_ranked_ioc);
323  vars.vertex_tree->Branch("sss2d_invar_ranked_pca",&vars.m_sss2d_invar_ranked_pca);
324  vars.vertex_tree->Branch("sss2d_invar_ranked_invar",&vars.m_sss2d_invar_ranked_invar);
325  vars.vertex_tree->Branch("sss2d_invar_ranked_angle_to_shower",&vars.m_sss2d_invar_ranked_angle_to_shower);
326  vars.vertex_tree->Branch("sss2d_invar_ranked_num_planes",&vars.m_sss2d_invar_ranked_num_planes);
327 
328  vars.vertex_tree->Branch("sss2d_conv_ranked_en",&vars.m_sss2d_conv_ranked_en);
329  vars.vertex_tree->Branch("sss2d_conv_ranked_conv",&vars.m_sss2d_conv_ranked_conv);
330  vars.vertex_tree->Branch("sss2d_conv_ranked_ioc",&vars.m_sss2d_conv_ranked_ioc);
331  vars.vertex_tree->Branch("sss2d_conv_ranked_pca",&vars.m_sss2d_conv_ranked_pca);
332  vars.vertex_tree->Branch("sss2d_conv_ranked_invar",&vars.m_sss2d_conv_ranked_invar);
333  vars.vertex_tree->Branch("sss2d_conv_ranked_angle_to_shower",&vars.m_sss2d_conv_ranked_angle_to_shower);
334  vars.vertex_tree->Branch("sss2d_conv_ranked_num_planes",&vars.m_sss2d_conv_ranked_num_planes);
335 
336  }
void single_photon::CreateSecondShowerBranches3D ( var_all &  vars)

Definition at line 338 of file init_branches.cxx.

338  {
339  vars.vertex_tree->Branch("sss3d_num_showers",&vars.m_sss3d_num_showers,"sss3d_num_showers/I");
340 
341  vars.vertex_tree->Branch("sss3d_shower_start_x",&vars.m_sss3d_shower_start_x);
342  vars.vertex_tree->Branch("sss3d_shower_start_y",&vars.m_sss3d_shower_start_y);
343  vars.vertex_tree->Branch("sss3d_shower_start_z",&vars.m_sss3d_shower_start_z);
344  vars.vertex_tree->Branch("sss3d_shower_dir_x",&vars.m_sss3d_shower_dir_x);
345  vars.vertex_tree->Branch("sss3d_shower_dir_y",&vars.m_sss3d_shower_dir_y);
346  vars.vertex_tree->Branch("sss3d_shower_dir_z",&vars.m_sss3d_shower_dir_z);
347 
348  vars.vertex_tree->Branch("sss3d_shower_length",&vars.m_sss3d_shower_length);
349  vars.vertex_tree->Branch("sss3d_shower_conversion_dist",&vars.m_sss3d_shower_conversion_dist);
350  vars.vertex_tree->Branch("sss3d_shower_invariant_mass",&vars.m_sss3d_shower_invariant_mass);
351  vars.vertex_tree->Branch("sss3d_shower_implied_invariant_mass",&vars.m_sss3d_shower_implied_invariant_mass);
352  vars.vertex_tree->Branch("sss3d_shower_impact_parameter",&vars.m_sss3d_shower_impact_parameter);
353  vars.vertex_tree->Branch("sss3d_shower_ioc_ratio",&vars.m_sss3d_shower_ioc_ratio);
354  vars.vertex_tree->Branch("sss3d_shower_energy_max",&vars.m_sss3d_shower_energy_max);
355  vars.vertex_tree->Branch("sss3d_shower_score",&vars.m_sss3d_shower_score);
356  vars.vertex_tree->Branch("sss3d_slice_nu",&vars.m_sss3d_slice_nu);
357  vars.vertex_tree->Branch("sss3d_slice_clear_cosmic",&vars.m_sss3d_slice_clear_cosmic);
358  }
void single_photon::CreateShowerBranches ( var_all &  vars)

Definition at line 1178 of file init_branches.cxx.

1178  {
1179  vars.vertex_tree->Branch("reco_asso_showers",&vars.m_reco_asso_showers,"reco_asso_showers/I");
1180  vars.vertex_tree->Branch("reco_shower_num_daughters",&vars.m_reco_shower_num_daughters);
1181  vars.vertex_tree->Branch("reco_shower_daughter_trackscore",&vars.m_reco_shower_daughter_trackscore);
1182 
1183  vars.vertex_tree->Branch("reco_shower_length", &vars.m_reco_shower_length);
1184  vars.vertex_tree->Branch("reco_shower_opening_angle", &vars.m_reco_shower_openingangle);
1185  vars.vertex_tree->Branch("reco_shower_dirx", &vars.m_reco_shower_dirx);
1186  vars.vertex_tree->Branch("reco_shower_diry", &vars.m_reco_shower_diry);
1187  vars.vertex_tree->Branch("reco_shower_dirz", &vars.m_reco_shower_dirz);
1188  vars.vertex_tree->Branch("reco_shower_startx", &vars.m_reco_shower_startx);
1189  vars.vertex_tree->Branch("reco_shower_starty", &vars.m_reco_shower_starty);
1190  vars.vertex_tree->Branch("reco_shower_startz", &vars.m_reco_shower_startz);
1191  vars.vertex_tree->Branch("reco_shower_start_dist_to_active_TPC", &vars.m_reco_shower_start_dist_to_active_TPC);
1192  vars.vertex_tree->Branch("reco_shower_start_dist_to_CPA", &vars.m_reco_shower_start_dist_to_CPA);
1193  vars.vertex_tree->Branch("reco_shower_start_dist_to_SCB", &vars.m_reco_shower_start_dist_to_SCB);
1194  vars.vertex_tree->Branch("reco_shower_start_in_SCB", &vars.m_reco_shower_start_in_SCB);
1195  vars.vertex_tree->Branch("reco_shower_end_dist_to_active_TPC", &vars.m_reco_shower_end_dist_to_active_TPC);
1196  vars.vertex_tree->Branch("reco_shower_end_dist_to_SCB", &vars.m_reco_shower_end_dist_to_SCB);
1197 
1198 
1199  vars.vertex_tree->Branch("reco_shower_theta_yz",&vars.m_reco_shower_theta_yz);
1200  vars.vertex_tree->Branch("reco_shower_phi_yx",&vars.m_reco_shower_phi_yx);
1201  vars.vertex_tree->Branch("reco_shower_conversion_distance",& vars.m_reco_shower_conversion_distance);
1202  vars.vertex_tree->Branch("reco_shower_impact_parameter",& vars.m_reco_shower_impact_parameter);
1203  vars.vertex_tree->Branch("reco_shower_implied_dirx", &vars.m_reco_shower_implied_dirx);
1204  vars.vertex_tree->Branch("reco_shower_implied_diry", &vars.m_reco_shower_implied_diry);
1205  vars.vertex_tree->Branch("reco_shower_implied_dirz", &vars.m_reco_shower_implied_dirz);
1206 
1207  vars.vertex_tree->Branch("reco_shower_delaunay_num_triangles_plane0",&vars.m_reco_shower_delaunay_num_triangles_plane0);
1208  vars.vertex_tree->Branch("reco_shower_delaunay_num_triangles_plane1",&vars.m_reco_shower_delaunay_num_triangles_plane1);
1209  vars.vertex_tree->Branch("reco_shower_delaunay_num_triangles_plane2",&vars.m_reco_shower_delaunay_num_triangles_plane2);
1210  vars.vertex_tree->Branch("reco_shower_num_hits_plane0",&vars.m_reco_shower_num_hits_plane0);
1211  vars.vertex_tree->Branch("reco_shower_num_hits_plane1",&vars.m_reco_shower_num_hits_plane1);
1212  vars.vertex_tree->Branch("reco_shower_num_hits_plane2",&vars.m_reco_shower_num_hits_plane2);
1213  vars.vertex_tree->Branch("reco_shower_delaunay_area_plane0",&vars.m_reco_shower_delaunay_area_plane0);
1214  vars.vertex_tree->Branch("reco_shower_delaunay_area_plane1",&vars.m_reco_shower_delaunay_area_plane1);
1215  vars.vertex_tree->Branch("reco_shower_delaunay_area_plane2",&vars.m_reco_shower_delaunay_area_plane2);
1216  //the calorimetry info
1217  vars.vertex_tree->Branch("reco_shower_energy_max",&vars.m_reco_shower_energy_max);
1218  vars.vertex_tree->Branch("reco_shower_energy_plane0",&vars.m_reco_shower_energy_plane0);
1219  vars.vertex_tree->Branch("reco_shower_energy_plane1",&vars.m_reco_shower_energy_plane1);
1220  vars.vertex_tree->Branch("reco_shower_energy_plane2",&vars.m_reco_shower_energy_plane2);
1221  vars.vertex_tree->Branch("reco_shower_plane0_nhits",&vars.m_reco_shower_plane0_nhits);
1222  vars.vertex_tree->Branch("reco_shower_plane1_nhits",&vars.m_reco_shower_plane1_nhits);
1223  vars.vertex_tree->Branch("reco_shower_plane2_nhits",&vars.m_reco_shower_plane2_nhits);
1224  vars.vertex_tree->Branch("reco_shower_plane0_meanRMS",&vars.m_reco_shower_plane0_meanRMS);
1225  vars.vertex_tree->Branch("reco_shower_plane1_meanRMS",&vars.m_reco_shower_plane1_meanRMS);
1226  vars.vertex_tree->Branch("reco_shower_plane2_meanRMS",&vars.m_reco_shower_plane2_meanRMS);
1227 
1228  vars.vertex_tree->Branch("reco_shower_reclustered_energy_plane0",&vars.m_reco_shower_reclustered_energy_plane0);
1229  vars.vertex_tree->Branch("reco_shower_reclustered_energy_plane1",&vars.m_reco_shower_reclustered_energy_plane1);
1230  vars.vertex_tree->Branch("reco_shower_reclustered_energy_plane2",&vars.m_reco_shower_reclustered_energy_plane2);
1231  vars.vertex_tree->Branch("reco_shower_reclustered_energy_max",&vars.m_reco_shower_reclustered_energy_max);
1232 
1233  vars.vertex_tree->Branch("reco_shower_hit_tick",&vars.m_reco_shower_hit_tick);
1234  vars.vertex_tree->Branch("reco_shower_hit_wire",&vars.m_reco_shower_hit_wire);
1235  vars.vertex_tree->Branch("reco_shower_hit_plane",&vars.m_reco_shower_hit_plane);
1236 
1237  vars.vertex_tree->Branch("reco_shower_spacepoint_x",&vars.m_reco_shower_spacepoint_x);
1238  vars.vertex_tree->Branch("reco_shower_spacepoint_y",&vars.m_reco_shower_spacepoint_y);
1239  vars.vertex_tree->Branch("reco_shower_spacepoint_z",&vars.m_reco_shower_spacepoint_z);
1240 
1241  vars.vertex_tree->Branch("reco_shower_ordered_energy_index",&vars.m_reco_shower_ordered_energy_index);
1242  vars.vertex_tree->Branch("i_shr",&vars.m_reco_shower_ordered_energy_index);
1243  vars.vertex_tree->Branch("reco_shower_dQdx_plane0",&vars.m_reco_shower_dQdx_plane0);
1244  vars.vertex_tree->Branch("reco_shower_dQdx_plane1",&vars.m_reco_shower_dQdx_plane1);
1245  vars.vertex_tree->Branch("reco_shower_dQdx_plane2",&vars.m_reco_shower_dQdx_plane2);
1246  vars.vertex_tree->Branch("reco_shower_dEdx_plane0",&vars.m_reco_shower_dEdx_plane0);
1247  vars.vertex_tree->Branch("reco_shower_dEdx_plane1",&vars.m_reco_shower_dEdx_plane1);
1248  vars.vertex_tree->Branch("reco_shower_dEdx_plane2",&vars.m_reco_shower_dEdx_plane2);
1249  vars.vertex_tree->Branch("reco_shower_dEdx_plane0_median",&vars.m_reco_shower_dEdx_plane0_median);
1250  vars.vertex_tree->Branch("reco_shower_dEdx_plane1_median",&vars.m_reco_shower_dEdx_plane1_median);
1251  vars.vertex_tree->Branch("reco_shower_dEdx_plane2_median",&vars.m_reco_shower_dEdx_plane2_median);
1252 
1253  vars.vertex_tree->Branch("reco_shower_angle_wrt_wires_plane0",& vars.m_reco_shower_angle_wrt_wires_plane0);
1254  vars.vertex_tree->Branch("reco_shower_angle_wrt_wires_plane1",& vars.m_reco_shower_angle_wrt_wires_plane1);
1255  vars.vertex_tree->Branch("reco_shower_angle_wrt_wires_plane2",& vars.m_reco_shower_angle_wrt_wires_plane2);
1256 
1257  vars.vertex_tree->Branch("reco_shower_dEdx_amalgamated",&vars.m_reco_shower_dEdx_amalgamated);
1258  vars.vertex_tree->Branch("reco_shower_dEdx_amalgamated_nhits",&vars.m_reco_shower_dEdx_amalgamated_nhits);
1259 
1260 
1261  vars.vertex_tree->Branch("reco_shower_dQdx_plane0_median",&vars.m_reco_shower_dQdx_plane0_median);
1262  vars.vertex_tree->Branch("reco_shower_dQdx_plane1_median",&vars.m_reco_shower_dQdx_plane1_median);
1263  vars.vertex_tree->Branch("reco_shower_dQdx_plane2_median",&vars.m_reco_shower_dQdx_plane2_median);
1264 
1265  vars.vertex_tree->Branch("reco_shower_dEdx_plane0_mean",&vars.m_reco_shower_dEdx_plane0_mean);
1266  vars.vertex_tree->Branch("reco_shower_dEdx_plane1_mean",&vars.m_reco_shower_dEdx_plane1_mean);
1267  vars.vertex_tree->Branch("reco_shower_dEdx_plane2_mean",&vars.m_reco_shower_dEdx_plane2_mean);
1268  vars.vertex_tree->Branch("reco_shower_dEdx_plane0_max",&vars.m_reco_shower_dEdx_plane0_max);
1269  vars.vertex_tree->Branch("reco_shower_dEdx_plane1_max",&vars.m_reco_shower_dEdx_plane1_max);
1270  vars.vertex_tree->Branch("reco_shower_dEdx_plane2_max",&vars.m_reco_shower_dEdx_plane2_max);
1271  vars.vertex_tree->Branch("reco_shower_dEdx_plane0_min",&vars.m_reco_shower_dEdx_plane0_min);
1272  vars.vertex_tree->Branch("reco_shower_dEdx_plane1_min",&vars.m_reco_shower_dEdx_plane1_min);
1273  vars.vertex_tree->Branch("reco_shower_dEdx_plane2_min",&vars.m_reco_shower_dEdx_plane2_min);
1274  vars.vertex_tree->Branch("reco_shower_dEdx_plane0_nhits",&vars.m_reco_shower_dEdx_plane0_nhits);
1275  vars.vertex_tree->Branch("reco_shower_dEdx_plane1_nhits",&vars.m_reco_shower_dEdx_plane1_nhits);
1276  vars.vertex_tree->Branch("reco_shower_dEdx_plane2_nhits",&vars.m_reco_shower_dEdx_plane2_nhits);
1277 
1278 // vars.vertex_tree->Branch("reco_shower_start_to_nearest_dead_wire_plane0",&vars.m_reco_shower_start_to_nearest_dead_wire_plane0);
1279 // vars.vertex_tree->Branch("reco_shower_start_to_nearest_dead_wire_plane1",&vars.m_reco_shower_start_to_nearest_dead_wire_plane1);
1280 // vars.vertex_tree->Branch("reco_shower_start_to_nearest_dead_wire_plane2",&vars.m_reco_shower_start_to_nearest_dead_wire_plane2);
1281 
1282  vars.vertex_tree->Branch("reco_shower_flash_shortest_distz",&vars.m_reco_shower_flash_shortest_distz);
1283  vars.vertex_tree->Branch("reco_shower_flash_shortest_disty",&vars.m_reco_shower_flash_shortest_disty);
1284  vars.vertex_tree->Branch("reco_shower_flash_shortest_distyz",&vars.m_reco_shower_flash_shortest_distyz);
1285  vars.vertex_tree->Branch("reco_shower_flash_shortest_index_z",&vars.m_reco_shower_flash_shortest_index_z);
1286  vars.vertex_tree->Branch("reco_shower_flash_shortest_index_y",&vars.m_reco_shower_flash_shortest_index_y);
1287  vars.vertex_tree->Branch("reco_shower_flash_shortest_index_yz",&vars.m_reco_shower_flash_shortest_index_yz);
1288 
1289  vars.vertex_tree->Branch("reco_shower_sliceId",& vars.m_reco_shower_sliceId);
1290  vars.vertex_tree->Branch("reco_shower_nuscore",& vars.m_reco_shower_nuscore);
1291  vars.vertex_tree->Branch("reco_shower_isclearcosmic",& vars.m_reco_shower_isclearcosmic);
1292  vars.vertex_tree->Branch("reco_shower_is_nuslice", & vars.m_reco_shower_is_nuslice);
1293  vars.vertex_tree->Branch("reco_shower_trackscore", & vars.m_reco_shower_trackscore);
1294  vars.vertex_tree->Branch("reco_shower_pfparticle_pdg", & vars.m_reco_shower_pfparticle_pdg);
1295 
1296 
1297  vars.vertex_tree->Branch("reco_shower3d_exists", &vars.m_reco_shower3d_exists);
1298  vars.vertex_tree->Branch("reco_shower3d_length", &vars.m_reco_shower3d_length);
1299  vars.vertex_tree->Branch("reco_shower3d_opening_angle", &vars.m_reco_shower3d_openingangle);
1300  vars.vertex_tree->Branch("reco_shower3d_dirx", &vars.m_reco_shower3d_dirx);
1301  vars.vertex_tree->Branch("reco_shower3d_diry", &vars.m_reco_shower3d_diry);
1302  vars.vertex_tree->Branch("reco_shower3d_dirz", &vars.m_reco_shower3d_dirz);
1303  vars.vertex_tree->Branch("reco_shower3d_startx", &vars.m_reco_shower3d_startx);
1304  vars.vertex_tree->Branch("reco_shower3d_starty", &vars.m_reco_shower3d_starty);
1305  vars.vertex_tree->Branch("reco_shower3d_startz", &vars.m_reco_shower3d_startz);
1306  vars.vertex_tree->Branch("reco_shower3d_theta_yz",&vars.m_reco_shower3d_theta_yz);
1307  vars.vertex_tree->Branch("reco_shower3d_phi_yx",&vars.m_reco_shower3d_phi_yx);
1308  vars.vertex_tree->Branch("reco_shower3d_conversion_distance",& vars.m_reco_shower3d_conversion_distance);
1309  vars.vertex_tree->Branch("reco_shower3d_impact_parameter",& vars.m_reco_shower3d_impact_parameter);
1310  vars.vertex_tree->Branch("reco_shower3d_implied_dirx", &vars.m_reco_shower3d_implied_dirx);
1311  vars.vertex_tree->Branch("reco_shower3d_implied_diry", &vars.m_reco_shower3d_implied_diry);
1312  vars.vertex_tree->Branch("reco_shower3d_implied_dirz", &vars.m_reco_shower3d_implied_dirz);
1313 
1314  vars.vertex_tree->Branch("reco_shower3d_energy_plane0", &vars.m_reco_shower3d_energy_plane0);
1315  vars.vertex_tree->Branch("reco_shower3d_energy_plane1", &vars.m_reco_shower3d_energy_plane1);
1316  vars.vertex_tree->Branch("reco_shower3d_energy_plane2", &vars.m_reco_shower3d_energy_plane2);
1317  vars.vertex_tree->Branch("reco_shower3d_dEdx_plane0", &vars.m_reco_shower3d_dEdx_plane0);
1318  vars.vertex_tree->Branch("reco_shower3d_dEdx_plane1", &vars.m_reco_shower3d_dEdx_plane1);
1319  vars.vertex_tree->Branch("reco_shower3d_dEdx_plane2", &vars.m_reco_shower3d_dEdx_plane2);
1320 
1321  vars.vertex_tree->Branch("reco_shower_kalman_exists",&vars.m_reco_shower_kalman_exists);
1322  vars.vertex_tree->Branch("reco_shower_kalman_dEdx_plane0_median",&vars.m_reco_shower_kalman_median_dEdx_plane0);
1323  vars.vertex_tree->Branch("reco_shower_kalman_dEdx_plane1_median",&vars.m_reco_shower_kalman_median_dEdx_plane1);
1324  vars.vertex_tree->Branch("reco_shower_kalman_dEdx_plane2_median",&vars.m_reco_shower_kalman_median_dEdx_plane2);
1325  vars.vertex_tree->Branch("reco_shower_kalman_dEdx_allplane_median",&vars.m_reco_shower_kalman_median_dEdx_allplane);
1326 
1327  vars.vertex_tree->Branch("reco_shower_kalman_dEdx_plane0_mean",&vars.m_reco_shower_kalman_mean_dEdx_plane0);
1328  vars.vertex_tree->Branch("reco_shower_kalman_dEdx_plane1_mean",&vars.m_reco_shower_kalman_mean_dEdx_plane1);
1329  vars.vertex_tree->Branch("reco_shower_kalman_dEdx_plane2_mean",&vars.m_reco_shower_kalman_mean_dEdx_plane2);
1330 
1331 
1332  vars.vertex_tree->Branch("sim_shower_matched",&vars.m_sim_shower_matched);
1333  vars.vertex_tree->Branch("sim_shower_energy",&vars.m_sim_shower_energy);
1334  vars.vertex_tree->Branch("sim_shower_kinetic_energy",&vars.m_sim_shower_kinetic_energy);
1335  vars.vertex_tree->Branch("sim_shower_mass",&vars.m_sim_shower_mass);
1336  vars.vertex_tree->Branch("sim_shower_pdg",&vars.m_sim_shower_pdg);
1337  vars.vertex_tree->Branch("sim_shower_trackID",&vars.m_sim_shower_trackID);
1338  vars.vertex_tree->Branch("sim_shower_parent_pdg",&vars.m_sim_shower_parent_pdg);
1339  vars.vertex_tree->Branch("sim_shower_parent_trackID",&vars.m_sim_shower_parent_trackID);
1340  vars.vertex_tree->Branch("sim_shower_origin",&vars.m_sim_shower_origin);
1341  vars.vertex_tree->Branch("sim_shower_process",&vars.m_sim_shower_process);
1342  vars.vertex_tree->Branch("sim_shower_end_process",&vars.m_sim_shower_end_process);
1343  vars.vertex_tree->Branch("sim_shower_start_x",&vars.m_sim_shower_start_x);
1344  vars.vertex_tree->Branch("sim_shower_start_y",&vars.m_sim_shower_start_y);
1345  vars.vertex_tree->Branch("sim_shower_start_z",&vars.m_sim_shower_start_z);
1346  vars.vertex_tree->Branch("sim_shower_vertex_x",&vars.m_sim_shower_vertex_x);
1347  vars.vertex_tree->Branch("sim_shower_vertex_y",&vars.m_sim_shower_vertex_y);
1348  vars.vertex_tree->Branch("sim_shower_vertex_z",&vars.m_sim_shower_vertex_z);
1349  vars.vertex_tree->Branch("sim_shower_px",&vars.m_sim_shower_px);
1350  vars.vertex_tree->Branch("sim_shower_py",&vars.m_sim_shower_py);
1351  vars.vertex_tree->Branch("sim_shower_pz",&vars.m_sim_shower_pz);
1352 
1353  vars.vertex_tree->Branch("sim_shower_is_true_shower",&vars.m_sim_shower_is_true_shower);
1354  vars.vertex_tree->Branch("sim_shower_best_matched_plane",&vars.m_sim_shower_best_matched_plane);
1355  vars.vertex_tree->Branch("sim_shower_matched_energy_fraction_plane0",&vars.m_sim_shower_matched_energy_fraction_plane0);
1356  vars.vertex_tree->Branch("sim_shower_matched_energy_fraction_plane1",&vars.m_sim_shower_matched_energy_fraction_plane1);
1357  vars.vertex_tree->Branch("sim_shower_matched_energy_fraction_plane2",&vars.m_sim_shower_matched_energy_fraction_plane2);
1358  vars.vertex_tree->Branch("sim_shower_overlay_fraction",&vars.m_sim_shower_overlay_fraction);
1359  vars.vertex_tree->Branch("sim_shower_sliceId", & vars.m_sim_shower_sliceId);
1360  vars.vertex_tree->Branch("sim_shower_nuscore", & vars.m_sim_shower_nuscore);
1361  vars.vertex_tree->Branch("sim_shower_isclearcosmic", & vars.m_sim_shower_isclearcosmic);
1362  vars.vertex_tree->Branch("sim_shower_is_nusclice", & vars.m_sim_shower_is_nuslice);
1363  }
void single_photon::CreateSliceBranches ( var_all &  vars)

Definition at line 2108 of file init_branches.cxx.

2108  {
2109  vars.vertex_tree->Branch("reco_slice_nuscore",&vars.m_reco_slice_nuscore);
2110  vars.vertex_tree->Branch("reco_slice_num",&vars.m_reco_slice_num);
2111  vars.vertex_tree->Branch("reco_slice_shower_num_matched_signal",& vars.m_reco_slice_shower_num_matched_signal);
2112  vars.vertex_tree->Branch("reco_slice_track_num_matched_signal",& vars.m_reco_slice_track_num_matched_signal);
2113 
2114  vars.ncdelta_slice_tree->Branch("matched_signal_shower_overlay_fraction", &vars.m_matched_signal_shower_overlay_fraction);
2115  //std::vector<double> vars.m_matched_signal_shower_conversion_length;
2116  vars.ncdelta_slice_tree->Branch("matched_signal_shower_true_E", &vars.m_matched_signal_shower_true_E);
2117  vars.ncdelta_slice_tree->Branch("matched_signal_shower_nuscore", &vars.m_matched_signal_shower_nuscore);
2118  vars.ncdelta_slice_tree->Branch("matched_signal_shower_sliceId", &vars.m_matched_signal_shower_sliceId);
2119  vars.ncdelta_slice_tree->Branch("matched_signal_shower_is_clearcosmic", &vars.m_matched_signal_shower_is_clearcosmic);
2120  vars.ncdelta_slice_tree->Branch("matched_signal_shower_num", &vars.m_matched_signal_shower_num);
2121  vars.ncdelta_slice_tree->Branch("matched_signal_shower_is_nuslice", &vars.m_matched_signal_shower_is_nuslice);
2122  vars.ncdelta_slice_tree->Branch("matched_signal_shower_tracks_in_slice", &vars.m_matched_signal_shower_tracks_in_slice);
2123  vars.ncdelta_slice_tree->Branch("matched_signal_shower_showers_in_slice", &vars.m_matched_signal_shower_showers_in_slice);
2124 
2125  vars.ncdelta_slice_tree->Branch("reco_slice_num_pfps", & vars.m_reco_slice_num_pfps);
2126  vars.ncdelta_slice_tree->Branch("reco_slice_num_showers", & vars.m_reco_slice_num_showers);
2127  vars.ncdelta_slice_tree->Branch("reco_slice_num_tracks", & vars.m_reco_slice_num_tracks);
2128 
2129  // vars.ncdelta_slice_tree->Branch("matched_signal_track_overlay_fraction", &vars.m_matched_signal_track_overlay_fraction);
2130  vars.ncdelta_slice_tree->Branch("matched_signal_track_true_E", &vars.m_matched_signal_track_true_E);
2131  vars.ncdelta_slice_tree->Branch("matched_signal_track_nuscore", &vars.m_matched_signal_track_nuscore);
2132  vars.ncdelta_slice_tree->Branch("matched_signal_track_sliceId", &vars.m_matched_signal_track_sliceId);
2133  vars.ncdelta_slice_tree->Branch("matched_signal_track_is_clearcosmic", &vars.m_matched_signal_track_is_clearcosmic);
2134  vars.ncdelta_slice_tree->Branch("matched_signal_track_num", &vars.m_matched_signal_track_num);
2135  vars.ncdelta_slice_tree->Branch("matched_signal_track_is_nuslice", &vars.m_matched_signal_track_is_nuslice);
2136  vars.ncdelta_slice_tree->Branch("matched_signal_track_tracks_in_slice", &vars.m_matched_signal_track_tracks_in_slice);
2137  vars.ncdelta_slice_tree->Branch("matched_signal_track_showers_in_slice", &vars.m_matched_signal_track_showers_in_slice);
2138 
2139  //int vars.m_matched_signal_total_num_slices;
2140  vars.ncdelta_slice_tree->Branch("reco_1g1p_is_same_slice",&vars.m_reco_1g1p_is_same_slice);
2141  vars.ncdelta_slice_tree->Branch("reco_1g1p_is_nuslice",&vars.m_reco_1g1p_is_nuslice);
2142  vars.ncdelta_slice_tree->Branch("reco_1g1p_is_multiple_slices",&vars.m_reco_1g1p_is_multiple_slices);
2143  vars.ncdelta_slice_tree->Branch("reco_1g1p_nuscore",&vars.m_reco_1g1p_nuscore);
2144  vars.ncdelta_slice_tree->Branch("is_matched_1g1p",&vars.m_is_matched_1g1p);
2145 
2146  vars.ncdelta_slice_tree->Branch("reco_1g0p_nuscore",&vars.m_reco_1g0p_nuscore);
2147  vars.ncdelta_slice_tree->Branch("reco_1g0p_is_nuslice",&vars.m_reco_1g0p_is_nuslice);
2148  vars.ncdelta_slice_tree->Branch("is_matched_1g0p",&vars.m_is_matched_1g0p);
2149 
2150  vars.ncdelta_slice_tree->Branch("no_matched_showers",& vars.m_no_matched_showers);
2151  vars.ncdelta_slice_tree->Branch("multiple_matched_showers",& vars.m_multiple_matched_showers);
2152  vars.ncdelta_slice_tree->Branch("multiple_matched_tracks",& vars.m_multiple_matched_tracks);
2153  }
void single_photon::CreateStubBranches ( var_all &  vars)

Definition at line 360 of file init_branches.cxx.

360  {
361 
362  vars.vertex_tree->Branch("trackstub_num_unassociated_hits",&vars.m_trackstub_num_unassociated_hits,"trackstub_num_unassociated_hits/I");
363  vars.vertex_tree->Branch("trackstub_unassociated_hits_below_threshold",&vars.m_trackstub_unassociated_hits_below_threshold,"trackstub_unassociated_hits_below_threshold/I");
364  vars.vertex_tree->Branch("trackstub_associated_hits",&vars.m_trackstub_associated_hits,"trackstub_associated_hits/I");
365  vars.vertex_tree->Branch("trackstub_num_candidates", &vars.m_trackstub_num_candidates, "trackstub_num_candidates/I");
366  vars.vertex_tree->Branch("trackstub_candidate_in_nu_slice", &vars.m_trackstub_candidate_in_nu_slice);
367  vars.vertex_tree->Branch("trackstub_candidate_num_hits", &vars.m_trackstub_candidate_num_hits);
368  vars.vertex_tree->Branch("trackstub_candidate_num_wires", &vars.m_trackstub_candidate_num_wires);
369  vars.vertex_tree->Branch("trackstub_candidate_num_ticks", &vars.m_trackstub_candidate_num_ticks);
370  vars.vertex_tree->Branch("trackstub_candidate_plane", &vars.m_trackstub_candidate_plane);
371  vars.vertex_tree->Branch("trackstub_candidate_PCA", &vars.m_trackstub_candidate_PCA);
372  vars.vertex_tree->Branch("trackstub_candidate_mean_ADC", &vars.m_trackstub_candidate_mean_ADC);
373  vars.vertex_tree->Branch("trackstub_candidate_ADC_RMS", &vars.m_trackstub_candidate_ADC_RMS);
374  vars.vertex_tree->Branch("trackstub_candidate_veto_score", &vars.m_trackstub_candidate_veto_score);
375  vars.vertex_tree->Branch("trackstub_candidate_mean_tick", &vars.m_trackstub_candidate_mean_tick);
376  vars.vertex_tree->Branch("trackstub_candidate_max_tick", &vars.m_trackstub_candidate_max_tick);
377  vars.vertex_tree->Branch("trackstub_candidate_min_tick", &vars.m_trackstub_candidate_min_tick);
378  vars.vertex_tree->Branch("trackstub_candidate_min_wire", &vars.m_trackstub_candidate_min_wire);
379  vars.vertex_tree->Branch("trackstub_candidate_max_wire", &vars.m_trackstub_candidate_max_wire);
380  vars.vertex_tree->Branch("trackstub_candidate_mean_wire", &vars.m_trackstub_candidate_mean_wire);
381  vars.vertex_tree->Branch("trackstub_candidate_min_dist", &vars.m_trackstub_candidate_min_dist);
382  vars.vertex_tree->Branch("trackstub_candidate_min_impact_parameter_to_shower", &vars.m_trackstub_candidate_min_impact_parameter_to_shower);
383  vars.vertex_tree->Branch("trackstub_candidate_min_conversion_dist_to_shower_start", &vars.m_trackstub_candidate_min_conversion_dist_to_shower_start);
384  vars.vertex_tree->Branch("trackstub_candidate_min_ioc_to_shower_start", &vars.m_trackstub_candidate_min_ioc_to_shower_start);
385  vars.vertex_tree->Branch("trackstub_candidate_ioc_based_length", &vars.m_trackstub_candidate_ioc_based_length);
386  vars.vertex_tree->Branch("trackstub_candidate_wire_tick_based_length", &vars.m_trackstub_candidate_wire_tick_based_length);
387  vars.vertex_tree->Branch("trackstub_candidate_mean_ADC_first_half", &vars.m_trackstub_candidate_mean_ADC_first_half);
388  vars.vertex_tree->Branch("trackstub_candidate_mean_ADC_second_half", &vars.m_trackstub_candidate_mean_ADC_second_half);
389  vars.vertex_tree->Branch("trackstub_candidate_mean_ADC_first_to_second_ratio", &vars.m_trackstub_candidate_mean_ADC_first_to_second_ratio);
390  vars.vertex_tree->Branch("trackstub_candidate_track_angle_wrt_shower_direction", &vars.m_trackstub_candidate_track_angle_wrt_shower_direction);
391  vars.vertex_tree->Branch("trackstub_candidate_linear_fit_chi2", &vars.m_trackstub_candidate_linear_fit_chi2);
392  vars.vertex_tree->Branch("trackstub_candidate_energy", &vars.m_trackstub_candidate_energy);
393  vars.vertex_tree->Branch("trackstub_candidate_remerge", &vars.m_trackstub_candidate_remerge);
394  vars.vertex_tree->Branch("trackstub_candidate_matched", &vars.m_trackstub_candidate_matched);
395  vars.vertex_tree->Branch("trackstub_candidate_matched_energy_fraction_best_plane", &vars.m_trackstub_candidate_matched_energy_fraction_best_plane);
396  vars.vertex_tree->Branch("trackstub_candidate_pdg", &vars.m_trackstub_candidate_pdg);
397  vars.vertex_tree->Branch("trackstub_candidate_parent_pdg", &vars.m_trackstub_candidate_parent_pdg);
398  vars.vertex_tree->Branch("trackstub_candidate_trackid", &vars.m_trackstub_candidate_trackid);
399  vars.vertex_tree->Branch("trackstub_candidate_true_energy", &vars.m_trackstub_candidate_true_energy);
400  vars.vertex_tree->Branch("trackstub_candidate_overlay_fraction", &vars.m_trackstub_candidate_overlay_fraction);
401 
402 
403  vars.vertex_tree->Branch("trackstub_num_candidate_groups", &vars.m_trackstub_num_candidate_groups, "trackstub_num_candidate_groups/I");
404  vars.vertex_tree->Branch("grouped_trackstub_candidate_indices", &vars.m_grouped_trackstub_candidate_indices);
405  vars.vertex_tree->Branch("trackstub_candidate_group_timeoverlap_fraction", &vars.m_trackstub_candidate_group_timeoverlap_fraction);
406 
407  }
void single_photon::CreateTrackBranches ( var_all &  vars)

Definition at line 660 of file init_branches.cxx.

660  {
661  vars.vertex_tree->Branch("reco_asso_tracks",&vars.m_reco_asso_tracks,"reco_asso_tracks/I");
662  vars.vertex_tree->Branch("reco_track_num_daughters",&vars.m_reco_track_num_daughters);
663  vars.vertex_tree->Branch("reco_track_daughter_trackscore",&vars.m_reco_track_daughter_trackscore);
664  vars.vertex_tree->Branch("reco_track_displacement", &vars.m_reco_track_length);
665  vars.vertex_tree->Branch("reco_track_dirx", &vars.m_reco_track_dirx);
666  vars.vertex_tree->Branch("reco_track_diry", &vars.m_reco_track_diry);
667  vars.vertex_tree->Branch("reco_track_dirz", &vars.m_reco_track_dirz);
668  vars.vertex_tree->Branch("reco_track_startx", &vars.m_reco_track_startx);
669  vars.vertex_tree->Branch("reco_track_starty", &vars.m_reco_track_starty);
670  vars.vertex_tree->Branch("reco_track_startz", &vars.m_reco_track_startz);
671 
672  vars.vertex_tree->Branch("reco_track_endx", &vars.m_reco_track_endx);
673  vars.vertex_tree->Branch("reco_track_endy", &vars.m_reco_track_endy);
674  vars.vertex_tree->Branch("reco_track_endz", &vars.m_reco_track_endz);
675  vars.vertex_tree->Branch("reco_track_end_dist_to_active_TPC", &vars.m_reco_track_end_dist_to_active_TPC);
676  vars.vertex_tree->Branch("reco_track_start_dist_to_active_TPC", &vars.m_reco_track_start_dist_to_active_TPC);
677  vars.vertex_tree->Branch("reco_track_end_dist_to_CPA", &vars.m_reco_track_end_dist_to_CPA);
678  vars.vertex_tree->Branch("reco_track_start_dist_to_CPA", &vars.m_reco_track_start_dist_to_CPA);
679  vars.vertex_tree->Branch("reco_track_end_dist_to_SCB", &vars.m_reco_track_end_dist_to_SCB);
680  vars.vertex_tree->Branch("reco_track_start_dist_to_SCB", &vars.m_reco_track_start_dist_to_SCB);
681  vars.vertex_tree->Branch("reco_track_end_in_SCB", &vars.m_reco_track_end_in_SCB);
682  vars.vertex_tree->Branch("reco_track_start_in_SCB", &vars.m_reco_track_start_in_SCB);
683 
684 
685  vars.vertex_tree->Branch("reco_track_theta_yz", &vars.m_reco_track_theta_yz);
686  vars.vertex_tree->Branch("reco_track_phi_yx", &vars.m_reco_track_phi_yx);
687 
688  vars.vertex_tree->Branch("reco_track_calo_energy_plane0", &vars.m_reco_track_calo_energy_plane0);
689  vars.vertex_tree->Branch("reco_track_calo_energy_plane1", &vars.m_reco_track_calo_energy_plane1);
690  vars.vertex_tree->Branch("reco_track_calo_energy_plane2", &vars.m_reco_track_calo_energy_plane2);
691  vars.vertex_tree->Branch("reco_track_calo_energy_max", &vars.m_reco_track_calo_energy_max);
692 
693  vars.vertex_tree->Branch("reco_track_num_trajpoints", &vars.m_reco_track_num_trajpoints);
694  vars.vertex_tree->Branch("reco_track_num_spacepoints", &vars.m_reco_track_num_spacepoints);
695  vars.vertex_tree->Branch("reco_track_proton_kinetic_energy", &vars.m_reco_track_proton_kinetic_energy);
696  vars.vertex_tree->Branch("reco_track_ordered_energy_index", &vars.m_reco_track_ordered_energy_index);
697  vars.vertex_tree->Branch("reco_track_ordered_displacement_index", &vars.m_reco_track_ordered_displacement_index);
698  vars.vertex_tree->Branch("i_trk", &vars.m_reco_track_ordered_displacement_index);
699 
700  vars.vertex_tree->Branch("reco_track_spacepoint_principal0",&vars.m_reco_track_spacepoint_principal0);
701  vars.vertex_tree->Branch("reco_track_spacepoint_principal1",&vars.m_reco_track_spacepoint_principal1);
702  vars.vertex_tree->Branch("reco_track_spacepoint_principal2",&vars.m_reco_track_spacepoint_principal2);
703 
704  vars.vertex_tree->Branch("reco_track_spacepoint_chi",&vars.m_reco_track_spacepoint_chi);
705  vars.vertex_tree->Branch("reco_track_spacepoint_max_dist",&vars.m_reco_track_spacepoint_max_dist);
706 
707  vars.vertex_tree->Branch("reco_track_best_calo_plane",&vars.m_reco_track_best_calo_plane);
708 
709  vars.vertex_tree->Branch("reco_track_mean_dEdx_best_plane",&vars.m_reco_track_mean_dEdx_best_plane);
710  vars.vertex_tree->Branch("reco_track_mean_dEdx_plane0",&vars.m_reco_track_mean_dEdx_p0);
711  vars.vertex_tree->Branch("reco_track_mean_dEdx_plane1",&vars.m_reco_track_mean_dEdx_p1);
712  vars.vertex_tree->Branch("reco_track_mean_dEdx_plane2",&vars.m_reco_track_mean_dEdx_p2);
713 
714  vars.vertex_tree->Branch("reco_track_mean_dEdx_start_half_best_plane",&vars.m_reco_track_mean_dEdx_end_half_best_plane);
715  vars.vertex_tree->Branch("reco_track_mean_dEdx_start_half_plane0",&vars.m_reco_track_mean_dEdx_end_half_p0);
716  vars.vertex_tree->Branch("reco_track_mean_dEdx_start_half_plane1",&vars.m_reco_track_mean_dEdx_end_half_p1);
717  vars.vertex_tree->Branch("reco_track_mean_dEdx_start_half_plane2",&vars.m_reco_track_mean_dEdx_end_half_p2);
718 
719  vars.vertex_tree->Branch("reco_track_mean_dEdx_end_half_best_plane",&vars.m_reco_track_mean_dEdx_start_half_best_plane);
720  vars.vertex_tree->Branch("reco_track_mean_dEdx_end_half_plane0",&vars.m_reco_track_mean_dEdx_start_half_p0);
721  vars.vertex_tree->Branch("reco_track_mean_dEdx_end_half_plane1",&vars.m_reco_track_mean_dEdx_start_half_p1);
722  vars.vertex_tree->Branch("reco_track_mean_dEdx_end_half_plane2",&vars.m_reco_track_mean_dEdx_start_half_p2);
723 
724  vars.vertex_tree->Branch("reco_track_good_calo_best_plane",&vars.m_reco_track_good_calo_best_plane);
725  vars.vertex_tree->Branch("reco_track_good_calo_plane0",&vars.m_reco_track_good_calo_p0);
726  vars.vertex_tree->Branch("reco_track_good_calo_plane1",&vars.m_reco_track_good_calo_p1);
727  vars.vertex_tree->Branch("reco_track_good_calo_plane2",&vars.m_reco_track_good_calo_p2);
728 
729  vars.vertex_tree->Branch("reco_track_trunc_dEdx_best_plane",&vars.m_reco_track_trunc_dEdx_best_plane);
730  vars.vertex_tree->Branch("reco_track_trunc_dEdx_plane0",&vars.m_reco_track_trunc_dEdx_p0);
731  vars.vertex_tree->Branch("reco_track_trunc_dEdx_plane1",&vars.m_reco_track_trunc_dEdx_p1);
732  vars.vertex_tree->Branch("reco_track_trunc_dEdx_plane2",&vars.m_reco_track_trunc_dEdx_p2);
733 
734  vars.vertex_tree->Branch("reco_track_mean_trunc_dEdx_best_plane",&vars.m_reco_track_mean_trunc_dEdx_best_plane);
735  vars.vertex_tree->Branch("reco_track_mean_trunc_dEdx_plane0",&vars.m_reco_track_mean_trunc_dEdx_p0);
736  vars.vertex_tree->Branch("reco_track_mean_trunc_dEdx_plane1",&vars.m_reco_track_mean_trunc_dEdx_p1);
737  vars.vertex_tree->Branch("reco_track_mean_trunc_dEdx_plane2",&vars.m_reco_track_mean_trunc_dEdx_p2);
738 
739  vars.vertex_tree->Branch("reco_track_mean_trunc_dEdx_start_half_best_plane",&vars.m_reco_track_mean_trunc_dEdx_end_half_best_plane);
740  vars.vertex_tree->Branch("reco_track_mean_trunc_dEdx_start_half_plane0",&vars.m_reco_track_mean_trunc_dEdx_end_half_p0);
741  vars.vertex_tree->Branch("reco_track_mean_trunc_dEdx_start_half_plane1",&vars.m_reco_track_mean_trunc_dEdx_end_half_p1);
742  vars.vertex_tree->Branch("reco_track_mean_trunc_dEdx_start_half_plane2",&vars.m_reco_track_mean_trunc_dEdx_end_half_p2);
743 
744  vars.vertex_tree->Branch("reco_track_mean_trunc_dEdx_end_half_best_plane",&vars.m_reco_track_mean_trunc_dEdx_start_half_best_plane);
745  vars.vertex_tree->Branch("reco_track_mean_trunc_dEdx_end_half_plane0",&vars.m_reco_track_mean_trunc_dEdx_start_half_p0);
746  vars.vertex_tree->Branch("reco_track_mean_trunc_dEdx_end_half_plane1",&vars.m_reco_track_mean_trunc_dEdx_start_half_p1);
747  vars.vertex_tree->Branch("reco_track_mean_trunc_dEdx_end_half_plane2",&vars.m_reco_track_mean_trunc_dEdx_start_half_p2);
748 
749  vars.vertex_tree->Branch("reco_track_trunc_PIDA_best_plane",&vars.m_reco_track_trunc_PIDA_best_plane);
750  vars.vertex_tree->Branch("reco_track_trunc_PIDA_plane0",&vars.m_reco_track_trunc_PIDA_p0);
751  vars.vertex_tree->Branch("reco_track_trunc_PIDA_plane1",&vars.m_reco_track_trunc_PIDA_p1);
752  vars.vertex_tree->Branch("reco_track_trunc_PIDA_plane2",&vars.m_reco_track_trunc_PIDA_p2);
753 
754  vars.vertex_tree->Branch("reco_track_resrange_best_plane",&vars.m_reco_track_resrange_best_plane);
755  vars.vertex_tree->Branch("reco_track_resrange_plane0",&vars.m_reco_track_resrange_p0);
756  vars.vertex_tree->Branch("reco_track_resrange_plane1",&vars.m_reco_track_resrange_p1);
757  vars.vertex_tree->Branch("reco_track_resrange_plane2",&vars.m_reco_track_resrange_p2);
758 
759  vars.vertex_tree->Branch("reco_track_dEdx_best_plane",&vars.m_reco_track_dEdx_best_plane);
760  vars.vertex_tree->Branch("reco_track_dEdx_plane0",&vars.m_reco_track_dEdx_p0);
761  vars.vertex_tree->Branch("reco_track_dEdx_plane1",&vars.m_reco_track_dEdx_p1);
762  vars.vertex_tree->Branch("reco_track_dEdx_plane2",&vars.m_reco_track_dEdx_p2);
763 
764  vars.vertex_tree->Branch("reco_track_num_calo_hits_plane0",&vars.m_reco_track_num_calo_hits_p0);
765  vars.vertex_tree->Branch("reco_track_num_calo_hits_plane1",&vars.m_reco_track_num_calo_hits_p1);
766  vars.vertex_tree->Branch("reco_track_num_calo_hits_plane2",&vars.m_reco_track_num_calo_hits_p2);
767 
768 
769 
770  vars.vertex_tree->Branch("reco_track_pid_bragg_likelihood_mu_plane0",&vars.m_reco_track_pid_bragg_likelihood_mu_plane0);
771  vars.vertex_tree->Branch("reco_track_pid_bragg_likelihood_mu_plane1",&vars.m_reco_track_pid_bragg_likelihood_mu_plane1);
772  vars.vertex_tree->Branch("reco_track_pid_bragg_likelihood_mu_plane2",&vars.m_reco_track_pid_bragg_likelihood_mu_plane2);
773  vars.vertex_tree->Branch("reco_track_pid_bragg_likelihood_p_plane0",&vars.m_reco_track_pid_bragg_likelihood_p_plane0);
774  vars.vertex_tree->Branch("reco_track_pid_bragg_likelihood_p_plane1",&vars.m_reco_track_pid_bragg_likelihood_p_plane1);
775  vars.vertex_tree->Branch("reco_track_pid_bragg_likelihood_p_plane2",&vars.m_reco_track_pid_bragg_likelihood_p_plane2);
776  vars.vertex_tree->Branch("reco_track_pid_bragg_likelihood_mip_plane0",&vars.m_reco_track_pid_bragg_likelihood_mip_plane0);
777  vars.vertex_tree->Branch("reco_track_pid_bragg_likelihood_mip_plane1",&vars.m_reco_track_pid_bragg_likelihood_mip_plane1);
778  vars.vertex_tree->Branch("reco_track_pid_bragg_likelihood_mip_plane2",&vars.m_reco_track_pid_bragg_likelihood_mip_plane2);
779  vars.vertex_tree->Branch("reco_track_pid_chi2_mu_plane0",&vars.m_reco_track_pid_chi2_mu_plane0);
780  vars.vertex_tree->Branch("reco_track_pid_chi2_mu_plane1",&vars.m_reco_track_pid_chi2_mu_plane1);
781  vars.vertex_tree->Branch("reco_track_pid_chi2_mu_plane2",&vars.m_reco_track_pid_chi2_mu_plane2);
782  vars.vertex_tree->Branch("reco_track_pid_chi2_p_plane0",&vars.m_reco_track_pid_chi2_p_plane0);
783  vars.vertex_tree->Branch("reco_track_pid_chi2_p_plane1",&vars.m_reco_track_pid_chi2_p_plane1);
784  vars.vertex_tree->Branch("reco_track_pid_chi2_p_plane2",&vars.m_reco_track_pid_chi2_p_plane2);
785  vars.vertex_tree->Branch("reco_track_pid_pida_plane0",&vars.m_reco_track_pid_pida_plane0);
786  vars.vertex_tree->Branch("reco_track_pid_pida_plane1",&vars.m_reco_track_pid_pida_plane1);
787  vars.vertex_tree->Branch("reco_track_pid_pida_plane2",&vars.m_reco_track_pid_pida_plane2);
788  vars.vertex_tree->Branch("reco_track_pid_three_plane_proton_pid",&vars.m_reco_track_pid_three_plane_proton_pid);
789 
790 // vars.vertex_tree->Branch("reco_track_end_to_nearest_dead_wire_plane0",&vars.m_reco_track_end_to_nearest_dead_wire_plane0);
791 // vars.vertex_tree->Branch("reco_track_end_to_nearest_dead_wire_plane1",&vars.m_reco_track_end_to_nearest_dead_wire_plane1);
792 // vars.vertex_tree->Branch("reco_track_end_to_nearest_dead_wire_plane2",&vars.m_reco_track_end_to_nearest_dead_wire_plane2);
793 
794  vars.vertex_tree->Branch("reco_track_sliceId",& vars.m_reco_track_sliceId);
795  vars.vertex_tree->Branch("reco_track_nuscore",& vars.m_reco_track_nuscore);
796  vars.vertex_tree->Branch("reco_track_isclearcosmic",& vars.m_reco_track_isclearcosmic);
797  vars.vertex_tree->Branch("reco_track_trackscore",& vars.m_reco_track_trackscore);
798  vars.vertex_tree->Branch("reco_track_pfparticle_pdg",& vars.m_reco_track_pfparticle_pdg);
799  vars.vertex_tree->Branch("reco_track_is_nuslice",& vars.m_reco_track_is_nuslice);
800 
801  vars.vertex_tree->Branch("sim_track_matched",&vars.m_sim_track_matched);
802  vars.vertex_tree->Branch("sim_track_overlay_fraction",&vars.m_sim_track_overlay_fraction);
803  vars.vertex_tree->Branch("sim_track_energy",&vars.m_sim_track_energy);
804  vars.vertex_tree->Branch("sim_track_kinetic_energy",&vars.m_sim_track_kinetic_energy);
805  vars.vertex_tree->Branch("sim_track_mass",&vars.m_sim_track_mass);
806  vars.vertex_tree->Branch("sim_track_pdg",&vars.m_sim_track_pdg);
807  vars.vertex_tree->Branch("sim_track_parent_pdg",&vars.m_sim_track_parent_pdg);
808  vars.vertex_tree->Branch("sim_track_origin",&vars.m_sim_track_origin);
809  vars.vertex_tree->Branch("sim_track_process",&vars.m_sim_track_process);
810  vars.vertex_tree->Branch("sim_track_startx",&vars.m_sim_track_startx);
811  vars.vertex_tree->Branch("sim_track_starty",&vars.m_sim_track_starty);
812  vars.vertex_tree->Branch("sim_track_startz",&vars.m_sim_track_startz);
813  vars.vertex_tree->Branch("sim_track_px",&vars.m_sim_track_px);
814  vars.vertex_tree->Branch("sim_track_py",&vars.m_sim_track_py);
815  vars.vertex_tree->Branch("sim_track_pz",&vars.m_sim_track_pz);
816  vars.vertex_tree->Branch("sim_track_endx",&vars.m_sim_track_endx);
817  vars.vertex_tree->Branch("sim_track_endy",&vars.m_sim_track_endy);
818  vars.vertex_tree->Branch("sim_track_endz",&vars.m_sim_track_endz);
819  vars.vertex_tree->Branch("sim_track_length",&vars.m_sim_track_length);
820 
821  vars.vertex_tree->Branch("sim_track_trackID",&vars.m_sim_track_trackID);
822 
823  vars.vertex_tree->Branch("sim_track_sliceId",& vars.m_sim_track_sliceId);
824  vars.vertex_tree->Branch("sim_track_nuscore",& vars.m_sim_track_nuscore);
825  vars.vertex_tree->Branch("sim_track_isclearcosmic",& vars.m_sim_track_isclearcosmic);
826  }
int single_photon::DefineNuSlice ( std::vector< PandoraPFParticle > &  PPFPs)

Definition at line 117 of file helper_PandoraPFParticles.cxx.

117  {
118 
119  int pfp_size = PPFPs.size();
120  double best_nuscore = 0;
121  int best_nuscore_SliceID = 0;
122  std::vector< int > IDs;
123 
124  for(int index = 0; index < pfp_size; index++){
125  PandoraPFParticle* temp_p = &PPFPs[index];
126  if(temp_p->get_IsNeutrino()){
127  int temp_sliceID = temp_p->get_SliceID();
128  //add one if not found;
129  if(!std::count(IDs.begin(), IDs.end(), temp_sliceID) ) IDs.push_back(temp_sliceID);
130  if(best_nuscore < temp_p->get_NuScore() ){
131  best_nuscore = temp_p->get_NuScore();
132 
133  best_nuscore_SliceID = temp_p->get_SliceID();
134 
135  }
136  }
137  }
138 
139  //now markdown all pfparticles in slice
140  //re-set pNuScore and pIsNuSlice
141  for(int index = 0; index < pfp_size; index++){
142  PandoraPFParticle* ppfp = &PPFPs[index];
143  if( std::count(IDs.begin(), IDs.end(), ppfp->get_SliceID()) ) ppfp->set_IsNuSlice(true);
144  }
145 
146  return best_nuscore_SliceID;
147  }
std::size_t count(Cont const &cont)
double single_photon::degToRad ( double  deg)
inline

Definition at line 64 of file helper_math.h.

64 { return deg * M_PI/180; }
int single_photon::delaunay_hit_wrapper ( const std::vector< art::Ptr< recob::Hit >> &  hits,
std::vector< int > &  num_hits,
std::vector< int > &  num_triangles,
std::vector< double > &  area,
para_all &  paras 
)

Definition at line 520 of file Processors.cxx.

520  {
521 
522  int n = hits.size();
523  std::vector<double> C0,T0;
524  std::vector<double> C1,T1;
525  std::vector<double> C2,T2;
526  size_t n_0=0;
527  size_t n_1=0;
528  size_t n_2=0;
529 
530  for(int i=0;i<n; i++){
531  const art::Ptr<recob::Hit> hit = hits[i];
532  switch(hit->View()){
533  case 0:
534  C0.push_back((double)hit->WireID().Wire);
535  T0.push_back(hit->PeakTime());
536  n_0++;
537  break;
538  case 1:
539  C1.push_back((double)hit->WireID().Wire);
540  T1.push_back(hit->PeakTime());
541  n_1++;
542  break;
543  case 2:
544  C2.push_back((double)hit->WireID().Wire);
545  T2.push_back(hit->PeakTime());
546  n_2++;
547  break;
548  default:
549  break;
550  }
551  }
552  if(paras.s_use_delaunay){
553  if(n_0>0 && (int)n_0 < paras.s_delaunay_max_hits) quick_delaunay_fit(n_0, &C0[0] , &T0[0] , &num_triangles[0], &area[0]);
554  if(n_1>0 && (int)n_1 < paras.s_delaunay_max_hits) quick_delaunay_fit(n_1, &C1[0] , &T1[0] , &num_triangles[1], &area[1]);
555  if(n_2>0 && (int)n_2 < paras.s_delaunay_max_hits) quick_delaunay_fit(n_2, &C2[0] , &T2[0] , &num_triangles[2], &area[2]);
556  }
557  num_hits[0] = n_0;
558  num_hits[1] = n_1;
559  num_hits[2] = n_2;
560 
561  //std::cout<<"Plane 0: "<<n_0<<" hits with "<<num_triangles[0]<<" triangles of area: "<< area[0]<<std::endl;
562  //std::cout<<"Plane 1: "<<n_1<<" hits with "<<num_triangles[1]<<" triangles of area: "<< area[1]<<std::endl;
563  //std::cout<<"Plane 2: "<<n_2<<" hits with "<<num_triangles[2]<<" triangles of area: "<< area[2]<<std::endl;
564 
565  return 0;
566  }
process_name hit
Definition: cheaterreco.fcl:51
int quick_delaunay_fit(int n, double *X, double *Y, int *num_triangles, double *area)
Definition: Processors.cxx:495
process_name opdaq physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator T0
Definition: gen_protons.fcl:45
double single_photon::dist_line_point ( std::vector< double > &  X1,
std::vector< double > &  X2,
std::vector< double > &  point 
)

Definition at line 8 of file helper_math.cxx.

8  {
9  double x1 =X1.at(0);
10  double y1 =X1.at(1);
11  double z1 =X1.at(2);
12 
13  double x2 =X2.at(0);
14  double y2 =X2.at(1);
15  double z2 =X2.at(2);
16 
17  double x0 =point.at(0);
18  double y0 =point.at(1);
19  double z0 =point.at(2);
20 
21  double x10 = x1-x0;
22  double y10 = y1-y0;
23  double z10 = z1-z0;
24 
25  double x21 = x2-x1;
26  double y21 = y2-y1;
27  double z21 = z2-z1;
28 
29  double t = -(x10*x21+y10*y21+z10*z21)/fabs(x21*x21+y21*y21+z21*z21 );
30  // right, but can be simplified
31  double d2 = pow(x1-x0,2)+pow(y1-y0,2)+pow(z1-z0,2)+2*t*((x2-x1)*(x1-x0)+(y2-y1)*(y1-y0)+(z2-z1)*(z1-z0))+t*t*( pow(x2-x1,2)+pow(y2-y1,2)+pow(z2-z1,2));
32 
33  return sqrt(d2);
34  }
double single_photon::distToCPA ( std::vector< double > &  vec,
para_all &  paras 
)

Definition at line 72 of file fiducial_volume.cxx.

72  {
73  if(!isInTPCActive(vec, paras)) return -999;
74  double dx = std::min( fabs(vec[0] - (-0.45)) , fabs(vec[0] - 0.45));
75 
76  return dx;
77 }
bool isInTPCActive(std::vector< double > &vec, para_all &paras)
int single_photon::distToSCB ( double &  dist,
std::vector< double > &  vec,
para_all &  paras 
)

Definition at line 86 of file fiducial_volume.cxx.

86  {
87  //CHECK!
88  dist = distToTPCActive( vec, paras);
89  int is_it_in = 0;
90  if(isInTPCActive( vec, paras)) is_it_in++;
91  return is_it_in;
92  //NOT USE SCB YET, bring it back later!
93  //
94  // //this one returns the distance to the boundary
95  // bool ans = false;
96  // double dist_yx = 999999;
97  //
98  // int iseg = 0;
99  // if (!isInTPCActive(vec)){
100  // dist=-1;
101  // return 0; // is it in active volume?
102  // }
103  // double cut = 0.0;
104  //
105  // TVector3 pt(&vec[0]);
106  //
107  // Int_t z_idx = (Int_t)pt.Z()/100; // Int_t: signed integer 4 bytes
108  //
109  // Int_t z_idx_YX = z_idx;//YX-view effective z index, it is only different for z > 10m area, where we want to appliy 9m<z<10m YX boundary, still need to keep the original z_idx bc it's needed in ZX-view
110  // if (z_idx_YX==10) z_idx_YX-=1;
111  // double tbi = -10000.; //means "to be initialized"
112  //
113  //
114  // double ptX[6] = {0.+cut, tbi, m_SCB_YX_TOP_x2_array-cut, m_SCB_YX_BOT_x2_array-cut, tbi, 0.+cut};
115  // double ptY[6] = {m_SCB_YX_TOP_y1_array-cut, m_SCB_YX_TOP_y1_array-cut, tbi, tbi, m_SCB_YX_BOT_y1_array+cut, m_SCB_YX_BOT_y1_array+cut};
116  //
117  // TGeoPolygon *polyXY = new TGeoPolygon(6);
118  //
119  // ptX[1] = m_SCB_YX_TOP_x1_array[z_idx_YX+1];
120  // ptX[4] = m_SCB_YX_BOT_x1_array[z_idx_YX+1];
121  // ptY[2] = m_SCB_YX_TOP_y2_array[z_idx_YX+1];
122  // ptY[3] = m_SCB_YX_BOT_y2_array[z_idx_YX+1];
123  //
124  // polyXY->SetXY(ptX,ptY);
125  // polyXY->FinishPolygon();
126  // double testpt[2] = {pt.X(), pt.Y()};
127  //
128  // //cout << "is testpt ("<< pt.X()<<", "<<pt.Y()<<") contrained? "<< polyXY->Contains(testpt)<<endl;
129  // //cout << "area ? " << polyXY->Area()<< endl;
130  //
131  // //polyXY->Draw();
132  //
133  // Bool_t XY_contain = polyXY->Contains(testpt);
134  // dist_yx = polyXY->Safety(testpt, iseg); // Compute minimum distance from testpt to any segment.
135  //
136  // if(0<z_idx && z_idx<10){
137  // double up_z = pt.Z()-s_tpc_active_z_low; // gonna bet, if it's middle enough to be up_z or down_z is smaller than the safefy in this z regime (1m,10m), it is safe to set up_z = z-0, down_z=1036.8-z
138  // double down_z = s_tpc_active_z_high-pt.Z();
139  // double min_z = std::min(up_z,down_z);
140  //
141  // XY_contain ? dist = std::min(dist_yx,min_z) : dist = -1 ;
142  //
143  // delete polyXY;
144  // return (XY_contain ? 1 : 0 );
145  // }
146  //
147  // //up or down
148  // double top_y = s_tpc_active_y_high-pt.Y();
149  // double bottom_y = pt.Y()+s_tpc_active_y_high;
150  // double min_y = std::min(top_y, bottom_y);
151  //
152  //
153  // // if z_idx==0 or z_idx==10, they need xz view,
154  // /// ZX view has Y dependence: Y sub-range from -116 to 116cm per 24cm
155  // Int_t y_idx = (pt.Y()+116.)/24;
156  // if (pt.Y()<-116. && pt.Y()>-116.5) y_idx = 0; //just the 0.5cm
157  // if(y_idx<0 || y_idx>9) {
158  // dist = -1;
159  // delete polyXY;
160  // return 0;
161  // }
162  //
163  // Bool_t ZX_contain = false;
164  // double arbit_out = 55555;
165  //
166  // double d_dist = -1;
167  //
168  // //upstream
169  // if(z_idx==0){
170  // double ptX_Up[5] = {0.+cut, m_SCB_ZX_Up_x1_array, m_SCB_ZX_Up_x2_array-cut, m_SCB_ZX_Up_x2_array-cut, 0+cut};
171  // double ptZ_Up[5] = {0.+cut,0.+cut,m_SCB_ZX_Up_z2_array, arbit_out, arbit_out};
172  //
173  // TGeoPolygon *polyXZ_Up = new TGeoPolygon(5);
174  // polyXZ_Up->SetXY(ptX_Up,ptZ_Up);
175  // polyXZ_Up->FinishPolygon();
176  //
177  // double testpt_Up[2] = {pt.X(), pt.Z()};
178  // ZX_contain = polyXZ_Up->Contains(testpt_Up);
179  // d_dist = polyXZ_Up->Safety(testpt_Up,iseg);
180  // delete polyXZ_Up;
181  //
182  // }
183  // if (z_idx==10){
184  // double ptX_Dw[5] = {0.+cut,m_SCB_ZX_Dw_x2_array-cut, m_SCB_ZX_Dw_x2_array-cut, tbi, 0.+cut};
185  // double ptZ_Dw[5] = {-arbit_out,-arbit_out,tbi,m_SCB_ZX_Dw_z1_array-cut, m_SCB_ZX_Dw_z1_array-cut};
186  //
187  // ptX_Dw[3] = m_SCB_ZX_Dw_x1_array[y_idx+1];
188  // ptZ_Dw[2] = m_SCB_ZX_Dw_z2_array[y_idx+1];
189  //
190  // TGeoPolygon *polyXZ_Dw = new TGeoPolygon(5);
191  // polyXZ_Dw->SetXY(ptX_Dw,ptZ_Dw);
192  // polyXZ_Dw->FinishPolygon();
193  //
194  // double testpt_Dw[2] = {pt.X(), pt.Z()};
195  // ZX_contain = polyXZ_Dw->Contains(testpt_Dw);
196  // d_dist = polyXZ_Dw->Safety(testpt_Dw,iseg);
197  // delete polyXZ_Dw;
198  // }
199  //
200  // delete polyXY;
201  //
202  // ans = XY_contain && ZX_contain;
203  // ans ? dist = std::min(d_dist,min_y) : dist=-1;
204  //
205  // return (ans ? 1 : 0);
206 }
bool isInTPCActive(std::vector< double > &vec, para_all &paras)
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
double distToTPCActive(std::vector< double > &vec, para_all &paras)
double single_photon::distToTPCActive ( std::vector< double > &  vec,
para_all &  paras 
)

Definition at line 61 of file fiducial_volume.cxx.

61  {
62  if(!isInTPCActive(vec, paras)) return -999;
63  double min_x = std::min( fabs(vec[0] - paras.s_tpc_active_XMin) , fabs(vec[0] - paras.s_tpc_active_XMax));
64  double min_y = std::min( fabs(vec[1] - paras.s_tpc_active_YMin) , fabs(vec[1] - paras.s_tpc_active_YMax));
65  double min_z = std::min( fabs(vec[2] - paras.s_tpc_active_ZMin) , fabs(vec[2] - paras.s_tpc_active_ZMax));
66 
67  return ( (min_x<min_y) ? std::min(min_x,min_z) : std::min(min_y,min_z) );
68 }
bool isInTPCActive(std::vector< double > &vec, para_all &paras)
double single_photon::getAmalgamateddEdx ( double  angle_wrt_plane0,
double  angle_wrt_plane1,
double  angle_wrt_plane2,
double  median_plane0,
double  median_plane1,
double  median_plane2,
int  plane0_nhits,
int  plane1_nhits,
int  plane2_nhits 
)

Definition at line 102 of file helper_math.cxx.

111  {
112  //if the shower is within 10 degrees of the wires on plane 2, consider planes 1 and 0
113  if(angle_wrt_plane2< degToRad(10)){
114  //if it's too close to the wires on either of the planes, then stick with plane 2
115  if (angle_wrt_plane1> degToRad(20)|| angle_wrt_plane0>degToRad(20) ){
116  //but if it's outside of the range on plane 1, choose that
117  if(angle_wrt_plane1> angle_wrt_plane0){
118  return median_plane1;
119  } else{
120  return median_plane0;
121  }
122  }
123  }
124  if (plane2_nhits< 2){
125  if (plane1_nhits >=2 ){
126  return median_plane1;
127  } else if (plane0_nhits >=2 ){
128  return median_plane0;
129  }
130  }
131  return median_plane2;
132  }
double degToRad(double deg)
Definition: helper_math.h:64
int single_photon::getAmalgamateddEdxNHits ( double  amalgamateddEdx,
double  median_plane0,
double  median_plane1,
double  median_plane2,
int  plane0_nhits,
int  plane1_nhits,
int  plane2_nhits 
)

Definition at line 135 of file helper_math.cxx.

142  {
143  if (amalgamateddEdx == median_plane0){
144  return plane0_nhits;
145  }
146  if (amalgamateddEdx == median_plane1){
147  return plane1_nhits;
148  }
149  if (amalgamateddEdx == median_plane2){
150  return plane2_nhits;
151  }
152  return -999;
153  }
double single_photon::getCoswrtWires ( TVector3  shower_dir,
TVector3  wire_dir 
)
inline

Definition at line 61 of file helper_math.h.

61  {
62  return wire_dir.Dot(shower_dir);
63  }
double single_photon::getMeanHitWidthPlane ( std::vector< art::Ptr< recob::Hit >>  hits,
int  this_plane 
)

Definition at line 454 of file Processors.cxx.

454  {
455  int nhits = 0;
456  double widths = 0;
457  for (art::Ptr<recob::Hit> thishitptr : hits){
458  //check the plane
459  int plane= thishitptr->View();
460 
461  //skip invalid planes
462  if (plane != this_plane) continue;
463 
464  widths += thishitptr->RMS(); // recob::Hit->RMS() returns RMS of the hit shape in tick units
465  nhits++;
466  }//for each hiti
467  return widths/(double)nhits;
468  }
double single_photon::getMedian ( std::vector< double >  thisvector)

Definition at line 88 of file helper_math.cxx.

88  {
89  size_t len = thisvector.size();
90  if(len < 1) return NAN;
91 
92  std::sort(thisvector.begin(), thisvector.end());
93  if(len % 2 != 0){//even - return average of two at median
94  return 0.5*(thisvector[len/2]+thisvector[len/2+1]);
95  }else{//odd - return the median
96  return thisvector[len/2];
97  }
98  }
TGraph * single_photon::GetNearestNpts ( int  p,
int  cl,
std::vector< art::Ptr< recob::Hit >> &  hitz,
double  vertex_wire,
double  vertex_tick,
int  Npts 
)

Definition at line 21 of file second_shower_search.cxx.

21  {
22 
23  std::vector<double>t_wire;
24  std::vector<double>t_tick;
25  // std::vector<double>t_dist;
26 
27  std::vector<double>all_wire; // wire of all hits
28  std::vector<double>all_tick;
29  std::vector<double>all_dist; // distance to vertex of all hits
30 
31 
32  for(size_t h = 0; h< hitz.size(); h++){
33  auto hit = hitz[h];
34  double h_wire = (double)hit->WireID().Wire;
35  double h_tick = (double)hit->PeakTime();
36 
37  double dd =sqrt(pow(h_wire*0.3-vertex_wire*0.3,2)+pow(h_tick/25.0- vertex_tick/25.0,2));
38  all_wire.push_back(h_wire);
39  all_tick.push_back(h_tick);
40  all_dist.push_back(dd);
41  }
42 
43  std::vector<size_t> sorted_in = sort_indexes(all_dist); // index of all dist in descending order
44  size_t max_e = std::min((size_t)Npts,hitz.size());
45 
46  for(size_t i =0; i<max_e; i++){
47  t_wire.push_back(all_wire[sorted_in[hitz.size()-1-i]]);
48  t_tick.push_back(all_tick[sorted_in[hitz.size()-1-i]]);
49  }
50 
51  return new TGraph(t_wire.size(),&t_wire[0],&t_tick[0]);
52  }
std::vector< size_t > sort_indexes(const std::vector< T > &v)
Definition: helper_math.h:20
process_name hit
Definition: cheaterreco.fcl:51
while getopts h
int single_photon::getNHitsPlane ( std::vector< art::Ptr< recob::Hit >>  hits,
int  this_plane 
)

Definition at line 472 of file Processors.cxx.

472  {
473  int nhits = 0;
474  for (art::Ptr<recob::Hit> thishitptr : hits){
475  //check the plane
476  int plane= thishitptr->View();
477 
478  //skip invalid planes
479  if (plane != this_plane) continue;
480 
481  nhits++;
482  }//for each hiti
483  return nhits;
484  }
std::vector< double > single_photon::getPitch ( TVector3  shower_dir,
para_all &  paras 
)

Definition at line 424 of file Processors.cxx.

424  {
425 
426  std::vector<double> pitches;
427  for (geo::PlaneGeo const& plane: paras.s_geom->IteratePlanes()) {
428  //6 planes in SBND
429  //WireAngleToVertical : 30 ,150,90,150,30 ,90
430  //ub wire angles : 30 ,150,90 (respected to beam,z)
431  //Pitch : 0.3,0.3,0.3,0.3,0.3,0.3
432 
433  const double angToVert(paras.s_geom->WireAngleToVertical(plane.View(), plane.ID())+0.5*M_PI);//wire angle respected to z + pi/2
434 
435  TVector3 wire_vector;
436  if(abs(angToVert) < 1e-9 ){
437  wire_vector = {0,0,1};
438  } else{
439  wire_vector = { 0 , sin(angToVert) ,cos(angToVert) };
440  }
441 
442  // std::cout<<" Angle "<<angToVert<<" Get Vec y="<<wire_vector[1]<< " z= "<<wire_vector[2]<<std::endl;
443  double cos = abs(wire_vector.Dot(shower_dir))/(wire_vector.Mag()*shower_dir.Mag());
444 
445  pitches.push_back((cos==0)? std::numeric_limits<double>::max() : paras.s_wire_spacing/cos );
446 
447  if(pitches.size()==3) break;
448  }
449  return pitches;
450  }
T abs(T value)
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
Definition: PlaneGeo.h:82
do i e
double single_photon::GetQHit ( art::Ptr< recob::Hit thishitptr,
int  plane,
para_all &  paras 
)

Definition at line 317 of file Processors.cxx.

317  {
318  double gain;
319  //choose gain based on whether data/mc and by plane
320  if (paras.s_is_data == false && paras.s_is_overlayed == false){
321  gain = paras.s_gain_mc[plane] ;
322  //if (g_is_verbose) std::cout<<"the gain for mc on plane "<<plane<<" is "<<gain<<std::endl;
323  } if (paras.s_is_data == true || paras.s_is_overlayed == true){
324  gain = paras.s_gain_data[plane] ;
325  //if (g_is_verbose) std::cout<<"the gain for data on plane "<<plane<<" is "<<gain<<std::endl;
326 
327  }
328 
329  double Q = thishitptr->Integral()*gain;
330  return Q;
331  }
std::pair< int, std::pair< std::vector< std::vector< double > >, std::vector< double > > > single_photon::GroupClusterCandidate ( int  num_clusters,
const std::vector< int > &  cluster_planes,
const std::vector< double > &  cluster_max_ticks,
const std::vector< double > &  cluster_min_ticks 
)

Definition at line 1048 of file second_shower_search.cxx.

1048  {
1049  std::cout << "group_cluster_candidate\t|| Total of " << num_clusters << " to be grouped" << std::endl;
1050 
1051  int num_cluster_groups=0; // number of matched cluster groups in total
1052  std::vector<std::vector<double>> grouped_cluster_indices;
1053  std::vector<double> cluster_group_timeoverlap_fraction;
1054  if(num_clusters <= 1)
1055  return {num_cluster_groups, {grouped_cluster_indices, cluster_group_timeoverlap_fraction}};
1056 
1057  for(int i = 0; i != num_clusters -1; ++i){
1058  for(int j = i+1; j != num_clusters; ++j){
1059 
1060  //first, look at candidate pairs
1061  auto pair_result = clusterCandidateOverlap({i,j}, cluster_planes, cluster_max_ticks, cluster_min_ticks);
1062  if( pair_result.first){
1063 
1064  ++num_cluster_groups;
1065  grouped_cluster_indices.push_back({(double)i,(double)j});
1066  double min_frac = *std::min_element(pair_result.second.cbegin(), pair_result.second.cend());
1067  cluster_group_timeoverlap_fraction.push_back(min_frac);
1068  std::cout << "Grouped cluster candidate: (" << i << ", " << j << ") | Minimum time tick overlap fraction: " << min_frac << std::endl;
1069 
1070  // if the pair is succefully grouped, look at possible trios
1071  for(int k = j+1; k!= num_clusters; ++k){
1072  auto tri_result = clusterCandidateOverlap({i,j,k}, cluster_planes, cluster_max_ticks, cluster_min_ticks);
1073  if(tri_result.first){
1074  ++num_cluster_groups;
1075  grouped_cluster_indices.push_back({(double)i,(double)j,(double)k});
1076  min_frac = *std::min_element(tri_result.second.cbegin(), tri_result.second.cend());
1077  cluster_group_timeoverlap_fraction.push_back(min_frac);
1078  std::cout << "Grouped cluster candidate: (" << i << ", " << j << ", " << k << ") | Minimum time tick overlap fraction: " << min_frac << std::endl;
1079  }
1080  } //k loop
1081  }
1082  }//j loop
1083  }//i loop
1084 
1085  std::cout << "GroupClusterCandidate\t|| Formed " << num_cluster_groups << " cluster groups" << std::endl;
1086 
1087  return {num_cluster_groups, {grouped_cluster_indices, cluster_group_timeoverlap_fraction}};
1088  }
pdgs k
Definition: selectors.fcl:22
std::pair< bool, std::vector< double > > clusterCandidateOverlap(const std::vector< int > &candidate_indices, const std::vector< int > &cluster_planes, const std::vector< double > &cluster_max_ticks, const std::vector< double > &cluster_min_ticks)
BEGIN_PROLOG could also be cout
double single_photon::impact_paramater_shr ( double  x,
double  y,
double  z,
art::Ptr< recob::Shower > &  shr 
)

Definition at line 39 of file helper_math.cxx.

39  {
40 
41  std::vector<double> vert = {x,y,z};
42  std::vector<double> start = {shr->ShowerStart().X(), shr->ShowerStart().Y(),shr->ShowerStart().Z()};
43  std::vector<double> abit = {shr->ShowerStart().X() + shr->Direction().X(), shr->ShowerStart().Y()+shr->Direction().Y(), shr->ShowerStart().Z()+shr->Direction().Z()};
44 
45  return dist_line_point(start, abit, vert);
46 
47  }
process_name opflash particleana ie ie ie z
process_name opflash particleana ie x
double dist_line_point(std::vector< double > &X1, std::vector< double > &X2, std::vector< double > &point)
Definition: helper_math.cxx:8
process_name opflash particleana ie ie y
double single_photon::implied_invar_mass ( double  vx,
double  vy,
double  vz,
art::Ptr< recob::Shower > &  s1,
double  E1,
art::Ptr< recob::Shower > &  s2,
double  E2 
)

Definition at line 50 of file helper_math.cxx.

50  {
51 
52  double s1x = s1->ShowerStart().X()-vx;
53  double s1y = s1->ShowerStart().Y()-vy;
54  double s1z = s1->ShowerStart().Z()-vz;
55  double norm1 = std::hypot(s1x,s1y,s1z);//distance btw two points with coordinate difference s1x, s1y, s1z
56  s1x = s1x/norm1; //unit vector pointing to shower start from point (vx, vy,vz)
57  s1y = s1y/norm1;
58  s1z = s1z/norm1;
59 
60  double s2x = s2->ShowerStart().X()-vx;
61  double s2y = s2->ShowerStart().Y()-vy;
62  double s2z = s2->ShowerStart().Z()-vz;
63  double norm2 = std::hypot(s2x,s2y,s2z);
64  s2x = s2x/norm2; // unit vector pointing to shower start from point (vx, vy, vz)
65  s2y = s2y/norm2;
66  s2z = s2z/norm2;
67 
68  return sqrt(2.0*E1*E2*(1.0-(s1x*s2x+s1y*s2y+s1z*s2z)));
69 
70 
71  }
double single_photon::invar_mass ( art::Ptr< recob::Shower > &  s1,
double  E1,
art::Ptr< recob::Shower > &  s2,
double  E2 
)

Definition at line 74 of file helper_math.cxx.

74  {
75 
76  double s1x = s1->Direction().X();
77  double s1y = s1->Direction().Y();
78  double s1z = s1->Direction().Z();
79 
80  double s2x = s2->Direction().X();
81  double s2y = s2->Direction().Y();
82  double s2z = s2->Direction().Z();
83 
84  return sqrt(2.0*E1*E2*(1.0-(s1x*s2x+s1y*s2y+s1z*s2z)));
85 
86  }
bool single_photon::IsEventInList ( int  run,
int  subrun,
int  event,
var_all &  vars 
)

Definition at line 219 of file Processors.cxx.

219  {
220  if(vars.m_selected_set.find( {run, subrun, event} ) == vars.m_selected_set.end()){
221  if(vars.m_selected_set.find({run, subrun}) == vars.m_selected_set.end() ){
222  if(vars.m_selected_set.find({run}) == vars.m_selected_set.end())
223  return false;
224  }
225  }
226  return true;
227  }
bool single_photon::isInsidev2 ( std::vector< double >  thishit_pos,
std::vector< std::vector< double >>  rectangle,
para_all &  paras 
)

Definition at line 234 of file Processors.cxx.

234  {
235  int n_vertices = (int)rectangle.size();
236  //bool inside = false;
237  int i, j = 0;
238  double areas = 0;
239  //for each pair of vertices
240  for (i = 0, j = n_vertices-1; i < n_vertices; j = i++) {
241  //calculate the area of a triangle with the point and two vertices
242  double this_area = 0.5*abs(rectangle[i][0]*(rectangle[j][1] - thishit_pos[1])
243  + rectangle[j][0]*(thishit_pos[1] - rectangle[i][1])
244  + thishit_pos[0]*(rectangle[i][1] - rectangle[j][1]));
245  areas += this_area;
246  }
247  //calc area of the rectangle
248  double area_rectangle = paras.s_width_dqdx_box* paras.s_length_dqdx_box;
249 
250  //check the sum of areas match
251  if (abs(areas - area_rectangle) <= 0.001 ){
252  return true;
253  }
254  return false;
255  }
T abs(T value)
bool single_photon::isInTPCActive ( std::vector< double > &  vec,
para_all &  paras 
)

Definition at line 46 of file fiducial_volume.cxx.

46  {
47  if( vec.size() != 3){
48  throw cet::exception("single_photon") << " The coordinate dimension is not 3!";
49  }
50 
51  bool is_x = (vec[0] > paras.s_tpc_active_XMin && vec[0]< paras.s_tpc_active_XMax );
52  bool is_y = (vec[1] > paras.s_tpc_active_YMin && vec[1]< paras.s_tpc_active_YMax );
53  bool is_z = (vec[2] > paras.s_tpc_active_ZMin && vec[2]< paras.s_tpc_active_ZMax );
54  bool inside = is_x&&is_y&&is_z;
55 
56  return inside;
57 }
void single_photon::IsolationStudy ( std::vector< PandoraPFParticle >  all_PPFPs,
const std::vector< art::Ptr< recob::Track >> &  tracks,
const std::vector< art::Ptr< recob::Shower >> &  showers,
detinfo::DetectorPropertiesData const &  theDetector,
var_all &  vars,
para_all &  paras 
)

Definition at line 1100 of file second_shower_search.cxx.

1106  {
1107 
1108  int total_track_hits =0;
1109  int total_shower_hits =0;
1110  int nu_slice_id = -999;
1111 
1112  std::vector< art::Ptr<recob::Hit> > associated_hits;
1113  std::vector< art::Ptr<recob::Hit> > unassociated_hits;
1114  std::vector< art::Ptr<recob::Hit> > unassociated_hits_plane0;
1115  std::vector< art::Ptr<recob::Hit> > unassociated_hits_plane1;
1116  std::vector< art::Ptr<recob::Hit> > unassociated_hits_plane2;
1117 
1118  std::vector< std::map<size_t, std::vector< art::Ptr<recob::Hit> >> > v_newClusterToHitsMap(3);
1119 
1120  std::vector<art::Ptr<recob::Hit>> slicehits;
1121 
1122  // BEGIN FOR LOOP TO COUNT TRACK HITS AND PUSH INTO ASSOCIATED HITS
1123  for(size_t t =0; t< tracks.size(); t++){
1124  art::Ptr<recob::Track> track = tracks[t];
1125  PandoraPFParticle* ppfp = PPFP_GetPPFPFromTrack(all_PPFPs, track);
1126  // art::Ptr<recob::PFParticle> pfp = ppfp->pPFParticle;//trackToPFParticleMap[track];
1127 
1128  int sliceid = ppfp->get_SliceID();//pfParticleToSliceIDMap.at(pfp);
1129  //WARNING the temp. solution only work with best nuscore slice Keng
1130  if(!ppfp->get_IsNuSlice()) continue;
1131 
1132  std::vector<art::Ptr<recob::Hit>> tmp_slicehits = ppfp->pSliceHits;//sliceIDToHitsMap.at(sliceid);
1133  std::vector<art::Ptr<recob::Hit>> trackhits = ppfp->pPFPHits;//pfParticleToHitsMap.at(pfp);
1134 
1135  if(ppfp->get_IsNeutrino()) slicehits.insert(slicehits.end(), tmp_slicehits.begin(), tmp_slicehits.end());//add up all nu slice hits
1136 
1137  std::cout << "*SSS: track "<< t <<" is in slice "<< sliceid <<" which has "<< tmp_slicehits.size() <<" hits. This track has "<< trackhits.size() <<" of them. " << std::endl;
1138  total_track_hits += trackhits.size();
1139 
1140  //WARNING nu_slice_id is updated? Oh, tracks[0] and tracks[1] have different slide IDs (both nu slice but different nu score), need to fix this;
1141  // temporary solution is to skip tracks[1];
1142  // if(nu_slice_id != sliceid && nu_slice_id != -999){
1143  // std::cout<<"*ERROR!! In Second Shower Search (Isolation Study), the neutrino slice ID changed? this: "<<sliceid<<", last: "<<nu_slice_id<<std::endl;
1144  // exit(EXIT_FAILURE);
1145  // }
1146  // nu_slice_id = sliceid;
1147 
1148  for(auto &h: trackhits){
1149  associated_hits.push_back(h);
1150  }
1151  }
1152  // END FOR LOOPING TRACKS
1153 
1154 
1155 
1156  // BEGIN FOR LOOPING SHOWERS TO COUNT SHOWER HITS AND PUSH INTO ASSOC HITS
1157  for(size_t s =0; s< showers.size(); s++){
1158  art::Ptr<recob::Shower> shower = showers[s];
1159  PandoraPFParticle* ppfp = PPFP_GetPPFPFromShower(all_PPFPs, shower);
1160  // art::Ptr<recob::PFParticle> pfp = ppfp->pPFParticle;//showerToPFParticleMap.at(shower);
1161 
1162  int sliceid = ppfp->get_SliceID();//pfParticleToSliceIDMap.at(pfp);
1163 
1164  // if(sliceid != slice_w_bestnuID) continue;//WARNING only deal with nu slice with best nu score for now Keng
1165  if(!ppfp->get_IsNuSlice()) continue;
1166  if(sliceid<0) continue; //negative sliceid is bad
1167 
1168  auto tmp_slicehits = ppfp->pSliceHits;//sliceIDToHitsMap.at(sliceid);
1169  auto showerhits = ppfp->pPFPHits;//pfParticleToHitsMap.at(pfp);
1170 
1171  std::cout<<"*SSS: shower "<< s <<" is in slice "<< sliceid <<" which has "<< tmp_slicehits.size() <<" hits. This shower has "<< showerhits.size() <<" of them. "<< std::endl;
1172  total_shower_hits+=showerhits.size();
1173 
1174  for(auto &h: showerhits){
1175  associated_hits.push_back(h);
1176  }
1177  }
1178  // END FOR LOOP COUNTING SHOWER HITS
1179 
1180  vars.m_sss_num_associated_hits = total_shower_hits + total_track_hits;
1181 
1182  // PRINT SUMMARY OF HIT TYPES
1183  std::cout<<"*SSS: So in total we have "<<total_shower_hits<<" shower hits and "<<total_track_hits<<" track hits"<<" associatedHits total: "<<associated_hits.size()<<std::endl;
1184 
1185 
1186  // IF VALID SLICE
1187  if(nu_slice_id >= 0){
1188  vars.m_sss_num_unassociated_hits = slicehits.size()-total_shower_hits-total_track_hits;
1189 
1190  std::cout<<"*SSS: So that leaves "<<slicehits.size()-total_shower_hits-total_track_hits<<" hits not included in tracks and showers"<<std::endl;
1191 
1192  if(vars.m_sss_num_unassociated_hits < 0){
1193  std::cout<<"ERROR!! Number of unassociated hits is negative, i.e: num_associated: "<<vars.m_sss_num_associated_hits<<" and total slice hits: "<<slicehits.size()<<std::endl;
1194  exit(EXIT_FAILURE);
1195  }
1196 
1197 
1198 
1199  // DETERMINE UNASSOCIATED HITS BY COMPARING ALL SLICE HITS WITH LIST OF ASSOCIATED HITS
1200  for(auto &h: slicehits){
1201 
1202  bool is_associated = false;
1203  for(auto &a: associated_hits){
1204  if(h==a){
1205  is_associated = true;
1206  break;
1207  }
1208  }
1209 
1210  if(!is_associated){
1211  unassociated_hits.push_back(h);
1212  auto plane_view = h->View();
1213  switch((int)plane_view){
1214  case (0) :
1215  unassociated_hits_plane0.push_back(h);
1216  break;
1217  case (1) :
1218  unassociated_hits_plane1.push_back(h);
1219  break;
1220  case (2) :
1221  unassociated_hits_plane2.push_back(h);
1222  break;
1223  }
1224 
1225  }
1226 
1227  }
1228 
1229  std::vector<std::vector<art::Ptr<recob::Hit>>> unassociated_hits_all = {unassociated_hits_plane0,unassociated_hits_plane1,unassociated_hits_plane2};
1230 
1231  std::cout<<" *associated_hits.size() "<<associated_hits.size()<<" unassociated_hits.size() "<<unassociated_hits.size()<<" p0: "<<unassociated_hits_plane0.size()<<" p1: "<<unassociated_hits_plane1.size()<<" p2: "<<unassociated_hits_plane2.size()<<std::endl;
1232 
1233 
1234  // IF HAVE 1+G 1P AND WANT TO PLOT
1235  if(paras.s_make_sss_plots && showers.size()==1 && tracks.size()==1){
1236 
1237  std::string print_name = "isolation_"+std::to_string(vars.m_run_number)+"_"+std::to_string(vars.m_subrun_number)+"_"+std::to_string(vars.m_event_number);
1238  TCanvas *can = new TCanvas(print_name.c_str(), print_name.c_str(),3000,800);
1239  can->Divide(4, 1, 0.0, 0.1);
1240 
1241  double tick_max = 0;
1242  double tick_min = 1e10;
1243  std::vector<double> chan_max(3,0);
1244  std::vector<double> chan_min(3,1e10);
1245 
1246  // Creation of canvas and histograms to hold hit distance data
1247  TCanvas *histcan = new TCanvas(("hists_"+print_name).c_str(), "Distances from the track", 600, 400);
1248  histcan->Divide(3, 2, 0.005, 0.1);
1249 
1250  TH1D *s_hist0 = new TH1D("shower hits hist plane0", "Showers Plane 0", 30, 0.0, 30.0);
1251  TH1D *s_hist1 = new TH1D("shower hist plane1", "Showers Plane 1", 30, 0.0, 30.0);
1252  TH1D *s_hist2 = new TH1D("shower hist plane2", "Showers Plane 2", 30, 0.0, 30.0);
1253  std::vector<TH1D *> s_hists = {s_hist0, s_hist1, s_hist2};
1254 
1255  TH1D *u_hist0 = new TH1D("unassociated hits hist plane0", "Unassoc Plane 0", 30, 0.0, 30.0);
1256  TH1D *u_hist1 = new TH1D("unassociated hits hist plane1", "Unassoc Plane 1", 30, 0.0, 30.0);
1257  TH1D *u_hist2 = new TH1D("unassociated hits hist plane2", "Unassoc Plane 2", 30, 0.0, 30.0);
1258  std::vector<TH1D *> u_hists = {u_hist0, u_hist1, u_hist2};
1259 
1260 
1261  std::cout << "Isolation: Acquiring track hit coordinates" << std::endl;
1262  // saving wire and time coordinates
1263  std::vector<std::vector<TGraph *>> pts_trk( tracks.size(), std::vector<TGraph *>(3) );
1264 
1265  PandoraPFParticle* ppfpt = PPFP_GetPPFPFromTrack(all_PPFPs, tracks[0]);
1266  // art::Ptr<recob::PFParticle> pfpt = trackToPFParticleMap.at(tracks[0]);
1267  auto trackhits = ppfpt->pPFPHits;//pfParticleToHitsMap.at(pfpt);
1268 
1269  std::vector<TGraph*> t_pts(3);
1270  std::vector<std::vector<double>> t_vec_t(3); // peak time of track hits on 3 planes.
1271  std::vector<std::vector<double>> t_vec_c(3); // wire number of track hits on 3 planes.
1272 
1273  for(auto &th: trackhits){
1274  double wire = (double)th->WireID().Wire;
1275  t_vec_c[(int)th->View()].push_back(wire);
1276 
1277  double time = (double)th->PeakTime();
1278  t_vec_t[(int)th->View()].push_back(time);
1279 
1280  tick_max = std::max(tick_max, time);
1281  tick_min = std::min(tick_min, time);
1282  chan_max[(int)th->View()] = std::max( chan_max[(int)th->View()], wire);
1283  chan_min[(int)th->View()] = std::min( chan_min[(int)th->View()], wire);
1284 
1285  }
1286 
1287  t_pts[0] = new TGraph(t_vec_c[0].size(), &(t_vec_c[0])[0], &(t_vec_t[0])[0]);
1288  t_pts[1] = new TGraph(t_vec_c[1].size(), &(t_vec_c[1])[0], &(t_vec_t[1])[0]);
1289  t_pts[2] = new TGraph(t_vec_c[2].size(), &(t_vec_c[2])[0], &(t_vec_t[2])[0]);
1290  pts_trk[0] = t_pts;
1291 
1292  std::cout << "Isolation: plane0 track hits = " << t_vec_t[0].size() << std::endl;
1293  std::cout << "Isolation: plane1 track hits = " << t_vec_t[1].size() << std::endl;
1294  std::cout << "Isolation: plane2 track hits = " << t_vec_t[2].size() << std::endl;
1295 
1296 
1297  std::cout << "Isolation: Acquiring shower hit coordinates and comparing with track hits " << std::endl;
1298 
1299  //First grab all shower clusters
1300  std::vector<std::vector<TGraph *>> pts_shr( showers.size(), std::vector<TGraph *>(3) );
1301 
1302  // map shower hits to distance to the closest track hit (hold up to 10 hits with minimum distance)
1303  std::vector<std::map< art::Ptr< recob::Hit>, double >> sh_dist(3);
1304  // vector to save hit with largest minimum distance (in sh_dist) on each plane
1305  std::vector< std::pair<art::Ptr< recob::Hit >, double > > max_min_hit(3);
1306 
1307  PandoraPFParticle* ppfps = PPFP_GetPPFPFromShower(all_PPFPs, showers[0]);
1308  auto showerhits = ppfps->pPFPHits;//pfParticleToHitsMap.at(pfp_s);
1309  // art::Ptr<recob::PFParticle> pfp_s = showerToPFParticleMap.at(showers[0]);
1310 
1311  std::vector<TGraph*> t_pts_s(3);
1312  std::vector<std::vector<double>> vec_t(3);
1313  std::vector<std::vector<double>> vec_c(3);
1314  std::vector<int> num_shr_hits(3);
1315 
1316  for(auto &sh: showerhits){
1317  int plane = (int)sh->View();
1318  num_shr_hits[plane] += 1;
1319 
1320  double minDist = 999.9; //minimum distance between this shower hit and all track hits
1321  double dist;
1322  // only do if there are track hits on this plane with which to compare
1323  if (t_vec_c[(int)sh->View()].size() != 0){
1324  double wire = (double)sh->WireID().Wire;
1325  vec_c[(int)sh->View()].push_back(wire);
1326  double time = (double)sh->PeakTime();
1327  vec_t[(int)sh->View()].push_back(time);
1328 
1329  for (unsigned int th = 0; th < t_vec_c[(int)sh->View()].size(); th++){
1330  dist = sqrt( pow (time/25 - (t_vec_t[(int)sh->View()])[th]/25, 2) + pow( wire*0.3 - (t_vec_c[(int)sh->View()])[th]*0.3, 2) );
1331  if (dist < minDist) {
1332  minDist = dist;
1333  }
1334 
1335  } // end of track hits for
1336  s_hists[(int)sh->View()]->Fill(minDist);
1337 
1338  // keep track of 10 smallest distances and their corresponding hits
1339  if (sh_dist[plane].size() < 10){
1340  (sh_dist[plane])[sh] = minDist; // insert shower hit with accompanying minimum distance
1341  max_min_hit[plane] = (*std::max_element(sh_dist[plane].begin(), sh_dist[plane].end(), map_max_fn)); // find new min dist hit
1342  }
1343  else{ if (minDist < max_min_hit[plane].second){
1344  sh_dist[plane].erase(max_min_hit[plane].first); // erase old max of min distances from map
1345  (sh_dist[plane])[sh] = minDist; // insert shower hit with accompanying minimum distance
1346  max_min_hit[plane] = (*std::max_element(sh_dist[plane].begin(), sh_dist[plane].end(), map_max_fn)); // find new min dist hit
1347  } }
1348 
1349  // finds the necessary plot boundaries to fit the shower
1350  tick_max = std::max(tick_max, (double)sh->PeakTime());
1351  tick_min = std::min(tick_min, (double)sh->PeakTime());
1352  chan_max[(int)sh->View()] = std::max( chan_max[(int)sh->View()], wire);
1353  chan_min[(int)sh->View()] = std::min( chan_min[(int)sh->View()], wire);
1354  } // end if stmnt t_vec_c
1355  } // end looping shower hits
1356 
1357  // create graphs from newly compiled shower coordinates
1358  t_pts_s[0] = new TGraph(vec_c[0].size(), &(vec_c[0])[0], &(vec_t[0])[0]);
1359  t_pts_s[1] = new TGraph(vec_c[1].size(), &(vec_c[1])[0], &(vec_t[1])[0]);
1360  t_pts_s[2] = new TGraph(vec_c[2].size(), &(vec_c[2])[0], &(vec_t[2])[0]);
1361  // save new graphs for this shower into vector containing all showers
1362  pts_shr[0] = t_pts_s;
1363 
1364  // place data into approriate vertex_tree variables
1365  for(int plane = 0; plane < 3; plane++){
1366  if (num_shr_hits[plane] == 0){ // if there are no shower hits on this plane, is extremely isolated
1367  vars.m_isolation_min_dist_trk_shr.push_back(999);
1368  vars.m_isolation_nearest_shr_hit_to_trk_wire.push_back(999);
1369  vars.m_isolation_nearest_shr_hit_to_trk_time.push_back(999);
1370  }
1371  else if (t_vec_t[plane].size() > 0) { // have to have both shower and track hits on this plane to have valid comparisons for distance
1372  auto abs_min = (*std::min_element(sh_dist[plane].begin(), sh_dist[plane].end(), map_min_fn));
1373  vars.m_isolation_min_dist_trk_shr.push_back(abs_min.second);
1374  vars.m_isolation_nearest_shr_hit_to_trk_wire.push_back((double)abs_min.first->WireID().Wire);
1375  vars.m_isolation_nearest_shr_hit_to_trk_time.push_back((double)abs_min.first->PeakTime());
1376  }
1377  else{ // if there are no shower hits or there are no track hits on this plane, getting min distance fails
1378  vars.m_isolation_min_dist_trk_shr.push_back(-999);
1379  vars.m_isolation_nearest_shr_hit_to_trk_wire.push_back(-999);
1380  vars.m_isolation_nearest_shr_hit_to_trk_time.push_back(-999);
1381  }
1382  vars.m_isolation_num_shr_hits_win_1cm_trk.push_back(s_hists[plane]->Integral(1,1));
1383  vars.m_isolation_num_shr_hits_win_2cm_trk.push_back(s_hists[plane]->Integral(1,2));
1384  vars.m_isolation_num_shr_hits_win_5cm_trk.push_back(s_hists[plane]->Integral(1,5));
1385  vars.m_isolation_num_shr_hits_win_10cm_trk.push_back(s_hists[plane]->Integral(1,10));
1386  }
1387 
1388  /* DRAW SHOWER HISTOGRAM */
1389  histcan->cd(1);
1390  s_hists[0]->Draw();
1391  s_hists[0]->GetXaxis()->SetTitle("distance from shower hit to closest track hit [cm]");
1392 
1393  histcan->cd(2);
1394  s_hists[1]->Draw();
1395  s_hists[1]->GetXaxis()->SetTitle("distance from shower hit to closest track hit [cm]");
1396 
1397  histcan->cd(3);
1398  s_hists[2]->Draw();
1399  s_hists[2]->GetXaxis()->SetTitle("distance from shower hit to closest track hit [cm]");
1400 
1401 
1402 
1403  //NOW THE UNASSOCIATED HITS - that is ones not part of an identified track or shower
1404  std::cout << "Isolation: Acquiring unassociated hits coordinates and comparing with track hits" << std::endl;
1405 
1406  // create vector of three layers for unassoc hits
1407  std::vector<TGraph *> g_unass(3);
1408 
1409  std::vector<std::vector<std::vector<double>>> pts_to_recluster(3); //plane, point, {wire,tic}
1410  //make a map tp actual hits here I guess.
1411  std::vector<std::map<int, art::Ptr<recob::Hit>>> mapPointIndexToHit(3);
1412 
1413  std::vector<double> minDist_tot(3);
1414  std::vector<double> minWire(3);
1415  std::vector<double> minTime(3);
1416 
1417  for(int plane = 0; plane < 3; plane++){
1418  minDist_tot[plane] = 999;
1419  std::vector<double> vec_t;
1420  std::vector<double> vec_c;
1421 
1422  for(auto &uh: unassociated_hits_all[plane]){
1423 
1424  if (t_vec_c[plane].size() == 0) break; // if track doesn't have hits on that plane
1425 
1426  double wire = (double)uh->WireID().Wire;
1427  vec_c.push_back(wire);
1428  double time = (double)uh->PeakTime();
1429  vec_t.push_back(time);
1430 
1431  double minDist = 999.9;
1432  double dist;
1433  for (unsigned int th = 0; th < t_vec_c[(int)uh->View()].size(); th++){
1434  dist = sqrt( pow (time/25 - (t_vec_t[(int)uh->View()])[th]/25, 2) + pow( wire*0.3 - (t_vec_c[(int)uh->View()])[th]*0.3, 2) );
1435  if (dist < minDist) { minDist = dist; }
1436  }
1437  u_hists[(int)uh->View()]->Fill(minDist);
1438 
1439  if (minDist < minDist_tot[plane]) { // of all unassociated hits, the one that has min distance to closest track hits
1440  minDist_tot[plane] = minDist;
1441  minWire[plane] = wire;
1442  minTime[plane] = time;
1443  }
1444 
1445  // for reclustering
1446  std::vector<double> pt = {wire, vec_t.back()};
1447  pts_to_recluster[(int)uh->View()].push_back(pt);
1448  mapPointIndexToHit[(int)uh->View()][pts_to_recluster[(int)uh->View()].size()-1] = uh;
1449 
1450  } // end looping unassociated_hits_all
1451 
1452  g_unass[plane] = new TGraph(vec_c.size(), &vec_c[0], &vec_t[0]);
1453  } // end looping planes
1454 
1455  // place data into appropriate vertex_tree variables
1456  for(int plane = 0; plane < 3; plane++){
1457  if (t_vec_t[plane].size() > 0 && unassociated_hits_all[plane].size() > 0){
1458  vars.m_isolation_min_dist_trk_unassoc.push_back(minDist_tot[plane]);
1459  vars.m_isolation_nearest_unassoc_hit_to_trk_wire.push_back(minWire[plane]);
1460  vars.m_isolation_nearest_unassoc_hit_to_trk_time.push_back(minTime[plane]);
1461  }
1462  else {
1463  vars.m_isolation_min_dist_trk_unassoc.push_back(-999);
1464  vars.m_isolation_nearest_unassoc_hit_to_trk_wire.push_back(-999);
1465  vars.m_isolation_nearest_unassoc_hit_to_trk_time.push_back(-999);
1466  }
1467  vars.m_isolation_num_unassoc_hits_win_1cm_trk.push_back(u_hists[plane]->Integral(1,1));
1468  vars.m_isolation_num_unassoc_hits_win_2cm_trk.push_back(u_hists[plane]->Integral(1,2));
1469  vars.m_isolation_num_unassoc_hits_win_5cm_trk.push_back(u_hists[plane]->Integral(1,5));
1470  vars.m_isolation_num_unassoc_hits_win_10cm_trk.push_back(u_hists[plane]->Integral(1,10));
1471  }
1472 
1473  /* DRAW UNASSOCIATED HITS DISTANCE HISTOGRAMS */
1474  histcan->cd(4);
1475  u_hists[0]->Draw();
1476  u_hists[0]->GetXaxis()->SetTitle("distance from unassoc hit to closest track hit [cm]");
1477 
1478  histcan->cd(5);
1479  u_hists[1]->Draw();
1480  u_hists[1]->GetXaxis()->SetTitle("distance from unassoc hit to closest track hit [cm]");
1481 
1482  histcan->cd(6);
1483  u_hists[2]->Draw();
1484  u_hists[2]->GetXaxis()->SetTitle("distance from unassoc hit to closest track hit [cm]");
1485 
1486 
1487  /* SAVE THE CANVAS -which holds all 6 distance histograms for shower and unassociated hits*/
1488  /* histcan->Update();
1489  histcan->SaveAs((print_name + "_hist.pdf").c_str(), "pdf");
1490  */
1491 
1492  delete histcan;
1493 
1494 
1495  //PLOTTING NOW
1496  //SET-UP
1497  double plot_point_size = 0.6;
1498 
1499  std::vector<int> tcols = {kRed-7, kBlue-7, kGreen-3, kOrange-3, kCyan-3, kMagenta-3, kGreen+1 , kRed+1};
1500  int used_col=0;
1501  if(showers.size()+tracks.size() > tcols.size()){
1502  for(int i =0; i< (int)(showers.size()+tracks.size() - tcols.size() +2); i++){
1503  tcols.push_back(tcols[(int)paras.rangen->Uniform(0,7)]+(int)paras.rangen->Uniform(-5,5));
1504  }
1505  }
1506 
1507  std::cout<<"*Tick Min: "<<tick_min<<" Max: "<<tick_max<<std::endl;
1508  auto const TPC = (*paras.s_geom).begin_TPC();
1509  auto ID = TPC.ID();
1510  int fCryostat = ID.Cryostat;
1511  int fTPC = ID.TPC;
1512  std::cout<<TPC.ID()<<"*= the beginning TPC ID" <<std::endl;
1513  std::cout<<"*the cryostat id = "<<fCryostat<<std::endl;
1514  std::cout<<"*the tpc id = "<<fTPC<<std::endl;
1515 
1516 
1517  //PLOTTING THE VERTEX POSITION ON THE PLOT
1518 
1519  std::vector<double> vertex_time(3);
1520  std::vector<double> vertex_wire(3);
1521 
1522 
1523  std::vector<TGraph*> g_vertex(3);
1524  for(int i=0; i<3; i++){
1525  TPad * pader = (TPad*)can->cd(i+1);
1526 
1527  if(i==0 ) pader->SetLeftMargin(0.1);
1528 
1529  std::vector<double> wire = {(double)calcWire(vars.m_vertex_pos_y, vars.m_vertex_pos_z, i, fTPC, fCryostat, *paras.s_geom)};
1530  std::vector<double> time = {theDetector.ConvertXToTicks(vars.m_vertex_pos_x, i, fTPC,fCryostat)};
1531 
1532  vertex_time[i] = time[0];
1533  vertex_wire[i] = wire[0];
1534 
1535  if(i==0) vars.m_vertex_pos_wire_p0 = wire[0];
1536  if(i==1) vars.m_vertex_pos_wire_p1 = wire[0];
1537  if(i==2) vars.m_vertex_pos_wire_p2 = wire[0];
1538  vars.m_vertex_pos_tick = time[0];
1539 
1540  chan_max[i] = std::max( chan_max[i],wire[0]);
1541  chan_min[i] = std::min( chan_min[i],wire[0]);
1542 
1543  g_vertex[i] = new TGraph(1,&wire[0],&time[0]);
1544  g_vertex[i]->SetMarkerStyle(29);
1545  g_vertex[i]->SetMarkerSize(4);
1546  g_vertex[i]->SetMarkerColor(kMagenta-3);
1547  g_vertex[i]->GetYaxis()->SetRangeUser(tick_min*0.9,tick_max*1.1);
1548  g_vertex[i]->GetXaxis()->SetLimits(chan_min[i]*0.9,chan_max[i]*1.1);
1549  g_vertex[i]->SetTitle(("Plane " +std::to_string(i)).c_str());
1550  g_vertex[i]->GetYaxis()->SetTitle("Peak Hit Time Tick");
1551  g_vertex[i]->GetXaxis()->SetTitle( ("Wire Number Plane " +std::to_string(i)).c_str());
1552  g_vertex[i]->Draw("ap");
1553 
1554  if(i>0){
1555  g_vertex[i]->GetYaxis()->SetLabelOffset(999);
1556  g_vertex[i]->GetYaxis()->SetLabelSize(0);
1557  }
1558 
1559 
1560  }
1561 
1562  // ******************************** DeadWireRegions ********************************************
1563  //plot dead wire
1564  // for(size_t i=0; i< bad_channel_list_fixed_mcc9.size(); i++){
1565  // int badchan = bad_channel_list_fixed_mcc9[i].first;
1566  // int ok = bad_channel_list_fixed_mcc9[i].second;
1567  //
1568  // if(ok>1)continue;
1569  // auto hs = geom->ChannelToWire(badchan);
1570  //
1571  // int thisp = (int)hs[0].Plane;
1572  // double bc = hs[0].Wire;
1573  // // std::cout<<"WIRE "<<thisp<<" "<<bc<<" "<<hs.size()<<std::endl;
1574  // if(chan_min[thisp]*0.9 < bc && bc < chan_max[thisp]*1.1 ){
1575  // can->cd(thisp+1);
1576  // TLine *l = new TLine(bc,tick_min*0.9,bc,tick_max*1.1);
1577  // l->SetLineColor(kGray+1);
1578  // l->Draw("same");
1579  // }
1580  // }
1581 
1582  // plot track
1583  for(size_t t=0; t< pts_trk.size(); t++){
1584  int tcol = tcols[used_col];
1585  used_col++;
1586 
1587  for(int i=0; i<3; i++){
1588  can->cd(i+1);
1589  if(pts_trk[t][i]->GetN()>0){//need a check in case this track has no hits on this plane.
1590  pts_trk[t][i]->Draw("p same");
1591  pts_trk[t][i]->SetMarkerColor(tcol);
1592  pts_trk[t][i]->SetFillColor(tcol);
1593  pts_trk[t][i]->SetMarkerStyle(20);
1594  pts_trk[t][i]->SetMarkerSize(plot_point_size);
1595  }
1596  }
1597  }
1598 
1599  // plot shower hits
1600  for(size_t t=0; t< pts_shr.size(); t++){
1601  int tcol = tcols[used_col];
1602  used_col++;
1603 
1604  for(int i=0; i<3; i++){
1605  can->cd(i+1);
1606  if(pts_shr[t][i]->GetN()>0){
1607  pts_shr[t][i]->Draw("p same"); //used in the vertex
1608  pts_shr[t][i]->SetMarkerColor(tcol);
1609  pts_shr[t][i]->SetFillColor(tcol);
1610  pts_shr[t][i]->SetMarkerStyle(20);
1611  pts_shr[t][i]->SetMarkerSize(plot_point_size);
1612  }
1613  }
1614  }
1615 
1616 
1617  // plot unassociated hits
1618  for(int i=0; i<3; i++){
1619  can->cd(i+1);
1620  if (g_unass[i]->GetN() > 0){
1621  g_unass[i]->SetMarkerColor(kBlack);
1622  g_unass[i]->SetMarkerStyle(20);
1623  g_unass[i]->SetMarkerSize(plot_point_size);
1624  }
1625  g_vertex[i]->Draw("p same");
1626  }
1627 
1628 
1629 
1630 
1631  //******************* INFO Plotting *******************************
1632 
1633  TPad *p_top_info = (TPad*)can->cd(4);
1634  p_top_info->cd();
1635 
1636  TLatex pottex;
1637  pottex.SetTextSize(0.045);
1638  pottex.SetTextAlign(13); //align at top
1639  pottex.SetNDC();
1640  std::string pot_draw = "Run: "+std::to_string(vars.m_run_number)+" SubRun: "+std::to_string(vars.m_subrun_number)+" Event: "+std::to_string(vars.m_event_number);
1641  pottex.DrawLatex(.1,.94, pot_draw.c_str());
1642 
1643  TLegend * l_top = new TLegend(0.5,0.5,0.85,0.85);
1644 
1645  // PLOTTING SHOWER?
1646  for(size_t t=0; t< pts_shr.size(); t++){
1647  std::string sname = "Shower "+std::to_string(t);
1648  if(pts_shr[t][0]->GetN()>0){
1649  l_top->AddEntry(pts_shr[t][0],sname.c_str(),"f");
1650  }else if(pts_shr[t][1]->GetN()>0){
1651  l_top->AddEntry(pts_shr[t][1],sname.c_str(),"f");
1652  }else if(pts_shr[t][2]->GetN()>0){
1653  l_top->AddEntry(pts_shr[t][2],sname.c_str(),"f");
1654  }
1655  }
1656 
1657  // PLOTTING
1658  for(size_t t=0; t< pts_trk.size(); t++){
1659  std::string sname = "Track "+std::to_string(t);
1660  if(pts_trk[t][0]->GetN()>0){
1661  l_top->AddEntry(pts_trk[t][0],sname.c_str(),"f");
1662  }else if(pts_trk[t][1]->GetN()>0){
1663  l_top->AddEntry(pts_trk[t][1],sname.c_str(),"f");
1664  }else if(pts_trk[t][2]->GetN()>0){
1665  l_top->AddEntry(pts_trk[t][2],sname.c_str(),"f");
1666  }
1667  }
1668  l_top->SetLineWidth(0);
1669  l_top->SetLineColor(kWhite);
1670  l_top->Draw("same");
1671 
1672  can->Update();
1673  // can->SaveAs((print_name+".pdf").c_str(),"pdf");
1674  std::cout<<"*PRINTING"<<std::endl;
1675 
1676  delete can;
1677  }
1678  }
1679  return;
1680  }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
process_name use argoneut_mc_hitfinder track
double calcWire(double Y, double Z, int plane, int fTPC, int fCryostat, geo::GeometryCore const &geo)
Definition: helper_math.h:54
process_name shower
Definition: cheaterreco.fcl:51
BEGIN_PROLOG TPC
process_name gaushit a
while getopts h
bool map_min_fn(const std::pair< art::Ptr< recob::Hit >, double > p1, const std::pair< art::Ptr< recob::Hit >, double > p2)
bool map_max_fn(const std::pair< art::Ptr< recob::Hit >, double > p1, const std::pair< art::Ptr< recob::Hit >, double > p2)
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
string sname
PandoraPFParticle * PPFP_GetPPFPFromTrack(std::vector< PandoraPFParticle > &PPFPs, art::Ptr< recob::Track > pTrack)
auto begin(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:573
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
std::string to_string(WindowPattern const &pattern)
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
PandoraPFParticle * PPFP_GetPPFPFromShower(std::vector< PandoraPFParticle > &PPFPs, art::Ptr< recob::Shower > pShower)
then echo ***************************************echo Variable FHICL_FILE_PATH not found echo You porbably haven t set up larsoft echo Try setup uboonecode vXX_XX_XX q e10
Definition: find_fhicl.sh:6
BEGIN_PROLOG could also be cout
bool single_photon::map_max_fn ( const std::pair< art::Ptr< recob::Hit >, double >  p1,
const std::pair< art::Ptr< recob::Hit >, double >  p2 
)

Definition at line 92 of file second_shower_search.h.

92  {
93  return (p1.second < p2.second);
94  }
physics associatedGroupsWithLeft p1
bool single_photon::map_min_fn ( const std::pair< art::Ptr< recob::Hit >, double >  p1,
const std::pair< art::Ptr< recob::Hit >, double >  p2 
)

Definition at line 97 of file second_shower_search.h.

97  {
98  return (p1.second > p2.second);
99  }
physics associatedGroupsWithLeft p1
template<typename T >
bool single_photon::marks_compare_vec_nonsense ( std::vector< T > &  v1,
std::vector< T > &  v2 
)

Definition at line 46 of file helper_math.h.

47  {
48  std::sort(v1.begin(), v1.end());
49  std::sort(v2.begin(), v2.end());
50  return v1 == v2;
51  }
int single_photon::photoNuclearTesting ( std::vector< art::Ptr< simb::MCParticle >> &  mcParticleVector)

Definition at line 644 of file reco_truth_matching.cxx.

644  {
645 
646 
647  for(auto &mcp: mcParticleVector){
648  int pdg = mcp->PdgCode();
649  std::string end_process = mcp->EndProcess();
650  int status = mcp->StatusCode() ;
651 
652 
653  if(pdg==22){
654  std::cout<<"PHOTO: "<<status<<" "<<end_process<<std::endl;
655  }
656  }
657 
658 
659  return 0;
660 
661  }
var pdg
Definition: selectors.fcl:14
BEGIN_PROLOG could also be cout
bool single_photon::Pi0PreselectionFilter ( var_all &  vars,
para_all &  paras 
)

Definition at line 185 of file Processors.cxx.

185  {
186 
187  if(vars.m_vertex_pos_x < paras.s_tpc_active_XMin|| vars.m_vertex_pos_x > paras.s_tpc_active_XMax) return false;
188  if(vars.m_vertex_pos_y < paras.s_tpc_active_YMin || vars.m_vertex_pos_y > paras.s_tpc_active_YMax) return false;
189  if(vars.m_vertex_pos_z < paras.s_tpc_active_ZMin|| vars.m_vertex_pos_z > paras.s_tpc_active_ZMax) return false;
190 
191  if(vars.m_reco_asso_showers!=2) return false;
192  if(vars.m_reco_asso_tracks!=1) return false;
193  if(vars.m_reco_vertex_size<1) return false;
194 
195  if(vars.m_reco_shower_conversion_distance.size()!=2) return false;
196  if(vars.m_reco_shower_conversion_distance[0]<1. || vars.m_reco_shower_conversion_distance[1]<1.) return false;
197 
198  return true;
199  }
bool single_photon::Pi0PreselectionFilter2g0p ( var_all &  vars,
para_all &  paras 
)

Definition at line 203 of file Processors.cxx.

203  {
204  if(vars.m_vertex_pos_x < paras.s_tpc_active_XMin|| vars.m_vertex_pos_x > paras.s_tpc_active_XMax) return false;
205  if(vars.m_vertex_pos_y < paras.s_tpc_active_YMin || vars.m_vertex_pos_y > paras.s_tpc_active_YMax) return false;
206  if(vars.m_vertex_pos_z < paras.s_tpc_active_ZMin|| vars.m_vertex_pos_z > paras.s_tpc_active_ZMax) return false;
207 
208  if(vars.m_reco_asso_showers!=2) return false;
209  if(vars.m_reco_asso_tracks!=0) return false;
210  if(vars.m_reco_vertex_size<1) return false;
211 
212  if(vars.m_reco_shower_energy_max.size()!=2) return false;
213  //if the maximum energy of all showers on all planes is smaller than 30
214  if(vars.m_reco_shower_energy_max[vars.m_reco_shower_ordered_energy_index[0]]<30.) return false;
215 
216  return true;
217  }
void single_photon::PPFP_FindAncestor ( std::vector< PandoraPFParticle > &  PPFPs)

Definition at line 65 of file helper_PandoraPFParticles.cxx.

65  {
66 
67  std::map< size_t, art::Ptr<recob::PFParticle>> pfParticleMap;
68  int pfp_size = PPFPs.size();
69  //build ID-PFParticle map;
70  for(int index = 0; index < pfp_size; index++){
71  PandoraPFParticle temp_pfp = PPFPs[index];
72  if (!pfParticleMap.insert(std::map< size_t, art::Ptr<recob::PFParticle>>::value_type((temp_pfp.pPFParticle)->Self(), temp_pfp.pPFParticle)).second){
73  throw cet::exception("SinglePhoton") << " Unable to get PFParticle ID map, the input PFParticle collection has repeat IDs!";
74  }
75  }
76 
77  //trace up parents
78  for(int jndex = 0; jndex < pfp_size; jndex++){
79  art::Ptr< recob::PFParticle > temp_pfp = PPFPs[jndex].pPFParticle;
80 
81  PPFPs[jndex].set_AncestorID(temp_pfp->Self() );
82  PPFPs[jndex].pAncestor = pfParticleMap[temp_pfp->Self()];
83  if(temp_pfp->IsPrimary()) continue;//skip PFP without parent is a parent of itself
84 
85  while(!(PPFPs[jndex].pAncestor)->IsPrimary()){//1+ gen. parent
86 
87  int temp_parent_id = PPFPs[jndex].pAncestor->Parent();
88  PPFPs[jndex].set_AncestorID( temp_parent_id );
89  PPFPs[jndex].pAncestor = pfParticleMap[temp_parent_id];
90  // std::cout<<PPFPs[jndex].pPFParticleID<<" Trace up a generation parent "<<temp_parent_id<<std::endl;
91 
92  }
93  }
94 
95  }
void single_photon::PPFP_FindSliceIDandHits ( std::vector< PandoraPFParticle > &  PPFPs,
art::Ptr< recob::Slice slice,
const std::vector< art::Ptr< recob::PFParticle > >  PFP_in_slice,
const std::vector< art::Ptr< recob::Hit > >  Hit_inslice 
)

Definition at line 99 of file helper_PandoraPFParticles.cxx.

99  {
100 
101  int pfp_size = PPFPs.size();
102  for( auto pfp : PFP_in_slice){
103  for(int index = 0; index < pfp_size; index++){
104  if(PPFPs[index].get_SliceID() > -1 ) continue;//slice# is found already
105  if( (PPFPs[index].pPFParticle)->Self() == pfp->Self() ){
106  PPFPs[index].pSlice = slice;
107  PPFPs[index].pSliceHits = Hit_inslice;
108  PPFPs[index].set_SliceID( slice.key() );
109  break;
110  }
111  }
112  }
113  }
PandoraPFParticle * single_photon::PPFP_GetPPFPFromPFID ( std::vector< PandoraPFParticle > &  PPFPs,
int  id 
)

Definition at line 180 of file helper_PandoraPFParticles.cxx.

180  {
181  int pfp_size = PPFPs.size();
182  for(int index = 0; index < pfp_size; index++){
183  if(PPFPs[index].get_PFParticleID() == id ){
184  return &PPFPs[index];
185  }
186  }
187  std::cout<<"Error, no PFParticle matched to track, returning the first element"<<std::endl;
188  return &PPFPs[0];
189  }
BEGIN_PROLOG could also be cout
PandoraPFParticle * single_photon::PPFP_GetPPFPFromShower ( std::vector< PandoraPFParticle > &  PPFPs,
art::Ptr< recob::Shower pShower 
)

Definition at line 150 of file helper_PandoraPFParticles.cxx.

150  {
151  int pfp_size = PPFPs.size();
152  for(int index = 0; index < pfp_size; index++){
153  if(PPFPs[index].get_HasShower() != 1 ) continue;
154  // std::cout<<"CHECK Shower start "<<pShower->ShowerStart().X()<<" vs "<<PPFPs[index].pShower->ShowerStart().X()<<std::endl;
155  //CHECK, this works, but there maybe a better way;
156  if((pShower->ShowerStart() == PPFPs[index].pShower->ShowerStart())
157  && (pShower->Direction() == PPFPs[index].pShower->Direction())){
158  return &PPFPs[index];
159  }
160  }
161  std::cout<<"Error, no PFParticle matched to shower, returning the first element"<<std::endl;
162  return &PPFPs[0];
163  }
BEGIN_PROLOG could also be cout
PandoraPFParticle * single_photon::PPFP_GetPPFPFromTrack ( std::vector< PandoraPFParticle > &  PPFPs,
art::Ptr< recob::Track pTrack 
)

Definition at line 166 of file helper_PandoraPFParticles.cxx.

166  {
167  int pfp_size = PPFPs.size();
168  for(int index = 0; index < pfp_size; index++){
169  if(PPFPs[index].get_HasTrack() != 1 ) continue;
170  if((pTrack->StartDirection() == PPFPs[index].pTrack->StartDirection())
171  && (pTrack->EndDirection() == PPFPs[index].pTrack->EndDirection())){
172  return &PPFPs[index];
173  }
174  }
175  std::cout<<"Error, no PFParticle matched to track, returning the first element"<<std::endl;
176  return &PPFPs[0];
177  }
BEGIN_PROLOG could also be cout
void single_photon::Printer_content ( std::vector< std::string >  nums,
std::vector< int >  spacers 
)

Definition at line 14 of file helper_gadget.cxx.

14  {
15 
16  if(nums.size() != spacers.size()) {
17  std::cout<<"CANNOT PRINT!"<<std::endl;
18  return;
19  }
20 
21  for( size_t index = 0; index < nums.size(); index++){
22  std::cout<<std::setw(spacers[index])<<nums[index];
23  }
24  std::cout<<std::endl;
25 }
BEGIN_PROLOG could also be cout
std::vector< int > single_photon::Printer_header ( std::vector< std::string >  headings)

Definition at line 3 of file helper_gadget.cxx.

3  {
4 
5  std::vector<int> spacers;
6  for( size_t index = 0; index < headings.size(); index++){
7  std::cout<<headings[index];
8  spacers.push_back( headings[index].size());
9  }
10  std::cout<<std::endl;
11  return spacers;
12 }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
BEGIN_PROLOG could also be cout
double single_photon::QtoEConversion ( double  Q,
para_all &  paras 
)

Definition at line 334 of file Processors.cxx.

334  {
335  //return the energy value converted to MeV (the factor of 1e-6)
336  double E = Q* paras.s_work_function *1e-6 /paras.s_recombination_factor;
337  return E;
338 
339  }
process_name E
do i e
int single_photon::quick_delaunay_fit ( int  n,
double *  X,
double *  Y,
int *  num_triangles,
double *  area 
)

Definition at line 495 of file Processors.cxx.

495  {
496 
497  std::vector<double> z(n,0.0);
498 
499  TGraph2D *g = new TGraph2D(n,X,Y,&z[0]);
500  TGraphDelaunay delan(g);
501  delan.SetMarginBinsContent(0);
502  delan.ComputeZ(0,0);
503  delan.FindAllTriangles();
504  (*num_triangles)=delan.GetNdt(); // number of Delaunay triangles found
505 
506  //Grab the locations of all the trianges. These will be intergers referencing to position in X,Y arrays
507  Int_t *MT = delan.GetMTried();
508  Int_t *NT = delan.GetNTried();
509  Int_t *PT = delan.GetPTried();
510 
511  (*area)=0.0;
512  for(int i = 0; i<delan.GetNdt(); i++){
513  (*area)+=triangle_area(X[MT[i]-1],Y[MT[i]-1],X[NT[i]-1],Y[NT[i]-1],X[PT[i]-1],Y[PT[i]-1]);
514  }
515 
516  delete g;
517  return 0;
518  }
process_name opflash particleana ie ie ie z
then echo echo For and will not be changed by echo further linking echo echo B echo The symbol is in the uninitialized data multiple common symbols may appear with the echo same name If the symbol is defined the common echo symbols are treated as undefined references For more echo details on common see the discussion of warn common echo in *Note Linker see the discussion of warn common echo in *Note Linker such as a global int variable echo as opposed to a large global array echo echo I echo The symbol is an indirect reference to another symbol This echo is a GNU extension to the a out object file format which is echo rarely used echo echo N echo The symbol is a debugging symbol echo echo R echo The symbol is in a read only data section echo echo S echo The symbol is in an uninitialized data section for small echo objects echo echo T echo The symbol is in the the normal defined echo symbol is used with no error When a weak undefined symbol echo is linked and the symbol is not the value of the echo weak symbol becomes zero with no error echo echo W echo The symbol is a weak symbol that has not been specifically echo tagged as a weak object symbol When a weak defined symbol echo is linked with a normal defined the normal defined echo symbol is used with no error When a weak undefined symbol echo is linked and the symbol is not the value of the echo weak symbol becomes zero with no error echo echo echo The symbol is a stabs symbol in an a out object file In echo this the next values printed are the stabs other echo the stabs desc and the stab type Stabs symbols are echo used to hold debugging information For more echo see *Note or object file format specific echo echo For Mac OS X
BEGIN_PROLOG g
double triangle_area(double a1, double a2, double b1, double b2, double c1, double c2)
Definition: Processors.cxx:488
double single_photon::radToDeg ( double  rad)
inline

Definition at line 65 of file helper_math.h.

65 { return rad * 180/M_PI; }
void single_photon::RecoMCTracks ( std::vector< PandoraPFParticle >  all_PPFPs,
const std::vector< art::Ptr< recob::Track >> &  tracks,
std::map< art::Ptr< recob::Track >, art::Ptr< simb::MCParticle > > &  trackToMCParticleMap,
std::map< art::Ptr< simb::MCParticle >, art::Ptr< simb::MCTruth >> &  MCParticleToMCTruthMap,
std::vector< art::Ptr< simb::MCParticle >> &  mcParticleVector,
std::map< int, art::Ptr< simb::MCParticle > > &  MCParticleToTrackIdMap,
std::vector< double > &  vfrac,
var_all &  vars 
)

Definition at line 9 of file reco_truth_matching.cxx.

18  {
19 
20 
21  //if(g_is_verbose)
22  std::cout<<"RecoMCTracks()\t||\t Begininning recob::Track Reco-MC suite on: "<<tracks.size()<<" tracks."<<std::endl;
23 
24  int i_trk = 0;
25 
26  for(size_t k =0; k< tracks.size();++k){
27  const art::Ptr<recob::Track> track = tracks[k];
28  vars.m_sim_track_matched[i_trk] = 0;
29 
30  if(trackToMCParticleMap.count(track)>0){
31 
32  const art::Ptr<simb::MCParticle> mcparticle = trackToMCParticleMap[track];
33  std::cout<<"count2: "<<MCParticleToMCTruthMap.count(mcparticle)<<std::endl;
34  const art::Ptr<simb::MCTruth> mctruth = MCParticleToMCTruthMap[mcparticle];
35 
36  PandoraPFParticle* ppfp = PPFP_GetPPFPFromTrack(all_PPFPs, track);
37  // const art::Ptr<recob::PFParticle> pfp = ppfp->pPFParticle;
38  // const art::Ptr<recob::PFParticle> pfp = //trackToPFParticleMap[track];
39 
40  std::vector<double> correctedstart(3);
41  std::vector<double> correctedend(3);
42  std::vector<double> raw_End ={mcparticle->EndX(), mcparticle->EndY(), mcparticle->EndZ()};
43  // std::cout<<"the raw end of this mcparticle is "<<raw_End[0]<<", "<<raw_End[1]<<", "<<raw_End[2]<<std::endl;
44  spacecharge_correction(mcparticle, correctedstart);
45  spacecharge_correction(mcparticle, correctedend, raw_End);
46 
47  //std::cout<<"the corrected end of this mcparticle is "<<correctedend[0]<<", "<<correctedend[1]<<", "<<correctedend[2]<<std::endl;
48 
49 
50  vars.m_sim_track_matched[i_trk] = 1;
51  vars.m_sim_track_energy[i_trk] = mcparticle->E();
52  vars.m_sim_track_mass[i_trk] = mcparticle->Mass();
53  vars.m_sim_track_kinetic_energy[i_trk] = vars.m_sim_track_energy[i_trk]-vars.m_sim_track_mass[i_trk];
54  vars.m_sim_track_pdg[i_trk] = mcparticle->PdgCode();
55  vars.m_sim_track_process[i_trk] = mcparticle->Process();
56  vars.m_sim_track_startx[i_trk] = correctedstart[0];
57  vars.m_sim_track_starty[i_trk] = correctedstart[1];
58  vars.m_sim_track_startz[i_trk] = correctedstart[2];
59 
60  vars.m_sim_track_endx[i_trk]= correctedend[0];
61  vars.m_sim_track_endy[i_trk]= correctedend[1];
62  vars.m_sim_track_endz[i_trk]= correctedend[2];
63 
64  vars.m_sim_track_length[i_trk]= sqrt(pow( vars.m_sim_track_endx[i_trk] - vars.m_sim_track_startx[i_trk], 2)+ pow( vars.m_sim_track_endy[i_trk] - vars.m_sim_track_starty[i_trk], 2) + pow( vars.m_sim_track_endz[i_trk] - vars.m_sim_track_startz[i_trk], 2));
65 
66  vars.m_sim_track_px[i_trk]= mcparticle->Px();
67  vars.m_sim_track_py[i_trk]= mcparticle->Py();
68  vars.m_sim_track_pz[i_trk]= mcparticle->Pz();
69 
70 
71  vars.m_sim_track_origin[i_trk] = mctruth->Origin();
72  vars.m_sim_track_trackID[i_trk] = mcparticle->TrackId();
73  vars.m_sim_track_overlay_fraction[i_trk] = vfrac[i_trk];
74 
75  vars.m_sim_track_sliceId[i_trk] = ppfp->get_SliceID();//PFPToSliceIdMap[pfp];
76  vars.m_sim_track_nuscore[i_trk] = ppfp->get_NuScore();//sliceIdToNuScoreMap[ vars.m_sim_track_sliceId[i_trk]] ;
77  vars.m_sim_track_isclearcosmic[i_trk] = ppfp->get_IsClearCosmic();//PFPToClearCosmicMap[pfp];
78 
79 
80  if(mcparticle->Mother()>=(int)mcParticleVector.size()){
81  vars.m_sim_track_parent_pdg[i_trk] = -1;
82  }else{
83  vars.m_sim_track_parent_pdg[i_trk] = mcParticleVector[mcparticle->Mother()]->PdgCode();
84  }
85 
86  }
87  i_trk++;
88  }
89 
90  return;
91  }
process_name use argoneut_mc_hitfinder track
PandoraPFParticle * PPFP_GetPPFPFromTrack(std::vector< PandoraPFParticle > &PPFPs, art::Ptr< recob::Track > pTrack)
int spacecharge_correction(const art::Ptr< simb::MCParticle > &mcparticle, std::vector< double > &corrected, std::vector< double > &input)
Definition: Processors.cxx:25
pdgs k
Definition: selectors.fcl:22
BEGIN_PROLOG could also be cout
void single_photon::ResizeFlashes ( size_t  size,
var_all &  vars 
)

Definition at line 478 of file init_branches.cxx.

478  {
479  vars.m_reco_flash_total_pe.resize(size);
480  vars.m_reco_flash_time.resize(size);
481  vars.m_reco_flash_time_width.resize(size);
482  vars.m_reco_flash_abs_time.resize(size);
483  vars.m_reco_flash_frame.resize(size);
484  vars.m_reco_flash_ycenter.resize(size);
485  vars.m_reco_flash_ywidth.resize(size);
486  vars.m_reco_flash_zcenter.resize(size);
487  vars.m_reco_flash_zwidth.resize(size);
488  vars.m_reco_flash_total_pe_in_beamgate.resize(size);
489  vars.m_reco_flash_time_in_beamgate.resize(size);
490  vars.m_reco_flash_ycenter_in_beamgate.resize(size);
491  vars.m_reco_flash_zcenter_in_beamgate.resize(size);
492  vars.m_CRT_veto_hit_PE.resize(size);
493 
494  vars.m_CRT_hits_time.resize(size);
495  vars.m_CRT_hits_PE.resize(size);
496  vars.m_CRT_hits_x.resize(size);
497  vars.m_CRT_hits_y.resize(size);
498  vars.m_CRT_hits_z.resize(size);
499  }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
void single_photon::ResizeMCTruths ( size_t  size,
var_all &  vars 
)

Definition at line 1761 of file init_branches.cxx.

1761  {
1762  vars.m_mctruth_daughters_pdg.resize(size);
1763  vars.m_mctruth_daughters_E.resize(size);
1764  vars.m_mctruth_daughters_status_code.resize(size);
1765  vars.m_mctruth_daughters_trackID.resize(size);
1766  vars.m_mctruth_daughters_mother_trackID.resize(size);
1767  vars.m_mctruth_daughters_px.resize(size);
1768  vars.m_mctruth_daughters_py.resize(size);
1769  vars.m_mctruth_daughters_pz.resize(size);
1770  vars.m_mctruth_daughters_startx.resize(size);
1771  vars.m_mctruth_daughters_starty.resize(size);
1772  vars.m_mctruth_daughters_startz.resize(size);
1773  vars.m_mctruth_daughters_time.resize(size);
1774  vars.m_mctruth_daughters_endx.resize(size);
1775  vars.m_mctruth_daughters_endy.resize(size);
1776  vars.m_mctruth_daughters_endz.resize(size);
1777  vars.m_mctruth_daughters_endtime.resize(size);
1778  vars.m_mctruth_daughters_end_process.resize(size);
1779  vars.m_mctruth_daughters_process.resize(size);
1780  }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
void single_photon::ResizeShowers ( size_t  size,
var_all &  vars 
)

Definition at line 1365 of file init_branches.cxx.

1365  {
1366  vars.m_reco_shower_num_daughters.resize(size);
1367  vars.m_reco_shower_daughter_trackscore.resize(size);
1368 
1369  vars.m_reco_shower_kalman_exists.resize(size);
1370  vars.m_reco_shower_kalman_median_dEdx_plane0.resize(size);
1371  vars.m_reco_shower_kalman_median_dEdx_plane1.resize(size);
1372  vars.m_reco_shower_kalman_median_dEdx_plane2.resize(size);
1373  vars.m_reco_shower_kalman_median_dEdx_allplane.resize(size);
1374  vars.m_reco_shower_kalman_mean_dEdx_plane0.resize(size);
1375  vars.m_reco_shower_kalman_mean_dEdx_plane1.resize(size);
1376  vars.m_reco_shower_kalman_mean_dEdx_plane2.resize(size);
1377 
1378  vars.m_reco_shower_reclustered_energy_plane0.resize(size);
1379  vars.m_reco_shower_reclustered_energy_plane1.resize(size);
1380  vars.m_reco_shower_reclustered_energy_plane2.resize(size);
1381  vars.m_reco_shower_reclustered_energy_max.resize(size);
1382 
1383 
1384  vars.m_reco_shower3d_exists.resize(size);
1385  vars.m_reco_shower3d_startx.resize(size);
1386  vars.m_reco_shower3d_starty.resize(size);
1387  vars.m_reco_shower3d_startz.resize(size);
1388  vars.m_reco_shower3d_dirx.resize(size);
1389  vars.m_reco_shower3d_diry.resize(size);
1390  vars.m_reco_shower3d_dirz.resize(size);
1391  vars.m_reco_shower3d_theta_yz.resize(size);
1392  vars.m_reco_shower3d_phi_yx.resize(size);
1393  vars.m_reco_shower3d_conversion_distance.resize(size);
1394  vars.m_reco_shower3d_openingangle.resize(size);
1395  vars.m_reco_shower3d_length.resize(size);
1396  vars.m_reco_shower3d_impact_parameter.resize(size);
1397  vars.m_reco_shower3d_implied_dirx.resize(size);
1398  vars.m_reco_shower3d_implied_diry.resize(size);
1399  vars.m_reco_shower3d_implied_dirz.resize(size);
1400  vars.m_reco_shower3d_energy_plane0.resize(size);
1401  vars.m_reco_shower3d_energy_plane1.resize(size);
1402  vars.m_reco_shower3d_energy_plane2.resize(size);
1403  vars.m_reco_shower3d_dEdx_plane0.resize(size);
1404  vars.m_reco_shower3d_dEdx_plane1.resize(size);
1405  vars.m_reco_shower3d_dEdx_plane2.resize(size);
1406 
1407  vars.m_reco_shower_start_dist_to_active_TPC.resize(size);
1408  vars.m_reco_shower_start_dist_to_CPA.resize(size);
1409  vars.m_reco_shower_start_dist_to_SCB.resize(size);
1410  vars.m_reco_shower_start_in_SCB.resize(size);
1411 
1412  vars.m_reco_shower_end_dist_to_active_TPC.resize(size);
1413  vars.m_reco_shower_end_dist_to_SCB.resize(size);
1414 
1415 
1416  vars.m_reco_shower_startx.resize(size);
1417  vars.m_reco_shower_starty.resize(size);
1418  vars.m_reco_shower_startz.resize(size);
1419  vars.m_reco_shower_dirx.resize(size);
1420  vars.m_reco_shower_diry.resize(size);
1421  vars.m_reco_shower_dirz.resize(size);
1422  vars.m_reco_shower_theta_yz.resize(size);
1423  vars.m_reco_shower_phi_yx.resize(size);
1424  vars.m_reco_shower_conversion_distance.resize(size);
1425  vars.m_reco_shower_openingangle.resize(size);
1426  vars.m_reco_shower_length.resize(size);
1427  vars.m_reco_shower_impact_parameter.resize(size);
1428  vars.m_reco_shower_implied_dirx.resize(size);
1429  vars.m_reco_shower_implied_diry.resize(size);
1430  vars.m_reco_shower_implied_dirz.resize(size);
1431  vars.m_reco_shower_delaunay_num_triangles_plane0.resize(size);
1432  vars.m_reco_shower_delaunay_num_triangles_plane1.resize(size);
1433  vars.m_reco_shower_delaunay_num_triangles_plane2.resize(size);
1434  vars.m_reco_shower_num_hits_plane0.resize(size);
1435  vars.m_reco_shower_num_hits_plane1.resize(size);
1436  vars.m_reco_shower_num_hits_plane2.resize(size);
1437  vars.m_reco_shower_delaunay_area_plane0.resize(size);
1438  vars.m_reco_shower_delaunay_area_plane1.resize(size);
1439  vars.m_reco_shower_delaunay_area_plane2.resize(size);
1440 
1441  vars.m_reco_shower_energy_max.resize(size);
1442  vars.m_reco_shower_energy_plane0.resize(size);
1443  vars.m_reco_shower_energy_plane1.resize(size);
1444  vars.m_reco_shower_energy_plane2.resize(size);
1445 
1446  vars.m_reco_shower_plane0_nhits.resize(size);
1447  vars.m_reco_shower_plane1_nhits.resize(size);
1448  vars.m_reco_shower_plane2_nhits.resize(size);
1449 
1450  vars.m_reco_shower_plane0_meanRMS.resize(size);
1451  vars.m_reco_shower_plane1_meanRMS.resize(size);
1452  vars.m_reco_shower_plane2_meanRMS.resize(size);
1453 
1454 
1455 
1456  vars.m_reco_shower_ordered_energy_index.resize(size);
1457  vars.m_reco_shower_dQdx_plane0.resize(size);
1458  vars.m_reco_shower_dQdx_plane1.resize(size);
1459  vars.m_reco_shower_dQdx_plane2.resize(size);
1460  vars.m_reco_shower_dEdx_plane0.resize(size);
1461  vars.m_reco_shower_dEdx_plane1.resize(size);
1462  vars.m_reco_shower_dEdx_plane2.resize(size);
1463  vars.m_reco_shower_dEdx_plane0_median.resize(size);
1464  vars.m_reco_shower_dEdx_plane1_median.resize(size);
1465  vars.m_reco_shower_dEdx_plane2_median.resize(size);
1466 
1467  vars.m_reco_shower_angle_wrt_wires_plane0.resize(size);
1468  vars.m_reco_shower_angle_wrt_wires_plane1.resize(size);
1469  vars.m_reco_shower_angle_wrt_wires_plane2.resize(size);
1470 
1471  vars.m_reco_shower_dEdx_amalgamated.resize(size);
1472  vars.m_reco_shower_dEdx_amalgamated_nhits.resize(size);
1473 
1474  vars.m_reco_shower_dQdx_plane0_median.resize(size);
1475  vars.m_reco_shower_dQdx_plane1_median.resize(size);
1476  vars.m_reco_shower_dQdx_plane2_median.resize(size);
1477 
1478  vars.m_reco_shower_dEdx_plane0_min.resize(size);
1479  vars.m_reco_shower_dEdx_plane1_min.resize(size);
1480  vars.m_reco_shower_dEdx_plane2_min.resize(size);
1481  vars.m_reco_shower_dEdx_plane0_max.resize(size);
1482  vars.m_reco_shower_dEdx_plane1_max.resize(size);
1483  vars.m_reco_shower_dEdx_plane2_max.resize(size);
1484  vars.m_reco_shower_dEdx_plane0_mean.resize(size);
1485  vars.m_reco_shower_dEdx_plane1_mean.resize(size);
1486  vars.m_reco_shower_dEdx_plane2_mean.resize(size);
1487 
1488 
1489 
1490 
1491  vars.m_reco_shower_dEdx_plane0_nhits.resize(size);
1492  vars.m_reco_shower_dEdx_plane1_nhits.resize(size);
1493  vars.m_reco_shower_dEdx_plane2_nhits.resize(size);
1494 
1495 // vars.m_reco_shower_start_to_nearest_dead_wire_plane0.resize(size);
1496 // vars.m_reco_shower_start_to_nearest_dead_wire_plane1.resize(size);
1497 // vars.m_reco_shower_start_to_nearest_dead_wire_plane2.resize(size);
1498 
1499  vars.m_reco_shower_flash_shortest_distz.resize(size);
1500  vars.m_reco_shower_flash_shortest_index_z.resize(size);
1501  vars.m_reco_shower_flash_shortest_disty.resize(size);
1502  vars.m_reco_shower_flash_shortest_index_y.resize(size);
1503 
1504  vars.m_reco_shower_flash_shortest_distyz.resize(size);
1505  vars.m_reco_shower_flash_shortest_index_yz.resize(size);
1506 
1507  vars.m_reco_shower_sliceId.resize(size);
1508  vars.m_reco_shower_nuscore.resize(size);
1509  vars.m_reco_shower_isclearcosmic.resize(size);
1510  vars.m_reco_shower_is_nuslice.resize(size);
1511  vars.m_reco_shower_trackscore.resize(size);
1512  vars.m_reco_shower_pfparticle_pdg.resize(size);
1513 
1514 
1515  vars.m_sim_shower_energy.resize(size);
1516  vars.m_sim_shower_matched.resize(size);
1517  vars.m_sim_shower_kinetic_energy.resize(size);
1518  vars.m_sim_shower_mass.resize(size);
1519  vars.m_sim_shower_pdg.resize(size);
1520  vars.m_sim_shower_trackID.resize(size);
1521  vars.m_sim_shower_parent_pdg.resize(size);
1522  vars.m_sim_shower_parent_trackID.resize(size);
1523  vars.m_sim_shower_origin.resize(size);
1524  vars.m_sim_shower_process.resize(size);
1525  vars.m_sim_shower_end_process.resize(size);
1526  vars.m_sim_shower_start_x.resize(size);
1527  vars.m_sim_shower_start_y.resize(size);
1528  vars.m_sim_shower_start_z.resize(size);
1529  vars.m_sim_shower_vertex_x.resize(size);
1530  vars.m_sim_shower_vertex_y.resize(size);
1531  vars.m_sim_shower_vertex_z.resize(size);
1532  vars.m_sim_shower_is_true_shower.resize(size);
1533  vars.m_sim_shower_best_matched_plane.resize(size);
1534  vars.m_sim_shower_matched_energy_fraction_plane0.resize(size);
1535  vars.m_sim_shower_matched_energy_fraction_plane1.resize(size);
1536  vars.m_sim_shower_matched_energy_fraction_plane2.resize(size);
1537  vars.m_sim_shower_overlay_fraction.resize(size);
1538  vars.m_sim_shower_px.resize(size);
1539  vars.m_sim_shower_py.resize(size);
1540  vars.m_sim_shower_pz.resize(size);
1541  vars.m_sim_shower_sliceId.resize(size);
1542  vars.m_sim_shower_nuscore.resize(size);
1543  vars.m_sim_shower_isclearcosmic.resize(size);
1544  vars.m_sim_shower_is_nuslice.resize(size);
1545  }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
void single_photon::ResizeSlices ( size_t  size,
var_all &  vars 
)

Definition at line 2155 of file init_branches.cxx.

2155  {
2156  vars.m_reco_slice_nuscore.resize(size,-999);
2157  vars.m_reco_slice_num_pfps.resize(size,0);
2158  vars.m_reco_slice_num_showers.resize(size,0);
2159  vars.m_reco_slice_num_tracks.resize(size,0);
2160  }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
void single_photon::ResizeTracks ( size_t  size,
var_all &  vars 
)

Definition at line 828 of file init_branches.cxx.

828  {
829  vars.m_reco_track_length.resize(size);
830  vars.m_reco_track_dirx.resize(size);
831  vars.m_reco_track_num_daughters.resize(size);
832  vars.m_reco_track_daughter_trackscore.resize(size);
833 
834  vars.m_reco_track_diry.resize(size);
835  vars.m_reco_track_dirz.resize(size);
836  vars.m_reco_track_endx.resize(size);
837  vars.m_reco_track_endy.resize(size);
838  vars.m_reco_track_endz.resize(size);
839  vars.m_reco_track_end_dist_to_active_TPC.resize(size);
840  vars.m_reco_track_start_dist_to_active_TPC.resize(size);
841  vars.m_reco_track_end_dist_to_CPA.resize(size);
842  vars.m_reco_track_start_dist_to_CPA.resize(size);
843  vars.m_reco_track_end_dist_to_SCB.resize(size);
844  vars.m_reco_track_start_dist_to_SCB.resize(size);
845  vars.m_reco_track_end_in_SCB.resize(size);
846  vars.m_reco_track_start_in_SCB.resize(size);
847 
848  vars.m_reco_track_calo_energy_plane0.resize(size);
849  vars.m_reco_track_calo_energy_plane1.resize(size);
850  vars.m_reco_track_calo_energy_plane2.resize(size);
851  vars.m_reco_track_calo_energy_max.resize(size);
852 
853 
854 
855  vars.m_reco_track_startx.resize(size);
856  vars.m_reco_track_starty.resize(size);
857  vars.m_reco_track_startz.resize(size);
858  vars.m_reco_track_num_trajpoints.resize(size);
859  vars.m_reco_track_num_spacepoints.resize(size);
860  vars.m_reco_track_proton_kinetic_energy.resize(size);
861  vars.m_reco_track_ordered_energy_index.resize(size);
862  vars.m_reco_track_ordered_displacement_index.resize(size);
863 
864 
865  vars.m_reco_track_spacepoint_principal0.resize(size);
866  vars.m_reco_track_spacepoint_principal1.resize(size);
867  vars.m_reco_track_spacepoint_principal2.resize(size);
868 
869  vars.m_reco_track_spacepoint_chi.resize(size);
870  vars.m_reco_track_spacepoint_max_dist.resize(size);
871 
872  vars.m_reco_track_theta_yz.resize(size);
873  vars.m_reco_track_phi_yx.resize(size);
874 
875  vars.m_reco_track_best_calo_plane.resize(size);
876 
877  vars.m_reco_track_mean_dEdx_best_plane.resize(size);
878  vars.m_reco_track_mean_dEdx_start_half_best_plane.resize(size);
879  vars.m_reco_track_mean_dEdx_end_half_best_plane.resize(size);
880  vars.m_reco_track_good_calo_best_plane.resize(size);
881  vars.m_reco_track_trunc_dEdx_best_plane.resize(size);
882  vars.m_reco_track_mean_trunc_dEdx_best_plane.resize(size);
883  vars.m_reco_track_mean_trunc_dEdx_start_half_best_plane.resize(size);
884  vars.m_reco_track_mean_trunc_dEdx_end_half_best_plane.resize(size);
885  vars.m_reco_track_trunc_PIDA_best_plane.resize(size);
886  vars.m_reco_track_resrange_best_plane.resize(size);
887  vars.m_reco_track_dEdx_best_plane.resize(size);
888 
889 
890  vars.m_reco_track_mean_dEdx_p0.resize(size);
891  vars.m_reco_track_mean_dEdx_start_half_p0.resize(size);
892  vars.m_reco_track_mean_dEdx_end_half_p0.resize(size);
893  vars.m_reco_track_good_calo_p0.resize(size);
894  vars.m_reco_track_trunc_dEdx_p0.resize(size);
895  vars.m_reco_track_mean_trunc_dEdx_p0.resize(size);
896  vars.m_reco_track_mean_trunc_dEdx_start_half_p0.resize(size);
897  vars.m_reco_track_mean_trunc_dEdx_end_half_p0.resize(size);
898  vars.m_reco_track_trunc_PIDA_p0.resize(size);
899  vars.m_reco_track_resrange_p0.resize(size);
900  vars.m_reco_track_dEdx_p0.resize(size);
901 
902  vars.m_reco_track_mean_dEdx_p1.resize(size);
903  vars.m_reco_track_mean_dEdx_start_half_p1.resize(size);
904  vars.m_reco_track_mean_dEdx_end_half_p1.resize(size);
905  vars.m_reco_track_good_calo_p1.resize(size);
906  vars.m_reco_track_trunc_dEdx_p1.resize(size);
907  vars.m_reco_track_mean_trunc_dEdx_p1.resize(size);
908  vars.m_reco_track_mean_trunc_dEdx_start_half_p1.resize(size);
909  vars.m_reco_track_mean_trunc_dEdx_end_half_p1.resize(size);
910  vars.m_reco_track_trunc_PIDA_p1.resize(size);
911  vars.m_reco_track_resrange_p1.resize(size);
912  vars.m_reco_track_dEdx_p1.resize(size);
913 
914  vars.m_reco_track_mean_dEdx_p2.resize(size);
915  vars.m_reco_track_mean_dEdx_start_half_p2.resize(size);
916  vars.m_reco_track_mean_dEdx_end_half_p2.resize(size);
917  vars.m_reco_track_good_calo_p2.resize(size);
918  vars.m_reco_track_trunc_dEdx_p2.resize(size);
919  vars.m_reco_track_mean_trunc_dEdx_p2.resize(size);
920  vars.m_reco_track_mean_trunc_dEdx_start_half_p2.resize(size);
921  vars.m_reco_track_mean_trunc_dEdx_end_half_p2.resize(size);
922  vars.m_reco_track_trunc_PIDA_p2.resize(size);
923  vars.m_reco_track_resrange_p2.resize(size);
924  vars.m_reco_track_dEdx_p2.resize(size);
925 
926  vars.m_reco_track_num_calo_hits_p1.resize(size);
927  vars.m_reco_track_num_calo_hits_p0.resize(size);
928  vars.m_reco_track_num_calo_hits_p2.resize(size);
929 
930 
931 
932  vars.m_sim_track_matched.resize(size);
933  vars.m_sim_track_energy.resize(size);
934  vars.m_sim_track_mass.resize(size);
935  vars.m_sim_track_kinetic_energy.resize(size);
936  vars.m_sim_track_pdg.resize(size);
937  vars.m_sim_track_parent_pdg.resize(size);
938  vars.m_sim_track_origin.resize(size);
939  vars.m_sim_track_process.resize(size);
940  vars.m_sim_track_startx.resize(size);
941  vars.m_sim_track_starty.resize(size);
942  vars.m_sim_track_startz.resize(size);
943  vars.m_sim_track_endx.resize(size);
944  vars.m_sim_track_endy.resize(size);
945  vars.m_sim_track_endz.resize(size);
946  vars.m_sim_track_length.resize(size);
947 
948  vars.m_sim_track_px.resize(size);
949  vars.m_sim_track_py.resize(size);
950  vars.m_sim_track_pz.resize(size);
951  vars.m_sim_track_trackID.resize(size);
952  vars.m_sim_track_overlay_fraction.resize(size);
953 
954  vars.m_reco_track_pid_bragg_likelihood_mu_plane0.resize(size);
955  vars.m_reco_track_pid_bragg_likelihood_mu_plane1.resize(size);
956  vars.m_reco_track_pid_bragg_likelihood_mu_plane2.resize(size);
957  vars.m_reco_track_pid_bragg_likelihood_p_plane0.resize(size);
958  vars.m_reco_track_pid_bragg_likelihood_p_plane1.resize(size);
959  vars.m_reco_track_pid_bragg_likelihood_p_plane2.resize(size);
960  vars.m_reco_track_pid_bragg_likelihood_mip_plane0.resize(size);
961  vars.m_reco_track_pid_bragg_likelihood_mip_plane1.resize(size);
962  vars.m_reco_track_pid_bragg_likelihood_mip_plane2.resize(size);
963  vars.m_reco_track_pid_chi2_mu_plane0.resize(size);
964  vars.m_reco_track_pid_chi2_mu_plane1.resize(size);
965  vars.m_reco_track_pid_chi2_mu_plane2.resize(size);
966  vars.m_reco_track_pid_chi2_p_plane0.resize(size);
967  vars.m_reco_track_pid_chi2_p_plane1.resize(size);
968  vars.m_reco_track_pid_chi2_p_plane2.resize(size);
969  vars.m_reco_track_pid_pida_plane0.resize(size);
970  vars.m_reco_track_pid_pida_plane1.resize(size);
971  vars.m_reco_track_pid_pida_plane2.resize(size);
972  vars.m_reco_track_pid_three_plane_proton_pid.resize(size);
973 
974 // vars.m_reco_track_end_to_nearest_dead_wire_plane0.resize(size);
975 // vars.m_reco_track_end_to_nearest_dead_wire_plane1.resize(size);
976 // vars.m_reco_track_end_to_nearest_dead_wire_plane2.resize(size);
977 
978  vars.m_reco_track_sliceId.resize(size);
979  vars.m_reco_track_nuscore.resize(size);
980  vars.m_reco_track_isclearcosmic.resize(size);
981  vars.m_reco_track_trackscore.resize(size);
982  vars.m_reco_track_pfparticle_pdg.resize(size);
983  vars.m_reco_track_is_nuslice.resize(size);
984 
985  vars.m_sim_track_sliceId.resize(size);
986  vars.m_sim_track_nuscore.resize(size);
987  vars.m_sim_track_isclearcosmic.resize(size);
988  }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
void single_photon::Save_EventMeta ( art::Event &  evt,
var_all &  vars 
)

Definition at line 2162 of file init_branches.cxx.

2162  {
2163 
2164  //Some event based properties
2165  vars.m_subrun_counts++;
2166  vars.m_number_of_events++;
2167  vars.m_run_number = evt.run();
2168  vars.m_subrun_number = evt.subRun();
2169  vars.m_event_number = evt.id().event();
2170  }
unsigned int event
Definition: DataStructs.h:634
unsigned int run
Definition: DataStructs.h:635
unsigned int subRun
Definition: DataStructs.h:636
TCEvent evt
Definition: DataStructs.cxx:8
void single_photon::Save_PFParticleInfo ( std::vector< PandoraPFParticle >  PPFPs,
var_all &  vars,
para_all &  paras 
)

Definition at line 2173 of file init_branches.cxx.

2173  {
2174 
2175  int pfp_size = PPFPs.size();
2176 
2177  for(int index = 0; index < pfp_size; index++){
2178 
2179  PandoraPFParticle* temp_p = &PPFPs[index];
2180  if(!(vars.pfp_w_bestnuID == temp_p->get_SliceID() && temp_p->get_IsNeutrino()) ) continue;
2181  vars.m_vertex_pos_x = temp_p->get_Vertex_pos()[0];
2182  vars.m_vertex_pos_y = temp_p->get_Vertex_pos()[1];
2183  vars.m_vertex_pos_z = temp_p->get_Vertex_pos()[2];
2184 // std::cout<<"Best NuScore is found, define the vertice as: ("<<temp_p->get_Vertex_pos()[0]<<","<<temp_p->get_Vertex_pos()[1]<<","<<temp_p->get_Vertex_pos()[2]<<")"<<std::endl;
2185 
2186  std::vector<double> tmp = {vars.m_vertex_pos_x, vars.m_vertex_pos_y, vars.m_vertex_pos_z};
2187  vars.m_reco_vertex_in_SCB = distToSCB(vars.m_reco_vertex_dist_to_SCB,tmp, paras);
2188  vars.m_reco_vertex_dist_to_active_TPC = distToTPCActive(tmp, paras);
2189  vars.m_reco_vertex_dist_to_CPA = distToCPA(tmp, paras);
2190 
2191  if(temp_p->get_IsNeutrino() ){
2192  vars.m_reco_slice_num++;
2193  vars.m_reco_slice_nuscore.push_back(temp_p->get_NuScore());
2194 
2195  }
2196  }
2197 
2198  //resize slice variables size;
2199  // this->ResizeSlices(vars.m_reco_slice_num);
2200  }
int distToSCB(double &dist, std::vector< double > &vec, para_all &paras)
double distToCPA(std::vector< double > &vec, para_all &paras)
double distToTPCActive(std::vector< double > &vec, para_all &paras)
sss_score single_photon::ScoreCluster ( int  p,
int  cl,
std::vector< art::Ptr< recob::Hit >> &  hits,
double  vertex_wire,
double  vertex_tick,
const art::Ptr< recob::Shower > &  shower 
)

Definition at line 54 of file second_shower_search.cxx.

54  {
55  sss_score score(p,cl);
56  score.n_hits = hits.size();
57 
58  std::vector<double> t_wires;
59  std::vector<double> t_ticks;
60 
61  //
62  int n_min_ticks = 4;
63  int n_min_wires = 3;
64  double n_max_pca = 0.9999;
65 
66  score.pass = true;
67 
68  // ************* Some simple metrics relative to study point (usually vertex) ***************
69  // this can be moved to inclass initializer
70  score.max_dist_tick = 0;
71  score.min_dist_tick = 1e10;
72  score.mean_dist_tick = 0;
73 
74  score.max_dist_wire = 0;
75  score.min_dist_wire = 1e10;
76  score.mean_dist_wire = 0;
77 
78  score.max_dist = 0;
79  score.min_dist = 1e10;
80  score.mean_dist = 0;
81 
82  score.mean_tick =0;
83  score.max_tick =0;
84  score.min_tick =1e10;
85 
86  score.mean_wire =0;
87  score.max_wire =0;
88  score.min_wire =1e10;
89 
90  score.n_wires = 0;
91  score.n_ticks = 0;
92 
93  score.impact_parameter = -99;
94 
95  score.close_tick = -99;
96  score.close_wire = -99;
97 
98  std::map<int,bool> wire_count;
99  std::map<int,bool> tick_count;
100 
101  for(auto &h: hits){
102  double h_tick = (double)h->PeakTime();
103  double h_wire = (double)h->WireID().Wire;
104 
105  score.mean_wire += h_wire;
106  score.mean_tick += h_tick;
107 
108  score.max_wire = std::max(score.max_wire, h_wire);
109  score.min_wire = std::min(score.min_wire, h_wire);
110 
111  score.max_tick = std::max(score.max_tick, h_tick);
112  score.min_tick = std::min(score.min_tick, h_tick);
113 
114  score.max_dist_tick = std::max(score.max_dist_tick, fabs(h_tick-vertex_tick));
115  score.min_dist_tick = std::min(score.min_dist_tick, fabs(h_tick-vertex_tick));
116 
117  score.max_dist_wire = std::max(score.max_dist_wire, fabs(h_wire-vertex_wire));
118  score.min_dist_wire = std::min(score.min_dist_wire, fabs(h_wire-vertex_wire));
119 
120  score.mean_dist_tick += fabs(h_tick-vertex_tick);
121  score.mean_dist_wire += fabs(h_wire-vertex_wire);
122 
123  //wierd dits
124  //requires that hit in hits has to be on the same plane as vertex_wire.
125  double dd =sqrt(pow(h_wire*0.3-vertex_wire*0.3,2)+pow(h_tick/25.0- vertex_tick/25.0,2));
126  score.mean_dist += dd;
127  if(dd< score.min_dist){
128  score.close_wire = h_wire;
129  score.close_tick = h_tick;
130  }
131 
132  score.max_dist = std::max(dd,score.max_dist);
133  score.min_dist = std::min(dd,score.min_dist);
134 
135 
136  t_wires.push_back(h_wire);
137  t_ticks.push_back(h_tick);
138 
139  if(wire_count.count((int)h_wire)<1){
140  wire_count[((int)h_wire)] = true;
141  score.n_wires++;
142  }
143  if(tick_count.count((int)h_tick)<1){
144  tick_count[((int)h_tick)] = true;
145  score.n_ticks++;
146  }
147 
148  }
149 
150  // TGraph * g_pts = new TGraph(t_wires.size(),&t_ticks[0],&t_wires[0]);
151 
152  score.mean_tick = score.mean_tick/(double)score.n_hits;
153  score.mean_wire = score.mean_wire/(double)score.n_hits;
154 
155  score.mean_dist = score.mean_dist/(double)score.n_hits;
156 
157  score.mean_dist_tick = score.mean_dist_tick/(double)score.n_hits;
158  score.mean_dist_wire = score.mean_dist_wire/(double)score.n_hits;
159 
160  // **************** Metrics of Pointing: Does this cluster "point" back to the vertex? *************************
161  // **************** First off, PCA
162 
163  TPrincipal* principal = new TPrincipal(2,"D");
164  double mod_wire = 1.0;
165  double mod_tick = 1.0;
166 
167  for(int i = 0; i < score.n_hits; i++){
168  std::vector<double> tmp_pts = {t_wires[i]*mod_wire, t_ticks[i]/mod_tick};
169  principal->AddRow(&tmp_pts[0]);
170  }
171  principal->MakePrincipals();
172  //principal->Print();
173 
174  TVectorD * eigenval = (TVectorD*) principal->GetEigenValues();
175  //TMatrixD * eigenvec = (TMatrixD*) principal->GetEigenVectors();
176  TMatrixD * covar = (TMatrixD*) principal->GetCovarianceMatrix();
177 
178  score.pca_0 = (*eigenval)(0);
179  score.pca_1 = (*eigenval)(1);
180 
181  //(*eigenvec).Print();
182  //(*covar).Print();
183  //std::cout<<"SSS\t||\tEigen: "<<score.pca_0<<" "<<score.pca_1<<std::endl;
184 
185  score.pca_theta = atan((*covar)[0][0]/(*covar)[0][1])*180.0/3.14159;
186 
187 
188  double slope = ((*covar)[0][0]/(*covar)[0][1]);
189  double c = score.mean_tick*mod_wire - slope*score.mean_wire/mod_tick;
190  score.impact_parameter = fabs(slope*vertex_wire*mod_wire +vertex_tick/mod_tick+c)/sqrt(slope*slope+1.0*1.0);
191 
192 
193  if(score.n_wires < n_min_wires || score.n_ticks < n_min_ticks || score.pca_0 >= n_max_pca){
194  score.pass = false;
195  }
196 
197 
198 
199 
200  delete principal;
201 
202  return score;
203  }
pdgs p
Definition: selectors.fcl:22
BEGIN_PROLOG or score(default)}sbnd_crttrackmatchingalg_crID
while getopts h
then echo ***************************************echo Variable FHICL_FILE_PATH not found echo You porbably haven t set up larsoft echo Try setup uboonecode vXX_XX_XX q e10
Definition: find_fhicl.sh:6
std::vector< double > single_photon::SecondShowerMatching ( std::vector< art::Ptr< recob::Hit >> &  hitz,
art::FindManyP< simb::MCParticle, anab::BackTrackerHitMatchingData > &  mcparticles_per_hit,
std::vector< art::Ptr< simb::MCParticle >> &  mcParticleVector,
std::map< int, art::Ptr< simb::MCParticle >> &  MCParticleToTrackIdMap,
var_all &  vars 
)

Definition at line 251 of file second_shower_search.cxx.

257  {
258 
259 
260  std::vector<double> ans; //matched,pdg,parentpdg,trkid
261 
262 
263  std::vector<double> vec_fraction_matched;
264  std::map<std::string,bool> map_is_shower_process = {{"compt",true},{"FastScintillation",true},{"eBrem",true},{"phot",true},{"eIoni",true},{"conv",true},{"annihil",true}};
265  bool reco_verbose = false;
266 
267  std::unordered_map<int,double> objide; //map between the MCParticle track ID and the backtracker energy
268 
269  //energy for an MCParticle that comprises the most energy when sum over associated hits in PFP
270  //total energy of the reco PFP taken from the sum of the hits associated to an MCParticle
271  double maxe=-1, tote=0;
272 
273  std::vector<double> total_energy_on_plane = {0.0,0.0,0.0};
274  art::Ptr<simb::MCParticle> best_matched_mcparticle; //pointer for the MCParticle match we will calculate
275  std::vector<art::Ptr<simb::MCParticle>> particle_vec; //vector of all MCParticles associated with a given hit in the cluster
276  std::vector<anab::BackTrackerHitMatchingData const *> match_vec; //vector of some backtracker thing
277 
278  int n_associated_mcparticle_hits = 0;
279  int n_not_associated_hits = 0;
280 
281  //this is the vector that will store the associated MC paritcles, as well as a MAP to the amount of energy associated
282  std::vector<art::Ptr<simb::MCParticle>> asso_mcparticles_vec;
283  std::map<art::Ptr<simb::MCParticle>, std::vector<double>> map_asso_mcparticles_energy;
284  bool found_a_match = false;
285 
286  //loop only over hits associated to this reco PFP
287  for(size_t i_h=0; i_h < hitz.size(); ++i_h){
288  int which_plane = (int)hitz[i_h]->View();
289  particle_vec.clear(); match_vec.clear(); //only store per hit
290  //for the hit, fill the backtracker info
291  mcparticles_per_hit.get(hitz[i_h].key(), particle_vec, match_vec);
292 
293  //if there is an MCParticle associated to this hit
294  if(particle_vec.size()>0) n_associated_mcparticle_hits++;
295  if(particle_vec.size()==0) n_not_associated_hits++;
296 
297  //for each MCParticle associated with this hit
298  for(size_t i_p=0; i_p<particle_vec.size(); ++i_p){
299  //add the energy of the back tracked hit for this MCParticle to the track id for the MCParticle in the map
300  objide[ particle_vec[i_p]->TrackId()] += match_vec[i_p]->energy; //store energy per track id
301 
302  //if the id isn't already in the map, store it in the vector of all associated MCParticles
303  if(std::find(asso_mcparticles_vec.begin(), asso_mcparticles_vec.end(), particle_vec[i_p]) == asso_mcparticles_vec.end()){
304  asso_mcparticles_vec.push_back(particle_vec[i_p]);
305  map_asso_mcparticles_energy[particle_vec[i_p]] = {0.0,0.0,0.0};
306  map_asso_mcparticles_energy[particle_vec[i_p]][which_plane] = match_vec[i_p]->energy;
307  }else{
308  map_asso_mcparticles_energy[particle_vec[i_p]][which_plane] += match_vec[i_p]->energy;
309  }
310  //add the energy of the back tracked hit to the total energy for the PFP
311  tote += match_vec[i_p]->energy; //calculate total energy deposited
312  total_energy_on_plane[which_plane]+=match_vec[i_p]->energy;
313 
314  //want the MCParticle with the max total energy summed from the back tracker hit energy from hits in PFP
315  //TODO: this part will change once the parts below are fully implemented
316  if( objide[ particle_vec[i_p]->TrackId()] > maxe ){ //keep track of maximum
317  maxe = objide[ particle_vec[i_p]->TrackId() ];
318  best_matched_mcparticle = particle_vec[i_p]; //we will now define the best match as a source MCP rather than the max single energy contributor
319  found_a_match = true;//will be false for showers from overlay
320  }
321  }//end loop over particles per hit
322 
323  } // end loop over hit
324  if(found_a_match){
325  std::cout<<"Found a match!"<<std::endl;
326  }
327  double fraction_num_hits_overlay = (double)n_not_associated_hits/(double)hitz.size();
328 
329  // if(reco_verbose)std::cout << "recoMC()\t||\t On Object "<<i<<". The number of MCParticles associated with this PFP is "<<objide.size()<<std::endl;
330  // if(reco_verbose) std::cout<<"recoMC()\t||\t the fraction of hits from overlay is is "<<fraction_num_hits_overlay<<" ("<<n_not_associated_hits<<"/"<<obj_hits_ptrs.size()<<")"<<std::endl;
331 
332 
333  if(n_associated_mcparticle_hits == 0){
334  //This will only occur if the whole recob::PFParticle is PURELY associated with an overlay object
335  found_a_match =false;
336  //Here we will fill every sivars.m_shower_XXX variable with -999 or something like that
337  return {0,0,0,0,0,0,0};
338  }//
339 
340  /*
341  *
342  * Loop over each MCParticle associated to the reco shower to find the source particle
343  *
344  */
345 
346  std::map<int, art::Ptr<simb::MCParticle>> mother_MCP_map; //map between MCP track id and the source MCP
347 
348  std::vector<art::Ptr<simb::MCParticle>> marks_mother_vector;
349  std::map<art::Ptr<simb::MCParticle>, std::vector<double>> marks_mother_energy_fraction_map;
350 
351  int this_mcp_id = -1; //the track id for the current MCP in parent tree
352  int last_mcp_id = -1; //the track id for the previous MCP in parent tree
353  int i_mcp = 0;
354 
355  int num_bt_mothers =0;
356 
357  //reco_verbose = false;
358  //for each MCP that's associated to the reco shower
359  for(auto mcp:asso_mcparticles_vec){
360 
361  if(reco_verbose) std::cout<<"-----------------------------Start L1 Loop --------------------------------------------------"<<std::endl;
362  // if(reco_verbose) std::cout<<"L1: ("<<i<<" <-> "<<i_mcp<<") Start by Looking at an MCP with pdg code "<<mcp->PdgCode()<<" and status code "<<mcp->StatusCode()<<" TrackID: "<<mcp->TrackId()<<std::endl;
363  // if(reco_verbose) std::cout<<"L1: ("<<i<<" <-> "<<i_mcp<<") This MCP gave "<< map_asso_mcparticles_energy[mcp][0] <<" | "<<map_asso_mcparticles_energy[mcp][1]<<" | "<<map_asso_mcparticles_energy[mcp][2]<<" energy to the recob::Object on each plane"<<std::endl;
364  // std::cout<<"L1: the mother of this MCP is track id "<<mcp->Mother()<<" and there are "<<mcp->NumberDaughters()<<" daughters"<<std::endl;
365 
366  //get the track ID for the current MCP
367  this_mcp_id = mcp->TrackId();
368  last_mcp_id = this_mcp_id;//initialize the previous one
369 
370  //while the track id is valid, move up the parent tree for the MCP that contributes to the reco shower
371  //currently it keeps going until it hits the top of the interaction chain, but this is likely too far
372  //to do a proper match you need to check for different cases and stop once one is fulfilled
373  while(this_mcp_id >= 0 ){
374  art::Ptr<simb::MCParticle> this_mcp = MCParticleToTrackIdMap[this_mcp_id];//get the MCP associated to the track ID
375  // std::cout<<"going up the tree got mother particle"<<std::endl;
376 
377  //check if it's a valid MCP
378  if (this_mcp.isNull()){
379  // if(reco_verbose) std::cout<<"L1: ("<<i<<" <-> "<<i_mcp<<") null pointer at id "<<this_mcp_id<<std::endl;
380  this_mcp_id = last_mcp_id; //if invalid, move back a level to the previous MCP in parent tree and break the loop
381  break;
382  }
383 
384  //If primary particle will have process "primary"
385  // if(reco_verbose) std::cout<<"L1: ("<<i<<" <-> "<<i_mcp<<") going up the tree at an MCP with track id "<<this_mcp_id<<", pdg code "<<this_mcp->PdgCode()<<", and status code "<<this_mcp->StatusCode()<<" and Mother: "<<this_mcp->Mother()<<" Process: "<<this_mcp->Process()<<" EndProcess: "<<this_mcp->EndProcess()<<std::endl;
386 
387  //if it is a valid particle, iterate forward to the mother
388  last_mcp_id = this_mcp_id;
389  this_mcp_id = this_mcp->Mother();
390 
391  //Check to see if this MCP was created in a "showery" process
392  if(map_is_shower_process.count(this_mcp->Process()) > 0){
393  //if it was, keep going,
394 
395  }else if(this_mcp->Process()=="primary"){
396  //if its primary, great! Note it.
397  if(reco_verbose) std::cout<<"L1: Backtracked to primary! breaking"<<std::endl;
398  this_mcp_id = last_mcp_id; //if invalid, move back a level to the previous MCP in parent tree and break the loop
399  break;
400  }else{
401  if(reco_verbose) std::cout<<"L1: Backtracked to a particle created in "<<this_mcp->EndProcess()<<"! breaking"<<std::endl;
402  this_mcp_id = last_mcp_id; //if invalid, move back a level to the previous MCP in parent tree and break the loop
403  break;
404  }
405  }
406 
407  //if the MCP at the top of the interaction chain has a valid track id store this in the mother map
408  if (this_mcp_id >= 0){
409 
410  mother_MCP_map[this_mcp_id] = MCParticleToTrackIdMap[this_mcp_id];//putting it in a map allows for multiple contributing MCP's in the reco shower to have the same mother MCP
411 
412  bool is_old = false;
413 
414  for(size_t k=0; k< marks_mother_vector.size(); k++){
415  //if its in it before, just run with it
416  if(marks_mother_vector[k]==MCParticleToTrackIdMap[this_mcp_id]){
417  marks_mother_energy_fraction_map[marks_mother_vector[k]][0] += map_asso_mcparticles_energy[mcp][0];
418  marks_mother_energy_fraction_map[marks_mother_vector[k]][1] += map_asso_mcparticles_energy[mcp][1];
419  marks_mother_energy_fraction_map[marks_mother_vector[k]][2] += map_asso_mcparticles_energy[mcp][2];
420  is_old = true;
421  break;
422  }
423  }
424  if(is_old==false){
425  marks_mother_vector.push_back(MCParticleToTrackIdMap[this_mcp_id]);
426  marks_mother_energy_fraction_map[marks_mother_vector.back()] = {0.0,0.0,0.0};
427  marks_mother_energy_fraction_map[marks_mother_vector.back()][0] = map_asso_mcparticles_energy[mcp][0];
428  marks_mother_energy_fraction_map[marks_mother_vector.back()][1] = map_asso_mcparticles_energy[mcp][1];
429  marks_mother_energy_fraction_map[marks_mother_vector.back()][2] = map_asso_mcparticles_energy[mcp][2];
430  }
431 
432 
433  num_bt_mothers++;
434  } else{
435  if(reco_verbose) std::cout<<"L1: error, the mother mother id was "<<this_mcp_id <<std::endl;
436 
437  }
438 
439  if(reco_verbose) std::cout<<"-----------------------------End L1 Loop --------------------------------------------------"<<std::endl;
440  i_mcp++;
441  }//for each MCParticle that's associated to a the recob::Shower
442 
443  //reco_verbose = true;
444  //there should be at least 1 mother MCP
445  if(reco_verbose) std::cout<<"recoMC()\t||\t the number of source mother particles is "<<mother_MCP_map.size()<<" of which : "<<marks_mother_vector.size()<<" are unique!"<<std::endl;
446 
447  if(reco_verbose) std::cout<<"---------------------------- L2-------------------------------"<<std::endl;
448 
449  double best_mother_index = 0;
450  double best_mother_energy = -9999;
451  int best_mother_plane = -99;
452 
453  for(size_t p=0; p< marks_mother_vector.size(); p++){
454  art::Ptr<simb::MCParticle> mother = marks_mother_vector[p];
455  std::vector<double> mother_energy_recod = marks_mother_energy_fraction_map[mother];
456  if(reco_verbose) std::cout<<"L2: Mother candidate "<<p<<" TrackID "<<mother->TrackId()<<" Process: "<<mother->Process()<<" EndProcess: "<<mother->EndProcess()<<std::endl;
457  if(reco_verbose) std::cout<<"L2: Mother candidate "<<p<<" Energy "<<mother->E()<<" Reco'd Energy: "<<mother_energy_recod[0]<<" | "<<mother_energy_recod[1]<<" | "<<mother_energy_recod[2]<<" Fraction: ("<<mother_energy_recod[0]/(1000*mother->E())*100.0<<"% , "<<mother_energy_recod[1]/(1000*mother->E())*100.0<<"% , "<<mother_energy_recod[2]/(1000*mother->E())*100.0<<"% )"<<std::endl;
458 
459  if( mother_energy_recod[0] > best_mother_energy){
460  best_mother_index = p;
461  best_mother_energy = mother_energy_recod[0];
462  best_mother_plane = 0;
463  }
464 
465  if( mother_energy_recod[1] > best_mother_energy){
466  best_mother_index = p;
467  best_mother_energy = mother_energy_recod[1];
468  best_mother_plane = 1;
469  }
470 
471  if( mother_energy_recod[2] > best_mother_energy){
472  best_mother_index = p;
473  best_mother_energy = mother_energy_recod[2];
474  best_mother_plane = 2;
475  }
476 
477  }
478 
479  if(marks_mother_vector.size()!=0){
480  //if(reco_verbose) std::cout<<"recoMC()\t||\t The `BEST` mother is a "<<marks_mother_vector[best_mother_index]->PdgCode()<<" at "<<best_mother_index<<" on plane: "<<best_mother_plane<<std::endl;
481  std::cout<<"recoMC()\t||\t The `BEST` mother is a "<<marks_mother_vector[best_mother_index]->PdgCode()<<" at "<<best_mother_index<<" on plane: "<<best_mother_plane<<std::endl;
482  for(int l=0; l<3; l++){
483  std::cout<<"recoMC()\t||\t It represents "<<marks_mother_energy_fraction_map[marks_mother_vector[best_mother_index]][l]/total_energy_on_plane[l]*100.0<<"% of the energy on plane: "<<l<<" which is "<<total_energy_on_plane[l] <<std::endl;
484  }
485  }
486 
487 
488  if(reco_verbose) std::cout<<"---------------------------- L2-------------------------------"<<std::endl;
489  const art::Ptr<simb::MCParticle> match = marks_mother_vector[best_mother_index];
490 
491  std::vector<double> corrected_vertex(3), corrected_start(3);
492  spacecharge_correction(match, corrected_vertex);
493 
494 
495  art::Ptr<simb::MCParticle> match_mother = MCParticleToTrackIdMap[match->Mother()];
496  int par_pdg = -1;
497  if (match_mother.isNull()){
498  par_pdg = -1;
499 
500  }else{
501  par_pdg = match_mother->PdgCode();
502  }
503 
504  ans = {1,(double)match->PdgCode(), (double)par_pdg, (double)match->TrackId(), match->E(), fraction_num_hits_overlay, best_mother_energy/total_energy_on_plane.at(best_mother_plane)};
505 
506  return ans;
507  }//end sss matching;
pdgs p
Definition: selectors.fcl:22
int spacecharge_correction(const art::Ptr< simb::MCParticle > &mcparticle, std::vector< double > &corrected, std::vector< double > &input)
Definition: Processors.cxx:25
pdgs k
Definition: selectors.fcl:22
BEGIN_PROLOG could also be cout
void single_photon::SecondShowerSearch3D ( std::vector< art::Ptr< recob::Shower >> &  showers,
std::map< art::Ptr< recob::Shower >, art::Ptr< recob::PFParticle >> &  NormalShowerToPFParticleMap,
std::vector< art::Ptr< recob::Track >> &  tracks,
std::map< art::Ptr< recob::Track >, art::Ptr< recob::PFParticle >> &  NormalTrackToPFParticleMap,
art::Event const &  evt,
var_all &  vars,
para_all &  paras 
)

Definition at line 522 of file second_shower_search.cxx.

531  {
532 
533  std::string sss3dlabel = "pandoraShower";//"pandoraAllOutcomesShower" WARNING, should check this!
534 
535  art::ValidHandle<std::vector<recob::Shower>> const & allShowerHandle = evt.getValidHandle<std::vector<recob::Shower>>(sss3dlabel);
536  std::vector<art::Ptr<recob::Shower>> allShowerVector;
537  art::fill_ptr_vector(allShowerVector,allShowerHandle);
538  std::cout<<"We have "<<showers.size()<<" showers in primary slice and "<<allShowerVector.size()<<" in full event."<<std::endl;
539 
540  art::FindManyP<recob::Hit> hits_per_shower(allShowerHandle, evt, sss3dlabel);
541  std::map<art::Ptr<recob::Shower>, std::vector<art::Ptr<recob::Hit>> > showerToHitsMap;
542  for(size_t i=0; i< allShowerVector.size(); ++i){
543  showerToHitsMap[allShowerVector[i]] = hits_per_shower.at(allShowerVector[i].key());
544  }
545 
546  art::FindOneP<recob::PFParticle> pfparticle_per_shower(allShowerHandle, evt, sss3dlabel);
547  std::map<art::Ptr<recob::Shower>, art::Ptr<recob::PFParticle> > showerToPFParticleMap;
548  for(size_t i=0; i< allShowerVector.size(); ++i){
549  showerToPFParticleMap[allShowerVector[i]] = pfparticle_per_shower.at(allShowerVector[i].key());
550  }
551 
552  art::ValidHandle<std::vector<recob::PFParticle>> const & pfParticleHandle = evt.getValidHandle<std::vector<recob::PFParticle>>("pandora");//""pandoraPatRec:allOutcomes");
553  std::vector<art::Ptr<recob::PFParticle>> allPFParticleVector;
554  art::fill_ptr_vector(allPFParticleVector,pfParticleHandle);
555 
556  //art::FindManyP< larpandoraobj::PFParticleMetadata > pfPartToMetadataAssoc(pfParticleHandle, evt, "pandora");//PatRec:allOutcomes");
557  //pfPartToMetadataAssoc.at(pfp.key());
558 
559  size_t n_all_shr = allShowerVector.size();
560  vars.m_sss3d_num_showers = (int)n_all_shr-showers.size();
561 
562  if(showers.size()==0) return;
563 
564  auto primary_shower = showers.front();
565 
566  std::cout<<"PandoraAllOutcomesShower has "<<n_all_shr<<" Showers in total. "<<std::endl;
567  for(auto &shr: allShowerVector){
568  //lets look at 3D distance to "vertex", and only go further with things that are within 80cm [default]
569  double dist = sqrt(pow(vars.m_vertex_pos_x - shr->ShowerStart().X(),2)+pow(vars.m_vertex_pos_y - shr->ShowerStart().Y(),2)+pow(vars.m_vertex_pos_z - shr->ShowerStart().Z(),2) );
570  if(dist>paras.s_max_conv_dist) continue;
571 
572  auto pfp = showerToPFParticleMap[shr];
573  //for(auto &prr: allPFParticleVector){
574  // std::cout<<pfp->Self()<<" "<<pfp.key()<<" "<<prr->Self()<<" "<<prr.key()<<std::endl;
575  //}
576 
577  //What are we intested in learning
578  std::vector<std::string> interested = {"IsClearCosmic","TrackScore","NuScore","IsNeutrino","SliceIndex"};
579 
580  /*
581  std::vector<art::Ptr<larpandoraobj::PFParticleMetadata>> metadatas = pfPartToMetadataAssoc.at(pfp.key());
582  for(auto &meta: metadatas){
583  std::map<std::string, float> propertiesmap = meta->GetPropertiesMap();
584 
585  for (auto it:propertiesmap ){
586  std::cout<<it.first<<" "<<it.second<<" ";
587  }
588  std::cout<<std::endl;
589 
590  //for each of the things in the list
591  for(auto &s: interested){
592  if(propertiesmap.count(s)==1){
593  std::cout<<" "<<s<<" : "<<propertiesmap[s]<<" ";
594  }else{
595  std::cout<<" NO "<<s<<" . ";
596  }
597  }
598  }
599  */
600 
601  //std::cout<<shr.key()<<" Length "<<shr->Length()<<" Dist "<<dist<<" Impact: "<<impact_paramater_shr(vars.m_vertex_pos_x, vars.m_vertex_pos_y, vars.m_vertex_pos_z, shr)<<" pfp key: "<<showerToPFParticleMap[shr].key()<<" Self "<<showerToPFParticleMap[shr]->Self()<<std::endl;
602 
603  //OK we need to "remove" the showers that are neutrino showers as well as those that are the "track"
604 
605  bool is_matched = false;
606 
607  for(auto &s: showers){
608  //const art::Ptr<recob::Slice> s_slice = slice_per_pfparticle.at(NormalShowerToPFParticleMap[s].key());
609  //std::cout<<s.key()<<"shr is in slice "<<s_slice->ID()<<std::endl;
610  if(s->ShowerStart().X() == shr->ShowerStart().X() || pfp->Self()== NormalShowerToPFParticleMap[s]->Self()){
611  //std::cout<<"Its a match!"<<std::endl;
612  is_matched = true;
613  }
614  }
615 
616  for(auto &s: tracks){
617  //const art::Ptr<recob::Slice> s_slice = slice_per_pfparticle.at(NormalTrackToPFParticleMap[s].key());
618  //std::cout<<s.key()<<"trk is in slice "<<s_slice->ID()<<std::endl;
619  if(pfp->Self()== NormalTrackToPFParticleMap[s]->Self()){
620  //std::cout<<"Its a match!"<<std::endl;
621  is_matched = true;
622  }
623  }
624 
625  if(is_matched)
626  {
627  // std::cout<<"matched and continuing"<<std::endl;
628  continue;
629  }
630 
631  double senergy = std::max( CalcEShowerPlane(showerToHitsMap[shr], 0, paras), std::max( CalcEShowerPlane(showerToHitsMap[shr], 1, paras), CalcEShowerPlane(showerToHitsMap[shr], 2, paras)) );
632  double invar = implied_invar_mass(vars.m_vertex_pos_x, vars.m_vertex_pos_y, vars.m_vertex_pos_z, primary_shower, vars.m_reco_shower_energy_max[0], shr, senergy);
633  double implied_invar = invar_mass(primary_shower, vars.m_reco_shower_energy_max[0], shr, senergy) ;
634  double shr_score = 0.0; //need pfp and metadata to get score, and might give slice! (This will be harder..) but on reflection, kinda important. PCA spread might be a good rplacement.
635  int is_clear_cosmic_slice = 0 ;
636  int is_nu_slice = 0;
637 
638 
639  vars.m_sss3d_shower_start_x.push_back(shr->ShowerStart().X());
640  vars.m_sss3d_shower_start_y.push_back(shr->ShowerStart().Y());
641  vars.m_sss3d_shower_start_z.push_back(shr->ShowerStart().Z());
642  vars.m_sss3d_shower_dir_x.push_back(shr->Direction().X());
643  vars.m_sss3d_shower_dir_y.push_back(shr->Direction().Y());
644  vars.m_sss3d_shower_dir_z.push_back(shr->Direction().Z());
645  vars.m_sss3d_shower_length.push_back(shr->Length());
646  vars.m_sss3d_shower_conversion_dist.push_back(dist);
647  vars.m_sss3d_shower_invariant_mass.push_back(invar);
648  vars.m_sss3d_shower_implied_invariant_mass.push_back(implied_invar);
649  double imp = impact_paramater_shr(vars.m_vertex_pos_x, vars.m_vertex_pos_y, vars.m_vertex_pos_z, shr);
650  vars.m_sss3d_shower_impact_parameter.push_back(imp);
651 
652  if(dist!=0) {
653  vars.m_sss3d_shower_ioc_ratio.push_back(imp/dist);
654  }else{
655  vars.m_sss3d_shower_ioc_ratio.push_back(0);
656 
657  }
658  vars.m_sss3d_shower_energy_max.push_back(senergy);
659  vars.m_sss3d_shower_score.push_back(shr_score);
660  vars.m_sss3d_slice_clear_cosmic.push_back(is_clear_cosmic_slice);
661  vars.m_sss3d_slice_nu.push_back(is_nu_slice);
662  }
663 
664  return;
665  }
double invar_mass(art::Ptr< recob::Shower > &s1, double E1, art::Ptr< recob::Shower > &s2, double E2)
Definition: helper_math.cxx:74
double implied_invar_mass(double vx, double vy, double vz, art::Ptr< recob::Shower > &s1, double E1, art::Ptr< recob::Shower > &s2, double E2)
Definition: helper_math.cxx:50
double CalcEShowerPlane(const std::vector< art::Ptr< recob::Hit >> &hits, int this_plane, para_all &paras)
Definition: Processors.cxx:293
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
double impact_paramater_shr(double x, double y, double z, art::Ptr< recob::Shower > &shr)
Definition: helper_math.cxx:39
TCEvent evt
Definition: DataStructs.cxx:8
BEGIN_PROLOG could also be cout
void single_photon::setTPCGeom ( para_all &  paras)

Definition at line 9 of file fiducial_volume.cxx.

9  {
10 
11  //copy these from CAFMaker/CAFMaker_module.c
12  const geo::GeometryCore *geometry = lar::providerFrom<geo::Geometry>();
13  for (auto const &cryo: geometry->IterateCryostats()) {
14  geo::GeometryCore::TPC_iterator iTPC = geometry->begin_TPC(cryo.ID()),
15  tend = geometry->end_TPC(cryo.ID());
16 
17  std::vector<geo::BoxBoundedGeo> this_tpc_volumes;
18  while (iTPC != tend) {
19  geo::TPCGeo const& TPC = *iTPC;
20  this_tpc_volumes.push_back(TPC.ActiveBoundingBox());
21  iTPC++;
22  }
23  paras.fTPCVolumes.push_back(std::move(this_tpc_volumes));
24  }
25 
26  // then combine them into active volumes
27  for (const std::vector<geo::BoxBoundedGeo> &tpcs: paras.fTPCVolumes) {
28  paras.s_tpc_active_XMin = std::min_element(tpcs.begin(), tpcs.end(), [](auto &lhs, auto &rhs) { return lhs.MinX() < rhs.MinX(); })->MinX();
29  paras.s_tpc_active_YMin = std::min_element(tpcs.begin(), tpcs.end(), [](auto &lhs, auto &rhs) { return lhs.MinY() < rhs.MinY(); })->MinY();
30  paras.s_tpc_active_ZMin = std::min_element(tpcs.begin(), tpcs.end(), [](auto &lhs, auto &rhs) { return lhs.MinZ() < rhs.MinZ(); })->MinZ();
31 
32  paras.s_tpc_active_XMax = std::max_element(tpcs.begin(), tpcs.end(), [](auto &lhs, auto &rhs) { return lhs.MaxX() < rhs.MaxX(); })->MaxX();
33  paras.s_tpc_active_YMax = std::max_element(tpcs.begin(), tpcs.end(), [](auto &lhs, auto &rhs) { return lhs.MaxY() < rhs.MaxY(); })->MaxY();
34  paras.s_tpc_active_ZMax = std::max_element(tpcs.begin(), tpcs.end(), [](auto &lhs, auto &rhs) { return lhs.MaxZ() < rhs.MaxZ(); })->MaxZ();
35  if(g_is_verbose){
36  std::cout<<""<<__FUNCTION__<<" || Active TPC info: X:("<<paras.s_tpc_active_XMin<<","<<paras.s_tpc_active_XMax<<")";
37  std::cout<<" Y:("<<paras.s_tpc_active_YMin<<","<<paras.s_tpc_active_YMax<<")";
38  std::cout<<" Z:("<<paras.s_tpc_active_ZMin<<","<<paras.s_tpc_active_ZMax<<")"<<std::endl;
39  }
40  }
41 
42 }
const geo::GeometryCore * geometry
Geometry information for a single TPC.
Definition: TPCGeo.h:38
geo::BoxBoundedGeo const & ActiveBoundingBox() const
Returns the box of the active volume of this TPC.
Definition: TPCGeo.h:320
BEGIN_PROLOG TPC
TPC_iterator begin_TPC() const
Returns an iterator pointing to the first TPC in the detector.
Description of geometry of one entire detector.
IteratorBox< cryostat_iterator,&GeometryCore::begin_cryostat,&GeometryCore::end_cryostat > IterateCryostats() const
Enables ranged-for loops on all cryostats of the detector.
Forward iterator browsing all geometry elements in the detector.
Definition: GeometryCore.h:727
BEGIN_PROLOG could also be cout
TPC_iterator end_TPC() const
Returns an iterator pointing after the last TPC in the detector.
void single_photon::showerRecoMCmatching ( std::vector< PandoraPFParticle >  all_PPFPs,
std::vector< art::Ptr< recob::Shower >> &  showerVector,
std::map< art::Ptr< recob::Shower >, art::Ptr< simb::MCParticle >> &  showerToMCParticleMap,
art::FindManyP< simb::MCParticle, anab::BackTrackerHitMatchingData > &  mcparticles_per_hit,
std::vector< art::Ptr< simb::MCParticle >> &  mcParticleVector,
std::map< int, art::Ptr< simb::MCParticle > > &  MCParticleToTrackIdMap,
var_all &  vars 
)

Loop over hits associated with the reco PFP to find MCParticles which contribute energy to the reco shower

Definition at line 94 of file reco_truth_matching.cxx.

101  {
102 
103  std::vector<double> vec_fraction_matched;
104  //processes that are "showery"
105  std::map<std::string,bool> map_is_shower_process = {{"compt",true},
106  {"FastScintillation",true},
107  {"eBrem",true},
108  {"phot",true},
109  {"eIoni",true},
110  {"conv",true},
111  {"annihil",true}};
112 
113  std::vector<int> spacers = Printer_header({"pfpID", " matched_#simb", " pdg"," E_plane0"," E_plane1"," E_plane2"," cosmic?"});
114  //for each recob::track/shower in the event
115  for(size_t i=0; i<showerVector.size();++i){
116  auto shower = showerVector[i];
117 
118  //get the associated reco PFP
119  // if(g_is_verbose)std::cout<<"We have "<<showerToPFParticleMap.count(shower)<<" matches in map"<<std::endl;
120 
121  PandoraPFParticle* ppfp = PPFP_GetPPFPFromShower(all_PPFPs, shower);
122  const art::Ptr<recob::PFParticle> pfp = ppfp->pPFParticle;
123 
124  //putting in the PFP pdg code as a check
125 
126  //and get the hits associated to the reco PFP
127  std::vector< art::Ptr<recob::Hit> > obj_hits_ptrs = ppfp->pPFPHits; //pfParticleToHitsMap[pfp];
128 
129  /**
130  *
131  * Loop over hits associated with the reco PFP to find MCParticles which contribute energy to the reco shower
132  *
133  **/
134 
135  std::unordered_map<int,double> objide; //map between the MCParticle track ID and the backtracker energy
136 
137  //energy for an MCParticle that comprises the most energy when sum over associated hits in PFP
138  //total energy of the reco PFP taken from the sum of the hits associated to an MCParticle
139  double maxe=-1, tote=0;
140 
141  std::vector<double> total_energy_on_plane = {0.0,0.0,0.0};
142  //simb::MCParticle const * best_matched_mcparticle = NULL; //pointer for the particle match we will calculate
143  art::Ptr<simb::MCParticle> best_matched_mcparticle; //pointer for the MCParticle match we will calculate
144 
145  // std::vector<simb::MCParticle const *> particle_vec;
146  // std::vector<anab::BackTrackerHitMatchingData const *> match_vec;
147 
148  std::vector<art::Ptr<simb::MCParticle>> particle_vec; //vector of all MCParticles associated with a given hit in the reco PFP
149  std::vector<anab::BackTrackerHitMatchingData const *> match_vec; //vector of some backtracker thing
150 
151  int n_associated_mcparticle_hits = 0;
152  int n_not_associated_hits = 0;
153 
154  //this is the vector that will store the associated MC paritcles, as well as a MAP to the amount of energy associated
155  std::vector<art::Ptr<simb::MCParticle>> asso_mcparticles_vec;
156  std::map<art::Ptr<simb::MCParticle>, std::vector<double>> map_asso_mcparticles_energy;
157 
158  bool found_a_match = false;
159 
160  //std::cout<<"RecoMC()\t||\t On shower: "<<i<<" with pfp "<< pfp->Self() <<"and slice id "<<PFPToSliceIdMap[pfp]<<". This shower has "<<obj_hits_ptrs.size()<<" hits associated with it"<<std::endl;
161 
162  //loop only over hits associated to this reco PFP
163  for(size_t i_h=0; i_h < obj_hits_ptrs.size(); ++i_h){
164 
165  int which_plane = (int)obj_hits_ptrs[i_h]->View();
166 
167  particle_vec.clear(); match_vec.clear(); //only store per hit
168 
169  //for the hit, fill the backtracker info
170  mcparticles_per_hit.get(obj_hits_ptrs[i_h].key(), particle_vec, match_vec);
171  // std::cout<<"for hit "<< i_h <<" particle_vec.size() = "<< particle_vec.size()<< " and match_vec.size() = "<< match_vec.size()<<std::endl;
172 
173 
174  //mcparticles_per_hit.get(obj_hits_ptrs[i_h].key(),particle_vec,match_vec);
175  //the .key() gives us the index in the original collection
176  //std::cout<<"REC: hit "<<i_h<<" has "<<particle_vec.size()<<" MCparticles assocaied: "<<std::endl;
177 
178  //if there is an MCParticle associated to this hit
179  if(particle_vec.size()>0) n_associated_mcparticle_hits++;
180 
181  if(particle_vec.size()==0) n_not_associated_hits++;
182 
183 
184 
185  //for each MCParticle associated with this hit
186  for(size_t i_p=0; i_p<particle_vec.size(); ++i_p){
187  //add the energy of the back tracked hit for this MCParticle to the track id for the MCParticle in the map
188  objide[ particle_vec[i_p]->TrackId()] += match_vec[i_p]->energy; //store energy per track id
189 
190  //if the id isn't already in the map, store it in the vector of all associated MCParticles
191  if(std::find(asso_mcparticles_vec.begin(), asso_mcparticles_vec.end(), particle_vec[i_p]) == asso_mcparticles_vec.end()){
192  asso_mcparticles_vec.push_back(particle_vec[i_p]);
193  map_asso_mcparticles_energy[particle_vec[i_p]] = {0.0,0.0,0.0};
194  map_asso_mcparticles_energy[particle_vec[i_p]][which_plane] = match_vec[i_p]->energy;
195  }else{
196  map_asso_mcparticles_energy[particle_vec[i_p]][which_plane] += match_vec[i_p]->energy;
197  }
198 
199  //add the energy of the back tracked hit to the total energy for the PFP
200  tote += match_vec[i_p]->energy; //calculate total energy deposited
201  total_energy_on_plane[which_plane]+=match_vec[i_p]->energy;
202 
203 
204  //want the MCParticle with the max total energy summed from the back tracker hit energy from hits in PFP
205  //TODO: this part will change once the parts below are fully implemented
206  if( objide[ particle_vec[i_p]->TrackId()] > maxe ){ //keep track of maximum
207  maxe = objide[ particle_vec[i_p]->TrackId() ];
208  best_matched_mcparticle = particle_vec[i_p]; //we will now define the best match as a source MCP rather than the max single energy contributor
209  found_a_match = true;//will be false for showers from overlay
210  }
211  }//end loop over particles per hit
212 
213 
214  } // end loop over hits
215 
216  double fraction_num_hits_overlay = (double)n_not_associated_hits/(double)obj_hits_ptrs.size();
217 
218  if(g_is_verbose)std::cout << "recoMC()\t||\t On Object "<<i<<". The number of MCParticles associated with this PFP is "<<objide.size()<<std::endl;
219  if(g_is_verbose) std::cout<<"recoMC()\t||\t the fraction of hits from overlay is is "<<fraction_num_hits_overlay<<" ("<<n_not_associated_hits<<"/"<<obj_hits_ptrs.size()<<")"<<std::endl;
220 
221 
222  if(n_associated_mcparticle_hits == 0){
223  //This will only occur if the whole recob::PFParticle is PURELY associated with an overlay shower
224  found_a_match =false;
225  if(!found_a_match){
226  }
227  //Here we will fill every sivars.m_shower_XXX variable with -999 or something like that
228 
229  vars.m_sim_shower_matched[i] = 0;
230  vars.m_sim_shower_energy[i] = -999;
231  vars.m_sim_shower_mass[i] = -999;
232  vars.m_sim_shower_kinetic_energy[i] = -999;
233  vars.m_sim_shower_pdg[i] = -999;
234  vars.m_sim_shower_trackID[i] = -999;
235  vars.m_sim_shower_process[i] = "overlay";
236  vars.m_sim_shower_end_process[i] = "overlay";
237  vars.m_sim_shower_parent_pdg[i] = -999;
238  vars.m_sim_shower_parent_trackID[i] = -999;
239  vars.m_sim_shower_vertex_x[i] = -9999;
240  vars.m_sim_shower_vertex_y[i] = -9999;
241  vars.m_sim_shower_vertex_z[i] = -9999;
242 
243  vars.m_sim_shower_start_x[i] = -9999;
244  vars.m_sim_shower_start_y[i] = -9999;
245  vars.m_sim_shower_start_z[i] = -9999;
246  vars.m_sim_shower_px[i] = -9999;
247  vars.m_sim_shower_py[i] = -9999;
248  vars.m_sim_shower_pz[i] = -9999;
249 
250  vars.m_sim_shower_is_true_shower[i] = -999;
251  vars.m_sim_shower_best_matched_plane[i] = -999;
252  vars.m_sim_shower_matched_energy_fraction_plane0[i] = -999;
253  vars.m_sim_shower_matched_energy_fraction_plane1[i] = -999;
254  vars.m_sim_shower_matched_energy_fraction_plane2[i] = -999;
255 
256  vars.m_sim_shower_overlay_fraction[i] = fraction_num_hits_overlay;
257  vars.m_sim_shower_sliceId[i] = -999;
258  vars.m_sim_shower_nuscore[i] = -999;
259  vars.m_sim_shower_isclearcosmic[i] = -999;
260  vars.m_sim_shower_is_nuslice[i] = -999;
261 
262 
263  continue;
264  }
265 
266 
267  /* ********** if shower has been matched to MCParticle ************************* */
268 
269  /*
270  *
271  * Loop over each MCParticle associated to the reco shower to find the source particle
272  *
273  */
274 
275  std::map<int, art::Ptr<simb::MCParticle>> mother_MCP_map; //map between MCP track id and the source MCP
276 
277  std::vector<art::Ptr<simb::MCParticle>> marks_mother_vector; // a vector of mother MCP
278  std::map<art::Ptr<simb::MCParticle>, std::vector<double>> marks_mother_energy_fraction_map; // map of mother MCP and its energy on 3 planes
279 
280  int this_mcp_id = -1; //the track id for the current MCP in parent tree
281  int last_mcp_id = -1; //the track id for the previous MCP in parent tree
282  int i_mcp = 0;
283 
284  int num_bt_mothers =0; // number of associated MCP that has mothers
285 
286  //g_is_verbose = false;
287  //for each MCP that's associated to the reco shower
288  for(auto mcp:asso_mcparticles_vec){
289 
290  if(g_is_verbose) std::cout<<"-----------------------------Start L1 Loop --------------------------------------------------"<<std::endl;
291  if(g_is_verbose) std::cout<<"L1: ("<<i<<" <-> "<<i_mcp<<") Start by Looking at an MCP with pdg code "<<mcp->PdgCode()<<" and status code "<<mcp->StatusCode()<<" TrackID: "<<mcp->TrackId()<<std::endl;
292  if(g_is_verbose) std::cout<<"L1: ("<<i<<" <-> "<<i_mcp<<") This MCP gave "<< map_asso_mcparticles_energy[mcp][0] <<" | "<<map_asso_mcparticles_energy[mcp][1]<<" | "<<map_asso_mcparticles_energy[mcp][2]<<" energy to the recob::Object on each plane"<<std::endl;
293  // std::cout<<"L1: the mother of this MCP is track id "<<mcp->Mother()<<" and there are "<<mcp->NumberDaughters()<<" daughters"<<std::endl;
294 
295  //get the track ID for the current MCP
296  this_mcp_id = mcp->TrackId();
297  last_mcp_id = this_mcp_id;//initialize the previous one
298 
299  //while the track id is valid, move up the parent tree for the MCP that contributes to the reco shower
300  //currently it keeps going until it hits the top of the interaction chain, but this is likely too far
301  //to do a proper match you need to check for different cases and stop once one is fulfilled
302  while(this_mcp_id >= 0 ){
303  art::Ptr<simb::MCParticle> this_mcp = MCParticleToTrackIdMap[this_mcp_id];//get the MCP associated to the track ID
304  // std::cout<<"going up the tree got mother particle"<<std::endl;
305 
306  //check if it's a valid MCP
307  if (this_mcp.isNull()){
308  if(g_is_verbose) std::cout<<"L1: ("<<i<<" <-> "<<i_mcp<<") null pointer at id "<<this_mcp_id<<std::endl;
309  this_mcp_id = last_mcp_id; //if invalid, move back a level to the previous MCP in parent tree and break the loop
310  break;
311  }
312 
313  //If primary particle will have process "primary"
314  if(g_is_verbose) std::cout<<"L1: ("<<i<<" <-> "<<i_mcp<<") going up the tree at an MCP with track id "<<this_mcp_id<<", pdg code "<<this_mcp->PdgCode()<<", and status code "<<this_mcp->StatusCode()<<" and Mother: "<<this_mcp->Mother()<<" Process: "<<this_mcp->Process()<<" EndProcess: "<<this_mcp->EndProcess()<<std::endl;
315 
316  //if it is a valid particle, iterate forward to the mother
317  last_mcp_id = this_mcp_id;
318  this_mcp_id = this_mcp->Mother();
319 
320  //Check to see if this MCP was created in a "showery" process
321  if(map_is_shower_process.count(this_mcp->Process()) > 0){
322  //if it was, keep going,
323 
324  }else if(this_mcp->Process()=="primary"){
325  //if its primary, great! Note it.
326  if(g_is_verbose) std::cout<<"L1: Backtracked to primary! breaking"<<std::endl;
327  this_mcp_id = last_mcp_id; //if invalid, move back a level to the previous MCP in parent tree and break the loop
328  break;
329  }else{
330  if(g_is_verbose) std::cout<<"L1: Backtracked to a particle created in "<<this_mcp->EndProcess()<<"! breaking"<<std::endl;
331  this_mcp_id = last_mcp_id; //if invalid, move back a level to the previous MCP in parent tree and break the loop
332  break;
333  }
334  }
335 
336  //if the MCP at the top of the interaction chain has a valid track id store this in the mother map
337  if (this_mcp_id >= 0){
338 
339  //Guanqun: this line here doesn't really cosider other break cases than finding primary particle
340  if(g_is_verbose) std::cout<<"L1: ("<<i<<" <-> "<<i_mcp<<") Storing the mother mother particle with track id "<<this_mcp_id<<" and pdg code "<<MCParticleToTrackIdMap[this_mcp_id]->PdgCode()<<" and status code "<<MCParticleToTrackIdMap[this_mcp_id]->StatusCode()<<std::endl;
341 
342  mother_MCP_map[this_mcp_id] = MCParticleToTrackIdMap[this_mcp_id];//putting it in a map allows for multiple contributing MCP's in the reco shower to have the same mother MCP
343 
344  bool is_old = false;
345 
346  for(size_t k=0; k< marks_mother_vector.size(); k++){
347  //if its in it before, just run with it
348  if(marks_mother_vector[k]==MCParticleToTrackIdMap[this_mcp_id]){
349  marks_mother_energy_fraction_map[marks_mother_vector[k]][0] += map_asso_mcparticles_energy[mcp][0];
350  marks_mother_energy_fraction_map[marks_mother_vector[k]][1] += map_asso_mcparticles_energy[mcp][1];
351  marks_mother_energy_fraction_map[marks_mother_vector[k]][2] += map_asso_mcparticles_energy[mcp][2];
352  is_old = true;
353  break;
354  }
355  }
356  if(is_old==false){//add one element in marks_mother_vector
357  marks_mother_vector.push_back(MCParticleToTrackIdMap[this_mcp_id]);
358  marks_mother_energy_fraction_map[marks_mother_vector.back()] = {0.0,0.0,0.0};
359  marks_mother_energy_fraction_map[marks_mother_vector.back()][0] = map_asso_mcparticles_energy[mcp][0];
360  marks_mother_energy_fraction_map[marks_mother_vector.back()][1] = map_asso_mcparticles_energy[mcp][1];
361  marks_mother_energy_fraction_map[marks_mother_vector.back()][2] = map_asso_mcparticles_energy[mcp][2];
362  }
363 
364 
365  num_bt_mothers++;
366  } else{
367  if(g_is_verbose) std::cout<<"L1: error, the mother mother id was "<<this_mcp_id <<std::endl;
368 
369  }
370 
371  if(g_is_verbose) std::cout<<"-----------------------------End L1 Loop --------------------------------------------------"<<std::endl;
372  i_mcp++;
373  }//for each MCParticle that's associated to a the recob::Shower
374 
375  //g_is_verbose = true;
376  //there should be at least 1 mother MCP
377  if(g_is_verbose) std::cout<<"recoMC()\t||\t the number of source mother particles is "<<mother_MCP_map.size()<<" of which : "<<marks_mother_vector.size()<<" are unique!"<<std::endl;
378 
379  if(g_is_verbose) std::cout<<"---------------------------- L2-------------------------------"<<std::endl;
380 
381  double best_mother_index = 0;
382  double best_mother_energy = -9999;
383  // int best_mother_plane = -99;
384 
385  for(size_t p=0; p< marks_mother_vector.size(); p++){
386  art::Ptr<simb::MCParticle> mother = marks_mother_vector[p];
387  std::vector<double> mother_energy_recod = marks_mother_energy_fraction_map[mother];
388  if(g_is_verbose) std::cout<<"L2: Mother candidate "<<p<<" TrackID "<<mother->TrackId()<<" Process: "<<mother->Process()<<" EndProcess: "<<mother->EndProcess()<<std::endl;
389  if(g_is_verbose) std::cout<<"L2: Mother candidate "<<p<<" Energy "<<mother->E()<<" Reco'd Energy: "<<mother_energy_recod[0]<<" | "<<mother_energy_recod[1]<<" | "<<mother_energy_recod[2]<<" Fraction: ("<<mother_energy_recod[0]/(1000*mother->E())*100.0<<"% , "<<mother_energy_recod[1]/(1000*mother->E())*100.0<<"% , "<<mother_energy_recod[2]/(1000*mother->E())*100.0<<"% )"<<std::endl;
390 
391  if( mother_energy_recod[0] > best_mother_energy){
392  best_mother_index = p;
393  best_mother_energy = mother_energy_recod[0];
394  // best_mother_plane = 0;
395  }
396 
397  if( mother_energy_recod[1] > best_mother_energy){
398  best_mother_index = p;
399  best_mother_energy = mother_energy_recod[1];
400  // best_mother_plane = 1;
401  }
402 
403  if( mother_energy_recod[2] > best_mother_energy){
404  best_mother_index = p;
405  best_mother_energy = mother_energy_recod[2];
406  // best_mother_plane = 2;
407  }
408 
409  }
410 
411 
412 
413  // now have found the best mother of the shower
414  if(g_is_verbose) std::cout<<"---------------------------- L2-------------------------------"<<std::endl;
415  const art::Ptr<simb::MCParticle> match = marks_mother_vector[best_mother_index];
416 
417  std::vector<double> corrected_vertex(3), corrected_start(3);
418  spacecharge_correction(match, corrected_vertex);
419 
420 
421  if(match->PdgCode()==22){ // if it's a gamma
422  std::vector<double> tmp ={match->EndX(), match->EndY(), match->EndZ()};
423  spacecharge_correction(match, corrected_start, tmp );
424  vars.m_sim_shower_is_true_shower[i] = 1;
425  }else if(abs(match->PdgCode())==11){ // if it's e+/e-
426  spacecharge_correction(match, corrected_start);
427  vars.m_sim_shower_is_true_shower[i] = 1;
428  }else{
429  corrected_start = {-999,-999,-999};
430  vars.m_sim_shower_is_true_shower[i] = 0;
431  }
432 
433  art::Ptr<simb::MCParticle> match_mother = MCParticleToTrackIdMap[match->Mother()];
434 
435  if (match_mother.isNull()){
436  vars.m_sim_shower_parent_pdg[i] = -1;
437  vars.m_sim_shower_parent_trackID[i] = -1;
438 
439  }else{
440  vars.m_sim_shower_parent_pdg[i] = match_mother->PdgCode();
441  vars.m_sim_shower_parent_trackID[i] = match_mother->TrackId();
442  }
443 
444 
445 
446  vars.m_sim_shower_matched[i] = 1;
447  vars.m_sim_shower_energy[i] = match->E();
448  vars.m_sim_shower_mass[i] = match->Mass();
449  vars.m_sim_shower_kinetic_energy[i] = match->E()-match->Mass();
450  vars.m_sim_shower_pdg[i] = match->PdgCode();
451  vars.m_sim_shower_trackID[i] = match->TrackId();
452  vars.m_sim_shower_process[i] = match->Process();
453  vars.m_sim_shower_end_process[i] = match->EndProcess();
454  vars.m_sim_shower_vertex_x[i] = corrected_vertex[0];
455  vars.m_sim_shower_vertex_y[i] = corrected_vertex[1];
456  vars.m_sim_shower_vertex_z[i] =corrected_vertex[2];
457 
458  vars.m_sim_shower_start_x[i] = corrected_start[0];
459  vars.m_sim_shower_start_y[i] = corrected_start[1];
460  vars.m_sim_shower_start_z[i] =corrected_start[2];
461 
462  vars.m_sim_shower_px[i] = match->Px();
463  vars.m_sim_shower_py[i] = match->Py();
464  vars.m_sim_shower_pz[i] = match->Pz();
465 
466  // should've use 'best_mother_plane' here
467  vars.m_sim_shower_best_matched_plane[i] = best_mother_index;
468  vars.m_sim_shower_matched_energy_fraction_plane0[i] = marks_mother_energy_fraction_map[marks_mother_vector[best_mother_index]][0]/total_energy_on_plane[0];
469  vars.m_sim_shower_matched_energy_fraction_plane1[i] = marks_mother_energy_fraction_map[marks_mother_vector[best_mother_index]][1]/total_energy_on_plane[1];
470  vars.m_sim_shower_matched_energy_fraction_plane2[i] = marks_mother_energy_fraction_map[marks_mother_vector[best_mother_index]][2]/total_energy_on_plane[2];
471 
472  vars.m_sim_shower_overlay_fraction[i] = fraction_num_hits_overlay;
473 
474  mcParticleVector.push_back(match);
475  showerToMCParticleMap[shower] = mcParticleVector.back();
476 
477  vars.m_sim_shower_sliceId[i] = ppfp->get_SliceID();//PFPToSliceIdMap[pfp];
478  vars.m_sim_shower_nuscore[i] = ppfp->get_NuScore();//sliceIdToNuScoreMap[ vars.m_sim_shower_sliceId[i]] ;
479  vars.m_sim_shower_isclearcosmic[i] = ppfp->get_IsClearCosmic();//PFPToClearCosmicMap[pfp];
480  vars.m_sim_shower_is_nuslice[i] = ppfp->get_IsNuSlice();//PFPToNuSliceMap[pfp];
481 
482  // if(marks_mother_vector.size()!=0){
483  // //if(g_is_verbose) std::cout<<"recoMC()\t||\t The `BEST` mother is a "<<marks_mother_vector[best_mother_index]->PdgCode()<<" at "<<best_mother_index<<" on plane: "<<best_mother_plane<<std::endl;
484  // //std::vector<int> spacers = Printer_header({"pfpID", " matched_#simb", " pdg"," E_plane0"," E_plane1"," E_plane2"," cosmic?"});
485  // std::cout<<"recoMC()\t||\t The `BEST` mother is a "<<marks_mother_vector[best_mother_index]->PdgCode()<<" at "<<best_mother_index<<" on plane: "<<best_mother_plane<<std::endl;
486  // for(int l=0; l<3; l++){
487  // std::cout<<"recoMC()\t||\t It represents "<<marks_mother_energy_fraction_map[marks_mother_vector[best_mother_index]][l]/total_energy_on_plane[l]*100.0<<"% of the energy on plane: "<<l<<" which is "<<total_energy_on_plane[l] <<std::endl;
488  // }
489  // }
490  //
491  //
492  // if (vars.m_sim_shower_isclearcosmic[i]== false){
493  // std::cout<<"sim shower is matched to non-clear cosmic PFP "<<pfp->Self()<<std::endl;
494  // }
495  Printer_content({std::to_string(pfp->Self()),
496  std::to_string(best_mother_index),
497  std::to_string(marks_mother_vector[best_mother_index]->PdgCode()),
498  std::to_string(total_energy_on_plane[0]),
499  std::to_string(total_energy_on_plane[1]),
500  std::to_string(total_energy_on_plane[2]),
501  std::to_string(ppfp->get_IsClearCosmic())
502  },spacers);
503 
504  if (g_is_verbose) std::cout<<"looking at pfp "<< pfp->Self()<<" with is matched to true particle with pdg vars.m_sim_shower_pdg[i]= "<< vars.m_sim_shower_pdg[i]<< ". is_nuslice = "<< vars.m_sim_shower_is_nuslice[i]<<" in slice "<< vars.m_sim_shower_sliceId[i]<<". The matched energy for this shower from mark's mother particle with pdg "<<marks_mother_vector[best_mother_index]->PdgCode()<< " is "<<vars.m_sim_shower_matched_energy_fraction_plane0[i]<<"/"<<vars.m_sim_shower_matched_energy_fraction_plane1[i]<<"/" <<vars.m_sim_shower_matched_energy_fraction_plane2[i]<<std::endl;
505 
506  }//end vector loop.
507  }//end showerRecoMCmatching
pdgs p
Definition: selectors.fcl:22
process_name shower
Definition: cheaterreco.fcl:51
T abs(T value)
std::vector< int > Printer_header(std::vector< std::string > headings)
int spacecharge_correction(const art::Ptr< simb::MCParticle > &mcparticle, std::vector< double > &corrected, std::vector< double > &input)
Definition: Processors.cxx:25
void Printer_content(std::vector< std::string > nums, std::vector< int > spacers)
std::string to_string(WindowPattern const &pattern)
PandoraPFParticle * PPFP_GetPPFPFromShower(std::vector< PandoraPFParticle > &PPFPs, art::Ptr< recob::Shower > pShower)
pdgs k
Definition: selectors.fcl:22
BEGIN_PROLOG could also be cout
void single_photon::SimpleSecondShowerCluster ( var_all &  vars,
para_all &  paras 
)

Definition at line 669 of file second_shower_search.cxx.

669  {
670 
671  std::string base = "sss3d_";
672  std::vector<std::string> mod = {"ioc_ranked","invar_ranked"};
673 
674  vars.m_sss3d_ioc_ranked_en = -9;
675  vars.m_sss3d_ioc_ranked_conv = -9;
676  vars.m_sss3d_ioc_ranked_invar = -9;
677  vars.m_sss3d_ioc_ranked_implied_invar = -9;
678  vars.m_sss3d_ioc_ranked_ioc = -9;
679  vars.m_sss3d_ioc_ranked_opang = -9;
680  vars.m_sss3d_ioc_ranked_implied_opang = -9;
681  vars.m_sss3d_ioc_ranked_id = -9;
682 
683  vars.m_sss3d_invar_ranked_en = -9;
684  vars.m_sss3d_invar_ranked_conv = -9;
685  vars.m_sss3d_invar_ranked_invar = -9;
686  vars.m_sss3d_invar_ranked_implied_invar = -9;
687  vars.m_sss3d_invar_ranked_ioc = -9;
688  vars.m_sss3d_invar_ranked_opang = -9;
689  vars.m_sss3d_invar_ranked_implied_opang = -9;
690  vars.m_sss3d_invar_ranked_id = -9;
691 
692 
693  std::string base2d = "sss_";
694  std::vector<std::string> mod2d = {"ioc_ranked","conv_ranked","invar_ranked"};
695 
696  vars.m_sss2d_ioc_ranked_en = -9;
697  vars.m_sss2d_ioc_ranked_conv = -9;
698  vars.m_sss2d_ioc_ranked_ioc = -9;
699  vars.m_sss2d_ioc_ranked_pca = -9;
700  vars.m_sss2d_ioc_ranked_invar = -9;
701  vars.m_sss2d_ioc_ranked_angle_to_shower = -9;
702  vars.m_sss2d_ioc_ranked_num_planes = -9;
703 
704  vars.m_sss2d_conv_ranked_en = -9;
705  vars.m_sss2d_conv_ranked_conv = -9;
706  vars.m_sss2d_conv_ranked_ioc = -9;
707  vars.m_sss2d_conv_ranked_pca = -9;
708  vars.m_sss2d_conv_ranked_invar = -9;
709  vars.m_sss2d_conv_ranked_angle_to_shower = -9;
710  vars.m_sss2d_conv_ranked_num_planes = -9;
711 
712  vars.m_sss2d_invar_ranked_en = -9;
713  vars.m_sss2d_invar_ranked_conv = -9;
714  vars.m_sss2d_invar_ranked_ioc = -9;
715  vars.m_sss2d_invar_ranked_pca = -9;
716  vars.m_sss2d_invar_ranked_invar = -9;
717  vars.m_sss2d_invar_ranked_angle_to_shower = -9;
718  vars.m_sss2d_invar_ranked_num_planes = -9;
719 
720  //---------------------------------------
721  //First off, the 3D showers
722  //First some 3D shower information
723  if(vars.m_sss3d_shower_conversion_dist.size()>0 && vars.m_reco_shower_energy_max.size()>0){
724  //std::cout<<"Primary shower en "<<reco_shower_energy_max->at(0)<<std::endl;
725 
726  std::vector<double> inv = vars.m_sss3d_shower_implied_invariant_mass;
727  for(auto &v : inv) v = fabs(v-paras.s_mass_pi0_mev);
728 
729  std::vector<size_t> ranked_ioc = sort_indexes_rev<double>((vars.m_sss3d_shower_ioc_ratio));
730  std::vector<size_t> ranked_invar = sort_indexes_rev<double>((inv));
731  std::vector<size_t> ranked_conv = sort_indexes_rev<double>((vars.m_sss3d_shower_conversion_dist));
732  std::vector<size_t> ranked_en = sort_indexes_rev<double>((vars.m_sss3d_shower_energy_max));
733 
734  int to_consider = vars.m_sss3d_shower_conversion_dist.size();
735 
736  if(false){
737  std::cout<<"IOC"<<std::endl;
738  for(int j=0; j<to_consider; j++){
739  std::cout<<"--"<<ranked_ioc[j]<<" ioc: "<<vars.m_sss3d_shower_ioc_ratio.at( ranked_ioc[j] )<<" invar: "<<vars.m_sss3d_shower_implied_invariant_mass.at(ranked_ioc[j])<<" en: "<<vars.m_sss3d_shower_energy_max.at(ranked_ioc[j])<<" conv: "<<vars.m_sss3d_shower_conversion_dist.at(ranked_ioc[j])<<std::endl;
740  }
741 
742  std::cout<<"INVAR"<<std::endl;
743  for(int j=0; j<to_consider; j++){
744  std::cout<<"--"<<ranked_invar[j]<<" ioc: "<<vars.m_sss3d_shower_ioc_ratio.at( ranked_invar[j] )<<" invar: "<<vars.m_sss3d_shower_implied_invariant_mass.at(ranked_invar[j])<<" en: "<<vars.m_sss3d_shower_energy_max.at(ranked_invar[j])<<" conv: "<<vars.m_sss3d_shower_conversion_dist.at(ranked_invar[j]) <<std::endl;
745  }
746 
747  std::cout<<"EN"<<std::endl;
748  for(int j=0; j<to_consider; j++){
749  int rk = ranked_en[ranked_en.size()-1-j];
750  std::cout<<"--"<<rk<<" ioc: "<<vars.m_sss3d_shower_ioc_ratio.at( rk )<<" invar: "<<vars.m_sss3d_shower_implied_invariant_mass.at(rk)<<" en: "<<vars.m_sss3d_shower_energy_max.at(rk)<<" conv: "<<vars.m_sss3d_shower_conversion_dist.at(rk)<<std::endl;
751  }
752  std::cout<<"CONV"<<std::endl;
753  for(int j=0; j<to_consider; j++){
754  std::cout<<"--"<<ranked_conv[j]<<" ioc: "<<vars.m_sss3d_shower_ioc_ratio.at( ranked_conv[j] )<<" invar: "<<vars.m_sss3d_shower_implied_invariant_mass.at(ranked_conv[j])<<" en: "<<vars.m_sss3d_shower_energy_max.at(ranked_conv[j])<<" conv: "<<vars.m_sss3d_shower_conversion_dist.at(ranked_conv[j])<<std::endl;
755  }
756  }
757 
758 
759  //std::cout<<"Best IOC "<<"--"<<ranked_ioc[0]<<" ioc: "<<sss3d_shower_ioc_ratio->at( ranked_ioc[0] )<<" invar: "<<sss3d_shower_implied_invariant_mass->at(ranked_ioc[0])<<" en: "<<sss3d_shower_energy_max->at(ranked_ioc[0])<<" conv: "<<sss3d_shower_conversion_dist->at(ranked_ioc[0])<<std::endl;
760  vars.m_sss3d_ioc_ranked_en = vars.m_sss3d_shower_energy_max.at(ranked_ioc[0]);
761  vars.m_sss3d_ioc_ranked_conv = vars.m_sss3d_shower_conversion_dist.at(ranked_ioc[0]);
762  vars.m_sss3d_ioc_ranked_invar = vars.m_sss3d_shower_invariant_mass.at(ranked_ioc[0]);
763  vars.m_sss3d_ioc_ranked_implied_invar = vars.m_sss3d_shower_implied_invariant_mass.at(ranked_ioc[0]);
764  vars.m_sss3d_ioc_ranked_ioc = vars.m_sss3d_shower_ioc_ratio.at(ranked_ioc[0]);
765  vars.m_sss3d_ioc_ranked_opang = 1.0 - pow(vars.m_sss3d_shower_invariant_mass.at(ranked_ioc[0]),2)/(2.0*vars.m_sss3d_shower_energy_max.at(ranked_ioc[0])*vars.m_reco_shower_energy_max.at(0));
766  vars.m_sss3d_ioc_ranked_implied_opang = 1.0 - pow(vars.m_sss3d_shower_implied_invariant_mass.at(ranked_ioc[0]),2)/(2.0*vars.m_sss3d_shower_energy_max.at(ranked_ioc[0])*vars.m_reco_shower_energy_max.at(0));
767  vars.m_sss3d_ioc_ranked_id = ranked_ioc[0];
768 
769 
770  // std::cout<<"Best invar "<<"--"<<ranked_invar[0]<<" ioc: "<<sss3d_shower_ioc_ratio.at( ranked_invar[0] )<<" invar: "<<sss3d_shower_implied_invariant_mass.at(ranked_invar[0])<<" en: "<<sss3d_shower_energy_max.at(ranked_invar[0])<<" conv: "<<sss3d_shower_conversion_dist.at(ranked_invar[0])<<std::endl;
771 
772  // minimum discrepancy between implied invariant mass and pi0 mass
773  vars.m_sss3d_invar_ranked_en = vars.m_sss3d_shower_energy_max.at(ranked_invar[0]);
774  vars.m_sss3d_invar_ranked_conv = vars.m_sss3d_shower_conversion_dist.at(ranked_invar[0]);
775  vars.m_sss3d_invar_ranked_invar = vars.m_sss3d_shower_invariant_mass.at(ranked_invar[0]);
776  vars.m_sss3d_invar_ranked_implied_invar = vars.m_sss3d_shower_implied_invariant_mass.at(ranked_invar[0]);
777  vars.m_sss3d_invar_ranked_ioc = vars.m_sss3d_shower_ioc_ratio.at(ranked_invar[0]);
778  vars.m_sss3d_invar_ranked_opang = 1.0 - pow(vars.m_sss3d_shower_invariant_mass.at(ranked_invar[0]),2)/(2.0*vars.m_sss3d_shower_energy_max.at(ranked_invar[0])*vars.m_reco_shower_energy_max.at(0));
779  vars.m_sss3d_invar_ranked_implied_opang = 1.0 - pow(vars.m_sss3d_shower_implied_invariant_mass.at(ranked_invar[0]),2)/(2.0*vars.m_sss3d_shower_energy_max.at(ranked_invar[0])*vars.m_reco_shower_energy_max.at(0));
780  vars.m_sss3d_invar_ranked_id = ranked_invar[0];
781 
782  }//end of 3D shower searching
783 
784 
785  //Now some 2D shower information
786  //
787  if(vars.m_sss_num_candidates>0){
788  //std::cout<<"2D clusters: "<<sss_num_candidates<<std::endl;
789  std::vector<int> nplans(3,0);
790  std::vector<std::vector<int>> indexmap(3);
791 
792 
793  for(int i=0; i< vars.m_sss_num_candidates; i++){
794  //std::cout<<i<<" p: "<<vars.m_sss_candidate_plane->at(i)<<" pdg: "<<vars.m_sss_candidate_parent_pdg->at(i)<<" ovf "<<vars.m_sss_candidate_overlay_fraction->at(i)<<" conv: "<<vars.m_sss_candidate_min_dist->at(i)<<std::endl;
795  }
796 
797  std::vector<std::vector<int>> uniq_candidates;
798 
799  for(int i=0; i< vars.m_sss_num_candidates; i++){
800  int ip = vars.m_sss_candidate_plane.at(i);
801  //int nhits = sss_candidate_num_hits.at(i);
802  nplans[ip]++;
803  indexmap[ip].push_back(i);
804 
805  //Two passes to build up all "Candidates" for 2 and 3 plane matches
806  for(int j=i;j<vars.m_sss_num_candidates;j++){
807  int jp = vars.m_sss_candidate_plane.at(j);
808  if(jp==ip) continue;
809 
810  bool contain_ij = false;
811  bool contain_ji = false;
812  if(vars.m_sss_candidate_mean_tick.at(j)<=vars.m_sss_candidate_max_tick.at(i) && vars.m_sss_candidate_mean_tick.at(j) >= vars.m_sss_candidate_min_tick.at(i))contain_ij = true;
813  if(vars.m_sss_candidate_mean_tick.at(i)<=vars.m_sss_candidate_max_tick.at(j) && vars.m_sss_candidate_mean_tick.at(i) >= vars.m_sss_candidate_min_tick.at(j))contain_ji = true;
814  // std::cout<<i<<" "<<j<<" "<<contain_ij<<" "<<contain_ji<<std::endl;
815  if(contain_ij && contain_ji){
816  uniq_candidates.push_back({i,j});
817  }
818  }
819  }
820 
821  //Now loop over to check if any indlude a third plane
822  for(int i = 0; i< (int)uniq_candidates.size(); i++){
823  for(int k=0; k<vars.m_sss_num_candidates; k++){
824  //first check if this possible 3rd match is on a seperate plane
825  bool new_plane = true;
826  for(auto &pp:uniq_candidates[i]){
827  if(vars.m_sss_candidate_plane.at(k)==vars.m_sss_candidate_plane.at(pp) ) new_plane = false;
828  }
829  if(new_plane){
830 
831  bool contain_ik = false;
832  bool contain_ki = false;
833  bool contain_jk = false;
834  bool contain_kj = false;
835  if(vars.m_sss_candidate_mean_tick.at(k)<=vars.m_sss_candidate_max_tick.at(uniq_candidates[i][0]) && vars.m_sss_candidate_mean_tick.at(k) >= vars.m_sss_candidate_min_tick.at(uniq_candidates[i][0]))contain_ik = true;
836  if(vars.m_sss_candidate_mean_tick.at(uniq_candidates[i][0])<=vars.m_sss_candidate_max_tick.at(k) && vars.m_sss_candidate_mean_tick.at(uniq_candidates[i][0]) >= vars.m_sss_candidate_min_tick.at(k))contain_ki = true;
837  if(vars.m_sss_candidate_mean_tick.at(k)<=vars.m_sss_candidate_max_tick.at(uniq_candidates[i][1]) && vars.m_sss_candidate_mean_tick.at(k) >= vars.m_sss_candidate_min_tick.at(uniq_candidates[i][1]))contain_ik = true;
838  if(vars.m_sss_candidate_mean_tick.at(uniq_candidates[i][1])<=vars.m_sss_candidate_max_tick.at(k) && vars.m_sss_candidate_mean_tick.at(uniq_candidates[i][1]) >= vars.m_sss_candidate_min_tick.at(k))contain_ki = true;
839 
840  //If this matches well with Either last candidate, include as a possibility
841  if((contain_ik&&contain_ki) || (contain_jk&&contain_kj)){
842  uniq_candidates[i].push_back(k);
843  }
844 
845  }
846  }
847  }
848  //Check which candidates have been used where
849  std::vector<int> used_candidates(vars.m_sss_num_candidates);
850  for(int i = 0; i< (int)uniq_candidates.size(); i++){
851  for(auto &j: uniq_candidates[i]){
852  used_candidates[j]++;
853  }
854  }
855 
856  //If a candidate has been included in NO 2 or 3 plane cluster, treat it on its own
857  for(int i = 0; i< (int)used_candidates.size(); i++){
858  if(used_candidates[i]==0) uniq_candidates.push_back({i});
859  }
860 
861  //Now lets delete any permutations
862  std::vector<std::vector<int>> uniq_candidates2;
863  uniq_candidates2.push_back(uniq_candidates.front());
864 
865  for(int i = 1; i< (int)uniq_candidates.size(); i++){
866 
867  bool perm = false;
868  for(int j = 0; j< (int)uniq_candidates2.size(); j++){
869  perm = marks_compare_vec_nonsense<int>(uniq_candidates[i], uniq_candidates2[j]);
870  if(perm) break;
871  }
872  if(!perm) uniq_candidates2.push_back(uniq_candidates[i]);
873  }
874 
875  //Printing candidates (After perm check)
876  std::cout<<"After: used_candidates "<<vars.m_sss_num_candidates<<std::endl;
877  for(int i = 0; i< (int)uniq_candidates2.size(); i++){
878  std::cout<<i<<" | ";
879  for(auto &j: uniq_candidates2[i])std::cout<<" "<<j;
880  std::cout<<std::endl;
881  }
882 
883  //Right lets CULL and rank the candidates
884  std::vector<bool> candidate_pass(uniq_candidates2.size(),false);
885  std::vector<double> candidates_en(uniq_candidates2.size(),0);
886  std::vector<double> candidates_ioc(uniq_candidates2.size(),0);
887  std::vector<double> candidates_conv(uniq_candidates2.size(),0);
888  std::vector<double> candidates_pca(uniq_candidates2.size(),0);
889  std::vector<double> candidates_angle_to_shower(uniq_candidates2.size(),0);
890  std::vector<int> candidates_num_planes(uniq_candidates2.size(),0);
891  std::vector<double> candidates_eff_invar(uniq_candidates2.size(),0);
892  std::vector<double> candidates_eff_invar_diff(uniq_candidates2.size(),0);
893 
894  //rank by min_impat/max_min_dist and select
895  //rank by Energy energy
896 
897  for(int j=0; j<(int)uniq_candidates2.size();j++){
898  int nt=uniq_candidates2[j].size();
899  //std::cout<<"Candidate #: "<<j<<" has "<<nt<<" 2D clusters"<<std::endl;
900 
901  double mean_min_dist = 0.0;
902  double max_min_dist = 0.0;
903 
904  double mean_energy = 0.0;
905 
906  double mean_impact = 0.0;
907  double mean_conv = 0.0;
908  double min_conv = 999;
909 
910  double min_impact = 999;
911  double mean_invar = 0.0;
912  double mean_invar_diff = 0.0;
913 
914  double max_pca = 0;
915  double min_angle = 999;
916 
917 
918  //int is_min_slice = 999;
919  //std::vector<int> is_in_slice;
920 
921  for(int c=0; c< nt;++c){
922  int ic = uniq_candidates2[j][c];
923 
924  //std::cout<<"----- plane: "<<vars.m_sss_candidate_plane.at(ic)<<" nhits: "<<vars.m_sss_candidate_num_hits.at(ic)<<" imp: "<<vars.m_sss_candidate_impact_parameter.at(ic)<<" en: "<<vars.m_sss_candidate_energy.at(ic)<<" a2s: "<<vars.m_sss_candidate_angle_to_shower.at(ic)<<" conv: "<<vars.m_sss_candidate_min_dist.at(ic)<<" pdg: "<<vars.m_sss_candidate_parent_pdg.at(ic)<<std::endl;
925 
926  double eff_invar = sqrt(2.0*vars.m_sss_candidate_energy.at(ic)*vars.m_reco_shower_energy_max.at(0)*(1.0-cos(vars.m_sss_candidate_angle_to_shower.at(ic))));
927  double eff_invar_diff = fabs(eff_invar-139.5);
928 
929  //is_min_slice = std::min(is_in_slice, vars.m_sss_candidate_in_nu_slice[ic] );
930  //is_in_slice.push_back(vars.m_sss_candidate_in_nu_slice[ic]);
931 
932  mean_min_dist +=vars.m_sss_candidate_min_dist.at(ic)/(double)nt;
933  mean_energy +=vars.m_sss_candidate_energy.at(ic)/(double)nt;
934  mean_impact +=vars.m_sss_candidate_impact_parameter.at(ic)/(double)nt;
935  mean_conv +=vars.m_sss_candidate_min_dist.at(ic)/(double)nt;
936  mean_invar +=eff_invar/(double)nt;
937  mean_invar_diff +=eff_invar_diff/(double)nt;
938 
939  min_conv = std::min(min_conv, vars.m_sss_candidate_min_dist.at(ic));
940  max_min_dist = std::max(max_min_dist, vars.m_sss_candidate_min_dist.at(ic));
941  max_pca = std::max(max_pca, vars.m_sss_candidate_PCA.at(ic));
942  min_impact = std::min(min_impact, vars.m_sss_candidate_impact_parameter.at(ic));
943  min_angle = std::min(min_angle, vars.m_sss_candidate_angle_to_shower.at(ic));
944 
945  }
946  std::cout<<"======== Mean En "<<mean_energy<<" mean dist "<<mean_min_dist<<" meanimpact "<<mean_impact<<" minimpact/maxdist : "<<min_impact/max_min_dist<<" invar "<<mean_invar<<std::endl;
947  candidates_ioc[j]=min_impact/max_min_dist;
948  candidates_en[j]=mean_energy;
949  candidates_conv[j] = min_conv;
950  candidates_pca[j] = max_pca;
951  candidates_angle_to_shower[j] = min_angle;
952  candidates_num_planes[j] =nt;
953  candidates_eff_invar_diff[j] = mean_invar_diff;
954  candidates_eff_invar[j] = mean_invar;
955  //candidates_min_slice[j] = is_min_slice;
956  //candidates_in_slice[j] = is_in_slice;
957  }
958 
959  std::vector<size_t> ranked_ioc = sort_indexes_rev<double>(candidates_ioc);
960  std::vector<size_t> ranked_invar = sort_indexes_rev<double>(candidates_eff_invar_diff);
961  std::vector<size_t> ranked_conv = sort_indexes_rev<double>(candidates_conv);
962 
963  std::cout<<"========== Ranking ======== "<<std::endl;
964  std::cout<<"IOC "; for (auto &ii: ranked_ioc) std::cout<<" "<<ii; std::cout<<std::endl;
965  std::cout<<"CONV "; for (auto &ii: ranked_conv) std::cout<<" "<<ii; std::cout<<std::endl;
966  std::cout<<"INVAR ";for (auto &ii: ranked_invar) std::cout<<" "<<ii; std::cout<<std::endl;
967 
968  vars.m_sss2d_ioc_ranked_en = candidates_en[ranked_ioc[0]];
969  vars.m_sss2d_ioc_ranked_conv = candidates_conv[ranked_ioc[0]];
970  vars.m_sss2d_ioc_ranked_ioc = candidates_ioc[ranked_ioc[0]];
971  vars.m_sss2d_ioc_ranked_invar = candidates_eff_invar[ranked_ioc[0]];
972  vars.m_sss2d_ioc_ranked_pca = candidates_pca[ranked_ioc[0]];
973  vars.m_sss2d_ioc_ranked_angle_to_shower = candidates_angle_to_shower[ranked_ioc[0]];
974  vars.m_sss2d_ioc_ranked_num_planes = candidates_num_planes[ranked_ioc[0]];
975 
976  vars.m_sss2d_conv_ranked_en = candidates_en[ranked_conv[0]];
977  vars.m_sss2d_conv_ranked_conv = candidates_conv[ranked_conv[0]];
978  vars.m_sss2d_conv_ranked_ioc = candidates_ioc[ranked_conv[0]];
979  vars.m_sss2d_conv_ranked_invar = candidates_eff_invar[ranked_conv[0]];
980  vars.m_sss2d_conv_ranked_pca = candidates_pca[ranked_conv[0]];
981  vars.m_sss2d_conv_ranked_angle_to_shower = candidates_angle_to_shower[ranked_conv[0]];
982  vars.m_sss2d_conv_ranked_num_planes = candidates_num_planes[ranked_conv[0]];
983 
984  vars.m_sss2d_invar_ranked_en = candidates_en[ranked_invar[0]];
985  vars.m_sss2d_invar_ranked_conv = candidates_conv[ranked_invar[0]];
986  vars.m_sss2d_invar_ranked_ioc = candidates_ioc[ranked_invar[0]];
987  vars.m_sss2d_invar_ranked_invar = candidates_eff_invar[ranked_invar[0]];
988  vars.m_sss2d_invar_ranked_pca = candidates_pca[ranked_invar[0]];
989  vars.m_sss2d_invar_ranked_angle_to_shower = candidates_angle_to_shower[ranked_invar[0]];
990  vars.m_sss2d_invar_ranked_num_planes = candidates_num_planes[ranked_invar[0]];
991  }
992 
993  return ;
994  }
pdgs k
Definition: selectors.fcl:22
BEGIN_PROLOG could also be cout
template<typename T >
std::vector<size_t> single_photon::sort_indexes ( const std::vector< T > &  v)

Definition at line 20 of file helper_math.h.

20  {
21 
22  std::vector<size_t> idx(v.size());
23  std::iota(idx.begin(), idx.end(), 0);
24 
25  // sort indexes based on comparing values in v
26  std::sort(idx.begin(), idx.end(), [&v](size_t i1, size_t i2) {return v[i1] > v[i2];});
27 
28  return idx;
29  }
template<typename T >
std::vector<size_t> single_photon::sort_indexes_rev ( const std::vector< T > &  v)

Definition at line 33 of file helper_math.h.

33  {
34 
35  std::vector<size_t> idx(v.size());
36  std::iota(idx.begin(), idx.end(), 0);
37 
38  // sort indexes based on comparing values in v
39  std::sort(idx.begin(), idx.end(), [&v](size_t i1, size_t i2) {return v[i1] < v[i2];});
40 
41  return idx;
42  }
int single_photon::spacecharge_correction ( const art::Ptr< simb::MCParticle > &  mcparticle,
std::vector< double > &  corrected,
std::vector< double > &  input 
)

Definition at line 25 of file Processors.cxx.

25  {
26  corrected.resize(3);
27 
28  //CHECK double kx = input[0];
29  double ky = input[1];
30  double kz = input[2];
31  //CHECK
32  // auto scecorr = SCE->GetPosOffsets( geo::Point_t(kx,ky,kz));
33  // CHECK
34  // double g4Ticks = detClocks->TPCG4Time2Tick(mcparticle->T())+theDetector->GetXTicksOffset(0,0,0)-theDetector->trigger_offset();
35 
36  //CHECK double xtimeoffset = 0;//CHECK theDetector->ConvertTicksToX(g4Ticks,0,0,0);
37 
38  // double xOffset = -scecorr.X() +xtimeoffset+0.6;
39  double yOffset = 0;//CHECK scecorr.Y();
40  double zOffset = 0;//CHECK scecorr.Z();
41 
42  corrected[0]=0;//CHECK kx - scecorr.X() + xtimeoffset + 0.6; //due to sim/wirecell differences Seev https://cdcvs.fnal.gov/redmine/projects/uboone-physics-analysis/wiki/MCC9_Tutorials
43  corrected[1]=ky+yOffset;
44  corrected[2]=kz+zOffset;
45  return 0;
46  }
int single_photon::spacecharge_correction ( const art::Ptr< simb::MCParticle > &  mcparticle,
std::vector< double > &  corrected 
)

Definition at line 52 of file Processors.cxx.

52  {
53  corrected.resize(3);
54 
55  double kx = mcparticle->Vx();
56  double ky = mcparticle->Vy();
57  double kz = mcparticle->Vz();
58 
59  //CHECK auto scecorr = SCE->GetPosOffsets( geo::Point_t(kx,ky,kz)); // to get position offsets to be used in ionization electron drift
60  //CHECK double g4Ticks = detClocks->TPCG4Time2Tick(mcparticle->T())+theDetector->GetXTicksOffset(0,0,0)-theDetector->trigger_offset();
61 
62  //CHECK double xtimeoffset = theDetector->ConvertTicksToX(g4Ticks,0,0,0);
63 
64  //double xOffset = -scecorr.X() +xtimeoffset+0.6;
65  double yOffset = 0;//CHECK scecorr.Y();
66  double zOffset = 0;//CHECK scecorr.Z();
67 
68  corrected[0]= kx;//CHECK- scecorr.X() + xtimeoffset + 0.6; //due to sim/wirecell differences Seev https://cdcvs.fnal.gov/redmine/projects/uboone-physics-analysis/wiki/MCC9_Tutorials
69  corrected[1]=ky+yOffset;
70  corrected[2]=kz+zOffset;
71 
72  return 0;
73  }
int single_photon::spacecharge_correction ( const simb::MCParticle &  mcparticle,
std::vector< double > &  corrected 
)

Definition at line 79 of file Processors.cxx.

79  {
80  corrected.resize(3);
81  //Space Charge Effect! functionize this soon.
82  double kx = mcparticle.Vx();
83  double ky = mcparticle.Vy();
84  double kz = mcparticle.Vz();
85  //CHECK auto scecorr = SCE->GetPosOffsets( geo::Point_t(kx,ky,kz));
86  //CHECK double g4Ticks = detClocks->TPCG4Time2Tick(mcparticle.T())+theDetector->GetXTicksOffset(0,0,0)-theDetector->trigger_offset();
87 
88  //CHECK double xtimeoffset = 0;//CHECK theDetector->ConvertTicksToX(g4Ticks,0,0,0);
89 
90  corrected[0]=kx;//CHECK - scecorr.X() +xtimeoffset+0.6;
91  corrected[1]=ky;//CHECK + scecorr.Y();
92  corrected[2]=kz;//CHECK + scecorr.Z();
93  return 0;
94  }
std::vector< double > single_photon::trackRecoMCmatching ( std::vector< art::Ptr< recob::Track >> &  objectVector,
std::map< art::Ptr< recob::Track >, art::Ptr< simb::MCParticle >> &  objectToMCParticleMap,
std::map< art::Ptr< recob::Track >, art::Ptr< recob::PFParticle >> &  objectToPFParticleMap,
std::map< art::Ptr< recob::PFParticle >, std::vector< art::Ptr< recob::Hit >> > &  pfParticleToHitsMap,
art::FindManyP< simb::MCParticle, anab::BackTrackerHitMatchingData > &  mcparticles_per_hit,
std::vector< art::Ptr< simb::MCParticle >> &  mcParticleVector,
var_all &  vars 
)

Definition at line 518 of file reco_truth_matching.cxx.

524  {
525 
526  std::vector<double> trk_overlay_vec;
527  std::vector<double> vec_fraction_matched;
528  bool reco_verbose = false;
529  //for each recob::track/shower in the event
530  for(size_t i=0; i<objectVector.size();++i){
531  auto object = objectVector[i];
532 
533  //get the associated reco PFP
534  const art::Ptr<recob::PFParticle> pfp = objectToPFParticleMap[object];
535 
536  // std::cout<<"recoMCmatching()\t||\t looking for a track match to pfp"<< pfp->Self()<<std::endl;
537 
538 
539  int pdg = pfp->PdgCode();
540  //and get the hits associated to the reco PFP
541  std::vector< art::Ptr<recob::Hit> > obj_hits_ptrs = pfParticleToHitsMap[pfp];
542 
543  std::unordered_map<int,double> objide; //map between the MCParticle track ID and the backtracker energy
544 
545  //energy for an MCParticle that comprises the most energy when sum over associated hits in PFP
546  //total energy of the reco PFP taken from the sum of the hits associated to an MCParticle
547  double maxe=-1, tote=0;
548 
549  //simb::MCParticle const * best_matched_mcparticle = NULL; //pointer for the particle match we will calculate
550  art::Ptr<simb::MCParticle> best_matched_mcparticle; //pointer for the MCParticle match we will calculate
551 
552  // std::vector<simb::MCParticle const *> particle_vec;
553  // std::vector<anab::BackTrackerHitMatchingData const *> match_vec;
554 
555  std::vector<art::Ptr<simb::MCParticle>> particle_vec; //vector of all MCParticles associated with a given hit in the reco PFP
556  std::vector<anab::BackTrackerHitMatchingData const *> match_vec; //vector of some backtracker thing
557 
558  bool found_a_match = false;
559  int n_associated_mcparticle_hits = 0;
560  int n_not_associated_hits = 0;
561 
562  // std::cout<<"REC: This object with pfp "<< pfp->Self() <<" in slice "<<PFPToSliceIdMap[pfp] <<" has "<<obj_hits_ptrs.size()<<" hits associated with it"<<std::endl;
563 
564  //loop only over hits associated to this reco PFP
565  for(size_t i_h=0; i_h < obj_hits_ptrs.size(); ++i_h){
566 
567  particle_vec.clear(); match_vec.clear(); //only store per hit
568 
569  //for the hit, fill the backtracker info
570 
571  mcparticles_per_hit.get(obj_hits_ptrs[i_h].key(), particle_vec, match_vec);
572  // std::cout<<"for hit "<< i_h <<" particle_vec.size() = "<< particle_vec.size()<< " and match_vec.size() = "<< match_vec.size()<<std::endl;
573 
574  //mcparticles_per_hit.get(obj_hits_ptrs[i_h].key(),particle_vec,match_vec);
575  //the .key() gives us the index in the original collection
576  //std::cout<<"REC: hit "<<i_h<<" has "<<particle_vec.size()<<" MCparticles assocaied: "<<std::endl;
577 
578  //if there is an MCParticle associated to this hit
579 
580  //if there is an MCParticle associated to this hit
581  if(particle_vec.size()>0) n_associated_mcparticle_hits++;
582 
583  if(particle_vec.size()==0) n_not_associated_hits++;
584 
585 
586  //loop over MCparticles finding which is the MCparticle with most "energy" matched correctly
587  //for each MCParticle associated with this hit
588  for(size_t i_p=0; i_p<particle_vec.size(); ++i_p){
589  //add the energy of the back tracked hit for this MCParticle to the track id for the MCParticle in the map
590  objide[ particle_vec[i_p]->TrackId()] += match_vec[i_p]->energy; //store energy per track id
591 
592  //add the energy of the back tracked hit to the total energy for the PFP
593  tote += match_vec[i_p]->energy; //calculate total energy deposited
594 
595  //want the MCParticle with the max total energy summed from the back tracker hit energy from hits in PFP
596  if( objide[ particle_vec[i_p]->TrackId() ] > maxe ){ //keep track of maximum
597  maxe = objide[ particle_vec[i_p]->TrackId() ];
598  best_matched_mcparticle = particle_vec[i_p];
599  found_a_match = true;
600  }
601  }//end loop over particles per hit
602  }
603 
604 
605  double fraction_num_hits_overlay = (double)n_not_associated_hits/(double)obj_hits_ptrs.size();
606 
607  trk_overlay_vec.push_back(fraction_num_hits_overlay);
608  if(n_associated_mcparticle_hits == 0){
609  //This will only occur if the whole recob::PFParticle is associated with an overlay object
610  //std::cout<<fraction_num_hits_overlay<<std::endl;
611  }//for each recob::track/shower in the event
612 
613  //std::cout << "recoMC()\t||\t the number of MCParticles associated with this PFP is "<<objide.size()<<std::endl;
614 
615  if(found_a_match){
616  mcParticleVector.push_back(best_matched_mcparticle);
617  objectToMCParticleMap[object] = mcParticleVector.back();
618  }else{
619  // mcParticleVector.push_back(0);
620  }
621  vec_fraction_matched.push_back(maxe/tote);
622  // if(g_is_verbose){
623  // std::cout << "recoMC()\t||\t the fracrion matched is "<<maxe/tote<<std::endl;
624  // }
625 
626 
627  if(!found_a_match){
628  if(reco_verbose) std::cout << "recoMC()\t||\t NO MATCH NO MATCH (from my loop) for PFP with pdg "<<pdg<<std::endl;
629  if(reco_verbose)std::cout<<" count "<<objectToMCParticleMap.count(object)<<std::endl;
630  }else{
631  //if(reco_verbose)
632  std::cout << "recoMC()\t||\t Final Match (from my loop) for PFP with pdg "<<pdg<<" is " << best_matched_mcparticle->TrackId() << " with energy " << maxe << " over " << tote << " (" << maxe/tote << ")"
633  << " pdg=" << best_matched_mcparticle->PdgCode()
634  << " trkid=" << best_matched_mcparticle->TrackId()
635  << " ke=" << best_matched_mcparticle->E()-best_matched_mcparticle->Mass()<< "\n";
636  }
637 
638  }//end vector loop.
639  //return vec_fraction_matched;
640  return trk_overlay_vec;
641  }
var pdg
Definition: selectors.fcl:14
object (unordered set of name/value pairs)
BEGIN_PROLOG could also be cout
double single_photon::triangle_area ( double  a1,
double  a2,
double  b1,
double  b2,
double  c1,
double  c2 
)

Definition at line 488 of file Processors.cxx.

488  {
489  double m1 = 0.3;
490  double m2 = 1.0/25.0;
491 
492  return fabs((a1*m1*(b2*m2-c2*m2)+b1*m1*(c2*m2-a2*m2)+c1*m1*(a2*m2-b2*m2))/2.0);
493  }
#define a2
#define a1

Variable Documentation

bool single_photon::g_is_verbose = true

Definition at line 13 of file init_branches.h.

const double single_photon::kINVALID_FLOAT = std::numeric_limits<double>::max()
static