ATLAS Offline Software
Loading...
Searching...
No Matches
CaloEnergyCnv_p2.cxx
Go to the documentation of this file.
1
2
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
21
22// RecTPCnv includes
26
27// For converter.
32
33// pre-allocate converters
36
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
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
146extern "C" {
151
152}
static const DepositInCaloCnv_p1 depositCnv
static const EnergyLossCnv_p1 energyLossCnv
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...
Registry for Root converters.
Template for streamer converter for vector<T> -> vector, assuming T is convertable to U.
CaloEnergyCnv_p2()
Default constructor:
void transToPers(const CaloEnergy *transObj, CaloEnergy_p2 *persObj, MsgStream &msg) const
Method creating the persistent representation CaloEnergy_p1 from its transient representation CaloEne...
static void registerStreamerConverter()
Register a streamer converter for backwards compatibility for the vector<DepositInCalo_p1> -> vector<...
void persToTrans(const CaloEnergy_p2 *persObj, CaloEnergy *transObj, MsgStream &msg) const
Method creating the transient representation of CaloEnergy from its persistent representation CaloEne...
unsigned short m_caloMuonIdTag
std::vector< DepositInCalo_p2 > m_deposits
Trk::EnergyLoss_p1 m_energyLoss
float m_fsrCandidateEnergy
float m_caloLRLikelihood
class extending the basic Trk::EnergyLoss to describe the measured or parameterised muon energy loss ...
Definition CaloEnergy.h:28
EnergyLossType
Calo Energy Loss Type Parametrized : reconstruction configured to use the parametrization w/o looking...
Definition CaloEnergy.h:43
CaloEnergy::EnergyLossType energyLossType(void) const
Accessor methods.
Definition CaloEnergy.h:162
void set_etCore(const float etcore)
isolation ET in core deltaR
Definition CaloEnergy.h:121
double caloLRLikelihood() const
the calo Muon Identification likehood
Definition CaloEnergy.h:88
float etCore() const
isolation ET in core deltaR
Definition CaloEnergy.h:97
void set_deposits(const std::vector< DepositInCalo > &deposits)
set the detailed energy deposits in the calorimeter layers
Definition CaloEnergy.h:111
void set_fsrCandidateEnergy(const float fs)
FSR Candidate Energy.
Definition CaloEnergy.h:118
void set_caloMuonIdTag(unsigned short tag)
set the tag
Definition CaloEnergy.h:108
void set_caloLRLikelihood(const float likelihood)
set the likelihood
Definition CaloEnergy.h:105
void set_energyLossType(const CaloEnergy::EnergyLossType lossType)
set methods
Definition CaloEnergy.h:102
const std::vector< DepositInCalo > & depositInCalo() const
the vector of detailed deposits in calo layers
Definition CaloEnergy.h:91
unsigned short caloMuonIdTag() const
the Calo Muon Identification tag
Definition CaloEnergy.h:85
float fsrCandidateEnergy() const
FSR Candidate Energy.
Definition CaloEnergy.h:94
class describing the measured energy loss associated to muons on the detector level,...
T/P converter for class EnergyLoss.
Converter for vector<T> to vector.
static TConverterRegistry * Instance()
Return a pointer to the global registry instance.
void AddStreamerConverter(const std::string &from_type, const std::string &to_type, TMemberStreamer *streamer)
MsgStream & msg
Definition testRead.cxx:32