ATLAS Offline Software
Loading...
Searching...
No Matches
egammaCnv_p3.cxx
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5*/
6
7// egammaCnv_p3.cxx
8// Implementation file for class egammaCnv_p3
10
11
12// STL includes
13
14// egammaEventTPCnv includes
16
17// some constants used to keep consistency over business of egPID conversion
18// --hack-hack-hack-- (ugly-ugly)
19
21// Public methods:
23
24// Constructors
26
27// Destructor
29
31// Const methods:
33
35 egamma* trans,
36 MsgStream& msg )
37{
38// msg << MSG::DEBUG << "Loading egamma from persistent state..."
39// << endmsg;
40
41 // Clear
42 *trans = egamma (pers->m_author);
43
44 m_momCnv.persToTrans (&pers->m_momentum,
45 &trans->momentumBase(),
46 msg);
47 m_partBaseCnv.persToTrans (&pers->m_particleBase,
48 &trans->particleBase(),
49 msg);
50
51 // element links
53 m_clusterCnv.persToTrans( &pers->m_cluster, &cluster, msg );
54 trans->setClusterElementLink (cluster);
55
57 m_trackCnv.persToTrans( &pers->m_trackParticle,
58 &elv,
59 msg );
61
63 m_conversionCnv.persToTrans( &pers->m_conversion,
64 &vx,
65 msg );
67
69 m_egDetailsCnv.persToTrans( &pers->m_egDetails,
70 &egDetails,
71 msg );
72 trans->setDetailElementLinkVector (std::move (egDetails));
73
74 // egPID filling (doubles)
75 {
76 const std::vector<double>& egID = pers->m_egammaDblPIDs;
77 const std::vector<unsigned int>& egEnum = pers->m_egammaEnumPIDs;
78
79 // if you crash here, then there is a data corruption...
80 assert( egEnum.size() == egID.size() );
81
82 for ( unsigned int i=0; i< egID.size(); i++ ) {
83 trans->set_egammaID( (egammaPIDObs::PID) egEnum[i], egID[i] );
84 }
85 }
86 //Clearing Rings ElementLink:
87 trans->resetRings();
88}
89
91 egamma_p3* pers,
92 MsgStream& msg )
93{
94// msg << MSG::DEBUG << "Creating persistent state of egamma..."
95// << endmsg;
96
97 m_momCnv.transToPers (&trans->momentumBase(),
98 &pers->m_momentum,
99 msg);
100 m_partBaseCnv.transToPers (&trans->particleBase(),
101 &pers->m_particleBase,
102 msg);
103
104 // element links
105 m_clusterCnv.transToPers( &trans->clusterElementLink(), &pers->m_cluster, msg );
106
107 m_trackCnv.transToPers( &trans->trackParticleElementLinkVector(),
108 &pers->m_trackParticle,
109 msg );
110
111 m_conversionCnv.transToPers( &trans->conversionElementLinkVector(),
112 &pers->m_conversion,
113 msg );
114
115 m_egDetailsCnv.transToPers( &trans->detailElementLinkVector(),
116 &pers->m_egDetails,
117 msg );
118
119 // author
120 pers->m_author = trans->author();
121
122 // egPID (ints)
123 {
124 std::vector<double>& egID = pers->m_egammaDblPIDs;
125 std::vector<unsigned int>& egEnum = pers->m_egammaEnumPIDs;
126
127 unsigned int nbOfEgammaIDs = (int) egammaPIDObs::LastEgammaPID;
128
129 double tmpID;
130 for ( unsigned int i=0; i<nbOfEgammaIDs; i++ ) {
131 tmpID = trans->egammaID( (egammaPIDObs::PID) i);
132 if ( tmpID != egammaPIDObs::EgPidUndefined ) {
133 egEnum.push_back(i);
134 egID.push_back(tmpID);
135 }
136 }
137 }
138
139// msg << MSG::DEBUG << "Created persistent state of egamma [OK]"
140// << endmsg;
141 }
ElementLinkVector implementation for standalone ROOT.
const momentum_type & momentumBase() const
access to underlying base type (I4Momentum-like)
const particle_type & particleBase() const
access to underlying base type (IParticle-like)
TrackLinkCnv_t m_trackCnv
ClusterLinkCnv_t m_clusterCnv
virtual void persToTrans(const egamma_p3 *persObj, egamma *transObj, MsgStream &msg) override final
Method creating the transient representation of egamma from its persistent representation egamma_p3.
virtual void transToPers(const egamma *transObj, egamma_p3 *persObj, MsgStream &msg) override final
Method creating the persistent representation egamma_p3 from its transient representation egamma.
ConversionLinkCnv_t m_conversionCnv
P4ImplEEtaPhiMCnv_p2 m_momCnv
ParticleBaseCnv_p2 m_partBaseCnv
EgDetailsCnv_t m_egDetailsCnv
ElementLinkInt_p3 m_cluster
links to clusters
Definition egamma_p3.h:65
ElementLinkIntVector_p1 m_trackParticle
links to tracks
Definition egamma_p3.h:68
P4EEtaPhiMFloat_p2 m_momentum
the 4-mom part
Definition egamma_p3.h:57
ElementLinkIntVector_p1 m_egDetails
links to egDetails
Definition egamma_p3.h:74
std::vector< double > m_egammaDblPIDs
Definition egamma_p3.h:81
unsigned int m_author
Definition egamma_p3.h:77
std::vector< unsigned int > m_egammaEnumPIDs
egamma PID
Definition egamma_p3.h:80
ElementLinkIntVector_p1 m_conversion
links to tracks
Definition egamma_p3.h:71
ParticleBase_p2 m_particleBase
the ParticleBase part
Definition egamma_p3.h:60
elec/gamma data class.
Definition egamma.h:58
void setTrackParticleElementLinkVector(const ElementLinkVector< Rec::TrackParticleContainer > &v)
Definition egamma.cxx:550
double egammaID(egammaPIDObs::PID, bool *found) const
access to PID information, as double to work for IsEM and all possible weights as likelihood
Definition egamma.cxx:308
unsigned int author() const
Reconstruction Author.
Definition egamma.h:244
const ElementLinkVector< Rec::TrackParticleContainer > & trackParticleElementLinkVector() const
Definition egamma.cxx:444
void setConversionElementLinkVector(const ElementLinkVector< VxContainer > &link)
Definition egamma.cxx:595
void setDetailElementLinkVector(const ElementLinkVector< egDetailContainer > &v)
Definition egamma.cxx:627
bool set_egammaID(egammaPIDObs::PID id, double result)
set_egamma ID, for doubles and all possible weights as likelihood
Definition egamma.cxx:329
const ElementLinkVector< egDetailContainer > & detailElementLinkVector() const
Definition egamma.cxx:877
void resetRings()
Reset Cluster.
Definition egamma.cxx:479
void setClusterElementLink(const ElementLink< CaloClusterContainer > &link)
Set Cluster Element Link.
Definition egamma.cxx:512
const ElementLinkVector< VxContainer > & conversionElementLinkVector() const
Definition egamma.cxx:461
const ElementLink< CaloClusterContainer > & clusterElementLink() const
element link to cluster
Definition egamma.cxx:427
const unsigned int EgPidUndefined
@ LastEgammaPID
Default for the last enum (don't change it !)
MsgStream & msg
Definition testRead.cxx:32