ATLAS Offline Software
Loading...
Searching...
No Matches
TrackTruthCollectionCnv_p2.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5// T/P converter for TrackTruthCollection.
6// Andrei Gaponenko <agaponenko@lbl.gov>, 2007
7// Olivier Arnaez <olivier.arnaez@cern.ch>, 2015
8
10
13
16
18
20
21namespace {
22 const HepMcParticleLinkCnv_p2 particleLinkConverter;
23 const DataLinkCnv_p1<DataLink<TrackCollection> > dataLinkConverter;
24}
25
28 MsgStream& msg )
29{
30 msg<<MSG::DEBUG<<"TrackTruthCollectionCnv_p2::persToTrans(): PERS size = "<<pers->m_entries.size()<<endmsg;
31
32 dataLinkConverter.persToTrans(pers->m_trackCollectionLink, TrackTruthCollectionAccessor::trackCollectionLink(trans), msg);
33
34 for(Trk::TrackTruthCollection_p2::CollectionType::const_iterator i=pers->m_entries.begin(); i!=pers->m_entries.end(); ++i) {
36 particleLinkConverter.persToTrans(&i->particle, &link, msg);
37 trans->insert(trans->end(), std::make_pair(i->index, TrackTruth(link, i->probability, 0)) );
38 }
39
40 msg<<MSG::DEBUG<<"TrackTruthCollectionCnv_p2::persToTrans() DONE"<<endmsg;
41}
42
45 MsgStream& msg )
46{
47 msg<<MSG::DEBUG<<"TrackTruthCollectionCnv_p2::transToPers()"<<endmsg;
48 msg<<MSG::DEBUG<<"TrackTruthCollectionCnv_p2::transToPers(): input size = "<<trans->size()<<endmsg;
49
50 dataLinkConverter.transToPers(trans->trackCollectionLink(), pers->m_trackCollectionLink, msg);
51
52 pers->m_entries.resize(trans->size());
53 Trk::TrackTruthCollection_p2::CollectionType::size_type ipers(0);
54 for(TrackTruthCollection::const_iterator itrans=trans->begin(); itrans!=trans->end(); ++itrans, ++ipers) {
55 Trk::TrackTruthCollection_p2::Entry& current = pers->m_entries[ipers];
56 const TrackTruth& truth = itrans->second;
57 current.index = itrans->first.index(); // extract index from ElementLink
58 current.probability = truth.probability();
59 particleLinkConverter.transToPers(&itrans->second.particleLink(), &current.particle, msg);
60 }
61
62 msg<<MSG::DEBUG<<"TrackTruthCollectionCnv_p2::transToPers() DONE"<<endmsg;
63}
#define endmsg
This file contains the class definition for the DataLinkCnv_p1 class and DataLinkVectorCnv_p1 class.
static DataLink< TrackCollection > & trackCollectionLink(TrackTruthCollection *truthColl)
virtual void persToTrans(const Trk::TrackTruthCollection_p2 *persObj, TrackTruthCollection *transObj, MsgStream &msg)
Method creating the transient representation of Analysis::TrackTruthCollection from its persistent re...
virtual void transToPers(const TrackTruthCollection *transObj, Trk::TrackTruthCollection_p2 *persObj, MsgStream &msg)
Method creating the persistent representation TrackTruthCollection_p2 from its transient representati...
DataLink< TrackCollection > trackCollectionLink() const
MC particle associated with a reco track + the quality of match.
Definition TrackTruth.h:14
float probability() const
Definition TrackTruth.h:28
MsgStream & msg
Definition testRead.cxx:32