ATLAS Offline Software
Loading...
Searching...
No Matches
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
SimpleProperty< std::vector< float > > m_scalefactorlist
std::map< uint64_t, float > m_scaleFactorMap
 map from properties
float m_currentSF
 cached scale factor
uint64_t m_now
 cached iovtime
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)
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}
SimpleProperty< std::vector< float > > m_scalefactorlist
float m_currentSF
cached scale factor
uint64_t m_now
cached iovtime
SimpleProperty< std::vector< uint64_t > > m_runlumilist
look-up table of lumi scale factor by run, lumiblock
std::map< uint64_t, float > m_scaleFactorMap
map from properties

◆ ~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}
#define ATH_MSG_ERROR(x)

◆ 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}
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)

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: