All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
helper_PandoraPFParticles.h
Go to the documentation of this file.
1 #ifndef HELPER_PANDORAPFPARTICLES_H
2 #define HELPER_PANDORAPFPARTICLES_H
3 
4 #include "art/Framework/Principal/Handle.h"
5 #include "art/Framework/Services/Registry/ServiceHandle.h"
6 
18 
27 
28 #include "nusimdata/SimulationBase/MCParticle.h"
29 #include "nusimdata/SimulationBase/MCTruth.h"
30 #include "nusimdata/SimulationBase/simb.h"
31 #include "nusimdata/SimulationBase/MCFlux.h"
32 #include "nusimdata/SimulationBase/GTruth.h"
34 
35 #include "canvas/Utilities/ensurePointer.h"
36 #include "canvas/Persistency/Common/FindManyP.h"
37 #include "canvas/Persistency/Common/FindMany.h"
38 #include "canvas/Persistency/Common/FindOneP.h"
39 #include "canvas/Persistency/Common/FindOne.h"
40 
41 #include "messagefacility/MessageLogger/MessageLogger.h"
42 
43 
44 #include <utility>
45 #include <iostream>
46 #include <string>
47 #include <numeric>
48 #include <algorithm>
49 #include <vector>
50 #include <sys/stat.h>
51 
52 
53 
54 namespace single_photon
55 {
57 
58  private:
59  double pVertex_pos[3] = {-9999,-9999,-9999};
60 
61  double pNuScore = -999 ;
62  double pTrackScore = -999;
63 
64  bool pIsNeutrino = false;
65  bool pIsClearCosmic = false;
66  bool pIsNuSlice = false; //it is defined in the DefineNuSlice() function.
67  bool pHasPID = false;
68 
69  int pHasShower = 0;
70  int pHasTrack = 0;
71  int pPdgCode = -999;
72  int pPFParticleID = -9;
73  int pAncestorID = -9;
74  int pSliceID = -9;
75 
76 
77  public:
78  //constructor:
80  art::Ptr<recob::PFParticle> input_PFParticle,
81  std::vector< art::Ptr< larpandoraobj::PFParticleMetadata > > input_MetaData,
82  std::vector< art::Ptr<recob::Vertex > > input_Vertex,
83  std::vector< art::Ptr<recob::Cluster> > input_Clusters,
84  std::vector< art::Ptr<recob::Shower > > input_Showers,
85  std::vector< art::Ptr<recob::Track > > input_Tracks,
86  art::FindManyP<recob::Hit> input_Hits );
87 
88  art::Ptr< recob::PFParticle > pPFParticle;
89  art::Ptr< recob::Shower> pShower; //with 0 or 1 element
90  art::Ptr< recob::Track > pTrack; //with 0 or 1 element
91  art::Ptr< recob::Slice > pSlice; //in helper_connector.h get the id from pSlice->key()
92  art::Ptr< recob::PFParticle > pAncestor; //found by tracing Parent()
93 
94  art::Ptr<anab::ParticleID> pParticleID; //for track only;
95  art::Ptr< simb::MCTruth > pMCTruth;//WARNING NOT USED YET
96 
97  std::vector< art::Ptr< larpandoraobj::PFParticleMetadata > > pMetaData;
98  std::vector< art::Ptr< recob::Vertex > > pVertex;
99  std::vector< art::Ptr< recob::Hit > > pSliceHits;
100  std::vector< art::Ptr< recob::Hit > > pPFPHits;
101  std::vector< art::Ptr< recob::Cluster > > pClusters;
102  std::vector<art::Ptr<anab::Calorimetry>> pCalorimetries;
103  std::vector< art::Ptr< recob::SpacePoint > > pSpacePoints;//WARNING NOT USED YET
104  std::vector< art::Ptr< simb::MCParticle > > pMCParticles;//WARNING NOT USED YET
105 
106 
107  //set methods
108  void set_NuScore (const double input_score){ pNuScore = input_score; }
109  void set_IsNuSlice (const bool input_bool){ pIsNuSlice = input_bool; }
110  void set_HasPID (const bool input_bool){ pHasPID = input_bool; }
111 
112  void set_AncestorID (const int input_number){ pAncestorID = input_number; }
113  void set_SliceID (const int input_number){ pSliceID = input_number; }
114 
115  void set_ParticleID (const art::Ptr<anab::ParticleID> input_ParticleID){pParticleID = input_ParticleID; }
116  void set_Calorimetries (const std::vector<art::Ptr<anab::Calorimetry>> input_Calorimetries){pCalorimetries = input_Calorimetries; }
117 
118  //call method
119  const art::Ptr<anab::ParticleID> get_ParticleID() const;
120  const std::vector<art::Ptr<anab::Calorimetry>> get_Calorimetries() const;
121 
122 
123  const double* get_Vertex_pos() const;
124 
125  const double get_NuScore() const;
126  const double get_TrackScore () const;
127 
128  const bool get_IsNeutrino () const;
129  const bool get_IsClearCosmic () const;
130  const bool get_IsNuSlice () const;
131  const bool get_HasPID () const;
132 
133  const int get_HasShower () const;
134  const int get_HasTrack () const;
135  const int get_PdgCode() const;
136  const int get_PFParticleID() const;
137  const int get_AncestorID() const;
138  const int get_SliceID () const;
139  };
140 
141  inline const art::Ptr<anab::ParticleID> PandoraPFParticle::get_ParticleID() const { return pParticleID; }
142  inline const std::vector<art::Ptr<anab::Calorimetry>> PandoraPFParticle::get_Calorimetries() const { return pCalorimetries; }
143 
144  inline const double* PandoraPFParticle::get_Vertex_pos() const { return pVertex_pos; }
145 
146  inline const double PandoraPFParticle::get_NuScore() const { return pNuScore; }
147  inline const double PandoraPFParticle::get_TrackScore () const { return pTrackScore; }
148 
149  inline const bool PandoraPFParticle::get_IsNeutrino () const { return pIsNeutrino; }
150  inline const bool PandoraPFParticle::get_IsClearCosmic () const { return pIsClearCosmic; }
151  inline const bool PandoraPFParticle::get_IsNuSlice () const { return pIsNuSlice; }
152  inline const bool PandoraPFParticle::get_HasPID () const { return pHasPID; }
153 
154  inline const int PandoraPFParticle::get_HasShower () const { return pHasShower; }
155  inline const int PandoraPFParticle::get_HasTrack () const { return pHasTrack; }
156  inline const int PandoraPFParticle::get_PdgCode() const { return pPdgCode; }
157  inline const int PandoraPFParticle::get_PFParticleID() const { return pPFParticleID; }
158  inline const int PandoraPFParticle::get_AncestorID() const { return pAncestorID; }
159  inline const int PandoraPFParticle::get_SliceID () const { return pSliceID; }
160 
161 
162 
163 //helper functions exclusively for PandoraPFParticles
164 
165 //1. Filler for each PandoraPFParticle
166  //find pAncestor & pAncesotrID
167  void PPFP_FindAncestor ( std::vector< PandoraPFParticle > & PPFPs);
168 
169  //Fill pSlice, pHits, pSliceID
170  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);
171 
172  //refill pNuScore and pIsNuSlice
173  int DefineNuSlice(std::vector< PandoraPFParticle > & PPFPs);
174 
175 //2. Trackers to find the correct PandoraPFParticle based on different inputs
176  PandoraPFParticle *PPFP_GetPPFPFromShower( std::vector< PandoraPFParticle > & PPFPs, art::Ptr<recob::Shower> pShower);
177  PandoraPFParticle* PPFP_GetPPFPFromTrack( std::vector< PandoraPFParticle > & PPFPs, art::Ptr<recob::Track> pTrack);
178  PandoraPFParticle* PPFP_GetPPFPFromPFID( std::vector< PandoraPFParticle > & PPFPs, int id);
179 
180 }
181 
182 #endif
PandoraPFParticle * PPFP_GetPPFPFromPFID(std::vector< PandoraPFParticle > &PPFPs, int id)
void set_ParticleID(const art::Ptr< anab::ParticleID > input_ParticleID)
std::vector< art::Ptr< recob::Cluster > > pClusters
int DefineNuSlice(std::vector< PandoraPFParticle > &PPFPs)
Declaration of signal hit object.
art::Ptr< recob::PFParticle > pPFParticle
Contains data associated to particles from detector simulation.
const std::vector< art::Ptr< anab::Calorimetry > > get_Calorimetries() const
const art::Ptr< anab::ParticleID > get_ParticleID() const
void PPFP_FindAncestor(std::vector< PandoraPFParticle > &PPFPs)
std::vector< art::Ptr< recob::Hit > > pPFPHits
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
art::Ptr< recob::PFParticle > pAncestor
void set_NuScore(const double input_score)
std::vector< art::Ptr< recob::Hit > > pSliceHits
std::vector< art::Ptr< recob::Vertex > > pVertex
std::vector< art::Ptr< larpandoraobj::PFParticleMetadata > > pMetaData
art::Ptr< anab::ParticleID > pParticleID
std::vector< art::Ptr< simb::MCParticle > > pMCParticles
Declaration of cluster object.
Class def header for mctrack data container.
PandoraPFParticle * PPFP_GetPPFPFromTrack(std::vector< PandoraPFParticle > &PPFPs, art::Ptr< recob::Track > pTrack)
void set_Calorimetries(const std::vector< art::Ptr< anab::Calorimetry >> input_Calorimetries)
Provides recob::Track data product.
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)
std::vector< art::Ptr< recob::SpacePoint > > pSpacePoints
void set_AncestorID(const int input_number)
PandoraPFParticle * PPFP_GetPPFPFromShower(std::vector< PandoraPFParticle > &PPFPs, art::Ptr< recob::Shower > pShower)
object containing MC truth information necessary for making RawDigits and doing back tracking ...
Class def header for MCShower data container.
void set_HasPID(const bool input_bool)
std::vector< art::Ptr< anab::Calorimetry > > pCalorimetries
PandoraPFParticle(art::Ptr< recob::PFParticle > input_PFParticle, std::vector< art::Ptr< larpandoraobj::PFParticleMetadata > > input_MetaData, std::vector< art::Ptr< recob::Vertex > > input_Vertex, std::vector< art::Ptr< recob::Cluster > > input_Clusters, std::vector< art::Ptr< recob::Shower > > input_Showers, std::vector< art::Ptr< recob::Track > > input_Tracks, art::FindManyP< recob::Hit > input_Hits)
helper function for LArPandoraInterface producer module
void set_SliceID(const int input_number)
void set_IsNuSlice(const bool input_bool)