1 #include <sevt/StationSimData.h>
2 #include <sevt/StationTriggerData.h>
3 #include <sevt/StationGPSData.h>
4 #include <sdet/Station.h>
5 #include <utl/Particle.h>
6 #include <utl/ShadowPtr.h>
7 #include <utl/ErrorLogger.h>
8 #include <fwk/RandomEngineRegistry.h>
26 ++fTotalSimCandidateParticleCount;
30 AlwaysInsertParticle(particle);
32 SometimesInsertParticle(particle);
33 if (fParticles.size() >= fMaxNParticles)
41 ++fTotalParticleCount;
59 const double sometimes =
60 RandomEngineRegistry::GetInstance().Get(RandomEngineRegistry::eDetector).GetEngine().flat();
61 if (sometimes < fThinning)
62 AlwaysInsertParticle(particle);
67 StationSimData::Shrink()
70 auto& rnd = RandomEngineRegistry::GetInstance().Get(RandomEngineRegistry::eDetector).GetEngine();
71 for (
const auto&
p : fParticles)
72 if (rnd.flat() < fThinningFactor)
74 fParticles.swap(newList);
75 fThinning *= fThinningFactor;
80 StationSimData::ClearParticleList()
82 decltype(fParticles)().
swap(fParticles);
87 StationSimData::MakeTriggerAndGPSData(
const TimeStamp& time)
89 if (HasTriggerData(time)) {
90 WARNING(
"Trigger and GPS data already present!");
99 StationSimData::GetSimulatorSignature()
102 if (fSimulatorSignature.empty()) {
103 const string err =
"Requesting an SD simulator signature which was never set.";
107 return fSimulatorSignature;
115 return fTriggerAndGPSData.find(time) != fTriggerAndGPSData.end();
122 if (!HasTriggerData(time)) {
124 err <<
"Tried to get unavailable GPS data at time " << time;
129 return fTriggerAndGPSData.find(time)->second.second;
137 if (!HasTriggerData(time)) {
139 err <<
"Tried to get unavailable GPS data at time " << time;
144 return fTriggerAndGPSData.find(time)->second.second;
151 if (!HasTriggerData(time)) {
153 err <<
"Tried to get unavailable trigger data at time " << time;
158 return fTriggerAndGPSData.find(time)->second.first;
166 if (!HasTriggerData(time)) {
168 err <<
"Tried to get unavailable trigger data at time " << time;
173 return fTriggerAndGPSData.find(time)->second.first;
void swap(utl::TabulatedFunction &t1, utl::TabulatedFunction &t2)
Describes a particle for Simulation.
std::vector< utl::Particle > ParticleVector
Base class for exceptions trying to access non-existing components.
A TimeStamp holds GPS second and nanosecond for some event.
#define WARNING(message)
Macro for logging warning messages.
std::pair< StationTriggerData, StationGPSData > TriggerGPSPair
Station Trigger Data description
struct particle_info particle[80]
#define ERROR(message)
Macro for logging error messages.