13 : base_class(name,svc)
25 declareProperty(
"MaxBunchCrossingPerOrbit",
m_maxBunchCrossingPerOrbit,
"The number of slots in each LHC beam. Default: 3564.");
27 "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"
29 declareProperty(
"SignalPattern",
m_signalPatternProp,
"An array of booleans to complement the IntensityPattern to indicate where the signal event should happen (i.e. which events to actually simulate). Default behaviour is to do EVERY bunch crossing."
45 std::vector<float>::const_iterator pBegin(rProp.begin());
46 std::vector<float>::const_iterator pEnd(rProp.end());
52 return StatusCode::FAILURE;
56 float nonZeroElementCount(
static_cast<float>(std::count_if(pBegin, pEnd,
IsNonZero)));
57 if(nonZeroElementCount<1.0)
60 return StatusCode::FAILURE;
62 float elementSum(
static_cast<float>(std::accumulate(pBegin, pEnd,0.0)));
63 float denominator(elementSum/nonZeroElementCount);
66 float maxElement(*(std::max_element(pBegin, pEnd)));
67 float inv_maxElement = maxElement != 0 ? 1. / maxElement : 1;
77 ATH_MSG_ERROR(
"All IntensityPattern elements must be >=0. Please fix element #" << i );
78 return StatusCode::FAILURE;
85 if (denominator != 0) {
103 ATH_MSG_ERROR(
"SignalPattern MUST have at least one non-zero value in it.");
104 return StatusCode::FAILURE;
111 return StatusCode::SUCCESS;
A IBeamIntensity service configured with an intensity array and an optional signal pattern array The ...
Holds helper functions used by FixedArrayBM and ArrayBM.
static bool IsNonZero(float lumi)
unsigned int m_spLength
length of the signal pattern
StepArrayBM(const std::string &name, ISvcLocator *svc)
unsigned int m_ipLength
length of the intensity pattern
unsigned int m_maxBunchCrossingPerOrbit
max bunch crossings per orbit
bool * m_signalPattern
locally stored siganlPattern
double * m_intensityPattern
normalized intensity pattern. C array to make clhep RandGeneral happy
Gaudi::Property< std::vector< float > > m_intensityPatternProp
user-defined intensity pattern
Gaudi::Hive::ContextSpecificData< unsigned int > m_t0Offset
offset of the t0 wrto our intensity pattern
virtual StatusCode initialize() override final
virtual void selectT0(unsigned int run, unsigned long long event) override final
Gaudi::Hive::ContextSpecificData< unsigned int > m_signalOffset
offset of the current xing wrto the signal pattern
float m_largestElementInPattern
The largest value in the pattern assuming that the pattern has mean value 1.0.
Gaudi::Property< std::vector< float > > m_signalPatternProp
user-defined signal pattern - non zero numbers means "Do Signal"