ATLAS Offline Software
EventInfoCalibRawDataProvider.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
5 
6 #include <time.h>
7 #include <iostream>
8 #include <memory>
9 
12 // #include "EventInfo/EventID.h"
13 // #include "EventInfo/EventInfo.h"
14 // #include "EventInfo/EventType.h"
17 #include "GaudiKernel/DataObject.h"
18 #include "GaudiKernel/IRegistry.h"
19 #include "GaudiKernel/StatusCode.h"
20 #include "MuCalDecode/CalibEvent.h"
21 //#include "MuonCalibStreamCnvSvc/MuonCalibStreamAddress.h"
22 //#include "MuonCalibStreamCnvSvc/MuonCalibStreamCnvSvc.h"
24 //#include "MuonCalibStreamCnvSvc/MuonCalibRunLumiBlockCoolSvc.h"
26 //#include "AthenaKernel/StorableConversions.h"
27 
28 // Instantiation of a static factory class used by clients to create
29 // instances of this service
30 // static CnvFactory<EventInfoMuonCalibStreamCnv> s_factory;
31 // const ICnvFactory& EventInfoMuonCalibStreamCnvFactory = s_factory;
32 using namespace LVL2_MUON_CALIBRATION;
33 
34 EventInfoCalibRawDataProvider::EventInfoCalibRawDataProvider(const std::string& name, ISvcLocator* pSvcLocator) :
35  AthReentrantAlgorithm(name, pSvcLocator) {}
36 
38  ATH_MSG_INFO("EventInfoCalibRawDataProvider::initialize");
39 
40  // retrieve the dataProviderSvc
41  ATH_CHECK(m_dataProvider.retrieve());
42  //ATH_CHECK(m_lumiBlockCoolSvc.retrieve());
43  // init output EventInfo key
45 
46  return StatusCode::SUCCESS;
47 }
48 
49 // Execute
50 StatusCode EventInfoCalibRawDataProvider::execute(const EventContext& ctx) const {
51 
52  ATH_MSG_INFO("EventInfoCalibRawDataProvider::execute");
53 
54  const CalibEvent *event = m_dataProvider->getEvent();
55 
56  // Build EventInfo
57  uint64_t eventNumber = event->lvl1_id();
58  int runNumber = event->run_number();
59  float pt = event->pt();
60  // Time Stamp
61  uint64_t timeStamp = event->timestamp();
62  int lb_nr(0);
63 
64  ATH_MSG_DEBUG("New EventInfo made, run/event/timestamp/pt/LB = "<<runNumber<<" "<<eventNumber<<" "<<timeStamp<<" "<<pt<<" "<<lb_nr);
65 
66  auto evtInfo = std::make_unique<xAOD::EventInfo>();
67  auto evtAuxInfo = std::make_unique<xAOD::EventAuxInfo>();
68  evtInfo->setStore(evtAuxInfo.get());
69 
70  evtInfo->setRunNumber(runNumber);
71  evtInfo->setEventNumber(eventNumber);
72  evtInfo->setLumiBlock(lb_nr);
73  evtInfo->setTimeStamp(timeStamp);
74  evtInfo->setBCID(0);
75  evtInfo->setTimeStampNSOffset(pt);
76  uint32_t eventTypeBitmask = 0;
77  eventTypeBitmask |= xAOD::EventInfo::IS_CALIBRATION;
78  evtInfo->setEventTypeBitmask( eventTypeBitmask );
79 
81  ATH_CHECK(handle.record(std::move(evtInfo),std::move(evtAuxInfo)));
82 
83  ATH_MSG_DEBUG("Created EventInfo " << m_eventInfoKey.key());
84  ATH_MSG_DEBUG("EventInfo core decode processed in MT decode (calibration stream event)");
85 
86  return StatusCode::SUCCESS;
87 }
AthCheckMacros.h
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthMsgStreamMacros.h
LVL2_MUON_CALIBRATION
Definition: MuCalStreamerTool.h:37
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
IMuonCalibStreamDataProviderSvc.h
xAOD::EventInfo_v1::IS_CALIBRATION
@ IS_CALIBRATION
true: calibration, false: physics
Definition: EventInfo_v1.h:155
test_pyathena.pt
pt
Definition: test_pyathena.py:11
EventInfoCalibRawDataProvider::m_eventInfoKey
SG::WriteHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition: EventInfoCalibRawDataProvider.h:54
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
EventInfoCalibRawDataProvider::EventInfoCalibRawDataProvider
EventInfoCalibRawDataProvider(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: EventInfoCalibRawDataProvider.cxx:34
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
xAOD::eventNumber
eventNumber
Definition: EventInfo_v1.cxx:124
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
MuonCalibStreamInputSvc.h
EventAuxInfo.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
EventInfoCalibRawDataProvider.h
EventInfo.h
xAOD::timeStamp
setEventNumber timeStamp
Definition: EventInfo_v1.cxx:128
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
DeMoAtlasDataLoss.runNumber
string runNumber
Definition: DeMoAtlasDataLoss.py:64
EventInfoCalibRawDataProvider::execute
virtual StatusCode execute(const EventContext &ctx) const override
Execute.
Definition: EventInfoCalibRawDataProvider.cxx:50
EventInfoCalibRawDataProvider::m_dataProvider
ServiceHandle< IMuonCalibStreamDataProviderSvc > m_dataProvider
Definition: EventInfoCalibRawDataProvider.h:50
EventInfoCalibRawDataProvider::initialize
virtual StatusCode initialize() override
Initialize.
Definition: EventInfoCalibRawDataProvider.cxx:37