ATLAS Offline Software
MuonCnv_p1.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 // MuonCnv_p1.cxx
8 // Implementation file for class MuonCnv_p1
9 // Author: K.Cranmer<cranmer@cern.ch>
10 // Author: S.Binet<binet@cern.ch>
12 
13 
14 // STL includes
15 
16 // DataModelAthenaPool includes
18 
19 // EventCommonTPCnv includes
21 
22 // ParticleEventTPCnv includes
24 
25 // muonEvent includes
26 #include "muonEvent/Muon.h"
28 
29 // RecTPCnv includes
31 #include "RecTPCnv/MuonCnv_p1.h"
32 
35 
36 // pre-allocate converters
37 static const P4ImplIPtCotThPhiMCnv_p1 momCnv;
38 static const ParticleBaseCnv_p1 partBaseCnv;
39 static const TrackLinkCnv_t trackCnv;
40 static const ClusterLinkCnv_t clusterCnv;
41 static const DepositInCaloCnv_p1 depositCnv;
42 
43 
44 void MuonCnv_p1::persToTrans( const Muon_p1* pers,
45  Analysis::Muon* trans,
46  MsgStream& msg ) const
47 {
48 // msg << MSG::DEBUG << "Loading Muon from persistent state..."
49 // << endmsg;
50 
51  // base classes
52  momCnv.persToTrans ( &pers->m_momentum, &trans->momentumBase(), msg );
53  partBaseCnv.persToTrans( &pers->m_particleBase, &trans->particleBase(), msg );
54 
55  // element links
57  trackCnv.persToTrans( &pers->m_inDetTrackParticle,
58  &inDetTrackLink,
59  msg );
60  trans->setInDetTrackLink (inDetTrackLink);
61 
62  ElementLink<Rec::TrackParticleContainer> muonSpectrometerTrackLink;
64  &muonSpectrometerTrackLink,
65  msg );
66  trans->setMuonSpectrometerTrackLink (muonSpectrometerTrackLink);
67 
68  ElementLink<Rec::TrackParticleContainer> muonExtrapTrackLink;
70  &muonExtrapTrackLink,
71  msg );
72  trans->setMuonExtrapTrackLink (muonExtrapTrackLink,
74 
75  ElementLink<Rec::TrackParticleContainer> innerExtrapTrackLink;
77  &innerExtrapTrackLink,
78  msg );
79  trans->setInnerExtrapTrackLink (innerExtrapTrackLink);
80 
83  &combinedTrackLink,
84  msg );
85  trans->setCombinedTrackLink (combinedTrackLink,
87 
89  clusterCnv.persToTrans( &pers->m_cluster,
90  &clusterLink,
91  msg );
92  trans->setClusterLink (clusterLink);
93 
94 
95  // muon parameters
96  const std::vector<float>& params = pers->m_parameters;
101 
106 
114 
115  // author
116  trans->set_author (static_cast<MuonParameters::Author>(pers->m_author));
117  trans->set_allAuthors (0);
118  trans->add_author ( trans->author() );
119 
120  // chi2 of the track matching
121  trans->set_matchChi2 (pers->m_matchChi2);
122 
123  // Low Pt muon stuff
126 
127  trans->set_bestMatch (pers->m_bestMatch);
128  trans->set_matchNumberDoF (pers->m_matchNumberDoF);
129 
130  // this muon is also found by the lowPT reconstruction algorithm
132 
133  // this muon is also found by the Calo Muon ID reconstruction algorithm
135 
137 
139  MuonCaloEnergyContainer * caloEnergyContainer = 0;
140  if (m_storeGate->retrieve(caloEnergyContainer, m_muonCaloEnergyContainerName).isFailure() || caloEnergyContainer == NULL) {
141  msg << MSG::WARNING << "Cannot retrieve MuonCaloEnergyContainer" << m_muonCaloEnergyContainerName
142  << endmsg;
143  } else {
144  float deltaE = pers->m_caloEnergyLoss.m_energyDeposit;
145  float sigmaM = pers->m_caloEnergyLoss.m_energySigmaMinus;
146  float sigmaP = pers->m_caloEnergyLoss.m_energySigmaPlus;
147  float sigma = (sigmaM+sigmaP)/2.0;
148  unsigned short elossT = static_cast<unsigned short> (pers->m_caloEnergyLoss.m_energyLossType);
149  float caloLR = pers->m_caloEnergyLoss.m_caloLRLikelihood;
150  unsigned short tag = static_cast<unsigned short>(pers->m_caloEnergyLoss.m_fsrCandidateEnergy);
151  float fsrEnergy = pers->m_caloEnergyLoss.m_fsrCandidateEnergy;
152 
153  CaloEnergy * caloEnergy = new CaloEnergy(deltaE, sigma, sigmaM, sigmaP, elossT, caloLR, tag) ;
154  caloEnergy->set_fsrCandidateEnergy ( fsrEnergy );
155  std::vector<DepositInCalo> deposits;
156  deposits.reserve( pers->m_caloEnergyLoss.m_deposits.size() );
157  typedef std::vector<DepositInCalo_p1> Deposits_t;
158  for ( Deposits_t::const_iterator
159  itr = pers->m_caloEnergyLoss.m_deposits.begin(),
160  iEnd = pers->m_caloEnergyLoss.m_deposits.end();
161  itr != iEnd;
162  ++itr ) {
163  deposits.push_back( DepositInCalo() );
164  depositCnv.persToTrans( &*itr, &deposits.back(), msg );
165  }
166  caloEnergy->set_deposits( deposits );
167  caloEnergyContainer->push_back( caloEnergy );
169  caloEnergyLink.toContainedElement(*caloEnergyContainer, caloEnergy);
170  trans->setCaloEnergyLink (caloEnergyLink);
171  }
172 
173 // msg << MSG::DEBUG << "Loaded Muon from persistent state [OK]"
174 // << endmsg;
175 
176  return;
177 }
178 
180  Muon_p1* pers,
181  MsgStream& msg ) const
182 {
183  msg << MSG::ERROR << "Analysis::Muon at " << trans << " Persistent Muon_p1 at " << pers << " Cannot write to Muon_p1" << endmsg;
184  throw std::runtime_error("Writing to Muon_p1 is not supported - MuonCnv_p1::transToPers(...)");
185  return;
186 }
Muon_p1::m_muonSpectrometerTrackParticle
ElementLinkInt_p1 m_muonSpectrometerTrackParticle
link to associated TrackParticle (Muon Spectrometer)
Definition: Muon_p1.h:99
ElementLinkCnv_p1.h
This file contains the class definition for the ElementLinkCnv_p1 class.
pdg_comparison.sigma
sigma
Definition: pdg_comparison.py:324
DepositInCaloCnv_p1
Definition: DepositInCaloCnv_p1.h:28
MuonParameters::etcone20
@ etcone20
Definition: MuonParamDefs.h:114
Analysis::Muon::set_isAlsoFoundByLowPt
void set_isAlsoFoundByLowPt(const bool isAlsoSeenByLowPt)
set is also seen by low Pt reconstruction
Definition: Reconstruction/MuonIdentification/muonEvent/muonEvent/Muon.h:189
CaloEnergy
class extending the basic Trk::EnergyLoss to describe the measured or parameterised muon energy loss ...
Definition: CaloEnergy.h:28
Analysis::Muon::setCaloEnergyLink
void setCaloEnergyLink(const ElementLink< MuonCaloEnergyContainer > &l)
Definition: Reconstruction/MuonIdentification/muonEvent/muonEvent/Muon.h:411
MuonParameters::nucone20
@ nucone20
Definition: MuonParamDefs.h:118
Analysis::Muon::set_bestMatch
void set_bestMatch(bool best)
set the best match
Definition: Reconstruction/MuonIdentification/muonEvent/muonEvent/Muon.h:600
TrackLinkCnv_t
ElementLinkCnv_p1< ElementLink< Rec::TrackParticleContainer > > TrackLinkCnv_t
Definition: MuonCnv_p1.cxx:33
Analysis::Muon::setMuonSpectrometerTrackLink
void setMuonSpectrometerTrackLink(const ElementLink< Rec::TrackParticleContainer > &l)
Definition: Reconstruction/MuonIdentification/muonEvent/muonEvent/Muon.h:399
Analysis::Muon::set_allAuthors
void set_allAuthors(const uint16_t allAuthors)
set all the authors of this Muon the authors are 16-bit word, 1-bit reserved for each muon Algorithm ...
Definition: Reconstruction/MuonIdentification/muonEvent/muonEvent/Muon.h:142
MuonCnv_p1::m_muonCaloEnergyContainerName
std::string m_muonCaloEnergyContainerName
Definition: MuonCnv_p1.h:66
Muon_p1::m_cluster
ElementLinkInt_p1 m_cluster
link to CaloCluster
Definition: Muon_p1.h:111
MuonCaloEnergyContainer.h
Analysis::Muon::setMuonExtrapTrackLink
void setMuonExtrapTrackLink(const ElementLink< Rec::TrackParticleContainer > &l, bool isValid)
Definition: Reconstruction/MuonIdentification/muonEvent/muonEvent/Muon.h:361
Analysis::Muon::setInDetTrackLink
void setInDetTrackLink(const ElementLink< Rec::TrackParticleContainer > &l)
Definition: Reconstruction/MuonIdentification/muonEvent/muonEvent/Muon.h:355
MuonParameters::innAngle
@ innAngle
common MuGirl and MuTag parameters
Definition: MuonParamDefs.h:148
ClusterLinkCnv_t
ElementLinkCnv_p1< ElementLink< CaloClusterContainer > > ClusterLinkCnv_t
Definition: MuonCnv_p1.cxx:34
Muon_p1::m_matchNumberDoF
int m_matchNumberDoF
Definition: Muon_p1.h:117
CaloEnergy_p1::m_caloLRLikelihood
float m_caloLRLikelihood
Definition: CaloEnergy_p1.h:63
Analysis::Muon::set_isAlsoFoundByCaloMuonId
void set_isAlsoFoundByCaloMuonId(const bool isAlsoSeenByCaloMuonId)
set is also seen by calo muon Id reconstruction
Definition: Reconstruction/MuonIdentification/muonEvent/muonEvent/Muon.h:194
Analysis::Muon::setInnerExtrapTrackLink
void setInnerExtrapTrackLink(const ElementLink< Rec::TrackParticleContainer > &l)
Definition: Reconstruction/MuonIdentification/muonEvent/muonEvent/Muon.h:374
MuonParameters::segmentDeltaPhi
@ segmentDeltaPhi
Definition: MuonParamDefs.h:140
MuonParameters::annBarrel
@ annBarrel
Definition: MuonParamDefs.h:145
Analysis::Muon::set_matchNumberDoF
void set_matchNumberDoF(int x)
set the chi2 parameters - number of degrees of freedom
Definition: Reconstruction/MuonIdentification/muonEvent/muonEvent/Muon.h:595
Muon_p1::m_hasCombinedMuonTrackParticle
bool m_hasCombinedMuonTrackParticle
Definition: Muon_p1.h:82
Analysis::Muon::set_matchChi2
void set_matchChi2(float x)
set the chi2 parameters - matchChi2
Definition: Reconstruction/MuonIdentification/muonEvent/muonEvent/Muon.h:593
Muon_p1::m_hasMuonExtrapolatedTrackParticle
bool m_hasMuonExtrapolatedTrackParticle
Definition: Muon_p1.h:80
MuonParameters::etcone30
@ etcone30
Definition: MuonParamDefs.h:115
ParticleBaseCnv_p1::persToTrans
virtual void persToTrans(const ParticleBase_p1 *persObj, ParticleBase *transObj, MsgStream &msg) const final
Method creating the transient representation of ParticleBase from its persistent representation Parti...
Definition: ParticleBaseCnv_p1.cxx:49
MuonCnv_p1::persToTrans
virtual void persToTrans(const Muon_p1 *persObj, Analysis::Muon *transObj, MsgStream &msg) const override
Method creating the transient representation of Analysis::Muon from its persistent representation Muo...
Definition: MuonCnv_p1.cxx:44
CaloEnergy_p1::m_energySigmaPlus
float m_energySigmaPlus
Definition: CaloEnergy_p1.h:61
Analysis::Muon::add_author
bool add_author(MuonParameters::Author author)
the add_author method returns a bool:
Definition: Muon.cxx:368
MuonParameters::Author
Author
do not change the order of these enums.
Definition: MuonParamDefs.h:39
Analysis::Muon::set_author
void set_author(MuonParameters::Author author)
set the primary Author : the primary author is the algorithm that first created this Muon
Definition: Reconstruction/MuonIdentification/muonEvent/muonEvent/Muon.h:133
Analysis::Muon::setCombinedTrackLink
void setCombinedTrackLink(const ElementLink< Rec::TrackParticleContainer > &l, bool isValid)
Definition: Reconstruction/MuonIdentification/muonEvent/muonEvent/Muon.h:380
Muon_p1::m_author
unsigned int m_author
author
Definition: Muon_p1.h:74
Muon_p1::m_momentum
P4IPtCotThPhiM_p1 m_momentum
the 4-mom part
Definition: Muon_p1.h:66
Muon_p1
Definition: Muon_p1.h:39
MuonParameters::midAngle
@ midAngle
Definition: MuonParamDefs.h:149
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
CaloEnergy_p1::m_energyDeposit
float m_energyDeposit
Definition: CaloEnergy_p1.h:59
Muon_p1::m_combinedMuonTrackParticle
ElementLinkInt_p1 m_combinedMuonTrackParticle
links to associated TrackParticle (Combined muon)
Definition: Muon_p1.h:108
MuonParameters::segmentDeltaEta
@ segmentDeltaEta
MuTag parameters.
Definition: MuonParamDefs.h:139
ParticleBaseCnv_p1.h
Muon_p1::m_associatedPhiDigits
std::vector< int > m_associatedPhiDigits
Definition: Muon_p1.h:92
Analysis::Muon
The ATLAS Muon object - see doxygen, physics workbookd and the Muon Combined Performance WG's pages f...
Definition: Reconstruction/MuonIdentification/muonEvent/muonEvent/Muon.h:48
CaloEnergy_p1::m_fsrCandidateEnergy
float m_fsrCandidateEnergy
Definition: CaloEnergy_p1.h:65
Analysis::Muon::setClusterLink
void setClusterLink(const ElementLink< CaloClusterContainer > &l)
Definition: Reconstruction/MuonIdentification/muonEvent/muonEvent/Muon.h:405
MuonCaloEnergyContainer
Data object for a StoreGate container holding a vector of CaloEnergy, the detailed energy loss descri...
Definition: MuonCaloEnergyContainer.h:19
ParticleImpl::momentumBase
const momentum_type & momentumBase() const
access to underlying base type (I4Momentum-like)
Definition: ParticleImpl.h:393
MuonParameters::nucone10
@ nucone10
Definition: MuonParamDefs.h:117
ElementLinkCnv_p1
Definition: ElementLinkCnv_p1.h:27
MuonCnv_p1::m_storeGate
StoreGateSvc_t m_storeGate
Definition: MuonCnv_p1.h:65
DepositInCaloCnv_p1.h
DepositInCalo
class describing the measured energy loss associated to muons on the detector level,...
Definition: DepositInCalo.h:23
Muon_p1::m_caloEnergyLoss
CaloEnergy_p1 m_caloEnergyLoss
energy loss in calorimeter
Definition: Muon_p1.h:123
Muon_p1::m_particleBase
ParticleBase_p1 m_particleBase
the ParticleBase part
Definition: Muon_p1.h:69
ParticleImpl::particleBase
const particle_type & particleBase() const
access to underlying base type (IParticle-like)
Definition: ParticleImpl.h:403
MuonParameters::nucone40
@ nucone40
Definition: MuonParamDefs.h:120
ElementLinkCnv_p1::persToTrans
void persToTrans(const PersLink_t &pers, Link_t &trans, MsgStream &log) const
MuonParameters::nucone30
@ nucone30
Definition: MuonParamDefs.h:119
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
P4ImplIPtCotThPhiMCnv_p1.h
DepositInCaloCnv_p1::persToTrans
virtual void persToTrans(const DepositInCalo_p1 *persObj, DepositInCalo *transObj, MsgStream &msg) const override
Method creating the transient representation of DepositInCalo from its persistent representation Depo...
Definition: DepositInCaloCnv_p1.cxx:25
Muon_p1::m_bestMatch
bool m_bestMatch
Definition: Muon_p1.h:116
Muon_p1::m_isAlsoFoundByCaloMuonId
bool m_isAlsoFoundByCaloMuonId
Definition: Muon_p1.h:120
CaloEnergy_p1::m_energyLossType
int m_energyLossType
Definition: CaloEnergy_p1.h:62
Analysis::Muon::set_parameter
void set_parameter(MuonParameters::ParamDef index, double value, bool overwrite=false)
set a parameter in the MuonParamDefs.h
Definition: Muon.cxx:888
Muon_p1::m_innerExtrapolatedTrackParticle
ElementLinkInt_p1 m_innerExtrapolatedTrackParticle
link to associated TrackParticle (Inner extrapolated)
Definition: Muon_p1.h:105
P4ImplIPtCotThPhiMCnv_p1::persToTrans
virtual void persToTrans(const P4ImplIPtCotThPhiM_p1 *persObj, P4ImplIPtCotThPhiM *transObj, MsgStream &msg) const override
Method creating the transient representation of P4ImplIPtCotThPhiM from its persistent representation...
Definition: P4ImplIPtCotThPhiMCnv_p1.cxx:26
ParticleBaseCnv_p1
Definition: ParticleBaseCnv_p1.h:30
Muon_p1::m_inDetTrackParticle
ElementLinkInt_p1 m_inDetTrackParticle
link to associated TrackParticle (Inner Detector)
Definition: Muon_p1.h:96
CaloEnergy::set_fsrCandidateEnergy
void set_fsrCandidateEnergy(const float fs)
FSR Candidate Energy.
Definition: CaloEnergy.h:118
P4ImplIPtCotThPhiMCnv_p1
Definition: P4ImplIPtCotThPhiMCnv_p1.h:38
Analysis::Muon::set_numberOfAssociatedEtaDigits
void set_numberOfAssociatedEtaDigits(int nMDT, int nCSC, int nRPC, int nTGC)
Set the LowPt stuff.
Definition: Muon.cxx:840
MuonParameters::annEndCap
@ annEndCap
Definition: MuonParamDefs.h:146
Muon_p1::m_matchChi2
double m_matchChi2
Chi2 of the track matching.
Definition: Muon_p1.h:88
MuonParameters::etcone10
@ etcone10
isolation enums - common parameters
Definition: MuonParamDefs.h:113
Muon.h
MuonCnv_p1.h
Analysis::Muon::set_numberOfAssociatedPhiDigits
void set_numberOfAssociatedPhiDigits(int nMDT, int nCSC, int nRPC, int nTGC)
Set the LowPt - Associated Phi Digits.
Definition: Muon.cxx:848
Muon_p1::m_isAlsoFoundByLowPt
bool m_isAlsoFoundByLowPt
Definition: Muon_p1.h:119
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_p1::m_deposits
std::vector< DepositInCalo_p1 > m_deposits
Definition: CaloEnergy_p1.h:66
MuonParameters::etcone40
@ etcone40
Definition: MuonParamDefs.h:116
CaloEnergy_p1::m_energySigmaMinus
float m_energySigmaMinus
Definition: CaloEnergy_p1.h:60
Muon_p1::m_associatedEtaDigits
std::vector< int > m_associatedEtaDigits
Low Pt muon stuff.
Definition: Muon_p1.h:91
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
MuonParameters::segmentChi2OverDoF
@ segmentChi2OverDoF
Definition: MuonParamDefs.h:141
MuonCnv_p1::transToPers
virtual void transToPers(const Analysis::Muon *transObj, Muon_p1 *persObj, MsgStream &msg) const override
Method creating the persistent representation Muon_p1 from its transient representation Analysis::Muo...
Definition: MuonCnv_p1.cxx:179
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
Analysis::Muon::author
MuonParameters::Author author() const
return the primary author of this Muon - the algorithm that is most likely to reconstruct prompt muon...
Definition: Reconstruction/MuonIdentification/muonEvent/muonEvent/Muon.h:111
Muon_p1::m_parameters
std::vector< float > m_parameters
muon parameters
Definition: Muon_p1.h:114
Muon_p1::m_muonExtrapolatedTrackParticle
ElementLinkInt_p1 m_muonExtrapolatedTrackParticle
link to associated TrackParticle (Muon extrapolated)
Definition: Muon_p1.h:102