25{
27 std::vector<float>::const_iterator pBegin(rProp.begin());
28 std::vector<float>::const_iterator pEnd(rProp.end());
31 {
33 return StatusCode::FAILURE;
34 }
35
37 {
39 return StatusCode::FAILURE;
40 }
41
42
43 float nonZeroElementCount(
static_cast<float>(std::count_if(pBegin, pEnd,
IsNonZero)));
44 if(nonZeroElementCount<1.0)
45 {
47 return StatusCode::FAILURE;
48 }
49 float elementSum(static_cast<float>(std::accumulate(pBegin, pEnd,0.0)));
51
52
53 float maxElement(*(std::max_element(pBegin, pEnd)));
54 float inv_maxElement = maxElement != 0 ? 1. / maxElement : 1;
55
56
59
61 {
62 if (rProp[i]<0.0)
63 {
64 ATH_MSG_ERROR(
"All IntensityPattern elements must be >=0. Please fix element #" << i );
65 return StatusCode::FAILURE;
66 }
68 }
69
70
71
72 if (denominator != 0) {
74 }
75
76
77
78
80 {
83 }
86 {
88 }
89 else
90 {
92 {
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;
95 }
96 else
97 {
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." );
99 }
100 }
101 return StatusCode::SUCCESS;
102}
static bool IsNonZero(float lumi)
Gaudi::Property< std::vector< float > > m_intensityPatternProp
Gaudi::Property< bool > m_allowEmptyT0BunchCrossing
float m_largestElementInPattern
The largest value in the pattern assuming that the pattern has mean value 1.0.