ATLAS Offline Software
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"
7 #include "EventInfo/EventType.h"
9 
14 
15 
16 static const EventIDCnv_p1 idConv;
17 static const EventTypeCnv_p1 typeConv;
18 static const TriggerInfoCnv_p2 trigInfoCnv;
19 
20 
21 void 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 
38 void 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
46 EventInfo* 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 }
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::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_p1::createTransientConst
virtual EventType * createTransientConst(const EventType_p1 *persObj, MsgStream &log) const override
Definition: EventTypeCnv_p1.cxx:27
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_p1::transToPers
virtual void transToPers(const EventType *transObj, EventType_p1 *persObj, MsgStream &log) const override
Definition: EventTypeCnv_p1.cxx:8
EventInfo_p2
Definition: EventInfo_p2.h:18
EventTypeCnv_p1
Definition: EventTypeCnv_p1.h:13
EventInfoCnv_p2.h
EventInfo_p2::m_event_type
EventType_p1 m_event_type
Definition: EventInfo_p2.h:23
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
EventInfo_p2::m_event_ID
EventID_p1 m_event_ID
Definition: EventInfo_p2.h:22
EventIDCnv_p1
Definition: EventIDCnv_p1.h:14
EventInfo::eventFlags
unsigned int eventFlags(EventFlagSubDet subDet) const
event flags for a particular sub-detector
Definition: EventInfo/EventInfo/EventInfo.h:254
EventInfo::event_ID
EventID * event_ID()
the unique identification of the event.
Definition: EventInfo/EventInfo/EventInfo.h:224
EventInfo_p2::m_event_flags
std::vector< unsigned int > m_event_flags
Definition: EventInfo_p2.h:25
TriggerInfoCnv_p2
Definition: TriggerInfoCnv_p2.h:13
TriggerInfoCnv_p2.h
EventInfoCnv_p2::persToTrans
virtual void persToTrans(const EventInfo_p2 *persObj, EventInfo *transObj, MsgStream &log) const override
Definition: EventInfoCnv_p2.cxx:38
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
EventTypeCnv_p1.h
EventInfoCnv_p2::createTransientConst
virtual EventInfo * createTransientConst(const EventInfo_p2 *persObj, MsgStream &log) const override
Definition: EventInfoCnv_p2.cxx:46
EventInfo_p2::m_trigger_info
TriggerInfo_p2 m_trigger_info
Definition: EventInfo_p2.h:24
EventInfoCnv_p2::transToPers
virtual void transToPers(const EventInfo *transObj, EventInfo_p2 *persObj, MsgStream &log) const override
Definition: EventInfoCnv_p2.cxx:21
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
calibdata.copy
bool copy
Definition: calibdata.py:27
EventInfo::event_type
EventType * event_type()
the type of the event, e.g. simulation, testbeam, etc
Definition: EventInfo/EventInfo/EventInfo.h:234