ATLAS Offline Software
egammaCnv_p4.cxx
Go to the documentation of this file.
1 
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 
46  &trans->momentumBase(),
47  msg);
48 
49  egamma::momentum_type momentumCluster;
51  &momentumCluster,
52  msg);
53  trans->setUncombined4Mom (momentumCluster.hlv());
54 
56  &trans->particleBase(),
57  msg);
58 
59  // element links
61  m_clusterCnv.persToTrans( &pers->m_cluster, &cluster, msg );
62  trans->setClusterElementLink (cluster);
63 
66  &elv,
67  msg );
69 
72  &vx,
73  msg );
75 
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);
104 
107 
108  }
109  //Clearing Rings ElementLink:
110  trans->resetRings();
111 }
112 
113 void egammaCnv_p4::transToPers( const egamma* trans,
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 
125  &pers->m_momentumCluster,
126  msg);
127 
129  &pers->m_particleBase,
130  msg);
131 
132  // element links
134 
136  &pers->m_trackParticle,
137  msg );
138 
140  &pers->m_conversion,
141  msg );
142 
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  }
egamma_p4::m_egDetails
ElementLinkIntVector_p1 m_egDetails
links to egDetails
Definition: egamma_p4.h:79
egamma::setConversionElementLinkVector
void setConversionElementLinkVector(const ElementLinkVector< VxContainer > &link)
Definition: egamma.cxx:595
egammaPIDObs::IsEM
@ IsEM
cut-based identification for egamma objects (cluster and track-based)
Definition: egammaPIDdefsObs.h:55
egamma::setDetailElementLinkVector
void setDetailElementLinkVector(const ElementLinkVector< egDetailContainer > &v)
Definition: egamma.cxx:627
egamma::set_egammaIDint
bool set_egammaIDint(egammaPIDObs::PID id, unsigned int result)
set_egamma ID, for usigned int values
Definition: egamma.cxx:340
ElementLinkCnv_p3::persToTrans
void persToTrans(const PersLink_t &pers, Link_t &trans, MsgStream &log) const
egammaPIDObs::EgPidUndefined
const unsigned int EgPidUndefined
Definition: egammaPIDdefsObs.h:127
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
egammaCnv_p4::m_clusterCnv
ClusterLinkCnv_t m_clusterCnv
Definition: egammaCnv_p4.h:80
egamma_p4::m_momentum
P4EEtaPhiMFloat_p2 m_momentum
the 4-mom part
Definition: egamma_p4.h:57
ParticleBaseCnv_p2::persToTrans
virtual void persToTrans(const ParticleBase_p2 *persObj, ParticleBase *transObj, MsgStream &msg) const final
Method creating the transient representation of ParticleBase from its persistent representation Parti...
Definition: ParticleBaseCnv_p2.cxx:42
egammaPIDObs::PID
PID
Definition: egammaPIDdefsObs.h:53
egamma_p4
Definition: egamma_p4.h:30
egammaCnv_p4::m_trackCnv
TrackLinkCnv_t m_trackCnv
Definition: egammaCnv_p4.h:81
egamma::Uncombined
@ Uncombined
Definition: egamma.h:79
egammaCnv_p4::m_conversionCnv
ConversionLinkCnv_t m_conversionCnv
Definition: egammaCnv_p4.h:82
egamma_p4::m_momentumCluster
P4EEtaPhiMFloat_p2 m_momentumCluster
the 4-mom part for the Cluster
Definition: egamma_p4.h:60
ElementLinkVector< Rec::TrackParticleContainer >
ElementLinkVectorCnv_p1::persToTrans
void persToTrans(const PersLinkVect_t &pers, LinkVect_t &trans, MsgStream &log) const
egamma_p4::m_egammaEnumPIDs
std::vector< unsigned int > m_egammaEnumPIDs
egamma PID
Definition: egamma_p4.h:86
egamma::conversionElementLinkVector
const ElementLinkVector< VxContainer > & conversionElementLinkVector() const
Definition: egamma.cxx:461
egamma::isem
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
egamma
Definition: egamma.h:58
ParticleBaseCnv_p2::transToPers
virtual void transToPers(const ParticleBase *transObj, ParticleBase_p2 *persObj, MsgStream &msg) const final
Method creating the persistent representation ParticleBase_p2 from its transient representation Parti...
Definition: ParticleBaseCnv_p2.cxx:73
P4BaseEEtaPhiM::hlv
CLHEP::HepLorentzVector hlv() const
Definition: P4BaseEEtaPhiM.h:209
P4ImplEEtaPhiM
Definition: P4ImplEEtaPhiM.h:40
ElementLinkCnv_p3::transToPers
void transToPers(const Link_t &trans, PersLink_t &pers, const SG::ThinningCache *cache, MsgStream &log) const
egammaPIDObs::IsGoodOQ
@ IsGoodOQ
Object Quality variable.
Definition: egammaPIDdefsObs.h:82
egamma::detailElementLinkVector
const ElementLinkVector< egDetailContainer > & detailElementLinkVector() const
Definition: egamma.cxx:877
egamma::get4Mom
const momentum_type & get4Mom(egamma::eg4MomType type=egamma::Combined) const
return the combined or additional uncombined cluster 4mom
Definition: egamma.h:395
egamma::resetRings
void resetRings()
Reset Cluster.
Definition: egamma.cxx:479
lumiFormat.i
int i
Definition: lumiFormat.py:85
egamma_p4::m_cluster
ElementLinkInt_p3 m_cluster
links to clusters
Definition: egamma_p4.h:68
egammaPIDObs::SofteIsEM
@ SofteIsEM
cut-based identification for softe electrons in jets (for btag)
Definition: egammaPIDdefsObs.h:64
ParticleImpl::momentumBase
const momentum_type & momentumBase() const
access to underlying base type (I4Momentum-like)
Definition: ParticleImpl.h:393
egamma::isemse
unsigned int isemse(unsigned int mask=egammaPIDObs::ALL) const
ID flag with cuts for softe, 0:e, >1:jet.
Definition: egamma.cxx:794
egamma_p4::m_particleBase
ParticleBase_p2 m_particleBase
the ParticleBase part
Definition: egamma_p4.h:63
egamma::author
unsigned int author() const
Reconstruction Author
Definition: egamma.h:244
egamma::setTrackParticleElementLinkVector
void setTrackParticleElementLinkVector(const ElementLinkVector< Rec::TrackParticleContainer > &v)
Definition: egamma.cxx:550
P4ImplEEtaPhiMCnv_p2::transToPers
virtual void transToPers(const P4ImplEEtaPhiM *transObj, P4EEtaPhiMFloat_p2 *persObj, MsgStream &log) const override
Method creating the persistent representation P4EEtaPhiMFloat_p2 from its transient representation P4...
Definition: P4ImplEEtaPhiMCnv_p2.cxx:38
ParticleImpl::particleBase
const particle_type & particleBase() const
access to underlying base type (IParticle-like)
Definition: ParticleImpl.h:403
egammaPIDObs::ALL
const unsigned int ALL
all cuts
Definition: egammaPIDdefsObs.h:950
egamma_p4::m_conversion
ElementLinkIntVector_p1 m_conversion
links to tracks
Definition: egamma_p4.h:75
egammaCnv_p4::m_partBaseCnv
ParticleBaseCnv_p2 m_partBaseCnv
Definition: egammaCnv_p4.h:79
P4ImplEEtaPhiMCnv_p2::persToTrans
virtual void persToTrans(const P4EEtaPhiMFloat_p2 *persObj, P4ImplEEtaPhiM *transObj, MsgStream &log) const override
Method creating the transient representation of P4ImplEEtaPhiM from its persistent representation P4E...
Definition: P4ImplEEtaPhiMCnv_p2.cxx:26
egamma::set_egammaID
bool set_egammaID(egammaPIDObs::PID id, double result)
set_egamma ID, for doubles and all possible weights as likelihood
Definition: egamma.cxx:329
egamma::egammaID
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
egamma_p4::m_trackParticle
ElementLinkIntVector_p1 m_trackParticle
links to tracks
Definition: egamma_p4.h:71
egamma::setClusterElementLink
void setClusterElementLink(const ElementLink< CaloClusterContainer > &link)
Set Cluster Element Link.
Definition: egamma.cxx:512
egammaCnv_p4.h
egammaCnv_p4::persToTrans
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.
Definition: egammaCnv_p4.cxx:35
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
egammaPIDObs::LastEgammaPID
@ LastEgammaPID
Default for the last enum (don't change it !)
Definition: egammaPIDdefsObs.h:92
egammaCnv_p4::m_egDetailsCnv
EgDetailsCnv_t m_egDetailsCnv
Definition: egammaCnv_p4.h:83
ElementLinkVectorCnv_p1::transToPers
void transToPers(const LinkVect_t &trans, PersLinkVect_t &pers, const SG::ThinningCache *cache, MsgStream &log) const
egamma::isgoodoq
unsigned int isgoodoq(unsigned int mask=egammaPIDObs::ALLOQ, bool *found=nullptr) const
Definition: egamma.cxx:823
egamma::clusterElementLink
const ElementLink< CaloClusterContainer > & clusterElementLink() const
element link to cluster
Definition: egamma.cxx:427
egamma_p4::m_egammaDblPIDs
std::vector< double > m_egammaDblPIDs
Definition: egamma_p4.h:87
egamma_p4::m_author
unsigned int m_author
Definition: egamma_p4.h:83
egammaCnv_p4::m_momCnv
P4ImplEEtaPhiMCnv_p2 m_momCnv
Definition: egammaCnv_p4.h:78
egammaCnv_p4::transToPers
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.
Definition: egammaCnv_p4.cxx:113
egammaPIDObs::ALLOQ
const unsigned int ALLOQ
Definition: egammaPIDdefsObs.h:729
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
egamma::trackParticleElementLinkVector
const ElementLinkVector< Rec::TrackParticleContainer > & trackParticleElementLinkVector() const
Definition: egamma.cxx:444
egamma::setUncombined4Mom
void setUncombined4Mom(const I4Momentum &theI4Mom)
set uncombined all 4-mom from another I4Momentum reference
Definition: egamma.cxx:947