All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MCShowerRecoPart.h
Go to the documentation of this file.
1 #ifndef MCSHOWERRECOPART_H
2 #define MCSHOWERRECOPART_H
3 
4 // ART includes
5 namespace fhicl { class ParameterSet; }
6 #include "cetlib_except/exception.h"
7 
8 // LArSoft
9 namespace sim {
10  class MCRecoPart;
11 }
12 
13 // STL
14 #include <map>
15 #include <vector>
16 
17 namespace sim
18 {
19 
21 
22  public:
23  static const unsigned int kINVALID_UINT;
24  static const int kINVALID_INT;
25 
26  public:
27 
28  /// Default constructor with fhicl parameters
29  explicit MCShowerRecoPart(fhicl::ParameterSet const& pset);
30  //ClusterMergeAlg(fhicl::ParameterSet const& pset, art::ActivityRegistry& reg);
31 
32  /// Main function to read-in data and fill variables in this algorithm to reconstruct MC shower
33  void ConstructShower(const MCRecoPart& part_v);
34 
35  /**
36  Returns a list ot daughter particle index numbers for the specified shower
37  with the shower index number as an input
38  */
39  const std::vector<unsigned int>& ShowerDaughters(const unsigned int shower_id) const
40  {
41  if(shower_id >= _shower_daughters.size()) throw cet::exception(__FUNCTION__) << "Invalid shower index!";
42  return _shower_daughters.at(shower_id);
43  }
44 
45  /**
46  Returns a list of shower-mother's particle index. Order respects shower index number.
47  */
48  const std::vector<unsigned int> ShowerMothers() const
49  {
50  std::vector<unsigned int> mothers(_shower_index.size(),0);
51  for(auto mother_iter = _shower_index.begin(); mother_iter!=_shower_index.end(); ++mother_iter)
52  mothers.at((*mother_iter).second) = (*mother_iter).first;
53  return mothers;
54  }
55 
56  //--------------- Particle Information Getters -----------------//
57 
58  /**
59  Take particle index number and returns shower index number to which this particle belongs.
60  Returns -1 if a particle does not belong to any MC shower. Returns kINVALID_INT if input is invalid.
61  */
62  int ShowerIndex(const unsigned int part_index) const
63  {
64  if(_shower_id.size() <= part_index) return kINVALID_INT;
65  return _shower_id.at(part_index);
66  }
67 
68  protected:
69 
70  /// lots of stdout stream
72 
73  /// Track index to shower index map
74  std::vector<int> _shower_id;
75 
76  //
77  // shower-indexed-variables
78  //
79  /// Shower Primary Index ID => Shower Index Map
80  std::map<unsigned int, unsigned int> _shower_index;
81 
82  /// Shower time-ordered daughters
83  std::vector<std::vector<unsigned int> > _shower_daughters;
84 
85  }; // class MCShowerRecoPart
86 
87 } //namespace cluster
88 #endif
std::vector< int > _shower_id
Track index to shower index map.
const std::vector< unsigned int > ShowerMothers() const
std::vector< std::vector< unsigned int > > _shower_daughters
Shower time-ordered daughters.
MCShowerRecoPart(fhicl::ParameterSet const &pset)
Default constructor with fhicl parameters.
static const int kINVALID_INT
int ShowerIndex(const unsigned int part_index) const
bool _debug_mode
lots of stdout stream
const std::vector< unsigned int > & ShowerDaughters(const unsigned int shower_id) const
std::map< unsigned int, unsigned int > _shower_index
Shower Primary Index ID =&gt; Shower Index Map.
static const unsigned int kINVALID_UINT
void ConstructShower(const MCRecoPart &part_v)
Main function to read-in data and fill variables in this algorithm to reconstruct MC shower...