/home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/io/include/RAT/TrackNode.hh Source File

Ratpac-two: /home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/io/include/RAT/TrackNode.hh Source File
Ratpac-two
TrackNode.hh
1 #ifndef __RAT_TrackNode__
2 #define __RAT_TrackNode__
3 
4 #include <RAT/DS/MCTrackStep.hh>
5 
6 namespace RAT {
7 
8 class TrackNode : public DS::MCTrackStep {
9  public:
10  TrackNode() {
11  trackStart = true;
12  prev = next = 0;
13  };
14  virtual ~TrackNode() {
15  if (next) delete next;
16  for (unsigned i = 0; i < child.size(); i++)
17  if (child[i]) delete child[i];
18  };
19 
21  virtual bool IsTrackStart() const { return trackStart; };
22  virtual void SetTrackStart(bool state = true) { trackStart = state; };
23 
25  virtual bool IsTrackEnd() const { return next == 0; };
26 
32  virtual int GetTrackID() const { return trackID; };
33  virtual void SetTrackID(int _trackID) { trackID = _trackID; };
34 
36  virtual int GetStepID() const { return stepID; };
37  virtual void SetStepID(int _stepID) { stepID = _stepID; };
38 
40  virtual int GetPDGCode() const { return pdgcode; };
41  virtual void SetPDGCode(int _pdgcode) { pdgcode = _pdgcode; };
42 
47  virtual const std::string &GetParticleName() const { return particleName; };
48  virtual void SetParticleName(const std::string &_particleName) { particleName = _particleName; }
49 
50  // Step information inherited from DS::MCTrackStep
51 
52  virtual TrackNode *GetPrev() const { return prev; };
53  virtual void SetPrev(TrackNode *_prev) { prev = _prev; };
54 
55  virtual TrackNode *GetNext() const { return next; };
56  virtual void SetNext(TrackNode *_next) { next = _next; };
57 
58  std::vector<TrackNode *> child; // Any additional tracks connected to this one
59  // Not using TClonesArray because this object does not go into a TTree ever!
60 
61  // Util methods
62  void AddNext(TrackNode *n) {
63  n->prev = this;
64  n->trackStart = false;
65  next = n;
66  };
67  void AddChild(TrackNode *c) {
68  c->prev = this;
69  c->trackStart = true;
70  child.push_back(c);
71  };
72  virtual TrackNode &operator=(const DS::MCTrackStep &rhs) {
73  *dynamic_cast<DS::MCTrackStep *>(this) = rhs;
74  return *this;
75  };
76 
77  ClassDef(TrackNode, 2);
78 
79  protected:
80  bool trackStart;
81  int trackID;
82  int stepID;
83  int pdgcode;
84  std::string particleName;
85 
86  TrackNode *prev;
87  TrackNode *next; // Next node for this same particle
88 };
89 
90 } // namespace RAT
91 
92 #endif
Definition: MCTrackStep.hh:29
Definition: TrackNode.hh:8
virtual int GetTrackID() const
Definition: TrackNode.hh:32
virtual int GetStepID() const
Definition: TrackNode.hh:36
virtual const std::string & GetParticleName() const
Definition: TrackNode.hh:47
virtual bool IsTrackStart() const
Definition: TrackNode.hh:21
virtual bool IsTrackEnd() const
Definition: TrackNode.hh:25
virtual int GetPDGCode() const
Definition: TrackNode.hh:40
Definition: CCCrossSecMessenger.hh:29