All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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  //-------------------------------------------------
43  : trackID (ide.trackID>=0? ide.trackID+offset : ide.trackID-offset)
44  , energyDeposited(ide.energyDeposited)
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)
53  , exitMomentumX (ide.exitMomentumX)
54  , exitMomentumY (ide.exitMomentumY)
55  , exitMomentumZ (ide.exitMomentumZ)
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(),
98  std::numeric_limits<int>::min());
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
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
Definition: UtilFunc.cxx:42
BEGIN_PROLOG TPC Trig offset(g4 rise time) ProjectToHeight
Definition: CORSIKAGen.fcl:7
std::pair< int, int > MergeAuxDetSimChannel(const AuxDetSimChannel &, int)
bool operator<(const AuxDetSimChannel &other) const
AuxDetSimChannel()
Default constructor (invalid, empty data)
constexpr int kBogusI
obviously bogus integer value
Collection of particles crossing one auxiliary detector cell.
T abs(T value)
object containing MC truth information necessary for making RawDigits and doing back tracking ...
uint32_t AuxDetID() const
uint32_t fAuxDetID
geo-&gt;AuxDet(auxDetID), integer used to retrieve AuxDetGeo objec
std::vector< sim::AuxDetIDE > const & AuxDetIDEs() const
constexpr float kBogusF
obviously bogus float value
uint32_t AuxDetSensitiveID() const
MC truth information to make RawDigits and do back tracking.
Collection of Physical constants used in LArSoft.
bool operator==(const AuxDetSimChannel &other) const