ATLAS Offline Software
Loading...
Searching...
No Matches
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;
32using namespace LVL2_MUON_CALIBRATION;
33
34EventInfoCalibRawDataProvider::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
44 ATH_CHECK(m_eventInfoKey.initialize());
45
46 return StatusCode::SUCCESS;
47}
48
49// Execute
50StatusCode 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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
An algorithm that can be simultaneously executed in multiple threads.
ServiceHandle< IMuonCalibStreamDataProviderSvc > m_dataProvider
EventInfoCalibRawDataProvider(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
SG::WriteHandleKey< xAOD::EventInfo > m_eventInfoKey
virtual StatusCode initialize() override
Initialize.
virtual StatusCode execute(const EventContext &ctx) const override
Execute.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
@ IS_CALIBRATION
true: calibration, false: physics