ATLAS Offline Software
Loading...
Searching...
No Matches
egammaCnv_p5.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_p5.cxx
8// Implementation file for class egammaCnv_p5
10
11
12// STL includes
13
14// egammaEventTPCnv includes
16
17
18
19// some constants used to keep consistency over business of egPID conversion
20// --hack-hack-hack-- (ugly-ugly)
21
23// Public methods:
25
26// Constructors
28
29// Destructor
31
33// Const methods:
35
37 egamma* trans,
38 MsgStream& msg )
39{
40// msg << MSG::DEBUG << "Loading egamma from persistent state..."
41// << endmsg;
42
43 // Clear
44 *trans = egamma (pers->m_author);
45
46 m_momCnv.persToTrans (&pers->m_momentum,
47 &trans->momentumBase(),
48 msg);
49
50 egamma::momentum_type momentumCluster;
51 m_momCnv.persToTrans (&pers->m_momentumCluster,
52 &momentumCluster,
53 msg);
54 trans->setUncombined4Mom (momentumCluster.hlv());
55
56 m_partBaseCnv.persToTrans (&pers->m_particleBase,
57 &trans->particleBase(),
58 msg);
59
60 // element links
62 m_clusterCnv.persToTrans( &pers->m_cluster, &cluster, msg );
63 trans->setClusterElementLink (cluster);
64
66 m_trackCnv.persToTrans( &pers->m_trackParticle,
67 &elv,
68 msg );
70
72 m_conversionCnv.persToTrans( &pers->m_conversion,
73 &vx,
74 msg );
76
78 m_egDetailsCnv.persToTrans( &pers->m_egDetails,
79 &egDetails,
80 msg );
81 trans->setDetailElementLinkVector (std::move (egDetails));
82
83 // egPID filling (doubles)
84 {
85 const std::vector<double>& egID = pers->m_egammaDblPIDs;
86 const std::vector<unsigned int>& egEnum = pers->m_egammaEnumPIDs;
87
88 // if you crash here, then there is a data corruption...
89 assert( egEnum.size() == egID.size() );
90
91 for ( unsigned int i=0; i< egID.size(); i++ ) {
92 trans->set_egammaID( (egammaPIDObs::PID) egEnum[i], egID[i] );
93 }
94 }
95
97 m_ringsCnv.persToTrans( &pers->m_rings, &rings, msg);
98 trans->setRingsElementLink (rings);
99}
100
102 egamma_p5* pers,
103 MsgStream& msg )
104{
105// msg << MSG::DEBUG << "Creating persistent state of egamma..."
106// << endmsg;
107
108 m_momCnv.transToPers (&trans->momentumBase(),
109 &pers->m_momentum,
110 msg);
111
112 m_momCnv.transToPers (&trans->get4Mom(egamma::Uncombined),
113 &pers->m_momentumCluster,
114 msg);
115
116 m_partBaseCnv.transToPers (&trans->particleBase(),
117 &pers->m_particleBase,
118 msg);
119
120 // element links
121 m_clusterCnv.transToPers( &trans->clusterElementLink(), &pers->m_cluster, msg );
122
123 m_trackCnv.transToPers( &trans->trackParticleElementLinkVector(),
124 &pers->m_trackParticle,
125 msg );
126
127 m_conversionCnv.transToPers( &trans->conversionElementLinkVector(),
128 &pers->m_conversion,
129 msg );
130
131 m_egDetailsCnv.transToPers( &trans->detailElementLinkVector(),
132 &pers->m_egDetails,
133 msg );
134
135 // author
136 pers->m_author = trans->author();
137
138 // egPID (ints)
139 {
140 std::vector<double>& egID = pers->m_egammaDblPIDs;
141 std::vector<unsigned int>& egEnum = pers->m_egammaEnumPIDs;
142
143 unsigned int nbOfEgammaIDs = (int) egammaPIDObs::LastEgammaPID;
144
145 bool found;
146 for ( unsigned int i=0; i<nbOfEgammaIDs; i++ ) {
147 const double tmpID = trans->egammaID( (egammaPIDObs::PID) i, &found);
148 if (found) {
149 egEnum.push_back(i);
150 egID.push_back(tmpID);
151 }
152 }
153 }
154
155 m_ringsCnv.transToPers (&trans->ringsElementLink(), &pers->m_rings, msg);
156}
ElementLinkVector implementation for standalone ROOT.
CLHEP::HepLorentzVector hlv() const
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
ParticleBaseCnv_p2 m_partBaseCnv
virtual void persToTrans(const egamma_p5 *persObj, egamma *transObj, MsgStream &msg) override final
Method creating the transient representation of egamma from its persistent representation egamma_p5.
RingsLinkCnv_t m_ringsCnv
ClusterLinkCnv_t m_clusterCnv
P4ImplEEtaPhiMCnv_p2 m_momCnv
virtual void transToPers(const egamma *transObj, egamma_p5 *persObj, MsgStream &msg) override final
Method creating the persistent representation egamma_p5 from its transient representation egamma.
EgDetailsCnv_t m_egDetailsCnv
ConversionLinkCnv_t m_conversionCnv
ElementLinkInt_p3 m_rings
links to rings
Definition egamma_p5.h:84
ElementLinkIntVector_p1 m_conversion
links to tracks
Definition egamma_p5.h:76
std::vector< double > m_egammaDblPIDs
Definition egamma_p5.h:91
P4EEtaPhiMFloat_p2 m_momentum
the 4-mom part
Definition egamma_p5.h:58
std::vector< unsigned int > m_egammaEnumPIDs
egamma PID
Definition egamma_p5.h:90
ElementLinkIntVector_p1 m_egDetails
links to egDetails
Definition egamma_p5.h:80
ElementLinkInt_p3 m_cluster
links to clusters
Definition egamma_p5.h:69
unsigned int m_author
Definition egamma_p5.h:87
P4EEtaPhiMFloat_p2 m_momentumCluster
the 4-mom part for the Cluster
Definition egamma_p5.h:61
ParticleBase_p2 m_particleBase
the ParticleBase part
Definition egamma_p5.h:64
ElementLinkIntVector_p1 m_trackParticle
links to tracks
Definition egamma_p5.h:72
elec/gamma data class.
Definition egamma.h:58
const momentum_type & get4Mom(egamma::eg4MomType type=egamma::Combined) const
return the combined or additional uncombined cluster 4mom
Definition egamma.h:395
const ElementLink< CaloRingsContainer > & ringsElementLink() const
element link to rings
Definition egamma.cxx:379
void setTrackParticleElementLinkVector(const ElementLinkVector< Rec::TrackParticleContainer > &v)
Definition egamma.cxx:550
@ Uncombined
Definition egamma.h:79
void setUncombined4Mom(const I4Momentum &theI4Mom)
set uncombined all 4-mom from another I4Momentum reference
Definition egamma.cxx:947
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
egammaImpl_t::momentum_type momentum_type
Definition egamma.h:70
void setRingsElementLink(const ElementLink< CaloRingsContainer > &link)
Set Rings Element Link.
Definition egamma.cxx:492
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 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
@ LastEgammaPID
Default for the last enum (don't change it !)
MsgStream & msg
Definition testRead.cxx:32