ATLAS Offline Software
CaloEnergyCnv_p2.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // CaloEnergyCnv_p2.cxx
8 // Implementation file for class CaloEnergyCnv_p2
9 // Author: S.Binet<binet@cern.ch>
11 
12 
13 // STL includes
14 
15 // AthenaPoolCnvSvc includes
17 
18 // muonEvent includes
20 #include "muonEvent/CaloEnergy.h"
21 
22 // RecTPCnv includes
26 
27 // For converter.
32 
33 // pre-allocate converters
34 static const DepositInCaloCnv_p2 depositCnv;
35 static const EnergyLossCnv_p1 energyLossCnv;
36 
38 {
39 }
40 
42  CaloEnergy* trans,
43  MsgStream& msg ) const
44 {
45 // msg << MSG::DEBUG << "Loading CaloEnergy from persistent state..."
46 // << endmsg;
47 
49  energyLossCnv.persToTrans( &pers->m_energyLoss,
50  trans,
51  msg );
52 
55  trans->set_caloMuonIdTag (pers->m_caloMuonIdTag);
57 
58  // reserve enough space so no re-alloc occurs
59  std::vector<DepositInCalo> deposits (pers->m_deposits.size());
60 
61  size_t ideposit = 0;
62  for (const DepositInCalo_p2& pers_dep : pers->m_deposits) {
63  depositCnv.persToTrans( &pers_dep, &deposits[ideposit++], msg );
64  }
65  trans->set_deposits (std::move (deposits));
66 
67  trans->set_etCore (pers->m_etCore);
68 
69 // msg << MSG::DEBUG << "Loaded CaloEnergy from persistent state [OK]"
70 // << endmsg;
71 
72  return;
73 }
74 
76  CaloEnergy_p2* pers,
77  MsgStream& msg ) const
78 {
79 // msg << MSG::DEBUG << "Creating persistent state of CaloEnergy..."
80 // << endmsg;
81 
82  energyLossCnv.transToPers ( trans, &pers->m_energyLoss, msg );
83 
84  pers->m_energyLossType = trans->energyLossType();
85  pers->m_caloLRLikelihood = trans->caloLRLikelihood();
86  pers->m_caloMuonIdTag = trans->caloMuonIdTag();
88 
89  // reserve enough space so no re-alloc occurs
90  pers->m_deposits.resize( trans->depositInCalo().size() );
91 
92  size_t ipersistent = 0;
93  for (const DepositInCalo& trans_dep : trans->depositInCalo()) {
94  depositCnv.transToPers( &trans_dep, &pers->m_deposits[ipersistent++], msg );
95  }
96 
97  pers->m_etCore = trans->etCore();
98 
99 // msg << MSG::DEBUG << "Created persistent state of CaloEnergy [OK]"
100 // << endmsg;
101  return;
102 }
103 
104 
111 {
112  // m_deposits was changed from vector<DepositInCalo_p1> to
113  // vector<DepositInCalo_p2>. Install a converter so that we can read
114  // the old data.
116  ("vector<DepositInCalo_p1>", "vector<DepositInCalo_p2>",
118  ("DepositInCalo_p1"));
119 }
120 
121 
123  CaloEnergy* transObj,
124  MsgStream& msg )
125 {
126  const CaloEnergyCnv_p2* cc = this;
127  return cc->persToTrans (persObj, transObj, msg);
128 }
129 
130 
132  CaloEnergy_p2* persObj,
133  MsgStream& msg )
134 {
135  const CaloEnergyCnv_p2* cc = this;
136  return cc->transToPers (transObj, persObj, msg);
137 }
138 
139 
146 extern "C" {
148 {
150 }
151 
152 }
CaloEnergy_p2::m_energyLossType
int m_energyLossType
Definition: CaloEnergy_p2.h:62
DepositInCaloCnv_p2::persToTrans
virtual void persToTrans(const DepositInCalo_p2 *persObj, DepositInCalo *transObj, MsgStream &msg) const override
Method creating the transient representation of DepositInCalo from its persistent representation Depo...
Definition: DepositInCaloCnv_p2.cxx:25
CaloEnergyCnv_p2::registerStreamerConverter
static void registerStreamerConverter()
Register a streamer converter for backwards compatibility for the vector<DepositInCalo_p1> -> vector<...
Definition: CaloEnergyCnv_p2.cxx:110
EnergyLossCnv_p1.h
EnergyLossCnv_p1::persToTrans
virtual void persToTrans(const Trk ::EnergyLoss_p1 *persObj, Trk ::EnergyLoss *transObj, MsgStream &log) const override
Definition: EnergyLossCnv_p1.cxx:8
CaloEnergy::EnergyLossType
EnergyLossType
Calo Energy Loss Type Parametrized : reconstruction configured to use the parametrization w/o looking...
Definition: CaloEnergy.h:43
CaloEnergy
class extending the basic Trk::EnergyLoss to describe the measured or parameterised muon energy loss ...
Definition: CaloEnergy.h:28
DepositInCalo_p2.h
CaloEnergy::set_energyLossType
void set_energyLossType(const CaloEnergy::EnergyLossType lossType)
set methods
Definition: CaloEnergy.h:102
CaloEnergyCnv_p2
Definition: CaloEnergyCnv_p2.h:38
CaloEnergyCnv_p2::persToTrans
void persToTrans(const CaloEnergy_p2 *persObj, CaloEnergy *transObj, MsgStream &msg) const
Method creating the transient representation of CaloEnergy from its persistent representation CaloEne...
Definition: CaloEnergyCnv_p2.cxx:41
CaloEnergy_p2::m_caloMuonIdTag
unsigned short m_caloMuonIdTag
Definition: CaloEnergy_p2.h:64
caloenergy_cnv_p2_register_streamer
void caloenergy_cnv_p2_register_streamer()
register a C function to be executed at library loading time this is b/c there is no more the ability...
Definition: CaloEnergyCnv_p2.cxx:147
CaloEnergy_p2::m_deposits
std::vector< DepositInCalo_p2 > m_deposits
Definition: CaloEnergy_p2.h:66
CaloEnergy_p2::m_etCore
float m_etCore
Definition: CaloEnergy_p2.h:67
RootConversions::VectorConverter
Converter for vector<T> to vector.
Definition: VectorConverter.h:40
DepositInCalo_p2
Definition: DepositInCalo_p2.h:22
EnergyLossCnv_p1
T/P converter for class EnergyLoss.
Definition: EnergyLossCnv_p1.h:20
DepositInCalo_p1.h
CaloEnergy::energyLossType
CaloEnergy::EnergyLossType energyLossType(void) const
Accessor methods.
Definition: CaloEnergy.h:162
T_AthenaPoolTPConverter.h
DepositInCaloCnv_p2::transToPers
virtual void transToPers(const DepositInCalo *transObj, DepositInCalo_p2 *persObj, MsgStream &msg) const override
Method creating the persistent representation DepositInCalo_p2 from its transient representation Depo...
Definition: DepositInCaloCnv_p2.cxx:44
CaloEnergy_p2::m_energyLoss
Trk::EnergyLoss_p1 m_energyLoss
Definition: CaloEnergy_p2.h:58
DepositInCalo.h
EnergyLossCnv_p1::transToPers
virtual void transToPers(const Trk ::EnergyLoss *transObj, Trk ::EnergyLoss_p1 *persObj, MsgStream &log) const override
Definition: EnergyLossCnv_p1.cxx:22
TConverterRegistry::AddStreamerConverter
void AddStreamerConverter(const std::string &from_type, const std::string &to_type, TMemberStreamer *streamer)
Definition: TConverterRegistry.cxx:114
DepositInCaloCnv_p2.h
DepositInCalo
class describing the measured energy loss associated to muons on the detector level,...
Definition: DepositInCalo.h:23
CaloEnergy::set_caloLRLikelihood
void set_caloLRLikelihood(const float likelihood)
set the likelihood
Definition: CaloEnergy.h:105
CaloEnergy_p2
Definition: CaloEnergy_p2.h:26
CaloEnergy::fsrCandidateEnergy
float fsrCandidateEnergy() const
FSR Candidate Energy.
Definition: CaloEnergy.h:94
CaloEnergy::caloMuonIdTag
unsigned short caloMuonIdTag() const
the Calo Muon Identification tag
Definition: CaloEnergy.h:85
CaloEnergy::set_caloMuonIdTag
void set_caloMuonIdTag(unsigned short tag)
set the tag
Definition: CaloEnergy.h:108
CaloEnergy_p2::m_caloLRLikelihood
float m_caloLRLikelihood
Definition: CaloEnergy_p2.h:63
CaloEnergy::set_fsrCandidateEnergy
void set_fsrCandidateEnergy(const float fs)
FSR Candidate Energy.
Definition: CaloEnergy.h:118
TConverterRegistry.h
Registry for Root converters.
TConverterRegistry::Instance
static TConverterRegistry * Instance()
Return a pointer to the global registry instance.
Definition: TConverterRegistry.cxx:143
CaloEnergy::etCore
float etCore() const
isolation ET in core deltaR
Definition: CaloEnergy.h:97
DepositInCaloCnv_p2
Definition: DepositInCaloCnv_p2.h:28
CaloEnergy::set_deposits
void set_deposits(const std::vector< DepositInCalo > &deposits)
set the detailed energy deposits in the calorimeter layers
Definition: CaloEnergy.h:111
CaloEnergy::set_etCore
void set_etCore(const float etcore)
isolation ET in core deltaR
Definition: CaloEnergy.h:121
CaloEnergyCnv_p2::transToPers
void transToPers(const CaloEnergy *transObj, CaloEnergy_p2 *persObj, MsgStream &msg) const
Method creating the persistent representation CaloEnergy_p1 from its transient representation CaloEne...
Definition: CaloEnergyCnv_p2.cxx:75
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
CaloEnergyCnv_p2::CaloEnergyCnv_p2
CaloEnergyCnv_p2()
Default constructor:
Definition: CaloEnergyCnv_p2.cxx:37
CaloEnergy::caloLRLikelihood
double caloLRLikelihood() const
the calo Muon Identification likehood
Definition: CaloEnergy.h:88
python.handimod.cc
int cc
Definition: handimod.py:523
VectorConverter.h
Template for streamer converter for vector<T> -> vector, assuming T is convertable to U.
CaloEnergy_p2::m_fsrCandidateEnergy
float m_fsrCandidateEnergy
Definition: CaloEnergy_p2.h:65
CaloEnergy::depositInCalo
const std::vector< DepositInCalo > & depositInCalo() const
the vector of detailed deposits in calo layers
Definition: CaloEnergy.h:91
CaloEnergyCnv_p2.h
CaloEnergy.h