ATLAS Offline Software
egammaCnv_p5.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_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 
47  &trans->momentumBase(),
48  msg);
49 
50  egamma::momentum_type momentumCluster;
52  &momentumCluster,
53  msg);
54  trans->setUncombined4Mom (momentumCluster.hlv());
55 
57  &trans->particleBase(),
58  msg);
59 
60  // element links
62  m_clusterCnv.persToTrans( &pers->m_cluster, &cluster, msg );
63  trans->setClusterElementLink (cluster);
64 
67  &elv,
68  msg );
70 
73  &vx,
74  msg );
76 
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 
101 void egammaCnv_p5::transToPers( const egamma* trans,
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 
113  &pers->m_momentumCluster,
114  msg);
115 
117  &pers->m_particleBase,
118  msg);
119 
120  // element links
122 
124  &pers->m_trackParticle,
125  msg );
126 
128  &pers->m_conversion,
129  msg );
130 
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 }
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
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
egammaCnv_p5::m_partBaseCnv
ParticleBaseCnv_p2 m_partBaseCnv
Definition: egammaCnv_p5.h:82
egammaPIDObs::PID
PID
Definition: egammaPIDdefsObs.h:53
egamma::Uncombined
@ Uncombined
Definition: egamma.h:79
ElementLinkVector< Rec::TrackParticleContainer >
egamma::ringsElementLink
const ElementLink< CaloRingsContainer > & ringsElementLink() const
element link to rings
Definition: egamma.cxx:379
ElementLinkVectorCnv_p1::persToTrans
void persToTrans(const PersLinkVect_t &pers, LinkVect_t &trans, MsgStream &log) const
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
P4BaseEEtaPhiM::hlv
CLHEP::HepLorentzVector hlv() const
Definition: P4BaseEEtaPhiM.h:209
egammaCnv_p5::m_ringsCnv
RingsLinkCnv_t m_ringsCnv
Definition: egammaCnv_p5.h:87
egammaCnv_p5::m_clusterCnv
ClusterLinkCnv_t m_clusterCnv
Definition: egammaCnv_p5.h:83
P4ImplEEtaPhiM
Definition: P4ImplEEtaPhiM.h:40
ElementLinkCnv_p3::transToPers
void transToPers(const Link_t &trans, PersLink_t &pers, const SG::ThinningCache *cache, MsgStream &log) const
egamma_p5::m_trackParticle
ElementLinkIntVector_p1 m_trackParticle
links to tracks
Definition: egamma_p5.h:72
egammaCnv_p5::m_egDetailsCnv
EgDetailsCnv_t m_egDetailsCnv
Definition: egammaCnv_p5.h:86
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
lumiFormat.i
int i
Definition: lumiFormat.py:85
egamma_p5::m_egammaDblPIDs
std::vector< double > m_egammaDblPIDs
Definition: egamma_p5.h:91
egamma_p5::m_egDetails
ElementLinkIntVector_p1 m_egDetails
links to egDetails
Definition: egamma_p5.h:80
egammaCnv_p5::persToTrans
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.
Definition: egammaCnv_p5.cxx:36
egamma_p5::m_momentum
P4EEtaPhiMFloat_p2 m_momentum
the 4-mom part
Definition: egamma_p5.h:58
egammaCnv_p5::m_momCnv
P4ImplEEtaPhiMCnv_p2 m_momCnv
Definition: egammaCnv_p5.h:81
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
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
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_p5::m_trackCnv
TrackLinkCnv_t m_trackCnv
Definition: egammaCnv_p5.h:84
egammaCnv_p5.h
egamma::setClusterElementLink
void setClusterElementLink(const ElementLink< CaloClusterContainer > &link)
Set Cluster Element Link.
Definition: egamma.cxx:512
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
egammaPIDObs::LastEgammaPID
@ LastEgammaPID
Default for the last enum (don't change it !)
Definition: egammaPIDdefsObs.h:92
egamma_p5::m_momentumCluster
P4EEtaPhiMFloat_p2 m_momentumCluster
the 4-mom part for the Cluster
Definition: egamma_p5.h:61
egamma_p5::m_author
unsigned int m_author
Definition: egamma_p5.h:87
egamma_p5::m_conversion
ElementLinkIntVector_p1 m_conversion
links to tracks
Definition: egamma_p5.h:76
egammaCnv_p5::transToPers
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.
Definition: egammaCnv_p5.cxx:101
egammaCnv_p5::m_conversionCnv
ConversionLinkCnv_t m_conversionCnv
Definition: egammaCnv_p5.h:85
egamma_p5::m_particleBase
ParticleBase_p2 m_particleBase
the ParticleBase part
Definition: egamma_p5.h:64
ElementLinkVectorCnv_p1::transToPers
void transToPers(const LinkVect_t &trans, PersLinkVect_t &pers, const SG::ThinningCache *cache, MsgStream &log) const
egamma::clusterElementLink
const ElementLink< CaloClusterContainer > & clusterElementLink() const
element link to cluster
Definition: egamma.cxx:427
egamma_p5::m_rings
ElementLinkInt_p3 m_rings
links to rings
Definition: egamma_p5.h:84
egamma_p5::m_egammaEnumPIDs
std::vector< unsigned int > m_egammaEnumPIDs
egamma PID
Definition: egamma_p5.h:90
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
egamma_p5::m_cluster
ElementLinkInt_p3 m_cluster
links to clusters
Definition: egamma_p5.h:69
egamma_p5
Definition: egamma_p5.h:31
egamma::trackParticleElementLinkVector
const ElementLinkVector< Rec::TrackParticleContainer > & trackParticleElementLinkVector() const
Definition: egamma.cxx:444
egamma::setRingsElementLink
void setRingsElementLink(const ElementLink< CaloRingsContainer > &link)
Set Rings Element Link.
Definition: egamma.cxx:492
egamma::setUncombined4Mom
void setUncombined4Mom(const I4Momentum &theI4Mom)
set uncombined all 4-mom from another I4Momentum reference
Definition: egamma.cxx:947