MCRecoPart.h
Go to the documentation of this file.
1 #ifndef MCRECOPART_H
2 #define MCRECOPART_H
3 
4 // ART includes
5 namespace fhicl { class ParameterSet; }
6 
7 // LArSoft
11 namespace simb { class MCParticle; }
12 
13 // STL
14 #include <set>
15 #include <vector>
16 
17 namespace sim
18 {
19 
20  class MCMiniPart {
21 
22  public:
23 
24  MCMiniPart() {Reset();}
25 
26  virtual ~MCMiniPart(){}
27 
28  unsigned int _track_id;
30  unsigned int _mother;
31  unsigned int _ancestor;
32  int _pdgcode;
33  TLorentzVector _start_vtx;
34  TLorentzVector _start_mom;
35  TLorentzVector _end_vtx;
36  TLorentzVector _end_mom;
37  std::vector<std::pair<TLorentzVector,TLorentzVector> > _det_path;
38  std::set<unsigned int> _daughters;
40 
41  void Reset(){
42  _track_id = _mother = _ancestor = kINVALID_UINT;
43  _pdgcode = kINVALID_INT;
44  _process = "";
45  _origin = ::simb::kUnknown;
46 
47  TLorentzVector invalid(kINVALID_DOUBLE,
51  _start_vtx = invalid;
52  _start_mom = invalid;
53  _end_vtx = invalid;
54  _end_mom = invalid;
55  _daughters.clear();
56  _det_path.clear();
57  }
58 
59  };
60 
61  class MCRecoPart : public std::vector<sim::MCMiniPart> {
62 
63  public:
64 
65  /// Default constructor with fhicl parameters
66  MCRecoPart(fhicl::ParameterSet const& pset);
67 
68  /// Default destructor
69  virtual ~MCRecoPart(){};
70 
71  void AddParticles(const std::vector<simb::MCParticle>& mcp_v,
72  const std::vector<simb::Origin_t>& orig_v);
73 
74  unsigned int AncestorTrackID(const unsigned int part_index);
75 
76  unsigned int MotherTrackID(const unsigned int part_index) const;
77 
78  /*
79  Take TrackID and returns the corresponding particle unique index number (MCParticle array index)
80  Returns kINVALID_UINT if nothing found.
81  */
82  unsigned int TrackToParticleIndex(const unsigned int track_id) const
83  {
84  auto const iter (_track_index.find(track_id));
85  if(iter==_track_index.end()) return kINVALID_UINT;
86  return (*iter).second;
87  }
88 
89  bool InDetector(const double& x,
90  const double& y,
91  const double& z) const;
92 
93  public:
94 
95  /// Track ID => Index Map
96  std::map<unsigned int, unsigned int> _track_index;
97  //std::map<size_t,size_t> _track_index;
98 
99  /// PDG code list for which particle's trajectory within the detector is saved
100  std::set<int> _pdg_list;
101 
102  protected:
103 
104  double _x_max; //!< x-max of volume box used to determine whether to save track information
105  double _x_min; //!< x-min of volume box used to determine whether to save track information
106  double _y_max; //!< y-max of volume box used to determine whether to save track information
107  double _y_min; //!< y-min of volume box used to determine whether to save track information
108  double _z_max; //!< z-max of volume box used to determine whether to save track information
109  double _z_min; //!< z-min of volume box used to determine whether to save track information
110 
111  }; // class MCRecoPart
112 
113 } //namespace cluster
114 #endif
std::string _process
Definition: MCRecoPart.h:29
const int kINVALID_INT
Definition: MCLimits.h:16
double _z_max
z-max of volume box used to determine whether to save track information
Definition: MCRecoPart.h:108
std::string string
Definition: nybbler.cc:12
enum simb::_ev_origin Origin_t
event origin types
virtual ~MCRecoPart()
Default destructor.
Definition: MCRecoPart.h:69
struct vector vector
double _y_max
y-max of volume box used to determine whether to save track information
Definition: MCRecoPart.h:106
double _y_min
y-min of volume box used to determine whether to save track information
Definition: MCRecoPart.h:107
std::map< unsigned int, unsigned int > _track_index
Track ID => Index Map.
Definition: MCRecoPart.h:96
TLorentzVector _start_vtx
Definition: MCRecoPart.h:33
art framework interface to geometry description
std::vector< std::pair< TLorentzVector, TLorentzVector > > _det_path
Definition: MCRecoPart.h:37
TLorentzVector _start_mom
Definition: MCRecoPart.h:34
double _z_min
z-min of volume box used to determine whether to save track information
Definition: MCRecoPart.h:109
TLorentzVector _end_mom
Definition: MCRecoPart.h:36
virtual ~MCMiniPart()
Definition: MCRecoPart.h:26
TLorentzVector _end_vtx
Definition: MCRecoPart.h:35
::simb::Origin_t _origin
Definition: MCRecoPart.h:39
Code to link reconstructed objects back to the MC truth information.
Base utilities and modules for event generation and detector simulation.
unsigned int _mother
Definition: MCRecoPart.h:30
double _x_max
x-max of volume box used to determine whether to save track information
Definition: MCRecoPart.h:104
double _x_min
x-min of volume box used to determine whether to save track information
Definition: MCRecoPart.h:105
std::set< int > _pdg_list
PDG code list for which particle&#39;s trajectory within the detector is saved.
Definition: MCRecoPart.h:100
const unsigned int kINVALID_UINT
Definition: MCLimits.h:14
list x
Definition: train.py:276
unsigned int _track_id
Definition: MCRecoPart.h:28
static const double kINVALID_DOUBLE
unsigned int TrackToParticleIndex(const unsigned int track_id) const
Definition: MCRecoPart.h:82
std::set< unsigned int > _daughters
Definition: MCRecoPart.h:38
unsigned int _ancestor
Definition: MCRecoPart.h:31