ATLAS Offline Software
Loading...
Searching...
No Matches
EventInfoCnv_p2.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "EventInfo/EventInfo.h"
6#include "EventInfo/EventID.h"
9
14
15
16static const EventIDCnv_p1 idConv;
19
20
21void EventInfoCnv_p2::transToPers(const EventInfo* trans, EventInfo_p2* pers, MsgStream &log) const {
22 idConv.transToPers(trans->event_ID(), &pers->m_event_ID, log);
23 typeConv.transToPers(trans->event_type(), &pers->m_event_type, log);
24 if( trans->trigger_info() ) {
25 trigInfoCnv.transToPers(trans->trigger_info(), &pers->m_trigger_info, log);
26 }
27 // Don't write out event flags if they are all == 0
28 const std::vector<unsigned int>& event_flags = trans->eventFlags();
29 if (event_flags.size()) {
30 bool copy = false;
31 for (unsigned int i = 0; i < event_flags.size(); ++i) {
32 if (event_flags[i]) { copy = true; break; }
33 }
34 if (copy) pers->m_event_flags = event_flags;
35 }
36}
37
38void EventInfoCnv_p2::persToTrans(const EventInfo_p2* pers, EventInfo* trans, MsgStream &log) const {
39 trans->setEventID (idConv.createTransientConst(&pers->m_event_ID, log));
40 trans->setEventType (typeConv.createTransientConst(&pers->m_event_type, log));
41 trans->setTriggerInfo (trigInfoCnv.createTransientConst(&pers->m_trigger_info, log));
42 if (pers->m_event_flags.size()) trans->m_event_flags = pers->m_event_flags;
43}
44
45// work around the default constructor of EventInfo allocating memory
46EventInfo* EventInfoCnv_p2::createTransientConst( const EventInfo_p2* persObj, MsgStream &log) const {
47 std::unique_ptr<EventInfo> trans( new EventInfo(0,0,0) );
48 persToTrans(persObj, trans.get(), log);
49 return(trans.release());
50}
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
static const TriggerInfoCnv_p1 trigInfoCnv
static const EventTypeCnv_p1 typeConv
static const EventIDCnv_p1 idConv
This class provides general information about an event.
This class contains trigger related information.
virtual void persToTrans(const EventInfo_p2 *persObj, EventInfo *transObj, MsgStream &log) const override
virtual void transToPers(const EventInfo *transObj, EventInfo_p2 *persObj, MsgStream &log) const override
virtual EventInfo * createTransientConst(const EventInfo_p2 *persObj, MsgStream &log) const override
TriggerInfo_p2 m_trigger_info
std::vector< unsigned int > m_event_flags
EventType_p1 m_event_type
EventID_p1 m_event_ID
void setEventID(owner< EventID * > pid)
Definition EventInfo.cxx:82
void setEventType(owner< EventType * >)
Definition EventInfo.cxx:90
void setTriggerInfo(owner< TriggerInfo * > pTrig)
Add TriggerInfo to existing object.
Definition EventInfo.cxx:98
EventID * event_ID()
the unique identification of the event.
TriggerInfo * trigger_info()
trigger information (ptr may be NULL)
unsigned int eventFlags(EventFlagSubDet subDet) const
event flags for a particular sub-detector
EventType * event_type()
the type of the event, e.g. simulation, testbeam, etc
std::vector< unsigned int > m_event_flags