ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonCalib
MuonCalibStream
MuonCalibStreamCnv
src
EventInfoMuonCalibStreamCnv.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
MuonCalibStreamCnv/EventInfoMuonCalibStreamCnv.h
"
5
6
#include <time.h>
7
#include <iostream>
8
#include <memory>
9
10
#include "
AthenaBaseComps/AthCheckMacros.h
"
11
#include "
AthenaBaseComps/AthMsgStreamMacros.h
"
12
#include "
xAODEventInfo/EventInfo.h
"
13
#include "
xAODEventInfo/EventAuxInfo.h
"
14
#include "GaudiKernel/DataObject.h"
15
#include "GaudiKernel/IRegistry.h"
16
#include "GaudiKernel/StatusCode.h"
17
#include "MuCalDecode/CalibEvent.h"
18
#include "
MuonCalibStreamCnvSvc/MuonCalibStreamAddress.h
"
19
#include "
MuonCalibStreamCnvSvc/MuonCalibStreamCnvSvc.h
"
20
#include "
MuonCalibStreamCnvSvc/MuonCalibStreamDataProviderSvc.h
"
21
#include "
MuonCalibStreamCnvSvc/MuonCalibStreamInputSvc.h
"
22
#include "
AthenaKernel/StorableConversions.h
"
23
24
// Update the EventInfo to xAOD::EventInfo 071120223
25
// Instantiation of a static factory class used by clients to create
26
// instances of this service
27
// static CnvFactory<EventInfoMuonCalibStreamCnv> s_factory;
28
// const ICnvFactory& EventInfoMuonCalibStreamCnvFactory = s_factory;
29
30
EventInfoMuonCalibStreamCnv::EventInfoMuonCalibStreamCnv
(ISvcLocator *svcloc) :
31
Converter
(
storageType
(),
classID
(), svcloc),
32
AthMessaging
(msgSvc(),
"EventInfoMuonCalibStreamCnv"
),
33
m_MuonCalibStreamCnvSvc
(
"MuonCalibStreamCnvSvc"
,
"EventInfoMuonCalibStreamCnv"
),
34
m_dataProvider
(
"MuonCalibStreamDataProviderSvc"
,
"EventInfoMuonCalibStreamCnv"
)
35
{}
36
37
CLID
EventInfoMuonCalibStreamCnv::classID
() {
return
ClassID_traits<xAOD::EventInfo>::ID
(); }
38
39
StatusCode
EventInfoMuonCalibStreamCnv::initialize
() {
40
ATH_MSG_DEBUG
(
"Initialize EventInfoMuonCalibStreamCnv"
);
41
42
ATH_CHECK
(Converter::initialize());
43
44
ATH_CHECK
(
m_MuonCalibStreamCnvSvc
.retrieve() );
45
ATH_CHECK
(
m_dataProvider
.retrieve() );
46
47
return
StatusCode::SUCCESS;
48
}
49
50
StatusCode
EventInfoMuonCalibStreamCnv::createObj
(IOpaqueAddress *pAddr, DataObject *&pObj) {
51
52
MuonCalibStreamAddress
*pRE_Addr;
53
pRE_Addr =
dynamic_cast<
MuonCalibStreamAddress
*
>
(pAddr);
54
if
(!pRE_Addr) {
55
ATH_MSG_ERROR
(
" Cannot cast to MuonCalibStreamAddress "
);
56
return
StatusCode::FAILURE;
57
}
58
59
ATH_MSG_DEBUG
(
" Creating Objects "
);
60
61
// get CalibEvent
62
const
LVL2_MUON_CALIBRATION::CalibEvent *
event
=
m_dataProvider
->getEvent();
63
if
(!event) {
64
ATH_MSG_ERROR
(
" Can not get CalibEvent "
);
65
return
StatusCode::FAILURE;
66
}
67
68
// Build EventInfo
69
uint64_t eventNumber =
event
->lvl1_id();
70
int
runNumber =
event
->run_number();
71
float
pt =
event
->pt();
72
// Time Stamp
73
uint64_t timeStamp =
event
->timestamp();
74
int
lb_nr(0);
75
76
// create xAOD::EventInfo objects directly
77
xAOD::EventInfo
* evtInfo =
new
xAOD::EventInfo
();
78
xAOD::EventAuxInfo
* evtAuxInfo =
new
xAOD::EventAuxInfo
();
79
evtInfo->setStore(evtAuxInfo);
80
81
evtInfo->
setRunNumber
(runNumber);
82
evtInfo->
setEventNumber
(eventNumber);
83
evtInfo->
setLumiBlock
(lb_nr);
84
evtInfo->
setTimeStamp
(timeStamp);
85
evtInfo->
setBCID
(0);
86
evtInfo->
setTimeStampNSOffset
(pt);
87
uint32_t eventTypeBitmask = 0;
88
eventTypeBitmask |=
xAOD::EventInfo::IS_CALIBRATION
;
89
evtInfo->
setEventTypeBitmask
( eventTypeBitmask );
90
91
pObj =
SG::asStorable
(evtInfo);
92
93
// PRINT TIMESTAMP INFO
94
ATH_MSG_DEBUG
(
"New EventInfo made, run/event/timestamp/pt/LB = "
<<runNumber<<
" "
<<eventNumber<<
" "
<<timeStamp<<
" "
<<pt<<
" "
<<lb_nr);
95
96
return
StatusCode::SUCCESS;
97
}
// EventInfoMuonCalibStreamCnv::createObj()
98
99
// Fill RawEvent object from DataObject
100
// (but really just configure the message service)
101
StatusCode
EventInfoMuonCalibStreamCnv::createRep
(DataObject *
/* pObj */
, IOpaqueAddress *&
/* pAddr */
) {
102
ATH_MSG_DEBUG
(
" Nothing to be done for EventInfo createRep "
);
103
return
StatusCode::SUCCESS;
104
}
105
AthCheckMacros.h
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
AthMsgStreamMacros.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
EventAuxInfo.h
EventInfoMuonCalibStreamCnv.h
CLID
uint32_t CLID
The Class ID type.
Definition
Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
MuonCalibStreamAddress.h
MuonCalibStreamCnvSvc.h
MuonCalibStreamDataProviderSvc.h
MuonCalibStreamInputSvc.h
StorableConversions.h
convert to and from a SG storable
AthMessaging::AthMessaging
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
Definition
AthMessaging.cxx:13
Converter::Converter
Converter()
Definition
Converter.h:29
EventInfoMuonCalibStreamCnv::initialize
virtual StatusCode initialize()
Definition
EventInfoMuonCalibStreamCnv.cxx:39
EventInfoMuonCalibStreamCnv::storageType
static long storageType()
Definition
EventInfoMuonCalibStreamCnv.h:28
EventInfoMuonCalibStreamCnv::EventInfoMuonCalibStreamCnv
EventInfoMuonCalibStreamCnv(ISvcLocator *svcloc)
Definition
EventInfoMuonCalibStreamCnv.cxx:30
EventInfoMuonCalibStreamCnv::m_dataProvider
ServiceHandle< IMuonCalibStreamDataProviderSvc > m_dataProvider
Definition
EventInfoMuonCalibStreamCnv.h:35
EventInfoMuonCalibStreamCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
Definition
EventInfoMuonCalibStreamCnv.cxx:50
EventInfoMuonCalibStreamCnv::createRep
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Definition
EventInfoMuonCalibStreamCnv.cxx:101
EventInfoMuonCalibStreamCnv::classID
static CLID classID()
Definition
EventInfoMuonCalibStreamCnv.cxx:37
EventInfoMuonCalibStreamCnv::m_MuonCalibStreamCnvSvc
ServiceHandle< IConversionSvc > m_MuonCalibStreamCnvSvc
Definition
EventInfoMuonCalibStreamCnv.h:34
MuonCalibStreamAddress
Definition
MuonCalibStreamAddress.h:14
xAOD::EventInfo_v1::setBCID
void setBCID(uint32_t value)
Set the bunch crossing ID of the event.
xAOD::EventInfo_v1::setTimeStampNSOffset
void setTimeStampNSOffset(uint32_t value)
Set the nanosecond offset wrt. the time stamp.
xAOD::EventInfo_v1::setTimeStamp
void setTimeStamp(uint32_t value)
Set the POSIX time of the event.
xAOD::EventInfo_v1::setEventNumber
void setEventNumber(uint64_t value)
Set the current event's event number.
xAOD::EventInfo_v1::setEventTypeBitmask
void setEventTypeBitmask(uint32_t value)
Set the event type bitmask.
xAOD::EventInfo_v1::setRunNumber
void setRunNumber(uint32_t value)
Set the current event's run number.
xAOD::EventInfo_v1::IS_CALIBRATION
@ IS_CALIBRATION
true: calibration, false: physics
Definition
EventInfo_v1.h:155
xAOD::EventInfo_v1::setLumiBlock
void setLumiBlock(uint32_t value)
Set the current event's luminosity block number.
SG::asStorable
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
Definition
DataObjectSharedPtr.h:31
xAOD::EventInfo
EventInfo_v1 EventInfo
Definition of the latest event info version.
Definition
IEventInfoCnvTool.h:16
xAOD::EventAuxInfo
EventAuxInfo_v3 EventAuxInfo
Definition of the latest event auxiliary info version.
Definition
EventAuxInfo.h:15
ClassID_traits::ID
static constexpr CLID ID()
Definition
Control/AthenaKernel/AthenaKernel/ClassID_traits.h:44
EventInfo.h
Generated on
for ATLAS Offline Software by
1.17.0