ATLAS Offline Software
MuonCalibStreamDataProviderSvc.cxx
Go to the documentation of this file.
1 // Include files.
3 
4 #include "GaudiKernel/ISvcLocator.h"
6 
7 // Constructor.
8 MuonCalibStreamDataProviderSvc::MuonCalibStreamDataProviderSvc(const std::string &name, ISvcLocator *svcloc) :
9  AthService(name, svcloc),
10  m_lumiBlockCoolSvc("MuonCalibRunLumiBlockCoolSvc", "MuonCalibRunLumiBlockCoolSvc"),
11  m_run_number_from_cool(false),
12  m_lumi_block_number_from_cool(false),
13  m_event(nullptr),
14  m_evtN(0),
15  m_runN(0),
16  m_fake_evtN(0),
17  m_fake_runN(-1),
18  m_fake_lumiB(200),
19  m_pt(0),
20  m_timeStamp(0) {
21  declareProperty("RunNumber", m_fake_runN, "run number to be used for DB access");
22  declareProperty("FirstEventNumber", m_fake_evtN, "reset fake event number to this value");
23  declareProperty("LumiBlockCoolSvc", m_lumiBlockCoolSvc);
24  declareProperty("RunNumberFromCool", m_run_number_from_cool);
25  declareProperty("LumiBlockNumberFromCool", m_lumi_block_number_from_cool);
26 }
27 
28 // Destructor.
30 
31 // Initialization
34  return StatusCode::SUCCESS;
35 }
36 
38 StatusCode MuonCalibStreamDataProviderSvc::queryInterface(const InterfaceID &riid, void **ppvInterface) {
39  if (IMuonCalibStreamDataProviderSvc::interfaceID().versionMatch(riid)) {
40  *ppvInterface = (IMuonCalibStreamDataProviderSvc *)this;
41  } else {
42  return AthService::queryInterface(riid, ppvInterface);
43  }
44 
45  addRef();
46  return StatusCode::SUCCESS;
47 }
48 
49 void MuonCalibStreamDataProviderSvc::setNextEvent(const LVL2_MUON_CALIBRATION::CalibEvent *re) {
50  m_event = re;
51  m_evtN = m_event->lvl1_id();
52  m_runN = m_event->run_number();
53  m_pt = m_event->pt();
54  m_timeStamp = m_event->timestamp();
55  m_fake_evtN++;
57  int runN(-1);
59  if (m_fake_runN >= 0)
60  runN = m_fake_runN;
61  else
62  runN = m_runN;
63  }
64  int lb_nr = 200;
65  if (!m_lumiBlockCoolSvc->GetRunEventNumber(m_timeStamp, runN, lb_nr).isSuccess()) {
66  ATH_MSG_FATAL("Failed to get run event number!");
67  return;
68  }
69  if (m_run_number_from_cool) { m_fake_runN = runN; }
71  }
72  return;
73 }
74 
75 const LVL2_MUON_CALIBRATION::CalibEvent *MuonCalibStreamDataProviderSvc::getEvent() { return m_event; }
76 
78  if (m_fake_runN < 0) {
79  return m_evtN;
80  } else {
81  return m_fake_evtN;
82  }
83 }
84 
86  if (m_fake_runN < 0) {
87  return m_runN;
88  } else {
89  return m_fake_runN;
90  }
91 }
92 
94 
96  return m_pt;
97 }
98 
100  return m_timeStamp;
101 }
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonCalibStreamDataProviderSvc::m_event
const LVL2_MUON_CALIBRATION::CalibEvent * m_event
Definition: MuonCalibStreamDataProviderSvc.h:36
MuonCalibStreamDataProviderSvc::initialize
virtual StatusCode initialize()
Definition: MuonCalibStreamDataProviderSvc.cxx:32
MuonCalibStreamDataProviderSvc::fakeLumiBlock
int fakeLumiBlock()
Definition: MuonCalibStreamDataProviderSvc.cxx:93
MuonCalibStreamDataProviderSvc::timeStamp
int timeStamp()
Definition: MuonCalibStreamDataProviderSvc.cxx:99
MuonCalibStreamDataProviderSvc::m_timeStamp
int m_timeStamp
Definition: MuonCalibStreamDataProviderSvc.h:43
MuonCalibStreamDataProviderSvc::~MuonCalibStreamDataProviderSvc
virtual ~MuonCalibStreamDataProviderSvc(void)
Definition: MuonCalibStreamDataProviderSvc.cxx:29
MuonCalibStreamDataProviderSvc::m_lumi_block_number_from_cool
bool m_lumi_block_number_from_cool
Definition: MuonCalibStreamDataProviderSvc.h:35
MuonCalibStreamDataProviderSvc::m_runN
int m_runN
Definition: MuonCalibStreamDataProviderSvc.h:38
MuonCalibStreamDataProviderSvc::m_evtN
int m_evtN
Definition: MuonCalibStreamDataProviderSvc.h:37
MuonCalibStreamDataProviderSvc::m_fake_lumiB
int m_fake_lumiB
Definition: MuonCalibStreamDataProviderSvc.h:41
MuonCalibStreamDataProviderSvc::m_fake_evtN
int m_fake_evtN
Definition: MuonCalibStreamDataProviderSvc.h:39
IMuonCalibStreamDataProviderSvc::interfaceID
static const InterfaceID & interfaceID()
Retrieve interface ID.
Definition: IMuonCalibStreamDataProviderSvc.h:16
MuonCalibRunLumiBlockCoolSvc.h
MuonCalibStreamDataProviderSvc::m_fake_runN
int m_fake_runN
Definition: MuonCalibStreamDataProviderSvc.h:40
MuonCalibStreamDataProviderSvc::getEvent
virtual const LVL2_MUON_CALIBRATION::CalibEvent * getEvent()
Definition: MuonCalibStreamDataProviderSvc.cxx:75
MuonCalibStreamDataProviderSvc::fakeEventN
int fakeEventN()
Definition: MuonCalibStreamDataProviderSvc.cxx:77
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MuonCalibStreamDataProviderSvc.h
AthService
Definition: AthService.h:32
MuonCalibStreamDataProviderSvc::MuonCalibStreamDataProviderSvc
MuonCalibStreamDataProviderSvc(const std::string &name, ISvcLocator *svcloc)
Definition: MuonCalibStreamDataProviderSvc.cxx:8
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MuonCalibStreamDataProviderSvc::m_run_number_from_cool
bool m_run_number_from_cool
Definition: MuonCalibStreamDataProviderSvc.h:34
MuonCalibStreamDataProviderSvc::setNextEvent
virtual void setNextEvent(const LVL2_MUON_CALIBRATION::CalibEvent *re)
Definition: MuonCalibStreamDataProviderSvc.cxx:49
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
MuonCalibStreamDataProviderSvc::queryInterface
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvInterface)
Query interface.
Definition: MuonCalibStreamDataProviderSvc.cxx:38
MuonCalibStreamDataProviderSvc::fakeRunN
int fakeRunN()
Definition: MuonCalibStreamDataProviderSvc.cxx:85
re
const boost::regex re(r_e)
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
MuonCalibStreamDataProviderSvc::LVL2_pt
float LVL2_pt()
Definition: MuonCalibStreamDataProviderSvc.cxx:95
MuonCalibStreamDataProviderSvc::m_lumiBlockCoolSvc
ServiceHandle< MuonCalibRunLumiBlockCoolSvc > m_lumiBlockCoolSvc
Definition: MuonCalibStreamDataProviderSvc.h:33
MuonCalibStreamDataProviderSvc::m_pt
float m_pt
Definition: MuonCalibStreamDataProviderSvc.h:42
IMuonCalibStreamDataProviderSvc
Definition: IMuonCalibStreamDataProviderSvc.h:13