38 if (!part_v.size())
return;
41 std::vector<std::multimap<double, unsigned int>> daughter_map;
42 for (
size_t i = 0; i < part_v.size(); ++i) {
44 auto const& mcp = part_v[i];
46 int candidate_mom_index = -1;
47 if (mcp._pdgcode == 22 || mcp._pdgcode == 11 || mcp._pdgcode == -11) candidate_mom_index = i;
49 unsigned int mom_track = mcp._mother;
53 unsigned int mom_index = (*mom_iter).second;
55 if (part_v.at(mom_index)._pdgcode == 22 || part_v.at(mom_index)._pdgcode == 11 ||
56 part_v.at(mom_index)._pdgcode == -11)
58 candidate_mom_index = mom_index;
60 mom_iter = part_v.
_track_index.find(part_v.at(mom_index)._mother);
63 if (candidate_mom_index >= 0) {
65 auto candidate_mom_iter =
_shower_index.find(candidate_mom_index);
68 std::make_pair((
unsigned int)candidate_mom_index, (
unsigned int)
_shower_index.size()));
69 daughter_map.push_back(std::multimap<double, unsigned int>());
72 daughter_map.at(shower_index)
73 .insert(std::make_pair((
double)(mcp._start_vtx[3]), (
unsigned int)i));
78 std::cout <<
"Found a particle that does not belong to a shower!" << std::endl
79 << Form(
" PDGID: %d ... Track %d @ (%g,%g,%g,%g) with (%g,%g,%g,%g)",
96 std::cout << Form(
"Found %zu MCShowers....",
_shower_index.size()) << std::endl;
102 for (
auto const& part_index : daughter_map.at(mom.second))
106 auto const& mcp = part_v.at(mom.first);
109 << 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
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...