|
ATLAS Offline Software
|
Go to the documentation of this file.
12 #include "CLHEP/Random/RandomEngine.h"
13 #include "CLHEP/Random/RandGeneral.h"
22 , m_maxBunchCrossingPerOrbit(3564)
24 , m_intensityPatternProp()
26 , m_intensityPattern(
new double[m_ipLength])
28 , m_largestElementInPattern(1.0)
29 , m_signalPattern(nullptr)
31 declareProperty(
"MaxBunchCrossingPerOrbit",
m_maxBunchCrossingPerOrbit,
"The number of slots in each LHC beam. Default: 3564.");
33 "An array of floats containing the beam intensity distribution as a function of time in bins of 25ns. ArrayBM normalizes the distribution and uses it as a stencil to determine the relative intensity at each beam xing in the simulated range"
35 declareProperty(
"EmptyBunchOption",
m_emptyBunches=0,
"Option for empty bunches. 0: normal treatment. Positive N: first N BCIDs after filled. Negative N: any empty BCID is allowed.");
55 std::vector<float>::const_iterator pBegin(rProp.begin());
56 std::vector<float>::const_iterator pEnd(rProp.end());
62 return StatusCode::FAILURE;
82 if (rProp[
i]>0) sinceFilled=0;
104 float nonZeroElementCount(
static_cast<float>(std::count_if(pBegin, pEnd, IsNonZero)));
105 if(nonZeroElementCount<1.0)
108 return StatusCode::FAILURE;
110 float elementSum(
static_cast<float>(
std::accumulate(pBegin, pEnd,0.0)));
114 float maxElement(*(std::max_element(pBegin, pEnd)));
115 float inv_maxElement = maxElement != 0 ? 1. / maxElement : 1;
124 ATH_MSG_ERROR(
"All IntensityPattern elements must be >=0. Please fix element #" <<
i );
125 return StatusCode::FAILURE;
149 std::make_unique<boost::random::discrete_distribution<unsigned int>>(
152 return StatusCode::SUCCESS;
159 const EventContext& ctx =
160 Gaudi::Hive::currentContext();
163 m_rngWrapper->setSeed(
"BEAMINT", ctx.slot(),
event,
run, ctx.evt());
164 CLHEP::HepRandomEngine* rndmEngine = m_rngWrapper->getEngine(ctx);
183 <<
" index " <<
index
virtual StatusCode initialize() override final
Gaudi::Property< std::uint64_t > m_seed
seed for FastReseededPRNG. Non-zero switches to using FastReseededPRNG.
unsigned int m_maxBunchCrossingPerOrbit
max bunch crossings per orbit
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
Gaudi::Hive::ContextSpecificData< unsigned int > m_t0Offset
offset of the t0 wrto our intensity pattern
int run(int argc, char *argv[])
A IBeamIntensity service configured with an intensity array The Gaudi::Property<std::vector<float>> d...
#define ATH_MSG_VERBOSE(x)
@ u
Enums for curvilinear frames.
int m_emptyBunches
Empty bunch option.
double * m_signalPattern
Additional array for keeping the locations we want signal in By default, will match the intensity pat...
prototypes for utility POOL collection funcs
POOL::TEvent event(POOL::TEvent::kClassAccess)
::StatusCode StatusCode
StatusCode definition for legacy code.
AthROOTErrorHandlerSvc * svc
Gaudi::Property< std::vector< float > > m_intensityPatternProp
user-defined intensity pattern
ServiceHandle< IAthRNGSvc > m_randomSvc
the service managing our random seeds/sequences
std::unique_ptr< const boost::random::discrete_distribution< unsigned int > > m_t0Dist
as with m_biRandom, but for FastReseededPRNG
unsigned int m_ipLength
length of the intensity pattern
float m_largestElementInPattern
The largest value in the pattern assuming that the pattern has mean value 1.0.
virtual float normFactor(int iXing) const override final
ArrayBM(const std::string &name, ISvcLocator *svc)
double * m_intensityPattern
normalized intensity pattern. C array to make clhep RandGeneral happy
virtual void selectT0(unsigned int run, unsigned long long event) override final
CLHEP::RandGeneral * m_biRandom
shoot random number proportionally to m_intensityPattern