Belle II Software  release-05-01-25
SensorTraversal.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010-2015 Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Martin Ritter *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #ifndef SENSORTRAVERSAL_H
12 #define SENSORTRAVERSAL_H
13 
14 #include <G4ThreeVector.hh>
15 
16 namespace Belle2 {
21  namespace claws {
27  class SensorTraversal {
28  public:
34  void add(const G4ThreeVector& position, double depEnergy, double visibleEnergy, double length)
35  {
36  m_depEnergy += depEnergy;
37  m_visibleEnergy += visibleEnergy;
38  m_length += length;
39  m_exitPosition = position;
40  }
41 
43  int getTrackID() const { return m_trackID; }
45  int getLadderID() const { return m_ladderID; }
47  int getSensorID() const { return m_sensorID; }
49  int getPDGCode() const { return m_pdgCode; }
51  double getDepEnergy() const { return m_depEnergy; }
53  double getVisibleEnergy() const { return m_visibleEnergy; }
55  double getLength() const { return m_length; }
57  double getEntryTime() const { return m_entryTime; }
59  const G4ThreeVector& getEntryMomentum() const { return m_entryMomentum; }
61  const G4ThreeVector& getEntryPosition() const { return m_entryPosition; }
63  const G4ThreeVector& getExitPosition() const { return m_exitPosition; }
64 
66  bool isContained() const { return m_contained; }
68  bool isPrimary() const { return m_primary; }
69 
71  void hasEntered() { m_contained = false; }
73  void hasLeft() { m_contained = false; }
74 
76  void setInitial(int trackID, int ladderID, int sensorID, int pdgCode, bool primary, const G4ThreeVector& position,
77  const G4ThreeVector& momentum, double time)
78  {
79  m_trackID = trackID;
80  m_ladderID = ladderID;
81  m_sensorID = sensorID;
82  m_pdgCode = pdgCode;
83  m_primary = primary;
84  m_entryPosition = position;
85  m_entryMomentum = momentum;
86  m_entryTime = time;
87  }
88 
90  void reset()
91  {
92  m_trackID = 0;
93  m_ladderID = 0;
94  m_sensorID = 0;
95  m_pdgCode = 0;
96  m_depEnergy = 0;
97  m_visibleEnergy = 0;
98  m_length = 0;
99  m_contained = true;
100  m_primary = false;
101  m_entryTime = 0;
102  }
103 
105  bool check(int trackID, int ladderID, int sensorID)
106  {
107  // object not set yet so we can use it
108  if (m_trackID == 0) return true;
109  return (trackID == m_trackID && ladderID == m_ladderID && sensorID == m_sensorID);
110  }
111 
112  private:
114  G4ThreeVector m_entryMomentum;
116  G4ThreeVector m_entryPosition;
118  G4ThreeVector m_exitPosition;
120  int m_trackID {0};
122  int m_ladderID {0};
124  int m_sensorID {0};
126  int m_pdgCode {0};
128  double m_depEnergy {0};
130  double m_visibleEnergy {0};
132  double m_length {0};
134  double m_entryTime {0};
136  bool m_contained {true};
138  bool m_primary {false};
139  };
140 
141  }
143 } //Belle2 namespace
144 #endif // SENSORTRAVERSAL_H
Belle2::claws::SensorTraversal::getExitPosition
const G4ThreeVector & getExitPosition() const
get exit position
Definition: SensorTraversal.h:71
Belle2::claws::SensorTraversal::m_sensorID
int m_sensorID
Sensor ID.
Definition: SensorTraversal.h:132
Belle2::claws::SensorTraversal::getDepEnergy
double getDepEnergy() const
get total energy deposition
Definition: SensorTraversal.h:59
Belle2::claws::SensorTraversal::getEntryTime
double getEntryTime() const
get entry time
Definition: SensorTraversal.h:65
Belle2::claws::SensorTraversal::check
bool check(int trackID, int ladderID, int sensorID)
check if a track belongs to this object
Definition: SensorTraversal.h:113
Belle2::claws::SensorTraversal::isContained
bool isContained() const
return whether the track was contained in the volume so far
Definition: SensorTraversal.h:74
Belle2::claws::SensorTraversal::m_primary
bool m_primary
Indication whether track is from a primary particle.
Definition: SensorTraversal.h:146
Belle2::claws::SensorTraversal::hasEntered
void hasEntered()
indicate that the track originated outisde the current volume
Definition: SensorTraversal.h:79
Belle2::claws::SensorTraversal::getEntryMomentum
const G4ThreeVector & getEntryMomentum() const
get entry momentum
Definition: SensorTraversal.h:67
Belle2::claws::SensorTraversal::getEntryPosition
const G4ThreeVector & getEntryPosition() const
get entry position
Definition: SensorTraversal.h:69
Belle2::claws::SensorTraversal::m_exitPosition
G4ThreeVector m_exitPosition
Exit Position.
Definition: SensorTraversal.h:126
Belle2::claws::SensorTraversal::m_length
double m_length
length of the sensor traversal
Definition: SensorTraversal.h:140
Belle2::claws::SensorTraversal::getLadderID
int getLadderID() const
get the ladder ID
Definition: SensorTraversal.h:53
Belle2::claws::SensorTraversal::getTrackID
int getTrackID() const
get Geant4 trackID
Definition: SensorTraversal.h:51
Belle2::claws::SensorTraversal::m_entryMomentum
G4ThreeVector m_entryMomentum
Entry Position.
Definition: SensorTraversal.h:122
Belle2::claws::SensorTraversal::getSensorID
int getSensorID() const
get the sensor ID
Definition: SensorTraversal.h:55
Belle2::claws::SensorTraversal::m_entryPosition
G4ThreeVector m_entryPosition
Entry Position.
Definition: SensorTraversal.h:124
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::claws::SensorTraversal::getLength
double getLength() const
get flight length so far
Definition: SensorTraversal.h:63
Belle2::claws::SensorTraversal::getPDGCode
int getPDGCode() const
get PDG code of the particle
Definition: SensorTraversal.h:57
Belle2::claws::SensorTraversal::m_depEnergy
double m_depEnergy
Total deposited energy by this track.
Definition: SensorTraversal.h:136
Belle2::claws::SensorTraversal::reset
void reset()
reset to be used again
Definition: SensorTraversal.h:98
Belle2::claws::SensorTraversal::getVisibleEnergy
double getVisibleEnergy() const
get visible energy deposition
Definition: SensorTraversal.h:61
Belle2::claws::SensorTraversal::m_contained
bool m_contained
Indication wether the track is completely contained inside the volume.
Definition: SensorTraversal.h:144
Belle2::claws::SensorTraversal::m_ladderID
int m_ladderID
Ladder ID.
Definition: SensorTraversal.h:130
Belle2::claws::SensorTraversal::isPrimary
bool isPrimary() const
return whether the track belongs to a primary particle
Definition: SensorTraversal.h:76
Belle2::claws::SensorTraversal::m_trackID
int m_trackID
Geant4 Track ID.
Definition: SensorTraversal.h:128
Belle2::claws::SensorTraversal::m_visibleEnergy
double m_visibleEnergy
Total visible energy by this track.
Definition: SensorTraversal.h:138
Belle2::claws::SensorTraversal::add
void add(const G4ThreeVector &position, double depEnergy, double visibleEnergy, double length)
add a new step
Definition: SensorTraversal.h:42
Belle2::claws::SensorTraversal::hasLeft
void hasLeft()
indicate that the track left the current volume
Definition: SensorTraversal.h:81
Belle2::claws::SensorTraversal::setInitial
void setInitial(int trackID, int ladderID, int sensorID, int pdgCode, bool primary, const G4ThreeVector &position, const G4ThreeVector &momentum, double time)
set initial values for a new track
Definition: SensorTraversal.h:84
Belle2::claws::SensorTraversal::m_pdgCode
int m_pdgCode
PDG code for the particle.
Definition: SensorTraversal.h:134
Belle2::claws::SensorTraversal::m_entryTime
double m_entryTime
time the track entered the volume
Definition: SensorTraversal.h:142