SEvent/StationSimData.h
Go to the documentation of this file.
1 #ifndef _sevt_StationSimData_h_
2 #define _sevt_StationSimData_h_
3 
4 #include <sevt/StationGPSData.h>
5 #include <sevt/StationTriggerData.h>
6 #include <utl/ShadowPtr.h>
7 #include <utl/TimeStamp.h>
8 #include <utl/Particle.h>
9 #include <utl/IteratorRange.h>
10 #include <boost/range/adaptor/map.hpp>
11 #include <vector>
12 #include <algorithm>
13 #include <map>
14 #include <string>
15 
16 
17 namespace io {
18  class StationSimData_ROOT;
19 }
20 
21 namespace sevt {
22 
33 
34  private:
35  typedef std::pair<StationTriggerData, StationGPSData> TriggerGPSPair;
36  typedef std::map<utl::TimeStamp, TriggerGPSPair> TriggerGPSMap;
37  typedef TriggerGPSMap::iterator TriggerGPSMapIterator;
38  typedef TriggerGPSMap::const_iterator ConstTriggerGPSMapIterator;
39 
40  public:
41  typedef std::vector<utl::Particle> ParticleVector;
42  typedef ParticleVector::iterator ParticleIterator;
43  typedef ParticleVector::const_iterator ConstParticleIterator;
44 
47  ConstParticleIterator ParticlesBegin() const { return fParticles.begin(); }
50  ConstParticleIterator ParticlesEnd() const { return fParticles.end(); }
52 
53  unsigned int GetNParticles() const { return fParticles.size(); }
54 
55  private:
56  // Add particle to list of particles to be injected into the
57  // virtual cyclinder housing either the WCD or both the WCD and
58  // SSD (larger cylinder) if an SSD exists.
59  void AddParticle(const utl::Particle& particle);
60 
61  // Update counters for particles to be injected into the virtual
62  // cylinder (see description of AddParticle above) whose
63  // trajectories intersect the WCD
65 
66  public:
68  void ClearParticleList();
69 
71  unsigned int GetNumberOfMuons() const { return fNumberOfMuons; }
72 
73  void SetNumberOfMuons(const unsigned int n) { fNumberOfMuons = n; }
74 
76  unsigned int GetNumberOfElectrons() const { return fNumberOfElectrons; }
77 
78  void SetNumberOfElectrons(const unsigned int n) { fNumberOfElectrons = n; }
79 
81  unsigned int GetNumberOfPhotons() const { return fNumberOfPhotons; }
82 
83  void SetNumberOfPhotons(const unsigned int n) { fNumberOfPhotons = n; }
84 
86  unsigned int GetTotalParticleCount() const { return fTotalParticleCount; }
87 
88  void SetTotalParticleCount(const unsigned int n) { fTotalParticleCount = n; }
89 
91  unsigned int GetTotalSimParticleCount() const { return fTotalSimParticleCount; }
92 
93  void SetTotalSimParticleCount(const unsigned int n) { fTotalSimParticleCount = n; }
94 
97 
99 
100  unsigned int GetMaxNParticles() const { return fMaxNParticles; }
101 
102  void SetMaxNParticles(const unsigned int max) { fMaxNParticles = max; }
103 
104  double GetThinning() const { return fThinning; }
105 
106  void SetThinning(const double th) { fThinning = th; }
107 
108  double GetThinningFactor() const { return fThinningFactor; }
109 
110  void SetThinningFactor(const double f) { fThinningFactor = f; }
111 
112  double GetUsedWeight() const { return fUsedWeight; }
113 
114  void SetUsedWeight(const double w) { fUsedWeight = w; }
115 
118 
120  void SetPlaneFrontTime(const utl::TimeStamp& time) { fPlaneFrontTime = time; }
121 
123 
125  void SetSimulatorSignature(const std::string& name) { fSimulatorSignature = name; }
126 
128  const std::string& GetSimulatorSignature() const;
129 
131 
136  bool IsInsideMinRadius() const { return fHoleStation; }
137 
139 
140  void SetIsInsideMinRadius(const bool isIn = true) { fHoleStation = isIn; }
141 
142  typedef decltype(std::begin(boost::adaptors::keys(TriggerGPSMap()))) TriggerTimeIterator;
143  typedef TriggerTimeIterator ConstTriggerTimeIterator; // for backwards compatibility
144 
146  TriggerTimeIterator TriggerTimesBegin() const { return std::begin(boost::adaptors::keys(fTriggerAndGPSData)); }
148  TriggerTimeIterator TriggerTimesEnd() const { return std::end(boost::adaptors::keys(fTriggerAndGPSData)); }
150 
151 
152  bool HasTriggerData(const utl::TimeStamp& time) const { return HasGPSData(time); }
153 
155  bool HasGPSData(const utl::TimeStamp& time) const;
156 
159  const sevt::StationGPSData& GetGPSData(const utl::TimeStamp& time) const;
160 
162  void MakeTriggerAndGPSData(const utl::TimeStamp& time);
163 
166  const sevt::StationTriggerData& GetTriggerData(const utl::TimeStamp& time) const;
167 
170 
171  private:
172  StationSimData() = default;
173  ~StationSimData() = default;
174 
175  void AlwaysInsertParticle(const utl::Particle& particle) { fParticles.push_back(particle); }
176 
178 
179  void Shrink();
180 
182  bool fHoleStation = false;
183  std::string fSimulatorSignature;
185 
187 
188  unsigned int fNumberOfMuons = 0;
189  unsigned int fNumberOfElectrons = 0;
190  unsigned int fNumberOfPhotons = 0;
191  unsigned int fTotalParticleCount = 0;
192  unsigned int fTotalSimParticleCount = 0;
194 
196  double fThinning = 1; // particle list was thinned with this factor
197  double fThinningFactor = 1; // each time limit is reached, thinning is bumped by this factor
198  double fUsedWeight = 1; // the exact signal scaling can differ slightly from the thinning
199 
201 
202  friend class Station;
205 
206  };
207 
208 }
209 
210 
211 #endif
unsigned int GetNumberOfPhotons() const
Get the number of photons whose trajectories intersected the WCD.
pointer with built-in initialization, deletion, deep copying
Definition: ShadowPtr.h:163
Station Level Simulated Data
void SetNumberOfPhotons(const unsigned int n)
std::map< utl::TimeStamp, TriggerGPSPair > TriggerGPSMap
void SetTotalParticleCount(const unsigned int n)
#define OFFLINE_MAKE_BOTH_ITERATOR_RANGES(_Iterator_, _ConstIterator_, _NamePrefix_)
Definition: IteratorRange.h:43
bool IsInsideMinRadius() const
Check whether the station is in the shower hole.
Describes a particle for Simulation.
Definition: Particle.h:26
const utl::TimeStamp & GetPlaneFrontTime() const
Get Shower front plane arrival time.
void AlwaysInsertParticle(const utl::Particle &particle)
StationSimData()=default
std::vector< utl::Particle > ParticleVector
sevt::StationGPSData & GetGPSData(const utl::TimeStamp &time)
Get simulated GPSData.
double GetThinningFactor() const
void ClearParticleList()
Clear the station particle list.
~StationSimData()=default
void SetThinning(const double th)
TriggerGPSMap::iterator TriggerGPSMapIterator
void SetUsedWeight(const double w)
void SetAbsoluteTimeOffset(const utl::TimeInterval &dt)
void SetSimulatorSignature(const std::string &name)
Set name of the tank simulator module used to simulate this station.
A TimeStamp holds GPS second and nanosecond for some event.
Definition: TimeStamp.h:110
TriggerTimeIterator ConstTriggerTimeIterator
TriggerGPSMap::const_iterator ConstTriggerGPSMapIterator
ParticleVector::iterator ParticleIterator
void SometimesInsertParticle(const utl::Particle &particle)
utl::TimeInterval fAbsoluteTimeOffset
sevt::StationTriggerData & GetTriggerData(const utl::TimeStamp &time)
Get simulated TriggerData.
#define max(a, b)
class to hold data at Station level
Persistent StationSimData using ROOT.
bool HasGPSData(const utl::TimeStamp &time) const
Check whether there is a GPS data at the given time.
void CountParticle(const utl::Particle &particle)
void SetNumberOfElectrons(const unsigned int n)
decltype(std::begin(boost::adaptors::keys(TriggerGPSMap()))) typedef TriggerTimeIterator
ParticleVector::const_iterator ConstParticleIterator
unsigned int GetNumberOfElectrons() const
Get the number of electrons whose trajectories intersected the WCD.
unsigned int fTotalSimCandidateParticleCount
#define OFFLINE_MAKE_CONST_ITERATOR_RANGE(_ConstIterator_, _NamePrefix_)
Definition: IteratorRange.h:28
void SetMaxNParticles(const unsigned int max)
void SetPlaneFrontTime(const utl::TimeStamp &time)
Set shower front plane arrival time.
TriggerTimeIterator TriggerTimesBegin() const
Beginning of simulated local trigger times list.
utl::TimeInterval GetAbsoluteTimeOffset() const
ParticleIterator ParticlesBegin()
Beginning of simulated particles entering the station.
unsigned int GetTotalSimCandidateParticleCount() const
Get the total number of particles that were candidates for simulation (before thinning) ...
std::pair< StationTriggerData, StationGPSData > TriggerGPSPair
A TimeInterval is used to represent time elapsed between two events.
Definition: TimeInterval.h:43
unsigned int GetTotalSimParticleCount() const
Get the total number of particles that were actually simulated (after thinning)
ConstParticleIterator ParticlesEnd() const
Station Trigger Data description
void MakeTriggerAndGPSData(const utl::TimeStamp &time)
Creates the trigger data at the given time and also the GPS data to guarantee they are both created...
void SetTotalSimParticleCount(const unsigned int n)
struct particle_info particle[80]
unsigned int GetMaxNParticles() const
unsigned int GetNumberOfMuons() const
Get the number of muons whose trajectories intersected the WCD.
ConstParticleIterator ParticlesBegin() const
TriggerTimeIterator TriggerTimesEnd() const
End of simulated local trigger times list.
bool HasTriggerData(const utl::TimeStamp &time) const
Check whether there is trigger data at the given time.
void SetTotalSimCandidateParticleCount(const unsigned int n)
unsigned int GetNParticles() const
void SetThinningFactor(const double f)
void AddParticle(const utl::Particle &particle)
void SetNumberOfMuons(const unsigned int n)
void SetIsInsideMinRadius(const bool isIn=true)
Set flag indicating whether station is in the shower hole.
ParticleIterator ParticlesEnd()
End of simulated particles entering the station.
unsigned int GetTotalParticleCount() const
Get the total number of particles whose trajectories intersected the WCD.
const std::string & GetSimulatorSignature() const
Get name of the tank simulator module used to simulate this station.

, generated on Tue Sep 26 2023.