AuxDetSimChannel.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 ///
3 /// \file lardataobj/Simulation/AuxDetSimChannel.cxx
4 ///
5 /// \author miceli@fnal.gov
6 ///
7 ////////////////////////////////////////////////////////////////////////
8 
9 
10 // our header
12 
13 // C/C++ standard library
14 #include <limits> // std::numeric_limits<>
15 #include <stdexcept>
16 
17 // LArSoft headers
19 
20 namespace sim{
21 
22  // Default constructor
23  //-------------------------------------------------
25  : trackID (util::kBogusI)
26  , energyDeposited(util::kBogusF)
27  , entryX (util::kBogusF)
28  , entryY (util::kBogusF)
29  , entryZ (util::kBogusF)
30  , entryT (util::kBogusF)
31  , exitX (util::kBogusF)
32  , exitY (util::kBogusF)
33  , exitZ (util::kBogusF)
34  , exitT (util::kBogusF)
35  , exitMomentumX (util::kBogusF)
36  , exitMomentumY (util::kBogusF)
37  , exitMomentumZ (util::kBogusF)
38  {}
39 
40  // Copy with offset constructor
41  //-------------------------------------------------
42  AuxDetIDE::AuxDetIDE(AuxDetIDE const& ide, int offset)
43  : trackID (ide.trackID>=0? ide.trackID+offset : ide.trackID-offset)
45  , entryX (ide.entryX)
46  , entryY (ide.entryY)
47  , entryZ (ide.entryZ)
48  , entryT (ide.entryT)
49  , exitX (ide.exitX)
50  , exitY (ide.exitY)
51  , exitZ (ide.exitZ)
52  , exitT (ide.exitT)
56  {}
57 
58  //----------------------------------------------------------------------------
60  : fAuxDetID(std::numeric_limits<uint32_t>::max())
61  , fAuxDetSensitiveID(std::numeric_limits<uint32_t>::max())
62  {
63  }
64 
65  //----------------------------------------------------------------------------
66  AuxDetSimChannel::AuxDetSimChannel(uint32_t inputAuxDetID,
67  uint32_t inputAuxDetSensitiveID)
68  : fAuxDetID(inputAuxDetID)
69  , fAuxDetSensitiveID(inputAuxDetSensitiveID)
70  {}
71 
72  //----------------------------------------------------------------------------
73  AuxDetSimChannel::AuxDetSimChannel(uint32_t inputAuxDetID,
74  const std::vector<sim::AuxDetIDE>& inputAuxDetIDEs,
75  uint32_t inputAuxDetSensitiveID)
76  : fAuxDetID(inputAuxDetID)
77  , fAuxDetSensitiveID(inputAuxDetSensitiveID)
78  , fAuxDetIDEs(inputAuxDetIDEs)
79  {}
80 
81  //----------------------------------------------------------------------------
82  AuxDetSimChannel::AuxDetSimChannel(uint32_t inputAuxDetID,
83  std::vector<sim::AuxDetIDE>&& inputAuxDetIDEs,
84  uint32_t inputAuxDetSensitiveID)
85  : fAuxDetID(inputAuxDetID)
86  , fAuxDetSensitiveID(inputAuxDetSensitiveID)
87  , fAuxDetIDEs(inputAuxDetIDEs)
88  {}
89 
90  //----------------------------------------------------------------------------
92  int offset)
93  {
94  if(this->fAuxDetID != chan.AuxDetID() && this->fAuxDetSensitiveID != chan.AuxDetSensitiveID())
95  throw std::runtime_error("ERROR AuxDetSimChannel Merge: Trying to merge different channels!");
96 
97  std::pair<int,int> range_trackID(std::numeric_limits<int>::max(),
99 
100  for(auto const& ide : AuxDetIDEs()){
101  this->fAuxDetIDEs.emplace_back(ide,offset);
102 
103  auto tid = std::abs(ide.trackID)+offset;
104 
105  if( tid < range_trackID.first )
106  range_trackID.first = tid;
107  if( tid > range_trackID.second )
108  range_trackID.second = tid;
109  }
110 
111  return range_trackID;
112  }
113 
114  //----------------------------------------------------------------------------
116  {
117  if(fAuxDetID < other.AuxDetID() ) return true;
118 
119  return fAuxDetSensitiveID < other.AuxDetSensitiveID();
120  }
121 
122  //----------------------------------------------------------------------------
124  {
125  return (fAuxDetID == other.AuxDetID() && fAuxDetSensitiveID == other.AuxDetSensitiveID());
126  }
127 
128 
129 }//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.
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
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.
T abs(T value)
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.
static int max(int a, int b)
Code to link reconstructed objects back to the MC truth information.
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
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
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