ATLAS Offline Software
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"
7 #include "EventInfo/EventType.h"
9 
14 
15 
16 static const EventIDCnv_p1 idConv;
17 static const EventTypeCnv_p3 typeConv;
18 static const TriggerInfoCnv_p2 trigInfoCnv;
19 
20 
21 void 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 
37 void 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
45 EventInfo* 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 
EventIDCnv_p1::transToPers
virtual void transToPers(const EventID *transObj, EventID_p1 *persObj, MsgStream &log) const override
Definition: EventIDCnv_p1.cxx:8
EventInfo::setEventID
void setEventID(owner< EventID * > pid)
Definition: EventInfo.cxx:82
EventInfo::setEventType
void setEventType(owner< EventType * >)
Definition: EventInfo.cxx:90
EventInfo_p4::m_event_type
EventType_p3 m_event_type
Definition: EventInfo_p4.h:23
EventInfo::m_trigger_info
std::unique_ptr< TriggerInfo > m_trigger_info
Definition: EventInfo/EventInfo/EventInfo.h:217
EventInfo::m_event_flags
std::vector< unsigned int > m_event_flags
Definition: EventInfo/EventInfo/EventInfo.h:218
TriggerInfoCnv_p2::createTransientConst
virtual TriggerInfo * createTransientConst(const TriggerInfo_p2 *persObj, MsgStream &log) const override
Definition: TriggerInfoCnv_p2.cxx:45
EventInfo
EventInfo
Definition: EventTPCnv.cxx:47
EventTypeCnv_p3
Definition: EventTypeCnv_p3.h:13
TriggerInfo.h
This class contains trigger related information.
EventType.h
This class provides general information about an event. It extends EventInfo with a list of sub-evts ...
EventIDCnv_p1::createTransientConst
virtual EventID * createTransientConst(const EventID_p1 *persObj, MsgStream &log) const override
Definition: EventIDCnv_p1.cxx:34
EventTypeCnv_p3::createTransientConst
virtual EventType * createTransientConst(const EventType_p3 *persObj, MsgStream &log) const override
Definition: EventTypeCnv_p3.cxx:40
EventInfo::setTriggerInfo
void setTriggerInfo(owner< TriggerInfo * > pTrig)
Add TriggerInfo to existing object.
Definition: EventInfo.cxx:98
EventID.h
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
lumiFormat.i
int i
Definition: lumiFormat.py:85
EventIDCnv_p1
Definition: EventIDCnv_p1.h:14
EventInfoCnv_p4::transToPers
virtual void transToPers(const EventInfo *transObj, EventInfo_p4 *persObj, MsgStream &log) const override
Definition: EventInfoCnv_p4.cxx:21
EventInfo::event_ID
EventID * event_ID()
the unique identification of the event.
Definition: EventInfo/EventInfo/EventInfo.h:224
EventInfoCnv_p4::createTransientConst
virtual EventInfo * createTransientConst(const EventInfo_p4 *persObj, MsgStream &log) const override
Definition: EventInfoCnv_p4.cxx:45
TriggerInfoCnv_p2
Definition: TriggerInfoCnv_p2.h:13
EventInfo_p4::m_event_ID
EventID_p1 m_event_ID
Definition: EventInfo_p4.h:22
TriggerInfoCnv_p2.h
EventTypeCnv_p3::transToPers
virtual void transToPers(const EventType *transObj, EventType_p3 *persObj, MsgStream &log) const override
Definition: EventTypeCnv_p3.cxx:8
EventIDCnv_p1.h
EventInfo
This class provides general information about an event. Event information is provided by the accessor...
Definition: EventInfo/EventInfo/EventInfo.h:43
TriggerInfoCnv_p2::transToPers
virtual void transToPers(const TriggerInfo *transObj, TriggerInfo_p2 *persObj, MsgStream &log) const override
Definition: TriggerInfoCnv_p2.cxx:8
EventInfoCnv_p4.h
EventInfo_p4
Definition: EventInfo_p4.h:18
EventInfo::trigger_info
TriggerInfo * trigger_info()
trigger information (ptr may be NULL)
Definition: EventInfo/EventInfo/EventInfo.h:244
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
EventInfo_p4::m_event_flags
std::vector< unsigned int > m_event_flags
Definition: EventInfo_p4.h:25
EventInfo_p4::m_trigger_info
TriggerInfo_p2 m_trigger_info
Definition: EventInfo_p4.h:24
calibdata.copy
bool copy
Definition: calibdata.py:27
EventTypeCnv_p3.h
EventInfo::event_type
EventType * event_type()
the type of the event, e.g. simulation, testbeam, etc
Definition: EventInfo/EventInfo/EventInfo.h:234
EventInfoCnv_p4::persToTrans
virtual void persToTrans(const EventInfo_p4 *persObj, EventInfo *transObj, MsgStream &log) const override
Definition: EventInfoCnv_p4.cxx:37