ATLAS Offline Software
Loading...
Searching...
No Matches
MuonCnv_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// MuonCnv_p2.cxx
8// Implementation file for class MuonCnv_p2
9// Author: Ketevi A. Assamagan <ketevi@bnl.gov>
11
12
13// STL includes
14
15// 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_p2.h"
32
36
37// pre-allocate converters
44
45
47 Analysis::Muon* trans,
48 MsgStream& msg ) const
49{
50// msg << MSG::DEBUG << "Loading Muon from persistent state..."
51// << endmsg;
52
53 // base classes
54 momCnv.persToTrans ( &pers->m_momentum, &trans->momentumBase(), msg );
55 partBaseCnv.persToTrans( &pers->m_particleBase, &trans->particleBase(), msg );
56
57 // element links
59 trackCnv.persToTrans( &pers->m_inDetTrackParticle,
60 &inDetTrackLink,
61 msg );
62 trans->setInDetTrackLink (inDetTrackLink);
63
64 ElementLink<Rec::TrackParticleContainer> muonSpectrometerTrackLink;
65 trackCnv.persToTrans( &pers->m_muonSpectrometerTrackParticle,
66 &muonSpectrometerTrackLink,
67 msg );
68 trans->setMuonSpectrometerTrackLink (muonSpectrometerTrackLink);
69
71 trackCnv.persToTrans( &pers->m_muonExtrapolatedTrackParticle,
72 &muonExtrapTrackLink,
73 msg );
74 trans->setMuonExtrapTrackLink (muonExtrapTrackLink,
76
79 &innerExtrapTrackLink,
80 msg );
81 trans->setInnerExtrapTrackLink (innerExtrapTrackLink);
82
84 trackCnv.persToTrans( &pers->m_combinedMuonTrackParticle,
85 &combinedTrackLink,
86 msg );
87 trans->setCombinedTrackLink (combinedTrackLink,
89
91 clusterCnv.persToTrans( &pers->m_cluster,
92 &clusterLink,
93 msg );
94 trans->setClusterLink (clusterLink);
95
97 segmentCnv.persToTrans( &pers->m_muonSegments,
98 &muonSegmentLink,
99 msg );
100 trans->setMuonSegmentLink (muonSegmentLink);
101
102 // muon parameters
103 const std::vector<float>& params = pers->m_parameters;
104 trans->set_parameter(MuonParameters::etcone10, params[ 0] );
105 trans->set_parameter(MuonParameters::etcone20, params[ 1] );
106 trans->set_parameter(MuonParameters::etcone30, params[ 2] );
107 trans->set_parameter(MuonParameters::etcone40, params[ 3] );
108
109 trans->set_parameter(MuonParameters::nucone10, params[ 8] );
110 trans->set_parameter(MuonParameters::nucone20, params[ 9] );
111 trans->set_parameter(MuonParameters::nucone30, params[10] );
112 trans->set_parameter(MuonParameters::nucone40, params[11] );
113
117 trans->set_parameter(MuonParameters::annBarrel, params[19] );
118 trans->set_parameter(MuonParameters::annEndCap, params[20] );
119 trans->set_parameter(MuonParameters::innAngle, params[21] );
120 trans->set_parameter(MuonParameters::midAngle, params[22] );
121
122 trans->set_parameter(MuonParameters::t0, params[23] );
123 trans->set_parameter(MuonParameters::beta, params[24] );
124
125 // author
126 trans->set_author (static_cast<MuonParameters::Author>(pers->m_author));
127 trans->set_allAuthors (0);
128 trans->add_author ( trans->author() );
129
130 // chi2 of the track matching
131 trans->set_matchChi2 (pers->m_matchChi2);
132
133 // Low Pt muon stuff
136
137 trans->set_bestMatch (pers->m_bestMatch);
139
140 // this muon is also found by the lowPT reconstruction algorithm
142
143 // this muon is also found by the Calo Muon ID reconstruction algorithm
145
148
150
151 MuonCaloEnergyContainer * caloEnergyContainer = 0;
152 if (m_storeGate->retrieve(caloEnergyContainer, m_muonCaloEnergyContainerName).isFailure() || caloEnergyContainer == NULL) {
153 msg << MSG::WARNING << "Cannot retrieve MuonCaloEnergyContainer" << m_muonCaloEnergyContainerName
154 << endmsg;
155 } else {
156 float deltaE = pers->m_caloEnergyLoss.m_energyDeposit;
157 float sigmaM = pers->m_caloEnergyLoss.m_energySigmaMinus;
158 float sigmaP = pers->m_caloEnergyLoss.m_energySigmaPlus;
159 float sigma = (sigmaM+sigmaP)/2.0;
160 unsigned short elossT = static_cast<unsigned short> (pers->m_caloEnergyLoss.m_energyLossType);
161 float caloLR = pers->m_caloEnergyLoss.m_caloLRLikelihood;
162 unsigned short tag = static_cast<unsigned short>(pers->m_caloEnergyLoss.m_fsrCandidateEnergy);
163 float fsrEnergy = pers->m_caloEnergyLoss.m_fsrCandidateEnergy;
164
165 CaloEnergy * caloEnergy = new CaloEnergy(deltaE, sigma, sigmaM, sigmaP, elossT, caloLR, tag) ;
166 caloEnergy->set_fsrCandidateEnergy ( fsrEnergy );
167 std::vector<DepositInCalo> deposits;
168 deposits.reserve( pers->m_caloEnergyLoss.m_deposits.size() );
169 typedef std::vector<DepositInCalo_p1> Deposits_t;
170 for ( Deposits_t::const_iterator
171 itr = pers->m_caloEnergyLoss.m_deposits.begin(),
172 iEnd = pers->m_caloEnergyLoss.m_deposits.end();
173 itr != iEnd;
174 ++itr ) {
175 deposits.push_back( DepositInCalo() );
176 depositCnv.persToTrans( &*itr, &deposits.back(), msg );
177 }
178 caloEnergy->set_deposits( deposits );
179 caloEnergyContainer->push_back( caloEnergy );
181 caloEnergyLink.toContainedElement(*caloEnergyContainer, caloEnergy);
182 trans->setCaloEnergyLink (caloEnergyLink);
183 }
184
185// msg << MSG::DEBUG << "Loaded Muon from persistent state [OK]"
186// << endmsg;
187
188 return;
189}
190
192 Muon_p2* pers,
193 MsgStream& msg ) const
194{
195 msg << MSG::ERROR << "Analysis::Muon at " << trans << " Persistent Muon_p2 at " << pers << " Cannot write to Muon_p2" << endmsg;
196 throw std::runtime_error("Writing to Muon_p2 is not supported - MuonCnv_p2::transToPers(...)");
197 return;
198
199}
200
#define endmsg
static const DepositInCaloCnv_p1 depositCnv
This file contains the class definition for the ElementLinkCnv_p1 class.
This file contains the class definition for the ElementLinkVectorCnv_p1 class.
static const P4ImplPxPyPzECnv_p1 momCnv
Definition JetCnv_p1.cxx:30
static const TrackLinkCnv_t trackCnv
ElementLinkCnv_p1< ElementLink< CaloClusterContainer > > ClusterLinkCnv_t
ElementLinkCnv_p1< ElementLink< Rec::TrackParticleContainer > > TrackLinkCnv_t
static const ClusterLinkCnv_t clusterCnv
ElementLinkVectorCnv_p1< ElementLinkVector< Trk::SegmentCollection > > segmentLinkCnv_t
static const segmentLinkCnv_t segmentCnv
static const ParticleBaseCnv_p1 partBaseCnv
The ATLAS Muon object - see doxygen, physics workbookd and the Muon Combined Performance WG's pages f...
MuonParameters::Author author() const
return the primary author of this Muon - the algorithm that is most likely to reconstruct prompt muon...
void set_matchNumberDoF(int x)
set the chi2 parameters - number of degrees of freedom
void set_isAlsoFoundByCaloMuonId(const bool isAlsoSeenByCaloMuonId)
set is also seen by calo muon Id reconstruction
void setMuonSpectrometerTrackLink(const ElementLink< Rec::TrackParticleContainer > &l)
void set_parameter(MuonParameters::ParamDef index, double value, bool overwrite=false)
set a parameter in the MuonParamDefs.h
Definition Muon.cxx:888
void setCaloEnergyLink(const ElementLink< MuonCaloEnergyContainer > &l)
void set_caloMuonAlsoFoundByMuonReco(const unsigned short isAlsoFoundByMuonReco)
set if this calo muon is also reconstructed by one of the standard muon recosntruction algorithms tha...
void set_isAlsoFoundByLowPt(const bool isAlsoSeenByLowPt)
set is also seen by low Pt reconstruction
bool add_author(MuonParameters::Author author)
the add_author method returns a bool:
Definition Muon.cxx:368
void set_numberOfAssociatedPhiDigits(int nMDT, int nCSC, int nRPC, int nTGC)
Set the LowPt - Associated Phi Digits.
Definition Muon.cxx:848
void setInnerExtrapTrackLink(const ElementLink< Rec::TrackParticleContainer > &l)
void setClusterLink(const ElementLink< CaloClusterContainer > &l)
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 ...
void set_numberOfAssociatedEtaDigits(int nMDT, int nCSC, int nRPC, int nTGC)
Set the LowPt stuff.
Definition Muon.cxx:840
void setMuonExtrapTrackLink(const ElementLink< Rec::TrackParticleContainer > &l, bool isValid)
void set_author(MuonParameters::Author author)
set the primary Author : the primary author is the algorithm that first created this Muon
void setCombinedTrackLink(const ElementLink< Rec::TrackParticleContainer > &l, bool isValid)
void setMuonSegmentLink(const ElementLinkVector< Trk::SegmentCollection > &l)
void setInDetTrackLink(const ElementLink< Rec::TrackParticleContainer > &l)
void set_matchChi2(float x)
set the chi2 parameters - matchChi2
std::vector< DepositInCalo_p1 > m_deposits
float m_energySigmaPlus
float m_caloLRLikelihood
float m_energySigmaMinus
float m_fsrCandidateEnergy
float m_energyDeposit
class extending the basic Trk::EnergyLoss to describe the measured or parameterised muon energy loss ...
Definition CaloEnergy.h:28
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
value_type push_back(value_type pElem)
Add an element to the end of the collection.
class describing the measured energy loss associated to muons on the detector level,...
ElementLinkVector implementation for standalone ROOT.
Data object for a StoreGate container holding a vector of CaloEnergy, the detailed energy loss descri...
std::string m_muonCaloEnergyContainerName
Definition MuonCnv_p2.h:65
virtual void transToPers(const Analysis::Muon *transObj, Muon_p2 *persObj, MsgStream &msg) const override
Method creating the persistent representation Muon_p1 from its transient representation Analysis::Muo...
StoreGateSvc_t m_storeGate
Definition MuonCnv_p2.h:64
virtual void persToTrans(const Muon_p2 *persObj, Analysis::Muon *transObj, MsgStream &msg) const override
Method creating the transient representation of Analysis::Muon from its persistent representation Muo...
ElementLinkInt_p1 m_muonExtrapolatedTrackParticle
link to associated TrackParticle (Muon extrapolated)
Definition Muon_p2.h:101
bool m_isAlsoFoundByCaloMuonId
Definition Muon_p2.h:119
bool m_bestMatch
Definition Muon_p2.h:115
P4IPtCotThPhiM_p1 m_momentum
the 4-mom part
Definition Muon_p2.h:64
ElementLinkInt_p1 m_cluster
link to CaloCluster
Definition Muon_p2.h:110
unsigned short m_caloMuonAlsoFoundByMuonReco
Definition Muon_p2.h:124
std::vector< int > m_associatedPhiDigits
Definition Muon_p2.h:88
ParticleBase_p1 m_particleBase
the ParticleBase part
Definition Muon_p2.h:67
unsigned int m_author
author
Definition Muon_p2.h:72
ElementLinkInt_p1 m_combinedMuonTrackParticle
links to associated TrackParticle (Combined muon)
Definition Muon_p2.h:107
bool m_isAlsoFoundByLowPt
Definition Muon_p2.h:118
int m_matchNumberDoF
Definition Muon_p2.h:116
CaloEnergy_p1 m_caloEnergyLoss
energy loss in calorimeter
Definition Muon_p2.h:122
std::vector< float > m_parameters
muon parameters
Definition Muon_p2.h:113
double m_matchChi2
Chi2 of the track matching.
Definition Muon_p2.h:84
ElementLinkInt_p1 m_innerExtrapolatedTrackParticle
link to associated TrackParticle (Inner extrapolated)
Definition Muon_p2.h:104
std::vector< int > m_associatedEtaDigits
Low Pt muon stuff.
Definition Muon_p2.h:87
bool m_hasMuonExtrapolatedTrackParticle
Definition Muon_p2.h:77
bool m_hasCombinedMuonTrackParticle
Definition Muon_p2.h:78
ElementLinkInt_p1 m_inDetTrackParticle
link to associated TrackParticle (Inner Detector)
Definition Muon_p2.h:92
ElementLinkIntVector_p1 m_muonSegments
link to the Trk::Segment
Definition Muon_p2.h:95
ElementLinkInt_p1 m_muonSpectrometerTrackParticle
link to associated TrackParticle (Muon Spectrometer)
Definition Muon_p2.h:98
const momentum_type & momentumBase() const
access to underlying base type (I4Momentum-like)
const particle_type & particleBase() const
access to underlying base type (IParticle-like)
@ innAngle
common MuGirl and MuTag parameters
@ t0
MuGirl parameter.
@ segmentDeltaEta
MuTag parameters.
@ etcone10
isolation enums - common parameters
Author
do not change the order of these enums.
MsgStream & msg
Definition testRead.cxx:32