AuxDetSimChannel.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 ///
3 /// \file SimulationDataProducts/AuxDetSimChannel.cxx
4 ///
5 ////////////////////////////////////////////////////////////////////////
6 
7 
8 // our header
10 
11 // C/C++ standard library
12 #include <limits> // std::numeric_limits<>
13 #include <stdexcept>
14 
15 
16 namespace gar {
17  namespace sdp{
18 
19  // Default constructor
20  //-------------------------------------------------
22  : trackID (std::numeric_limits<int >::min())
23  , energyDeposited(std::numeric_limits<float>::min())
24  , entryX (std::numeric_limits<float>::min())
25  , entryY (std::numeric_limits<float>::min())
26  , entryZ (std::numeric_limits<float>::min())
27  , entryT (std::numeric_limits<float>::min())
28  , exitX (std::numeric_limits<float>::min())
29  , exitY (std::numeric_limits<float>::min())
30  , exitZ (std::numeric_limits<float>::min())
31  , exitT (std::numeric_limits<float>::min())
32  , exitMomentumX (std::numeric_limits<float>::min())
33  , exitMomentumY (std::numeric_limits<float>::min())
34  , exitMomentumZ (std::numeric_limits<float>::min())
35  {}
36 
37  // Copy with offset constructor
38  //-------------------------------------------------
40  int offset)
41  : trackID (ide.trackID+offset)
43  , entryX (ide.entryX)
44  , entryY (ide.entryY)
45  , entryZ (ide.entryZ)
46  , entryT (ide.entryT)
47  , exitX (ide.exitX)
48  , exitY (ide.exitY)
49  , exitZ (ide.exitZ)
50  , exitT (ide.exitT)
54  {}
55 
56  //----------------------------------------------------------------------------
58  : fAuxDetID(std::numeric_limits<uint32_t>::max())
59  , fAuxDetSensitiveID(std::numeric_limits<uint32_t>::max())
60  {
61  }
62 
63  //----------------------------------------------------------------------------
64  AuxDetSimChannel::AuxDetSimChannel(uint32_t inputAuxDetID,
65  uint32_t inputAuxDetSensitiveID)
66  : fAuxDetID(inputAuxDetID)
67  , fAuxDetSensitiveID(inputAuxDetSensitiveID)
68  {}
69 
70  //----------------------------------------------------------------------------
71  AuxDetSimChannel::AuxDetSimChannel(uint32_t inputAuxDetID,
72  std::vector<sdp::AuxDetIDE> const& inputAuxDetIDEs,
73  uint32_t inputAuxDetSensitiveID)
74  : fAuxDetID(inputAuxDetID)
75  , fAuxDetSensitiveID(inputAuxDetSensitiveID)
76  , fAuxDetIDEs(inputAuxDetIDEs)
77  {}
78 
79  //----------------------------------------------------------------------------
80  AuxDetSimChannel::AuxDetSimChannel(uint32_t inputAuxDetID,
81  std::vector<sdp::AuxDetIDE>&& inputAuxDetIDEs,
82  uint32_t inputAuxDetSensitiveID)
83  : fAuxDetID(inputAuxDetID)
84  , fAuxDetSensitiveID(inputAuxDetSensitiveID)
85  , fAuxDetIDEs(inputAuxDetIDEs)
86  {}
87 
88  //----------------------------------------------------------------------------
90  int offset)
91  {
92  if(this->fAuxDetID != chan.AuxDetID() &&
93  this->fAuxDetSensitiveID != chan.AuxDetSensitiveID())
94  throw std::runtime_error("ERROR AuxDetSimChannel Merge: Trying to merge different channels!");
95 
96  std::pair<int,int> range_trackID(std::numeric_limits<int>::max(),
98 
99  for(auto const& ide : AuxDetIDEs()){
100  this->fAuxDetIDEs.emplace_back(ide,offset);
101 
102  if( ide.trackID+offset < range_trackID.first ) range_trackID.first = ide.trackID+offset;
103  if( ide.trackID+offset > range_trackID.second ) range_trackID.second = ide.trackID+offset;
104  }
105 
106  return range_trackID;
107  }
108 
109  //----------------------------------------------------------------------------
111  {
112  if(fAuxDetID < other.AuxDetID() ) return true;
113 
114  return fAuxDetSensitiveID < other.AuxDetSensitiveID();
115  }
116 
117  //----------------------------------------------------------------------------
119  {
120  return (fAuxDetID == other.AuxDetID() && fAuxDetSensitiveID == other.AuxDetSensitiveID());
121  }
122 
123 
124  }//namespace sim
125 } // gar
std::vector< sdp::AuxDetIDE > const & AuxDetIDEs() const
float entryZ
Entry position Z of particle.
bool operator<(const AuxDetSimChannel &other) const
float exitT
Exit time of particle.
uint32_t fAuxDetSensitiveID
integer used to retrieve AuxDetSensitiveGeo object
float exitMomentumX
Exit X-Momentum of particle.
float entryT
Entry time of particle.
STL namespace.
float entryY
Entry position Y of particle.
AuxDetSimChannel()
Default constructor (invalid, empty data)
float exitY
Exit position Y of particle.
std::vector< sdp::AuxDetIDE > fAuxDetIDEs
one sdp::AuxDetIDE for each G4 track id
uint32_t fAuxDetID
geo->AuxDet(auxDetID), integer used to retrieve AuxDetGeo objec
bool operator==(const AuxDetSimChannel &other) const
float entryX
Entry position X of particle.
uint32_t AuxDetSensitiveID() const
static int max(int a, int b)
float exitMomentumZ
Exit Z-Momentum of particle.
General GArSoft Utilities.
float exitMomentumY
Exit Y-Momentum of particle.
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
float exitX
Exit position X of particle.
MC truth information to make RawDigits and do back tracking.
float energyDeposited
total energy deposited for this track ID and time
float exitZ
Exit position Z of particle.
Collection of particles crossing one auxiliary detector cell.
int trackID
Geant4 supplied track ID.
std::pair< int, int > MergeAuxDetSimChannel(const AuxDetSimChannel &, int)