33 if(!part_v.size())
return;
36 std::vector<std::multimap<double,unsigned int> > daughter_map;
37 for(
size_t i=0; i<part_v.size(); ++i) {
39 auto const& mcp = part_v[i];
41 int candidate_mom_index=-1;
42 if( mcp._pdgcode == 22 ||
45 candidate_mom_index = i;
47 unsigned int mom_track = mcp._mother;
51 unsigned int mom_index = (*mom_iter).second;
53 if( part_v.at(mom_index)._pdgcode == 22 || part_v.at(mom_index)._pdgcode == 11 || part_v.at(mom_index)._pdgcode == -11 )
55 candidate_mom_index = mom_index;
57 mom_iter = part_v.
_track_index.find(part_v.at(mom_index)._mother);
61 if(candidate_mom_index >= 0) {
63 auto candidate_mom_iter =
_shower_index.find(candidate_mom_index);
66 daughter_map.push_back(std::multimap<double,unsigned int>());
69 daughter_map.at(shower_index).insert(std::make_pair((
double)(mcp._start_vtx[3]),(
unsigned int)i));
75 <<
"Found a particle that does not belong to a shower!" <<
std::endl 76 << Form(
" PDGID: %d ... Track %d @ (%g,%g,%g,%g) with (%g,%g,%g,%g)",
101 for(
auto const &part_index : daughter_map.at(mom.second))
105 auto const& mcp = part_v.at(mom.first);
108 << Form(
"PDGID: %d ... Track %d @ (%g,%g,%g,%g) with (%g,%g,%g,%g) ... %zu daughters!",
std::vector< int > _shower_id
Track index to shower index map.
std::map< unsigned int, unsigned int > _track_index
Track ID => Index Map.
std::vector< std::vector< unsigned int > > _shower_daughters
Shower time-ordered daughters.
MCShowerRecoPart(fhicl::ParameterSet const &pset)
Default constructor with fhicl parameters.
T get(std::string const &key) const
static const int kINVALID_INT
bool _debug_mode
lots of stdout stream
static int max(int a, int b)
Code to link reconstructed objects back to the MC truth information.
std::map< unsigned int, unsigned int > _shower_index
Shower Primary Index ID => Shower Index Map.
static const unsigned int kINVALID_UINT
second_as<> second
Type of time stored in seconds, in double precision.
void ConstructShower(const MCRecoPart &part_v)
Main function to read-in data and fill variables in this algorithm to reconstruct MC shower...
QTextStream & endl(QTextStream &s)