3 namespace single_photon
6 art::Ptr<recob::PFParticle> input_PFParticle,
7 std::vector< art::Ptr< larpandoraobj::PFParticleMetadata > > input_MetaData,
8 std::vector< art::Ptr<recob::Vertex > > input_Vertex,
9 std::vector< art::Ptr<recob::Cluster> > input_Clusters,
10 std::vector< art::Ptr<recob::Shower > > input_Showers,
11 std::vector< art::Ptr<recob::Track > > input_Tracks,
12 art::FindManyP<recob::Hit> input_Hits
15 pPFParticle(input_PFParticle),
16 pMetaData(input_MetaData),
17 pVertex(input_Vertex),
18 pClusters(input_Clusters)
24 const unsigned int nShowers(input_Showers.size());
25 const unsigned int nTracks(input_Tracks.size());
26 if(nShowers+nTracks != 1) mf::LogDebug(
"SinglePhoton") <<
" No just one shower/track is associated to PFParticle " <<
pPFParticleID <<
"\n";
41 for(
size_t index=0; index<
pClusters.size(); ++index){
43 std::vector< art::Ptr<recob::Hit > > temp_hits = input_Hits.at(
cluster.key());
55 std::map<std::string, float> propertiesmap = meta->GetPropertiesMap();
56 if(propertiesmap.count(
"NuScore")==1)
pNuScore = propertiesmap[
"NuScore"];
57 if(propertiesmap.count(
"TrackScore")==1)
pTrackScore = propertiesmap[
"TrackScore"];
58 if(propertiesmap.count(
"IsNeutrino")==1)
pIsNeutrino =
true;
67 std::map< size_t, art::Ptr<recob::PFParticle>> pfParticleMap;
68 int pfp_size = PPFPs.size();
70 for(
int index = 0; index < pfp_size; 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!";
78 for(
int jndex = 0; jndex < pfp_size; jndex++){
79 art::Ptr< recob::PFParticle > temp_pfp = PPFPs[jndex].pPFParticle;
81 PPFPs[jndex].set_AncestorID(temp_pfp->Self() );
82 PPFPs[jndex].pAncestor = pfParticleMap[temp_pfp->Self()];
83 if(temp_pfp->IsPrimary())
continue;
85 while(!(PPFPs[jndex].pAncestor)->IsPrimary()){
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];
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;
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() );
119 int pfp_size = PPFPs.size();
120 double best_nuscore = 0;
121 int best_nuscore_SliceID = 0;
122 std::vector< int > IDs;
124 for(
int index = 0; index < pfp_size; index++){
129 if(!
std::count(IDs.begin(), IDs.end(), temp_sliceID) ) IDs.push_back(temp_sliceID);
130 if(best_nuscore < temp_p->get_NuScore() ){
141 for(
int index = 0; index < pfp_size; index++){
146 return best_nuscore_SliceID;
151 int pfp_size = PPFPs.size();
152 for(
int index = 0; index < pfp_size; index++){
153 if(PPFPs[index].get_HasShower() != 1 )
continue;
156 if((pShower->ShowerStart() == PPFPs[index].pShower->ShowerStart())
157 && (pShower->Direction() == PPFPs[index].pShower->Direction())){
158 return &PPFPs[index];
161 std::cout<<
"Error, no PFParticle matched to shower, returning the first element"<<std::endl;
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];
175 std::cout<<
"Error, no PFParticle matched to track, returning the first element"<<std::endl;
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];
187 std::cout<<
"Error, no PFParticle matched to track, returning the first element"<<std::endl;
PandoraPFParticle * PPFP_GetPPFPFromPFID(std::vector< PandoraPFParticle > &PPFPs, int id)
std::vector< art::Ptr< recob::Cluster > > pClusters
art::Ptr< recob::Track > pTrack
int DefineNuSlice(std::vector< PandoraPFParticle > &PPFPs)
art::Ptr< recob::Shower > pShower
art::Ptr< recob::PFParticle > pPFParticle
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.
art::Ptr< recob::PFParticle > pAncestor
std::vector< art::Ptr< recob::Vertex > > pVertex
std::vector< art::Ptr< larpandoraobj::PFParticleMetadata > > pMetaData
PandoraPFParticle * PPFP_GetPPFPFromTrack(std::vector< PandoraPFParticle > &PPFPs, art::Ptr< recob::Track > pTrack)
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)
const int get_SliceID() const
PandoraPFParticle * PPFP_GetPPFPFromShower(std::vector< PandoraPFParticle > &PPFPs, art::Ptr< recob::Shower > pShower)
const double get_NuScore() const
const bool get_IsNeutrino() const
std::size_t count(Cont const &cont)
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)
void set_IsNuSlice(const bool input_bool)
BEGIN_PROLOG could also be cout