Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions duneana/CAFMaker/CAFMaker_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,9 @@ namespace caf {
//Creating the FD interaction record where we are going to save the tracks/showers in parallel to the PFPs objects
caf::SRFDInt fdIxn;

//Mapping particle idx in the vector to their Pandora ID for later use
std::map<unsigned int, int> pandoraIDToPFPIdx;

//Iterating on all the PFParticles to fill the reco particles
for (unsigned int n = 0; n < particleVector.size(); ++n) {
const art::Ptr<recob::PFParticle> particle = particleVector.at(n);
Expand All @@ -960,6 +963,13 @@ namespace caf {
//TODO: Not filling the momentum information as it requires some specific PID to be made.
// particle_record.p;

//Pre-fill the parent and daughter fields with the Pandora IDs. They will be converted to SR indices later.
particle_record.parent = (particle_record.primary) ? -1 : particle->Parent(); //Setting to -1 if primary as there is no saved record for the neutrino
for(auto const& daughter_id : particle->Daughters()){
particle_record.daughters.push_back(daughter_id);
}
pandoraIDToPFPIdx[particle->Self()] = fdIxn.npfps;

FillTruthMatchingAndOverlap(particle, evt, particle_record.truth, particle_record.truthOverlap);
particle_record.walldist = GetWallDistance(*particle, evt); //Getting the distance to the wall for this PFP
particle_record.contained = (particle_record.walldist < fContainedDistThreshold); //Setting the contained flag based on the distance to the wall
Expand Down Expand Up @@ -1095,6 +1105,34 @@ namespace caf {

}

//Now that all particles are saved, we can convert the parent/daughter fields from Pandora IDs to SR indices
for(auto &particle : recoParticlesBranch.pandora){
//Parent
if(particle.parent == -1) continue; //Skipping if primary
unsigned int parent_pfpID = particle.parent;
//Finding the SR index in the map
if(pandoraIDToPFPIdx.count(parent_pfpID) == 0){
mf::LogWarning("CAFMaker") << "No SR index found for parent PFP ID " << parent_pfpID;
particle.parent = -1; //Setting to -1 to avoid confusion
}
else{
particle.parent = pandoraIDToPFPIdx.at(parent_pfpID);
}

//Daughters
for(auto &daughter_idx : particle.daughters){
unsigned int daughter_pfpID = daughter_idx;
//Finding the SR index in the map
if(pandoraIDToPFPIdx.count(daughter_pfpID) == 0){
mf::LogWarning("CAFMaker") << "No SR index found for daughter PFP ID " << daughter_pfpID;
daughter_idx = -1; //Setting to -1 to avoid confusion
}
else{
daughter_idx = pandoraIDToPFPIdx.at(daughter_pfpID);
}
}
}

//Saving the FD interaction record
fdBranch.pandora.push_back(std::move(fdIxn));
fdBranch.npandora++;
Expand Down
2 changes: 1 addition & 1 deletion ups/product_deps
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ product version
cetmodules v3_24_01 - only_for_build
dunereco v10_14_00d00
duneopdet v10_14_00d00
duneanaobj v03_11_00
duneanaobj v03_12_00
systematicstools v01_04_04
end_product_list
####################################
Expand Down