ATLAS Offline Software
Loading...
Searching...
No Matches
CaloBCIDLumi.cxx
Go to the documentation of this file.
1/*
2 * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration.
3 */
10
11
16
17
24 const BunchCrossingCondData& bcData)
25 : m_coeffs (coeffs)
26{
27 // MC case
28 // convert from mu/bunch to lumi in 10**30 units per bunch (for MC only)
29 // 25ns*Nbcid*71mb*10**30 = 25e-9*3564*71e-27*1e30 = 6.31 Use 1/6.31 = 0.158478605
30 // For this implementation, we multiply through by
31 // averageInteractionsByCrossing() in calc().
32 const float xlumiMC = /*ei->averageInteractionsPerCrossing()* */ 0.158478605;
33
34 static constexpr int MAX_BCID = BunchCrossingCondData::m_MAX_BCID;
35
36 std::vector<float> lumiVec (MAX_BCID);
37 for (size_t i = 0; i < MAX_BCID; i++) {
38 lumiVec[i] = bcData.isFilled(i)*xlumiMC;
39 }
40
41 initLumi (lumiVec);
42}
43
44
51 const LuminosityCondData& lumiData)
52 : m_coeffs (coeffs)
53{
55}
56
57
62void CaloBCIDLumi::initLumi (const std::vector<float>& lumiVec)
63{
64 // Number of entries from the end we put at the beginning.
65 unsigned int nbefore = m_coeffs.nshapes()-1;
66 // Number of entries from the beginning we put at the end.
67 unsigned int nafter = m_coeffs.nsamples_coeff()-1;
68
69 m_lumiData.resize (nbefore + lumiVec.size() + nafter);
70
71 // Copy [BCID-nbefore, NBCID) to the start of m_lumiData.
72 std::copy (lumiVec.end() - nbefore, lumiVec.end(),
73 m_lumiData.begin());
74
75 // Append [0, NBCID)
76 std::copy (lumiVec.begin(), lumiVec.end(),
77 m_lumiData.begin() + nbefore);
78
79 // Append [0, nafter)
80 std::copy (lumiVec.begin(), lumiVec.begin() + nafter,
81 m_lumiData.begin() + nbefore + lumiVec.size());
82
83 // Set the pointer to BCID 0.
84 m_lumi = m_lumiData.data() + nbefore;
85}
86
87
94void CaloBCIDLumi::calc (const size_t bcid,
95 const float averageInteractionsPerCrossing,
97{
98 // Perform the calculation using the proper lumi range for the BCID.
99 m_coeffs.calc (m_lumi + bcid, out);
100
101 // Scale the results if requested (for MC).
102 if (averageInteractionsPerCrossing != 1) {
103 for (float& o : out) {
104 o *= averageInteractionsPerCrossing;
105 }
106 }
107}
Replaces the BunchCrossing AlgTool used in run1/2.
Luminosity-dependent pileup offset correction conditions object.
Luminosity-dependent pileup offset correction conditions object.
Hold luminosity data produced by LuminosityCondAlg.
static constexpr int m_MAX_BCID
bool isFilled(const bcid_type bcid) const
The simplest query: Is the bunch crossing filled or not?
Luminosity-dependent pileup offset correction conditions object.
void calc(const size_t bcid, const float averageInteractionsPerCrossing, CxxUtils::vec_aligned_vector< float > &out) const
Perform the calculation for a given BCID.
const float * m_lumi
Pointer to the luminosity data for BCID 0 (after initial padding).
void initLumi(const std::vector< float > &lumiVec)
Initialize m_lumiData.
std::vector< float > m_lumiData
Per-BCID luminosities. Padded at the start and end as described above.
CaloBCIDLumi(const CaloBCIDCoeffs &coeffs, const BunchCrossingCondData &bcData)
Constructor (for MC).
const CaloBCIDCoeffs & m_coeffs
Associated coefficients conditions object.
const std::vector< float > & lbLuminosityPerBCIDVector() const
aligned_vector< T, 64 > vec_aligned_vector
A std::vector with alignment sufficient for any vector instructions on this platform.