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  base_class(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 
37 void MuonCalibStreamDataProviderSvc::setNextEvent(const LVL2_MUON_CALIBRATION::CalibEvent *re) {
38  m_event = re;
39  m_evtN = m_event->lvl1_id();
40  m_runN = m_event->run_number();
41  m_pt = m_event->pt();
42  m_timeStamp = m_event->timestamp();
43  m_fake_evtN++;
45  int runN(-1);
47  if (m_fake_runN >= 0)
48  runN = m_fake_runN;
49  else
50  runN = m_runN;
51  }
52  int lb_nr = 200;
53  if (!m_lumiBlockCoolSvc->GetRunEventNumber(m_timeStamp, runN, lb_nr).isSuccess()) {
54  ATH_MSG_FATAL("Failed to get run event number!");
55  return;
56  }
57  if (m_run_number_from_cool) { m_fake_runN = runN; }
59  }
60  return;
61 }
62 
63 const LVL2_MUON_CALIBRATION::CalibEvent *MuonCalibStreamDataProviderSvc::getEvent() { return m_event; }
64 
66  if (m_fake_runN < 0) {
67  return m_evtN;
68  } else {
69  return m_fake_evtN;
70  }
71 }
72 
74  if (m_fake_runN < 0) {
75  return m_runN;
76  } else {
77  return m_fake_runN;
78  }
79 }
80 
82 
84  return m_pt;
85 }
86 
88  return m_timeStamp;
89 }
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:35
MuonCalibStreamDataProviderSvc::initialize
virtual StatusCode initialize()
Definition: MuonCalibStreamDataProviderSvc.cxx:32
MuonCalibStreamDataProviderSvc::fakeLumiBlock
int fakeLumiBlock()
Definition: MuonCalibStreamDataProviderSvc.cxx:81
MuonCalibStreamDataProviderSvc::timeStamp
int timeStamp()
Definition: MuonCalibStreamDataProviderSvc.cxx:87
MuonCalibStreamDataProviderSvc::m_timeStamp
int m_timeStamp
Definition: MuonCalibStreamDataProviderSvc.h:42
MuonCalibStreamDataProviderSvc::m_lumi_block_number_from_cool
bool m_lumi_block_number_from_cool
Definition: MuonCalibStreamDataProviderSvc.h:34
MuonCalibStreamDataProviderSvc::m_runN
int m_runN
Definition: MuonCalibStreamDataProviderSvc.h:37
MuonCalibStreamDataProviderSvc::m_evtN
int m_evtN
Definition: MuonCalibStreamDataProviderSvc.h:36
MuonCalibStreamDataProviderSvc::m_fake_lumiB
int m_fake_lumiB
Definition: MuonCalibStreamDataProviderSvc.h:40
MuonCalibStreamDataProviderSvc::m_fake_evtN
int m_fake_evtN
Definition: MuonCalibStreamDataProviderSvc.h:38
MuonCalibRunLumiBlockCoolSvc.h
MuonCalibStreamDataProviderSvc::m_fake_runN
int m_fake_runN
Definition: MuonCalibStreamDataProviderSvc.h:39
MuonCalibStreamDataProviderSvc::getEvent
virtual const LVL2_MUON_CALIBRATION::CalibEvent * getEvent()
Definition: MuonCalibStreamDataProviderSvc.cxx:63
MuonCalibStreamDataProviderSvc::fakeEventN
int fakeEventN()
Definition: MuonCalibStreamDataProviderSvc.cxx:65
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MuonCalibStreamDataProviderSvc.h
MuonCalibStreamDataProviderSvc::MuonCalibStreamDataProviderSvc
MuonCalibStreamDataProviderSvc(const std::string &name, ISvcLocator *svcloc)
Definition: MuonCalibStreamDataProviderSvc.cxx:8
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MuonCalibStreamDataProviderSvc::~MuonCalibStreamDataProviderSvc
virtual ~MuonCalibStreamDataProviderSvc()
Definition: MuonCalibStreamDataProviderSvc.cxx:29
MuonCalibStreamDataProviderSvc::m_run_number_from_cool
bool m_run_number_from_cool
Definition: MuonCalibStreamDataProviderSvc.h:33
MuonCalibStreamDataProviderSvc::setNextEvent
virtual void setNextEvent(const LVL2_MUON_CALIBRATION::CalibEvent *re)
Definition: MuonCalibStreamDataProviderSvc.cxx:37
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
MuonCalibStreamDataProviderSvc::fakeRunN
int fakeRunN()
Definition: MuonCalibStreamDataProviderSvc.cxx:73
re
const boost::regex re(r_e)
MuonCalibStreamDataProviderSvc::LVL2_pt
float LVL2_pt()
Definition: MuonCalibStreamDataProviderSvc.cxx:83
MuonCalibStreamDataProviderSvc::m_lumiBlockCoolSvc
ServiceHandle< MuonCalibRunLumiBlockCoolSvc > m_lumiBlockCoolSvc
Definition: MuonCalibStreamDataProviderSvc.h:32
MuonCalibStreamDataProviderSvc::m_pt
float m_pt
Definition: MuonCalibStreamDataProviderSvc.h:41