ATLAS Offline Software
CaloBCIDLumi.cxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration.
3  */
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 
62 void 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 
94 void CaloBCIDLumi::calc (const size_t bcid,
95  const float averageInteractionsPerCrossing,
97 {
98  // Perform the calculation using the proper lumi range for the BCID.
100 
101  // Scale the results if requested (for MC).
102  if (averageInteractionsPerCrossing != 1) {
103  for (float& o : out) {
104  o *= averageInteractionsPerCrossing;
105  }
106  }
107 }
CaloBCIDLumi::m_lumi
const float * m_lumi
Pointer to the luminosity data for BCID 0 (after initial padding).
Definition: CaloBCIDLumi.h:91
LuminosityCondData::lbLuminosityPerBCIDVector
const std::vector< float > & lbLuminosityPerBCIDVector() const
Definition: LuminosityCondData.cxx:46
CxxUtils::vec_aligned_vector
aligned_vector< T, 64 > vec_aligned_vector
A std::vector with alignment sufficient for any vector instructions on this platform.
Definition: aligned_vector.h:51
BunchCrossingCondData
Definition: BunchCrossingCondData.h:23
CaloBCIDLumi::m_coeffs
const CaloBCIDCoeffs & m_coeffs
Associated coefficients conditions object.
Definition: CaloBCIDLumi.h:95
CaloBCIDCoeffs::nshapes
size_t nshapes() const
Return the number of shape points per cell.
Definition: CaloBCIDCoeffs.h:213
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
CaloBCIDCoeffs::nsamples_coeff
size_t nsamples_coeff() const
Return the number of samples per cell used in the calculation (after padding).
Definition: CaloBCIDCoeffs.h:224
CaloBCIDLumi::m_lumiData
std::vector< float > m_lumiData
Per-BCID luminosities. Padded at the start and end as described above.
Definition: CaloBCIDLumi.h:87
perfmonmt-refit.coeffs
coeffs
Definition: perfmonmt-refit.py:105
BunchCrossingCondData::m_MAX_BCID
static constexpr int m_MAX_BCID
Definition: BunchCrossingCondData.h:28
lumiFormat.i
int i
Definition: lumiFormat.py:92
CaloBCIDCoeffs.h
Luminosity-dependent pileup offset correction conditions object.
CaloBCIDLumi::CaloBCIDLumi
CaloBCIDLumi(const CaloBCIDCoeffs &coeffs, const BunchCrossingCondData &bcData)
Constructor (for MC).
Definition: CaloBCIDLumi.cxx:23
LuminosityCondData.h
Hold luminosity data produced by LuminosityCondAlg.
LuminosityCondData
Definition: LuminosityCondData.h:23
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
CaloBCIDLumi::calc
void calc(const size_t bcid, const float averageInteractionsPerCrossing, CxxUtils::vec_aligned_vector< float > &out) const
Perform the calculation for a given BCID.
Definition: CaloBCIDLumi.cxx:94
CaloBCIDCoeffs
Luminosity-dependent pileup offset correction conditions object.
Definition: CaloBCIDCoeffs.h:84
BunchCrossingCondData.h
Replaces the BunchCrossing AlgTool used in run1/2.
CaloBCIDCoeffs::calc
void calc(const float *lumi, CxxUtils::vec_aligned_vector< float > &out) const
Perform the calculation for a given set of per-bunch luminosities.
Definition: CaloBCIDCoeffs.cxx:277
calibdata.copy
bool copy
Definition: calibdata.py:27
CaloBCIDLumi::initLumi
void initLumi(const std::vector< float > &lumiVec)
Initialize m_lumiData.
Definition: CaloBCIDLumi.cxx:62
CaloBCIDLumi.h
Luminosity-dependent pileup offset correction conditions object.
BunchCrossingCondData::isFilled
bool isFilled(const bcid_type bcid) const
The simplest query: Is the bunch crossing filled or not?
Definition: BunchCrossingCondData.h:339