13 : base_class(name,svc)
27 std::vector<float>::const_iterator pBegin(rProp.begin());
28 std::vector<float>::const_iterator pEnd(rProp.end());
33 return StatusCode::FAILURE;
39 return StatusCode::FAILURE;
43 float nonZeroElementCount(
static_cast<float>(std::count_if(pBegin, pEnd,
IsNonZero)));
44 if(nonZeroElementCount<1.0)
47 return StatusCode::FAILURE;
49 float elementSum(
static_cast<float>(std::accumulate(pBegin, pEnd,0.0)));
50 float denominator(elementSum/nonZeroElementCount);
53 float maxElement(*(std::max_element(pBegin, pEnd)));
54 float inv_maxElement = maxElement != 0 ? 1. / maxElement : 1;
64 ATH_MSG_ERROR(
"All IntensityPattern elements must be >=0. Please fix element #" << i );
65 return StatusCode::FAILURE;
72 if (denominator != 0) {
93 ATH_MSG_ERROR(
"Requested T0 offset (" <<
m_t0Offset <<
") coincides with an empty bunch crossing in the IntensityPattern provided. Please re-submit your job and select an offset corresponding to a bunch crossing with non-zero luminosity.");
94 return StatusCode::FAILURE;
98 ATH_MSG_INFO(
"Allowing T0 to coincide with an empty bunch crossing in the IntensityPattern provided. T0 offset set to " <<
m_t0Offset <<
" for all events in this run." );
101 return StatusCode::SUCCESS;
110 <<
" index " <<
index
#define ATH_MSG_VERBOSE(x)
A IBeamIntensity service configured with an intensity array The Gaudi::Property<std::vector<float>> d...
Holds helper functions used by FixedArrayBM and ArrayBM.
static bool IsNonZero(float lumi)
Gaudi::Property< unsigned int > m_maxBunchCrossingPerOrbit
Gaudi::Property< unsigned int > m_t0Offset
double * m_intensityPattern
normalized intensity pattern.
Gaudi::Property< std::vector< float > > m_intensityPatternProp
virtual StatusCode initialize() override final
Gaudi::Property< bool > m_allowEmptyT0BunchCrossing
unsigned int m_ipLength
length of the intensity pattern
FixedArrayBM(const std::string &name, ISvcLocator *svc)
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