ATLAS Offline Software
egammaCnv_p3.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_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 
45  &trans->momentumBase(),
46  msg);
48  &trans->particleBase(),
49  msg);
50 
51  // element links
53  m_clusterCnv.persToTrans( &pers->m_cluster, &cluster, msg );
54  trans->setClusterElementLink (cluster);
55 
58  &elv,
59  msg );
61 
64  &vx,
65  msg );
67 
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 
90 void egammaCnv_p3::transToPers( const egamma* trans,
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);
101  &pers->m_particleBase,
102  msg);
103 
104  // element links
106 
108  &pers->m_trackParticle,
109  msg );
110 
112  &pers->m_conversion,
113  msg );
114 
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  }
egamma::setConversionElementLinkVector
void setConversionElementLinkVector(const ElementLinkVector< VxContainer > &link)
Definition: egamma.cxx:595
egamma::setDetailElementLinkVector
void setDetailElementLinkVector(const ElementLinkVector< egDetailContainer > &v)
Definition: egamma.cxx:627
ElementLinkCnv_p3::persToTrans
void persToTrans(const PersLink_t &pers, Link_t &trans, MsgStream &log) const
egammaCnv_p3::m_clusterCnv
ClusterLinkCnv_t m_clusterCnv
Definition: egammaCnv_p3.h:81
egammaPIDObs::EgPidUndefined
const unsigned int EgPidUndefined
Definition: egammaPIDdefsObs.h:127
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
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_p3::m_author
unsigned int m_author
Definition: egamma_p3.h:77
ElementLinkVectorCnv_p1::persToTrans
void persToTrans(const PersLinkVect_t &pers, LinkVect_t &trans, MsgStream &log) const
egammaCnv_p3::transToPers
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.
Definition: egammaCnv_p3.cxx:90
egamma::conversionElementLinkVector
const ElementLinkVector< VxContainer > & conversionElementLinkVector() const
Definition: egamma.cxx:461
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
egamma_p3::m_conversion
ElementLinkIntVector_p1 m_conversion
links to tracks
Definition: egamma_p3.h:71
ElementLinkCnv_p3::transToPers
void transToPers(const Link_t &trans, PersLink_t &pers, const SG::ThinningCache *cache, MsgStream &log) const
egamma_p3
Definition: egamma_p3.h:30
egamma::detailElementLinkVector
const ElementLinkVector< egDetailContainer > & detailElementLinkVector() const
Definition: egamma.cxx:877
egamma::resetRings
void resetRings()
Reset Cluster.
Definition: egamma.cxx:479
lumiFormat.i
int i
Definition: lumiFormat.py:85
egamma_p3::m_particleBase
ParticleBase_p2 m_particleBase
the ParticleBase part
Definition: egamma_p3.h:60
egamma_p3::m_momentum
P4EEtaPhiMFloat_p2 m_momentum
the 4-mom part
Definition: egamma_p3.h:57
egamma_p3::m_trackParticle
ElementLinkIntVector_p1 m_trackParticle
links to tracks
Definition: egamma_p3.h:68
egammaCnv_p3::m_trackCnv
TrackLinkCnv_t m_trackCnv
Definition: egammaCnv_p3.h:82
ParticleImpl::momentumBase
const momentum_type & momentumBase() const
access to underlying base type (I4Momentum-like)
Definition: ParticleImpl.h:393
egamma::author
unsigned int author() const
Reconstruction Author
Definition: egamma.h:244
ElementLinkVector< Rec::TrackParticleContainer >
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
egamma_p3::m_egammaEnumPIDs
std::vector< unsigned int > m_egammaEnumPIDs
egamma PID
Definition: egamma_p3.h:80
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
egammaCnv_p3::m_momCnv
P4ImplEEtaPhiMCnv_p2 m_momCnv
Definition: egammaCnv_p3.h:79
egammaCnv_p3::m_conversionCnv
ConversionLinkCnv_t m_conversionCnv
Definition: egammaCnv_p3.h:83
egammaCnv_p3::persToTrans
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.
Definition: egammaCnv_p3.cxx:34
egammaCnv_p3::m_partBaseCnv
ParticleBaseCnv_p2 m_partBaseCnv
Definition: egammaCnv_p3.h:80
egamma::setClusterElementLink
void setClusterElementLink(const ElementLink< CaloClusterContainer > &link)
Set Cluster Element Link.
Definition: egamma.cxx:512
egammaCnv_p3::m_egDetailsCnv
EgDetailsCnv_t m_egDetailsCnv
Definition: egammaCnv_p3.h:84
egammaPIDObs::LastEgammaPID
@ LastEgammaPID
Default for the last enum (don't change it !)
Definition: egammaPIDdefsObs.h:92
ElementLinkVectorCnv_p1::transToPers
void transToPers(const LinkVect_t &trans, PersLinkVect_t &pers, const SG::ThinningCache *cache, MsgStream &log) const
egamma_p3::m_cluster
ElementLinkInt_p3 m_cluster
links to clusters
Definition: egamma_p3.h:65
egamma::clusterElementLink
const ElementLink< CaloClusterContainer > & clusterElementLink() const
element link to cluster
Definition: egamma.cxx:427
egammaCnv_p3.h
egamma_p3::m_egammaDblPIDs
std::vector< double > m_egammaDblPIDs
Definition: egamma_p3.h:81
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
egamma_p3::m_egDetails
ElementLinkIntVector_p1 m_egDetails
links to egDetails
Definition: egamma_p3.h:74
egamma::trackParticleElementLinkVector
const ElementLinkVector< Rec::TrackParticleContainer > & trackParticleElementLinkVector() const
Definition: egamma.cxx:444