ATLAS Offline Software
Loading...
Searching...
No Matches
egammaCnv_p4.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_p4.cxx
8// Implementation file for class egammaCnv_p4
10
11
12// STL includes
13
14// egammaEventTPCnv includes
16
17
18// some constants used to keep consistency over business of egPID conversion
19// --hack-hack-hack-- (ugly-ugly)
20
22// Public methods:
24
25// Constructors
27
28// Destructor
30
32// Const methods:
34
36 egamma* trans,
37 MsgStream& msg )
38{
39// msg << MSG::DEBUG << "Loading egamma from persistent state..."
40// << endmsg;
41
42 // Clear
43 *trans = egamma (pers->m_author);
44
45 m_momCnv.persToTrans (&pers->m_momentum,
46 &trans->momentumBase(),
47 msg);
48
49 egamma::momentum_type momentumCluster;
50 m_momCnv.persToTrans (&pers->m_momentumCluster,
51 &momentumCluster,
52 msg);
53 trans->setUncombined4Mom (momentumCluster.hlv());
54
55 m_partBaseCnv.persToTrans (&pers->m_particleBase,
56 &trans->particleBase(),
57 msg);
58
59 // element links
61 m_clusterCnv.persToTrans( &pers->m_cluster, &cluster, msg );
62 trans->setClusterElementLink (cluster);
63
65 m_trackCnv.persToTrans( &pers->m_trackParticle,
66 &elv,
67 msg );
69
71 m_conversionCnv.persToTrans( &pers->m_conversion,
72 &vx,
73 msg );
75
77 m_egDetailsCnv.persToTrans( &pers->m_egDetails,
78 &egDetails,
79 msg );
80 trans->setDetailElementLinkVector (std::move (egDetails));
81
82 // egPID filling (doubles)
83 {
84 const std::vector<double>& egID = pers->m_egammaDblPIDs;
85 const std::vector<unsigned int>& egEnum = pers->m_egammaEnumPIDs;
86
87 // if you crash here, then there is a data corruption...
88 assert( egEnum.size() == egID.size() );
89
90 for ( unsigned int i=0; i< egID.size(); i++ ) {
91 trans->set_egammaID( (egammaPIDObs::PID) egEnum[i], egID[i] );
92 }
93
94 // HACK: before rel 17 PID values of 0 were not stored. Therefore,
95 // let's put 0's if OQ or IsEM are missing. (We will not worry
96 // about the MVA tools)
97
98 bool found;
100 if (!found) trans->set_egammaIDint(egammaPIDObs::IsEM, 0);
101
102 trans->isemse(egammaPIDObs::ALL, &found);
103 if (!found) trans->set_egammaIDint(egammaPIDObs::SofteIsEM, 0);
104
105 trans->isgoodoq(egammaPIDObs::ALLOQ, &found);
106 if (!found) trans->set_egammaIDint(egammaPIDObs::IsGoodOQ, 0);
107
108 }
109 //Clearing Rings ElementLink:
110 trans->resetRings();
111}
112
114 egamma_p4* pers,
115 MsgStream& msg )
116{
117// msg << MSG::DEBUG << "Creating persistent state of egamma..."
118// << endmsg;
119
120 m_momCnv.transToPers (&trans->momentumBase(),
121 &pers->m_momentum,
122 msg);
123
124 m_momCnv.transToPers (&trans->get4Mom(egamma::Uncombined),
125 &pers->m_momentumCluster,
126 msg);
127
128 m_partBaseCnv.transToPers (&trans->particleBase(),
129 &pers->m_particleBase,
130 msg);
131
132 // element links
133 m_clusterCnv.transToPers( &trans->clusterElementLink(), &pers->m_cluster, msg );
134
135 m_trackCnv.transToPers( &trans->trackParticleElementLinkVector(),
136 &pers->m_trackParticle,
137 msg );
138
139 m_conversionCnv.transToPers( &trans->conversionElementLinkVector(),
140 &pers->m_conversion,
141 msg );
142
143 m_egDetailsCnv.transToPers( &trans->detailElementLinkVector(),
144 &pers->m_egDetails,
145 msg );
146
147 // author
148 pers->m_author = trans->author();
149
150 // egPID (ints)
151 {
152 std::vector<double>& egID = pers->m_egammaDblPIDs;
153 std::vector<unsigned int>& egEnum = pers->m_egammaEnumPIDs;
154
155 unsigned int nbOfEgammaIDs = (int) egammaPIDObs::LastEgammaPID;
156
157 double tmpID;
158 for ( unsigned int i=0; i<nbOfEgammaIDs; i++ ) {
159 tmpID = trans->egammaID( (egammaPIDObs::PID) i);
160 if ( tmpID != egammaPIDObs::EgPidUndefined ) {
161 egEnum.push_back(i);
162 egID.push_back(tmpID);
163 }
164 }
165 }
166
167// msg << MSG::DEBUG << "Created persistent state of egamma [OK]"
168// << endmsg;
169 }
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)
ConversionLinkCnv_t m_conversionCnv
virtual void transToPers(const egamma *transObj, egamma_p4 *persObj, MsgStream &msg) override final
Method creating the persistent representation egamma_p4 from its transient representation egamma.
P4ImplEEtaPhiMCnv_p2 m_momCnv
ParticleBaseCnv_p2 m_partBaseCnv
TrackLinkCnv_t m_trackCnv
EgDetailsCnv_t m_egDetailsCnv
virtual void persToTrans(const egamma_p4 *persObj, egamma *transObj, MsgStream &msg) override final
Method creating the transient representation of egamma from its persistent representation egamma_p4.
ClusterLinkCnv_t m_clusterCnv
P4EEtaPhiMFloat_p2 m_momentumCluster
the 4-mom part for the Cluster
Definition egamma_p4.h:60
unsigned int m_author
Definition egamma_p4.h:83
ElementLinkIntVector_p1 m_trackParticle
links to tracks
Definition egamma_p4.h:71
std::vector< double > m_egammaDblPIDs
Definition egamma_p4.h:87
P4EEtaPhiMFloat_p2 m_momentum
the 4-mom part
Definition egamma_p4.h:57
std::vector< unsigned int > m_egammaEnumPIDs
egamma PID
Definition egamma_p4.h:86
ParticleBase_p2 m_particleBase
the ParticleBase part
Definition egamma_p4.h:63
ElementLinkIntVector_p1 m_egDetails
links to egDetails
Definition egamma_p4.h:79
ElementLinkIntVector_p1 m_conversion
links to tracks
Definition egamma_p4.h:75
ElementLinkInt_p3 m_cluster
links to clusters
Definition egamma_p4.h:68
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
unsigned int isemse(unsigned int mask=egammaPIDObs::ALL) const
ID flag with cuts for softe, 0:e, >1:jet.
Definition egamma.cxx:794
unsigned int isem(unsigned int mask=egammaPIDObs::ALL, egammaPIDObs::PID pid=egammaPIDObs::IsEM) const
ID flag with cuts, 0:e, >1:jet.
Definition egamma.cxx:769
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
bool set_egammaIDint(egammaPIDObs::PID id, unsigned int result)
set_egamma ID, for usigned int values
Definition egamma.cxx:340
void setConversionElementLinkVector(const ElementLinkVector< VxContainer > &link)
Definition egamma.cxx:595
egammaImpl_t::momentum_type momentum_type
Definition egamma.h:70
unsigned int isgoodoq(unsigned int mask=egammaPIDObs::ALLOQ, bool *found=nullptr) const
Definition egamma.cxx:823
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
@ IsGoodOQ
Object Quality variable.
@ SofteIsEM
cut-based identification for softe electrons in jets (for btag)
@ LastEgammaPID
Default for the last enum (don't change it !)
@ IsEM
cut-based identification for egamma objects (cluster and track-based)
const unsigned int ALLOQ
const unsigned int ALL
all cuts
MsgStream & msg
Definition testRead.cxx:32