ATLAS Offline Software
Loading...
Searching...
No Matches
EventInfoCnv_p4.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_p4::transToPers(const EventInfo* trans, EventInfo_p4* 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->m_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 if (trans->m_event_flags.size()) {
29 bool copy = false;
30 for (unsigned int i = 0; i < trans->m_event_flags.size(); ++i) {
31 if (trans->m_event_flags[i]) { copy = true; break; }
32 }
33 if (copy) pers->m_event_flags = trans->m_event_flags;
34 }
35}
36
37void EventInfoCnv_p4::persToTrans(const EventInfo_p4* pers, EventInfo* trans, MsgStream &log) const {
38 trans->setEventID(idConv.createTransientConst(&pers->m_event_ID, log));
39 trans->setEventType(typeConv.createTransientConst(&pers->m_event_type, log));
40 trans->setTriggerInfo(trigInfoCnv.createTransientConst(&pers->m_trigger_info, log));
41 if (pers->m_event_flags.size()) trans->m_event_flags = pers->m_event_flags;
42}
43
44// work around the default constructor of EventInfo allocating memory
45EventInfo* EventInfoCnv_p4::createTransientConst( const EventInfo_p4* persObj, MsgStream &log) const {
46 std::unique_ptr<EventInfo> trans( new EventInfo(0,0,0) );
47 persToTrans(persObj, trans.get(), log);
48 return(trans.release());
49}
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_p4 *persObj, EventInfo *transObj, MsgStream &log) const override
virtual EventInfo * createTransientConst(const EventInfo_p4 *persObj, MsgStream &log) const override
virtual void transToPers(const EventInfo *transObj, EventInfo_p4 *persObj, MsgStream &log) const override
std::vector< unsigned int > m_event_flags
EventType_p3 m_event_type
EventID_p1 m_event_ID
TriggerInfo_p2 m_trigger_info
void setEventID(owner< EventID * > pid)
Definition EventInfo.cxx:82
void setEventType(owner< EventType * >)
Definition EventInfo.cxx:90
std::unique_ptr< TriggerInfo > m_trigger_info
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)
EventType * event_type()
the type of the event, e.g. simulation, testbeam, etc
std::vector< unsigned int > m_event_flags