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