ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ZdcInjPulserAmpMap Class Reference

#include <ZdcInjPulserAmpMap.h>

Inheritance diagram for ZdcInjPulserAmpMap:
Collaboration diagram for ZdcInjPulserAmpMap:

Public Member Functions

 ZdcInjPulserAmpMap ()
 
std::string getFilePath () const
 
unsigned int getFirstLumiBlock () const
 
int getCycleNumber (unsigned int lumiBlock) const
 
float getPulserAmplitude (unsigned int lumiBlock) const
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Static Public Member Functions

static const ZdcInjPulserAmpMapgetInstance ()
 

Private Member Functions

void ReadPulserSteps (std::ifstream &ifs)
 
void FillVVector (const nlohmann::json &entry)
 
void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

std::string m_filePath
 
unsigned int m_firstLB {1}
 
std::vector< float > m_LBPulserVMap
 
std::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

Detailed Description

Definition at line 16 of file ZdcInjPulserAmpMap.h.

Constructor & Destructor Documentation

◆ ZdcInjPulserAmpMap()

ZdcInjPulserAmpMap::ZdcInjPulserAmpMap ( )

Definition at line 18 of file ZdcInjPulserAmpMap.cxx.

18  : asg::AsgMessaging("ZdcInjPulserAmpMap")
19 {
20  msg().setLevel(MSG::INFO);
21 
22  // std::string filePath = PathResolver::find_file("ZDC_InjectPulseSteps.json","DATAPATH", PathResolver::RecursiveSearch);
23  std::string filePath = PathResolverFindCalibFile("ZdcConditions/ZDC_InjectPulseSteps.json");
24 
25  if (!filePath.empty())
26  {
27  ATH_MSG_DEBUG( "ZdcInjPulserAmpMap::found ZDC JSON at " << filePath );
28  }
29  else
30  {
31  ATH_MSG_WARNING( "ZdcInjPulserAmpMap constructor, JSON file not found in search path, trying local file" ) ;
32  filePath = "./ZDC_InjectPulseSteps.json";
33  }
34 
35 
36  std::ifstream ifs(filePath);
37  if (!ifs.is_open()) {
38  ATH_MSG_FATAL("ZdcInjPulserAmpMap constructor, JSON file cannot be opened!" ) ;
39  }
40 
41  m_filePath = std::move(filePath);
42  ReadPulserSteps(ifs);
43 }

Member Function Documentation

◆ FillVVector()

void ZdcInjPulserAmpMap::FillVVector ( const nlohmann::json entry)
private

Definition at line 65 of file ZdcInjPulserAmpMap.cxx.

66 {
67  unsigned int nStep = entry.at("nStep");
68  float vStart = entry.at("vStart");
69  float vStep = entry.at("vStep");
70 
71  float voltage = vStart;
72  for (size_t step = 0; step < nStep; step++) {
73  m_LBPulserVMap.push_back(voltage);
74  voltage += vStep;
75  }
76 }

◆ getCycleNumber()

int ZdcInjPulserAmpMap::getCycleNumber ( unsigned int  lumiBlock) const
inline

Definition at line 44 of file ZdcInjPulserAmpMap.h.

45  {
46  if (lumiBlock < m_firstLB) return -1;
47  return std::floor(float(lumiBlock - m_firstLB)/m_LBPulserVMap.size());
48  }

◆ getFilePath()

std::string ZdcInjPulserAmpMap::getFilePath ( ) const
inline

Definition at line 36 of file ZdcInjPulserAmpMap.h.

36 {return m_filePath;}

◆ getFirstLumiBlock()

unsigned int ZdcInjPulserAmpMap::getFirstLumiBlock ( ) const
inline

Definition at line 40 of file ZdcInjPulserAmpMap.h.

40 {return m_firstLB;}

◆ getInstance()

const ZdcInjPulserAmpMap * ZdcInjPulserAmpMap::getInstance ( )
static

Definition at line 11 of file ZdcInjPulserAmpMap.cxx.

12 {
13  static const ZdcInjPulserAmpMap pulser_map;
14  return &pulser_map;
15 }

◆ getPulserAmplitude()

float ZdcInjPulserAmpMap::getPulserAmplitude ( unsigned int  lumiBlock) const
inline

Definition at line 52 of file ZdcInjPulserAmpMap.h.

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  }

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40 {
42  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ msg() [1/2]

MsgStream & asg::AsgMessaging::msg ( ) const
inherited

The standard message stream.

Returns
A reference to the default message stream of this object.

Definition at line 49 of file AsgMessaging.cxx.

49  {
50 #ifndef XAOD_STANDALONE
52 #else // not XAOD_STANDALONE
53  return m_msg;
54 #endif // not XAOD_STANDALONE
55  }

◆ msg() [2/2]

MsgStream & asg::AsgMessaging::msg ( const MSG::Level  lvl) const
inherited

The standard message stream.

Parameters
lvlThe message level to set the stream to
Returns
A reference to the default message stream, set to level "lvl"

Definition at line 57 of file AsgMessaging.cxx.

57  {
58 #ifndef XAOD_STANDALONE
60 #else // not XAOD_STANDALONE
61  m_msg << lvl;
62  return m_msg;
63 #endif // not XAOD_STANDALONE
64  }

◆ msgLvl()

bool asg::AsgMessaging::msgLvl ( const MSG::Level  lvl) const
inherited

Test the output level of the object.

Parameters
lvlThe message level to test against
Returns
boolean Indicting if messages at given level will be printed
true If messages at level "lvl" will be printed

Definition at line 41 of file AsgMessaging.cxx.

41  {
42 #ifndef XAOD_STANDALONE
43  return ::AthMessaging::msgLvl( lvl );
44 #else // not XAOD_STANDALONE
45  return m_msg.msgLevel( lvl );
46 #endif // not XAOD_STANDALONE
47  }

◆ ReadPulserSteps()

void ZdcInjPulserAmpMap::ReadPulserSteps ( std::ifstream &  ifs)
private

Definition at line 45 of file ZdcInjPulserAmpMap.cxx.

46 {
48 
49  m_LBPulserVMap.clear();
50 
51  // Get the starting LB entry in the json if it exists
52  //
53  nlohmann::json first = j[0];
54 
55  if (first.find("startLB") != first.end()) {
56  m_firstLB = first["startLB"];
57  j.erase(j.begin());
58  }
59 
60  for (const auto &entry : j) {
62  }
63 }

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level  lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29 {
30  m_lvl = lvl;
31 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_filePath

std::string ZdcInjPulserAmpMap::m_filePath
private

Definition at line 22 of file ZdcInjPulserAmpMap.h.

◆ m_firstLB

unsigned int ZdcInjPulserAmpMap::m_firstLB {1}
private

Definition at line 23 of file ZdcInjPulserAmpMap.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_LBPulserVMap

std::vector<float> ZdcInjPulserAmpMap::m_LBPulserVMap
private

Definition at line 24 of file ZdcInjPulserAmpMap.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.


The documentation for this class was generated from the following files:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
ZdcInjPulserAmpMap::m_firstLB
unsigned int m_firstLB
Definition: ZdcInjPulserAmpMap.h:23
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
json
nlohmann::json json
Definition: HistogramDef.cxx:9
parse
std::map< std::string, std::string > parse(const std::string &list)
Definition: egammaLayerRecalibTool.cxx:1054
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
ZdcInjPulserAmpMap::m_filePath
std::string m_filePath
Definition: ZdcInjPulserAmpMap.h:22
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
asg::AsgMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AsgMessaging.cxx:49
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
hancool.filePath
string filePath
Definition: hancool.py:28
asg::AsgMessaging
Class mimicking the AthMessaging class from the offline software.
Definition: AsgMessaging.h:40
PathResolverFindCalibFile
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Definition: PathResolver.cxx:431
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
DeMoScan.first
bool first
Definition: DeMoScan.py:536
LArCellBinning.step
step
Definition: LArCellBinning.py:158
ZdcInjPulserAmpMap
Definition: ZdcInjPulserAmpMap.h:17
xAOD::lumiBlock
setTeId lumiBlock
Definition: L2StandAloneMuon_v1.cxx:327
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
ZdcInjPulserAmpMap::FillVVector
void FillVVector(const nlohmann::json &entry)
Definition: ZdcInjPulserAmpMap.cxx:65