ATLAS Offline Software
ZdcInjPulserAmpMap.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ZDCINJPULSERAMPMAP_H
6 #define ZDCINJPULSERAMPMAP_H
7 
9 #include <nlohmann/json.hpp>
10 
11 #include <string>
12 #include <vector>
13 #include <cmath>
14 
15 
17 {
18 private:
19  //
20  // Data members
21  //
22  std::string m_filePath;
23  unsigned int m_firstLB{1};
24  std::vector<float> m_LBPulserVMap;
25 
26  // Private Methods
27  //
28  void ReadPulserSteps(std::ifstream& ifs);
29  void FillVVector(const nlohmann::json& entry);
30 
31 public:
33 
34  static const ZdcInjPulserAmpMap* getInstance();
35 
36  std::string getFilePath() const {return m_filePath;}
37 
38  // Return the lumi block number at which we start stepping through the different aplitudes
39  //
40  unsigned int getFirstLumiBlock() const {return m_firstLB;}
41 
42  // Return the cycle within which the lumi block falls
43  //
44  int getCycleNumber(unsigned int lumiBlock) const
45  {
46  if (lumiBlock < m_firstLB) return -1;
47  return std::floor(float(lumiBlock - m_firstLB)/m_LBPulserVMap.size());
48  }
49 
50  // Return the pulser amplitude for the given lumi block
51  //
52  float getPulserAmplitude(unsigned int lumiBlock) const
53  {
54  // We do a cyclic lookup of the pulser amplitude (in volts) starting from the first LB
55  //
56  if (lumiBlock < m_firstLB) return -1000.;
57  unsigned int vecIndex = (lumiBlock - m_firstLB) % m_LBPulserVMap.size();
58  return m_LBPulserVMap.at(vecIndex);
59  }
60 
61 };
62 
63 #endif //ZDCLUCRODMAPRUN3_H
ZdcInjPulserAmpMap::getPulserAmplitude
float getPulserAmplitude(unsigned int lumiBlock) const
Definition: ZdcInjPulserAmpMap.h:52
ZdcInjPulserAmpMap::getCycleNumber
int getCycleNumber(unsigned int lumiBlock) const
Definition: ZdcInjPulserAmpMap.h:44
ZdcInjPulserAmpMap::m_firstLB
unsigned int m_firstLB
Definition: ZdcInjPulserAmpMap.h:23
json
nlohmann::json json
Definition: HistogramDef.cxx:9
ZdcInjPulserAmpMap::ZdcInjPulserAmpMap
ZdcInjPulserAmpMap()
Definition: ZdcInjPulserAmpMap.cxx:18
ZdcInjPulserAmpMap::getFirstLumiBlock
unsigned int getFirstLumiBlock() const
Definition: ZdcInjPulserAmpMap.h:40
ZdcInjPulserAmpMap::m_filePath
std::string m_filePath
Definition: ZdcInjPulserAmpMap.h:22
AsgMessaging.h
ZdcInjPulserAmpMap::m_LBPulserVMap
std::vector< float > m_LBPulserVMap
Definition: ZdcInjPulserAmpMap.h:24
ZdcInjPulserAmpMap::ReadPulserSteps
void ReadPulserSteps(std::ifstream &ifs)
Definition: ZdcInjPulserAmpMap.cxx:45
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
asg::AsgMessaging
Class mimicking the AthMessaging class from the offline software.
Definition: AsgMessaging.h:40
ZdcInjPulserAmpMap::getInstance
static const ZdcInjPulserAmpMap * getInstance()
Definition: ZdcInjPulserAmpMap.cxx:11
ZdcInjPulserAmpMap::getFilePath
std::string getFilePath() const
Definition: ZdcInjPulserAmpMap.h:36
ZdcInjPulserAmpMap
Definition: ZdcInjPulserAmpMap.h:17
xAOD::lumiBlock
setTeId lumiBlock
Definition: L2StandAloneMuon_v1.cxx:327
ZdcInjPulserAmpMap::FillVVector
void FillVVector(const nlohmann::json &entry)
Definition: ZdcInjPulserAmpMap.cxx:65