ATLAS Offline Software
List of all members
LumiProfileSvc Class Reference

#include <LumiProfileSvc.h>

Inheritance diagram for LumiProfileSvc:
Collaboration diagram for LumiProfileSvc:

Public Member Functions

Constructor / Destructor
 LumiProfileSvc (const std::string &name, ISvcLocator *svc)
 
virtual ~LumiProfileSvc ()
 
AthService methods
virtual StatusCode initialize () override final
 

IBeamLuminosity methods

SimpleProperty< std::vector< uint64_t > > m_runlumilist
 look-up table of lumi scale factor by run, lumiblock More...
 
SimpleProperty< std::vector< float > > m_scalefactorlist
 
std::map< uint64_t, float > m_scaleFactorMap
 map from properties More...
 
float m_currentSF
 cached scale factor More...
 
uint64_t m_now
 cached iovtime More...
 
virtual float scaleFactor (unsigned int run, unsigned int lumi, bool &updated) override final
 

Detailed Description

Definition at line 18 of file LumiProfileSvc.h.

Constructor & Destructor Documentation

◆ LumiProfileSvc()

LumiProfileSvc::LumiProfileSvc ( const std::string &  name,
ISvcLocator *  svc 
)

Definition at line 7 of file LumiProfileSvc.cxx.

8  : base_class(name,svc)
9  , m_runlumilist()
12  , m_currentSF(1.0)
13  , m_now(0)
14 {
15  declareProperty("RunLumiList", m_runlumilist, "List of all IOVTimes ((run << 32) + (0xFFFFFFFF & lumiblock)). Same length as ScaleFactorList." );
16  declareProperty("ScaleFactorList", m_scalefactorlist, "List of scale factors for the luminosity. Same length as RunLumiList.");
17 }

◆ ~LumiProfileSvc()

LumiProfileSvc::~LumiProfileSvc ( )
virtual

Definition at line 19 of file LumiProfileSvc.cxx.

20 {
21 }

Member Function Documentation

◆ initialize()

StatusCode LumiProfileSvc::initialize ( )
finaloverridevirtual

Definition at line 23 of file LumiProfileSvc.cxx.

24 {
25  m_scaleFactorMap.clear();
26  const std::vector<uint64_t>& rProp(m_runlumilist.value());
27  std::vector<uint64_t>::const_iterator iRL(rProp.begin());
28  std::vector<uint64_t>::const_iterator prEnd(rProp.end());
29  const std::vector<float>& sProp(m_scalefactorlist.value());
30  std::vector<float>::const_iterator iSF(sProp.begin());
31  std::vector<float>::const_iterator psEnd(sProp.end());
32  if (rProp.size() != sProp.size())
33  {
34  ATH_MSG_ERROR("Length of RunLumiList differs from length of ScaleFactorList!");
35  return StatusCode::FAILURE;
36  }
37  for( ; iRL != prEnd && iSF != psEnd; ++iRL, ++iSF )
38  {
39  m_scaleFactorMap.insert(std::map<uint64_t,float>::value_type(*iRL, *iSF));
40  }
41  return StatusCode::SUCCESS;
42 }

◆ scaleFactor()

float LumiProfileSvc::scaleFactor ( unsigned int  run,
unsigned int  lumi,
bool &  updated 
)
finaloverridevirtual

Definition at line 44 of file LumiProfileSvc.cxx.

45 {
46  uint64_t now = (( (uint64_t) run << 32) + lumi);
47  if (m_now != now)
48  {
49  updated = true;
50  m_now = now;
51  std::map<uint64_t,float>::const_iterator iSF = m_scaleFactorMap.find(now);
52  if (iSF == m_scaleFactorMap.end())
53  {
54  ATH_MSG_WARNING("Did not find lumi scale factor for run " << run << " lb " << lumi << "; using cached value.");
55  }
56  else
57  {
58  m_currentSF = iSF->second;
59  }
60  ATH_MSG_DEBUG("Using SF=" << m_currentSF <<" for run=" << run << " lb=" << lumi << ".");
61  }
62  else
63  {
64  updated = false;
65  }
66  return m_currentSF;
67 }

Member Data Documentation

◆ m_currentSF

float LumiProfileSvc::m_currentSF
private

cached scale factor

Definition at line 41 of file LumiProfileSvc.h.

◆ m_now

uint64_t LumiProfileSvc::m_now
private

cached iovtime

Definition at line 43 of file LumiProfileSvc.h.

◆ m_runlumilist

SimpleProperty< std::vector< uint64_t > > LumiProfileSvc::m_runlumilist
private

look-up table of lumi scale factor by run, lumiblock

Definition at line 36 of file LumiProfileSvc.h.

◆ m_scalefactorlist

SimpleProperty< std::vector< float > > LumiProfileSvc::m_scalefactorlist
private

Definition at line 37 of file LumiProfileSvc.h.

◆ m_scaleFactorMap

std::map<uint64_t,float> LumiProfileSvc::m_scaleFactorMap
private

map from properties

Definition at line 39 of file LumiProfileSvc.h.


The documentation for this class was generated from the following files:
LumiProfileSvc::m_scaleFactorMap
std::map< uint64_t, float > m_scaleFactorMap
map from properties
Definition: LumiProfileSvc.h:39
python.handimod.now
now
Definition: handimod.py:675
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
run
Definition: run.py:1
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
LumiProfileSvc::m_runlumilist
SimpleProperty< std::vector< uint64_t > > m_runlumilist
look-up table of lumi scale factor by run, lumiblock
Definition: LumiProfileSvc.h:36
LumiProfileSvc::m_scalefactorlist
SimpleProperty< std::vector< float > > m_scalefactorlist
Definition: LumiProfileSvc.h:37
LumiProfileSvc::m_now
uint64_t m_now
cached iovtime
Definition: LumiProfileSvc.h:43
lumiFormat.lumi
lumi
Definition: lumiFormat.py:106
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
LumiProfileSvc::m_currentSF
float m_currentSF
cached scale factor
Definition: LumiProfileSvc.h:41