ATLAS Offline Software
PileUpEventInfoCnv_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 
8 
9 static const EventInfoCnv_p2 evInfoConv;
10 
11 namespace {
12  const int MODULO(100000);
13  const double MINTIME(-2000.0); //ns
14 }
15 
16 void PileUpEventInfoCnv_p2::transToPers(const PileUpEventInfo* trans, PileUpEventInfo_p2* pers, MsgStream &log) const {
17  evInfoConv.transToPers(trans, pers, log);
18 
20  size_t sub_ev_n = std::distance (sub_iter, trans->endSubEvt());
21  pers->m_subEvents.resize(sub_ev_n);
22  PileUpEventInfo_p2::SubEvVect_t::iterator p_sub_iter = pers->m_subEvents.begin();
23  while( sub_iter!=trans->endSubEvt() ) {
24  short time = sub_iter->time();
25  short index = sub_iter->index();
26  p_sub_iter->m_timeIndex = (time - MINTIME) + MODULO * index;
27  evInfoConv.transToPers(sub_iter->pSubEvt, &p_sub_iter->m_subEventInfo, log);
28  ++p_sub_iter; ++sub_iter;
29  }
30 }
31 
32 void PileUpEventInfoCnv_p2::persToTrans(const PileUpEventInfo_p2* pers, PileUpEventInfo* trans, MsgStream &log) const
33 {
34  *trans = PileUpEventInfo();
35  evInfoConv.persToTrans(pers, trans, log);
36 
37  PileUpEventInfo_p2::SubEvVect_t::const_iterator p_sub_iter = pers->m_subEvents.begin();
38  while( p_sub_iter != pers->m_subEvents.end() ) {
39  short index1 = static_cast<short>( (p_sub_iter->m_timeIndex)*(1./MODULO) );
40  unsigned long index = MODULO*index1;
41 
42  trans->addSubEvt (static_cast<short>( MINTIME+(p_sub_iter->m_timeIndex-index) ),
43  //index1
45  std::unique_ptr<EventInfo>
46  (evInfoConv.createTransientConst(&p_sub_iter->m_subEventInfo, log)),
47  nullptr);
48  ++p_sub_iter;
49  }
50 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
PileUpEventInfo.h
This class provides information about an overlaid event. It extends EventInfo with a list of sub-evts...
index
Definition: index.py:1
EventInfoCnv_p2
Definition: EventInfoCnv_p2.h:13
PileUpEventInfo_p2::m_subEvents
SubEvVect_t m_subEvents
Definition: PileUpEventInfo_p2.h:32
EventInfoCnv_p2.h
PileUpEventInfo::beginSubEvt
SubEvent::iterator beginSubEvt()
Definition: PileUpEventInfo.h:131
PileUpEventInfoCnv_p2.h
Trk::index1
@ index1
Definition: BoundarySurfaceFace.h:48
PileUpEventInfo_p2
Definition: PileUpEventInfo_p2.h:20
PileUpEventInfo
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Old PileUpEventInfo
Definition: EventTPCnv.cxx:87
PileUpEventInfo::addSubEvt
void addSubEvt(time_type t, PileUpTimeEventIndex::PileUpType puType, const EventInfo *pse, StoreGateSvc *psg)
setter for the subEvt collection t=0(ns) for the original event
Definition: PileUpEventInfo.h:104
EventInfoCnv_p2::persToTrans
virtual void persToTrans(const EventInfo_p2 *persObj, EventInfo *transObj, MsgStream &log) const override
Definition: EventInfoCnv_p2.cxx:38
PileUpEventInfoCnv_p2::transToPers
virtual void transToPers(const PileUpEventInfo *transObj, PileUpEventInfo_p2 *persObj, MsgStream &log) const override
Definition: PileUpEventInfoCnv_p2.cxx:16
PileUpEventInfo
This class provides information about an overlaid event. It extends EventInfo with a list of sub-evts...
Definition: PileUpEventInfo.h:37
PileUpEventInfoCnv_p2::persToTrans
virtual void persToTrans(const PileUpEventInfo_p2 *persObj, PileUpEventInfo *transObj, MsgStream &log) const override
Definition: PileUpEventInfoCnv_p2.cxx:32
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
EventInfoCnv_p2::createTransientConst
virtual EventInfo * createTransientConst(const EventInfo_p2 *persObj, MsgStream &log) const override
Definition: EventInfoCnv_p2.cxx:46
EventInfoCnv_p2::transToPers
virtual void transToPers(const EventInfo *transObj, EventInfo_p2 *persObj, MsgStream &log) const override
Definition: EventInfoCnv_p2.cxx:21
PileUpEventInfo::SubEvent::const_iterator
std::list< SubEvent >::const_iterator const_iterator
Definition: PileUpEventInfo.h:97
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
PileUpEventInfo::endSubEvt
SubEvent::iterator endSubEvt()
Definition: PileUpEventInfo.h:132
PileUpTimeEventIndex::Unknown
@ Unknown
Definition: PileUpTimeEventIndex.h:15