10#include <generators/modules/EventT0GeneratorModule.h>
13#include <framework/gearbox/Unit.h>
14#include <framework/logging/Logger.h>
36 setDescription(
"Module generates discrete event t0 in ~4ns steps (bunch spacing) "
37 "according to double gaussian distribution and adds it to the "
38 "production and decay times of MCParticles. This means that after "
39 "this module the time origin (t = 0) is set to what L1 trigger "
40 "would give as the collision time. In case of cosmics, the L1 trigger"
41 "jitter is generated according to a continuos double gaussian distribution");
49 "fraction (by area) of tail gaussian",
double(0.08));
51 "If set, a fixed event t0 is used instead of simulating the bunch timing.",
m_fixedT0);
53 "If set, randomize between -maximum and maximum.",
56 "if True simulate L1 jitter for cosmics",
bool(
false));
61 "fraction (by area) of tail gaussian for cosmics",
double(0.09));
73 B2ERROR(
"You can not set both the maximum T0 and the fixed T0 option.");
84 int beamRevo9Cycle = 0;
89 unsigned revo9range = (
m_bunchStructure->getRFBucketsPerRevolution() / 4) * 9;
90 int revo9count = gRandom->Integer(revo9range);
96 beamRevo9Cycle = gRandom->Integer(9);
97 int bucketRevo9 = bucket + beamRevo9Cycle *
m_bunchStructure->getRFBucketsPerRevolution();
101 double timeJitter = 0;
109 timeJitter = gRandom->Gaus(0., sigma);
115 relBucketNo = round(timeJitter / bucketTimeSep);
116 revo9count = (bucketRevo9 + relBucketNo) / 4;
120 eventTime = (bucketRevo9 - revo9count * 4) * bucketTimeSep;
127 eventTime = gRandom->Gaus(0., sigma);
133 particle.setProductionTime(particle.getProductionTime() + eventTime);
134 particle.setDecayTime(particle.getDecayTime() + eventTime);
143 revo9count %= revo9range;
144 if (revo9count < 0) revo9count += revo9range;
double m_tailGaussMeanCosmics
mean of tail gaussian [ns] for cosmics
EventT0GeneratorModule()
Constructor.
double m_maximumT0
if set, randomize between -maximum and maximum
bool m_isCosmics
if true L1 jitter for cosmics is simulated
virtual void initialize() override
Initialize the Module.
double m_fixedT0
if set, a fixed t0 value is used instead of a gaussian distribution
DBObjPtr< HardwareClockSettings > m_clockSettings
hardware clock settings
virtual void event() override
Event processor.
double m_tailGaussFractionCosmics
area fraction of core gaussian for cosmics
double m_coreGaussWidth
sigma of core gaussian [ns]
double m_tailGaussWidthCosmics
sigma of tail gaussian [ns] for cosmics
DBObjPtr< BunchStructure > m_bunchStructure
bunch structure (fill pattern)
double m_tailGaussFraction
area fraction of core gaussian
double m_tailGaussWidth
sigma of tail gaussian [ns]
StoreArray< MCParticle > m_mcParticles
MC particles.
double m_coreGaussWidthCosmics
sigma of core gaussian [ns] for cosmics
StoreObjPtr< SimClockState > m_simClockState
generated hardware clock state
StoreObjPtr< MCInitialParticles > m_initialParticles
beam particles
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.