LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
AuxDetSimChannel.cxx
Go to the documentation of this file.
1 
9 // our header
11 
12 // C/C++ standard library
13 #include <limits> // std::numeric_limits<>
14 #include <stdexcept>
15 
16 // LArSoft headers
18 
19 namespace sim {
20 
21  // Default constructor
22  //-------------------------------------------------
24  : trackID(util::kBogusI)
25  , energyDeposited(util::kBogusF)
26  , entryX(util::kBogusF)
27  , entryY(util::kBogusF)
28  , entryZ(util::kBogusF)
29  , entryT(util::kBogusF)
30  , exitX(util::kBogusF)
31  , exitY(util::kBogusF)
32  , exitZ(util::kBogusF)
33  , exitT(util::kBogusF)
34  , exitMomentumX(util::kBogusF)
35  , exitMomentumY(util::kBogusF)
36  , exitMomentumZ(util::kBogusF)
37  {}
38 
39  // Copy with offset constructor
40  //-------------------------------------------------
41  AuxDetIDE::AuxDetIDE(AuxDetIDE const& ide, int offset)
42  : trackID(ide.trackID >= 0 ? ide.trackID + offset : ide.trackID - offset)
44  , entryX(ide.entryX)
45  , entryY(ide.entryY)
46  , entryZ(ide.entryZ)
47  , entryT(ide.entryT)
48  , exitX(ide.exitX)
49  , exitY(ide.exitY)
50  , exitZ(ide.exitZ)
51  , exitT(ide.exitT)
55  {}
56 
57  //----------------------------------------------------------------------------
59  : fAuxDetID(std::numeric_limits<uint32_t>::max())
60  , fAuxDetSensitiveID(std::numeric_limits<uint32_t>::max())
61  {}
62 
63  //----------------------------------------------------------------------------
64  AuxDetSimChannel::AuxDetSimChannel(uint32_t inputAuxDetID, uint32_t inputAuxDetSensitiveID)
65  : fAuxDetID(inputAuxDetID), fAuxDetSensitiveID(inputAuxDetSensitiveID)
66  {}
67 
68  //----------------------------------------------------------------------------
69  AuxDetSimChannel::AuxDetSimChannel(uint32_t inputAuxDetID,
70  const std::vector<sim::AuxDetIDE>& inputAuxDetIDEs,
71  uint32_t inputAuxDetSensitiveID)
72  : fAuxDetID(inputAuxDetID)
73  , fAuxDetSensitiveID(inputAuxDetSensitiveID)
74  , fAuxDetIDEs(inputAuxDetIDEs)
75  {}
76 
77  //----------------------------------------------------------------------------
78  AuxDetSimChannel::AuxDetSimChannel(uint32_t inputAuxDetID,
79  std::vector<sim::AuxDetIDE>&& inputAuxDetIDEs,
80  uint32_t inputAuxDetSensitiveID)
81  : fAuxDetID(inputAuxDetID)
82  , fAuxDetSensitiveID(inputAuxDetSensitiveID)
83  , fAuxDetIDEs(inputAuxDetIDEs)
84  {}
85 
86  //----------------------------------------------------------------------------
88  int offset)
89  {
90  if (this->fAuxDetID != chan.AuxDetID() && this->fAuxDetSensitiveID != chan.AuxDetSensitiveID())
91  throw std::runtime_error("ERROR AuxDetSimChannel Merge: Trying to merge different channels!");
92 
93  std::pair<int, int> range_trackID(std::numeric_limits<int>::max(),
94  std::numeric_limits<int>::min());
95 
96  for (auto const& ide : AuxDetIDEs()) {
97  this->fAuxDetIDEs.emplace_back(ide, offset);
98 
99  auto tid = std::abs(ide.trackID) + offset;
100 
101  if (tid < range_trackID.first) range_trackID.first = tid;
102  if (tid > range_trackID.second) range_trackID.second = tid;
103  }
104 
105  return range_trackID;
106  }
107 
108  //----------------------------------------------------------------------------
110  {
111  if (fAuxDetID < other.AuxDetID()) return true;
112 
113  return fAuxDetSensitiveID < other.AuxDetSensitiveID();
114  }
115 
116  //----------------------------------------------------------------------------
118  {
119  return (fAuxDetID == other.AuxDetID() && fAuxDetSensitiveID == other.AuxDetSensitiveID());
120  }
121 
122 } //namespace sim
uint32_t fAuxDetSensitiveID
integer used to retrieve AuxDetSensitiveGeo object
std::vector< sim::AuxDetIDE > fAuxDetIDEs
one sim::AuxDetIDE for each G4 track id
Namespace for general, non-LArSoft-specific utilities.
Definition: PIDAAlg.h:26
std::pair< int, int > MergeAuxDetSimChannel(const AuxDetSimChannel &, int)
int trackID
Geant4 supplied track ID.
float exitMomentumZ
Exit Z-Momentum of particle.
bool operator<(const AuxDetSimChannel &other) const
constexpr auto abs(T v)
Returns the absolute value of the argument.
AuxDetSimChannel()
Default constructor (invalid, empty data)
STL namespace.
constexpr int kBogusI
obviously bogus integer value
float exitY
Exit position Y of particle.
Collection of particles crossing one auxiliary detector cell.
object containing MC truth information necessary for making RawDigits and doing back tracking ...
uint32_t AuxDetID() const
float entryT
Entry time of particle.
uint32_t fAuxDetID
geo->AuxDet(auxDetID), integer used to retrieve AuxDetGeo objec
float exitMomentumX
Exit X-Momentum of particle.
float exitT
Exit time of particle.
std::vector< sim::AuxDetIDE > const & AuxDetIDEs() const
float exitZ
Exit position Z of particle.
Monte Carlo Simulation.
float entryZ
Entry position Z of particle.
float exitX
Exit position X of particle.
float energyDeposited
total energy deposited for this track ID and time
constexpr float kBogusF
obviously bogus float value
float entryX
Entry position X of particle.
float entryY
Entry position Y of particle.
uint32_t AuxDetSensitiveID() const
MC truth information to make RawDigits and do back tracking.
float exitMomentumY
Exit Y-Momentum of particle.
Collection of Physical constants used in LArSoft.
bool operator==(const AuxDetSimChannel &other) const