ATLAS Offline Software
CSCSimHitCollectionCnv_p1.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
9 
10 //#include <cmath>
12 
13 // Gaudi
14 #include "GaudiKernel/MsgStream.h"
15 // Athena
16 #include "StoreGate/StoreGateSvc.h"
17 
19 {
20  // for reasons of efficiency, set size before hand
21  unsigned int size=transCont->size();
22  persCont->m_CSCid.reserve(size);
23  persCont->m_globalTime.reserve(size);
24  persCont->m_energyDeposit.reserve(size);
25  persCont->m_stX.reserve(size);
26  persCont->m_stY.reserve(size);
27  persCont->m_stZ.reserve(size);
28  persCont->m_enX.reserve(size);
29  persCont->m_enY.reserve(size);
30  persCont->m_enZ.reserve(size);
31  persCont->m_particleID.reserve(size);
32  // persCont->m_meanTime.reserve(size);
33  persCont->m_partLink.reserve(size);
34 
35  // make convertor to handle HepMcParticleLinks
36  HepMcParticleLinkCnv_p1 hepMcPLCnv;
37  HepMcParticleLink_p1 persLink; // will use this as a temp object inside the loop
38 
39  // loop through container, filling pers object
40  CSCSimHitCollection::const_iterator it = transCont->begin(), itEnd = transCont->end();
41  for (; it != itEnd; ++it) {
42  persCont->m_CSCid.push_back(it->CSCid());
43  persCont->m_globalTime.push_back(it->globalTime());
44  persCont->m_energyDeposit.push_back(it->energyDeposit());
45  persCont->m_stX.push_back(it->getHitStart().x());
46  persCont->m_stY.push_back(it->getHitStart().y());
47  persCont->m_stZ.push_back(it->getHitStart().z());
48  persCont->m_enX.push_back(it->getHitEnd().x());
49  persCont->m_enY.push_back(it->getHitEnd().y());
50  persCont->m_enZ.push_back(it->getHitEnd().z());
51  persCont->m_particleID.push_back(it->particleID());
52  // persCont->m_meanTime.push_back(hit->m_meanTime);
53 
54  hepMcPLCnv.transToPers(&(it->particleLink()),&persLink, log);
55  persCont->m_partLink.push_back(persLink);
56  }
57 }
58 
59 
61  std::unique_ptr<CSCSimHitCollection> trans(new CSCSimHitCollection("DefaultCollectionName",persObj->m_globalTime.size()));
62  persToTrans(persObj, trans.get(), log);
63  return(trans.release());
64 }
65 
66 
68 {
69  HepMcParticleLinkCnv_p1 hepMcPLCnv;
70 
71  //transCont->reserve(persCont->m_CSCid.size());//done in createTransient
72  for (unsigned int i = 0; i < persCont->m_CSCid.size(); i++) {
73  Amg::Vector3D start(persCont->m_stX[i], persCont->m_stY[i], persCont->m_stZ[i]);
74  Amg::Vector3D end(persCont->m_enX[i], persCont->m_enY[i], persCont->m_enZ[i]);
75 
76  HepMcParticleLink link;
77  hepMcPLCnv.persToTrans(&persCont->m_partLink[i],&link, log);
78 
79  transCont->Emplace (persCont->m_CSCid[i], persCont->m_globalTime[i], persCont->m_energyDeposit[i], start, end, persCont->m_particleID[i],
80  link,-1.);
81  }
82 }
83 
CSCSimHitCollectionCnv_p1.h
Muon::CSCSimHitCollection_p1::m_particleID
std::vector< int > m_particleID
Definition: CSCSimHitCollection_p1.h:20
Muon::CSCSimHitCollection_p1::m_stX
std::vector< float > m_stX
Definition: CSCSimHitCollection_p1.h:18
Muon::CSCSimHitCollection_p1::m_stY
std::vector< float > m_stY
Definition: CSCSimHitCollection_p1.h:18
Muon::CSCSimHitCollection_p1::m_globalTime
std::vector< float > m_globalTime
Definition: CSCSimHitCollection_p1.h:16
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
Muon::CSCSimHitCollection_p1::m_enX
std::vector< float > m_enX
Definition: CSCSimHitCollection_p1.h:19
AtlasHitsVector
Definition: AtlasHitsVector.h:33
skel.it
it
Definition: skel.GENtoEVGEN.py:423
CSCSimHitCollection_p1.h
AtlasHitsVector::begin
const_iterator begin() const
Definition: AtlasHitsVector.h:131
AtlasHitsVector::const_iterator
CONT::const_iterator const_iterator
Definition: AtlasHitsVector.h:43
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
CSCSimHitCollection
AtlasHitsVector< CSCSimHit > CSCSimHitCollection
Definition: CSCSimHitCollection.h:14
AtlasHitsVector::Emplace
void Emplace(Args &&... args)
Definition: AtlasHitsVector.h:81
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
GeoPrimitives.h
lumiFormat.i
int i
Definition: lumiFormat.py:92
Muon::CSCSimHitCollection_p1::m_energyDeposit
std::vector< float > m_energyDeposit
Definition: CSCSimHitCollection_p1.h:17
CSCSimHitCollectionCnv_p1::persToTrans
virtual void persToTrans(const Muon::CSCSimHitCollection_p1 *persCont, CSCSimHitCollection *transCont, MsgStream &log)
Definition: CSCSimHitCollectionCnv_p1.cxx:67
Muon::CSCSimHitCollection_p1::m_stZ
std::vector< float > m_stZ
Represents m_hitStart in transient class.
Definition: CSCSimHitCollection_p1.h:18
Muon::CSCSimHitCollection_p1::m_CSCid
std::vector< int > m_CSCid
Definition: CSCSimHitCollection_p1.h:15
CSCSimHit.h
Muon::CSCSimHitCollection_p1::m_enZ
std::vector< float > m_enZ
Represents m_hitEnd in transient class.
Definition: CSCSimHitCollection_p1.h:19
HepMcParticleLinkCnv_p1.h
HepMcParticleLinkCnv_p1::transToPers
virtual void transToPers(const HepMcParticleLink *transObj, HepMcParticleLink_p1 *persObj, MsgStream &msg) const override
Method creating the persistent representation HepMcParticleLink_p1 from its transient representation ...
Definition: HepMcParticleLinkCnv_p1.cxx:46
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
HepMcParticleLinkCnv_p1
Definition: HepMcParticleLinkCnv_p1.h:33
HepMcParticleLinkCnv_p1::persToTrans
virtual void persToTrans(const HepMcParticleLink_p1 *persObj, HepMcParticleLink *transObj, MsgStream &msg) const override
Method creating the transient representation of HepMcParticleLink from its persistent representation ...
Definition: HepMcParticleLinkCnv_p1.cxx:30
CSCSimHitCollectionCnv_p1::transToPers
virtual void transToPers(const CSCSimHitCollection *transCont, Muon::CSCSimHitCollection_p1 *persCont, MsgStream &log)
Definition: CSCSimHitCollectionCnv_p1.cxx:18
AtlasHitsVector::end
const_iterator end() const
Definition: AtlasHitsVector.h:134
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
AtlasHitsVector::size
size_type size() const
Definition: AtlasHitsVector.h:143
Muon::CSCSimHitCollection_p1::m_partLink
std::vector< HepMcParticleLink_p1 > m_partLink
Definition: CSCSimHitCollection_p1.h:22
StoreGateSvc.h
Muon::CSCSimHitCollection_p1::m_enY
std::vector< float > m_enY
Definition: CSCSimHitCollection_p1.h:19
CSCSimHitCollectionCnv_p1::createTransient
virtual CSCSimHitCollection * createTransient(const Muon::CSCSimHitCollection_p1 *persObj, MsgStream &log)
Definition: CSCSimHitCollectionCnv_p1.cxx:60
Muon::CSCSimHitCollection_p1
Definition: CSCSimHitCollection_p1.h:13