ATLAS Offline Software
V0MainDecorator.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
6 #include "HepPDT/ParticleDataTable.hh"
7 #include "xAODTracking/Vertex.h"
10 namespace InDet
11 {
12 V0MainDecorator::V0MainDecorator(const std::string& t, const std::string& n, const IInterface* p)
13  :
14  AthAlgTool(t,n,p){}
15 
17 
18 StatusCode V0MainDecorator::initKey(const std::string &containerKey,
20  decokey = containerKey + decokey.key();
21  ATH_MSG_DEBUG(" : " << decokey.key());
22  ATH_CHECK(decokey.initialize(!containerKey.empty()));
23  return StatusCode::SUCCESS;
24 }
25 
27 
28  ATH_CHECK( m_V0Tools.retrieve() );
35 
42 
71 
72 
73 
74  if (m_masses == 1) {
75  // get the Particle Properties Service
76  ATH_CHECK(m_partPropSvc.retrieve());
77  auto *particleDataTable = m_partPropSvc->PDT();
78 
79  const HepPDT::ParticleData* pd_pi = particleDataTable->particle(MC::PIPLUS);
80  const HepPDT::ParticleData* pd_p = particleDataTable->particle(MC::PROTON);
81  const HepPDT::ParticleData* pd_e = particleDataTable->particle(MC::ELECTRON);
82  const HepPDT::ParticleData* pd_K = particleDataTable->particle(MC::K0S);
83  const HepPDT::ParticleData* pd_L = particleDataTable->particle(MC::LAMBDA0);
84 
85  m_masspi = pd_pi->mass();
86  m_massp = pd_p->mass();
87  m_masse = pd_e->mass();
88  m_massK0S = pd_K->mass();
89  m_massLambda = pd_L->mass();
90  }
91  return StatusCode::SUCCESS;
92 }
93 
94 StatusCode V0MainDecorator::decorateV0(xAOD::VertexContainer *container, const EventContext& ctx) const
95 {
96 
110 
111  for ( auto unconstrV0 : *container )
112  {
113  double mass_ks = m_V0Tools->invariantMass(unconstrV0,m_masspi,m_masspi);
114  double mass_error_ks = m_V0Tools->invariantMassError(unconstrV0,m_masspi,m_masspi);
115  double mass_la = m_V0Tools->invariantMass(unconstrV0,m_massp,m_masspi);
116  double mass_error_la = m_V0Tools->invariantMassError(unconstrV0,m_massp,m_masspi);
117  double mass_lb = m_V0Tools->invariantMass(unconstrV0,m_masspi,m_massp);
118  double mass_error_lb = m_V0Tools->invariantMassError(unconstrV0,m_masspi,m_massp);
119  double pt = m_V0Tools->pT(unconstrV0);
120  double ptError = m_V0Tools->pTError(unconstrV0);
121  double rxy = m_V0Tools->rxy(unconstrV0);
122  double rxyError = m_V0Tools->rxyError(unconstrV0);
123  Amg::Vector3D momentum = m_V0Tools->V0Momentum(unconstrV0);
124 
125  decorKsMass( *unconstrV0 ) = mass_ks;
126  decorLaMass( *unconstrV0 ) = mass_la;
127  decorLbMass( *unconstrV0 ) = mass_lb;
128  decorKsMassErr( *unconstrV0 ) = mass_error_ks;
129  decorLaMassErr( *unconstrV0 ) = mass_error_la;
130  decorLbMassErr( *unconstrV0 ) = mass_error_lb;
131  decorPt_v0( *unconstrV0 ) = pt;
132  decorPtErr_v0( *unconstrV0 ) =ptError;
133  decorRxy_v0( *unconstrV0 ) = rxy;
134  decorRxyErr_v0( *unconstrV0 ) =rxyError;
135  decorPx_v0( *unconstrV0 ) = momentum.x();
136  decorPy_v0( *unconstrV0 ) = momentum.y();
137  decorPz_v0( *unconstrV0 ) = momentum.z();
138  }
139  return StatusCode::SUCCESS;
140 }
141 
142 StatusCode V0MainDecorator::decorateks(xAOD::VertexContainer *container, const EventContext& ctx) const
143 {
144 
154 
155  for ( auto ksV0 : *container )
156  {
157  double mass_ks = m_V0Tools->invariantMass(ksV0,m_masspi,m_masspi);
158  double mass_error_ks = m_V0Tools->invariantMassError(ksV0,m_masspi,m_masspi);
159  double pt = m_V0Tools->pT(ksV0);
160  double ptError = m_V0Tools->pTError(ksV0);
161  double rxy = m_V0Tools->rxy(ksV0);
162  double rxyError = m_V0Tools->rxyError(ksV0);
163  Amg::Vector3D momentum = m_V0Tools->V0Momentum(ksV0);
164 
165  decorMass_ks( *ksV0 ) = mass_ks;
166  decorMassErr_ks( *ksV0 ) = mass_error_ks;
167  decorPt_ks( *ksV0 ) = pt;
168  decorPtErr_ks( *ksV0 ) = ptError;
169  decorRxy_ks( *ksV0 ) = rxy;
170  decorRxyErr_ks( *ksV0 ) = rxyError;
171  decorPx_ks( *ksV0 ) = momentum.x();
172  decorPy_ks( *ksV0 ) = momentum.y();
173  decorPz_ks( *ksV0 ) = momentum.z();
174  }
175  return StatusCode::SUCCESS;
176 }
177 
178 StatusCode V0MainDecorator::decoratela(xAOD::VertexContainer *container, const EventContext& ctx) const
179 {
189 
190  for ( auto laV0 : *container )
191  {
192  double mass_la = m_V0Tools->invariantMass(laV0,m_massp,m_masspi);
193  double mass_error_la = m_V0Tools->invariantMassError(laV0,m_massp,m_masspi);
194  double pt = m_V0Tools->pT(laV0);
195  double ptError = m_V0Tools->pTError(laV0);
196  double rxy = m_V0Tools->rxy(laV0);
197  double rxyError = m_V0Tools->rxyError(laV0);
198  Amg::Vector3D momentum = m_V0Tools->V0Momentum(laV0);
199 
200  decorMass_la( *laV0 ) = mass_la;
201  decorMassErr_la( *laV0 ) = mass_error_la;
202  decorPt_la( *laV0 ) = pt;
203  decorPtErr_la( *laV0 ) = ptError;
204  decorRxy_la( *laV0 ) = rxy;
205  decorRxyErr_la( *laV0 ) = rxyError;
206  decorPx_la( *laV0 ) = momentum.x();
207  decorPy_la( *laV0 ) = momentum.y();
208  decorPz_la( *laV0 ) = momentum.z();
209  }
210  return StatusCode::SUCCESS;
211 }
212 
213 StatusCode V0MainDecorator::decoratelb(xAOD::VertexContainer *container, const EventContext& ctx) const
214 {
224 
225  for ( auto lbV0 : *container )
226  {
227  double mass_lb = m_V0Tools->invariantMass(lbV0,m_masspi,m_massp);
228  double mass_error_lb = m_V0Tools->invariantMassError(lbV0,m_masspi,m_massp);
229  double pt = m_V0Tools->pT(lbV0);
230  double ptError = m_V0Tools->pTError(lbV0);
231  double rxy = m_V0Tools->rxy(lbV0);
232  double rxyError = m_V0Tools->rxyError(lbV0);
233  Amg::Vector3D momentum = m_V0Tools->V0Momentum(lbV0);
234 
235  decorMass_lb( *lbV0 ) = mass_lb;
236  decorMassErr_lb( *lbV0 ) = mass_error_lb;
237  decorPt_lb( *lbV0 ) = pt;
238  decorPtErr_lb( *lbV0 ) = ptError;
239  decorRxy_lb( *lbV0 ) = rxy;
240  decorRxyErr_lb( *lbV0 ) = rxyError;
241  decorPx_lb( *lbV0 ) = momentum.x();
242  decorPy_lb( *lbV0 ) = momentum.y();
243  decorPz_lb( *lbV0 ) = momentum.z();
244  }
245  return StatusCode::SUCCESS;
246 }
247 
248 }
InDet::V0MainDecorator::m_decorPx_v0
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorPx_v0
Definition: V0MainDecorator.h:68
InDet::V0MainDecorator::m_decorPy_ks
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorPy_ks
Definition: V0MainDecorator.h:90
SG::WriteDecorHandleKey
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Definition: StoreGate/StoreGate/WriteDecorHandleKey.h:89
InDet::V0MainDecorator::m_decorMass_la
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorMass_la
Definition: V0MainDecorator.h:96
InDet::V0MainDecorator::m_decorLbMass
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorLbMass
Definition: V0MainDecorator.h:56
InDet::V0MainDecorator::m_decorPz_v0
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorPz_v0
Definition: V0MainDecorator.h:72
InDet::V0MainDecorator::m_decorMassErr_la
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorMassErr_la
Definition: V0MainDecorator.h:98
InDet::V0MainDecorator::initKey
StatusCode initKey(const std::string &, SG::WriteDecorHandleKey< xAOD::VertexContainer > &decokey) const
Definition: V0MainDecorator.cxx:18
InDet::V0MainDecorator::m_massLambda
DoubleProperty m_massLambda
Lambda mass (1115.68 MeV)
Definition: V0MainDecorator.h:34
InDet::V0MainDecorator::m_massK0S
DoubleProperty m_massK0S
Kshort mass (497.672 MeV)
Definition: V0MainDecorator.h:33
InDet::V0MainDecorator::m_V0Tools
ToolHandle< Trk::V0Tools > m_V0Tools
Definition: V0MainDecorator.h:35
InDet
Primary Vertex Finder.
Definition: VP1ErrorUtils.h:36
InDet::V0MainDecorator::m_decorKsMassErr
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorKsMassErr
Definition: V0MainDecorator.h:50
InDet::V0MainDecorator::m_decorLaMass
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorLaMass
Definition: V0MainDecorator.h:52
InDet::V0MainDecorator::m_laKey
Gaudi::Property< std::string > m_laKey
Definition: V0MainDecorator.h:41
test_pyathena.pt
pt
Definition: test_pyathena.py:11
InDet::V0MainDecorator::m_massp
DoubleProperty m_massp
proton mass (938.272 MeV)
Definition: V0MainDecorator.h:31
InDet::V0MainDecorator::m_decorPy_v0
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorPy_v0
Definition: V0MainDecorator.h:70
InDet::V0MainDecorator::m_decorPtErr_la
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorPtErr_la
Definition: V0MainDecorator.h:102
InDet::V0MainDecorator::m_decorPx_la
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorPx_la
Definition: V0MainDecorator.h:108
InDet::V0MainDecorator::m_decorPt_la
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorPt_la
Definition: V0MainDecorator.h:100
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
InDet::V0MainDecorator::m_decorRxy_ks
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorRxy_ks
Definition: V0MainDecorator.h:84
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
InDet::V0MainDecorator::m_decorRxy_v0
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorRxy_v0
Definition: V0MainDecorator.h:64
InDet::V0MainDecorator::m_decorRxyErr_lb
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorRxyErr_lb
Definition: V0MainDecorator.h:126
InDet::V0MainDecorator::m_decorPtErr_ks
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorPtErr_ks
Definition: V0MainDecorator.h:82
InDet::V0MainDecorator::m_lbKey
Gaudi::Property< std::string > m_lbKey
Definition: V0MainDecorator.h:43
InDet::V0MainDecorator::m_decorPy_lb
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorPy_lb
Definition: V0MainDecorator.h:130
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
InDet::V0MainDecorator::decoratela
StatusCode decoratela(xAOD::VertexContainer *container, const EventContext &ctx) const
Definition: V0MainDecorator.cxx:178
InDet::V0MainDecorator::decoratelb
StatusCode decoratelb(xAOD::VertexContainer *container, const EventContext &ctx) const
Definition: V0MainDecorator.cxx:213
InDet::V0MainDecorator::m_decorPt_lb
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorPt_lb
Definition: V0MainDecorator.h:120
ParticleGun_EoverP_Config.momentum
momentum
Definition: ParticleGun_EoverP_Config.py:63
InDet::V0MainDecorator::m_decorRxyErr_v0
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorRxyErr_v0
Definition: V0MainDecorator.h:66
V0MainDecorator.h
InDet::V0MainDecorator::m_decorMassErr_lb
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorMassErr_lb
Definition: V0MainDecorator.h:118
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
InDet::V0MainDecorator::m_partPropSvc
ServiceHandle< IPartPropSvc > m_partPropSvc
Definition: V0MainDecorator.h:134
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:100
WriteDecorHandle.h
Handle class for adding a decoration to an object.
InDet::V0MainDecorator::~V0MainDecorator
~V0MainDecorator()
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
InDet::V0MainDecorator::decorateV0
StatusCode decorateV0(xAOD::VertexContainer *container, const EventContext &ctx) const
Definition: V0MainDecorator.cxx:94
InDet::V0MainDecorator::m_decorPy_la
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorPy_la
Definition: V0MainDecorator.h:110
InDet::V0MainDecorator::m_masse
DoubleProperty m_masse
electron mass (0.510999 MeV)
Definition: V0MainDecorator.h:32
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
Vertex.h
InDet::V0MainDecorator::m_decorPtErr_v0
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorPtErr_v0
Definition: V0MainDecorator.h:62
InDet::V0MainDecorator::m_decorRxyErr_la
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorRxyErr_la
Definition: V0MainDecorator.h:106
InDet::V0MainDecorator::m_masses
IntegerProperty m_masses
= 1 if using PDG values, = 2 if user set (1)
Definition: V0MainDecorator.h:29
InDet::V0MainDecorator::m_ksKey
Gaudi::Property< std::string > m_ksKey
Definition: V0MainDecorator.h:40
InDet::V0MainDecorator::m_decorPt_v0
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorPt_v0
Definition: V0MainDecorator.h:60
InDet::V0MainDecorator::m_v0Key
Gaudi::Property< std::string > m_v0Key
Definition: V0MainDecorator.h:39
InDet::V0MainDecorator::m_decorPz_la
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorPz_la
Definition: V0MainDecorator.h:112
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
InDet::V0MainDecorator::m_decorMass_ks
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorMass_ks
Definition: V0MainDecorator.h:76
InDet::V0MainDecorator::m_decorRxy_lb
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorRxy_lb
Definition: V0MainDecorator.h:124
InDet::V0MainDecorator::m_decorRxy_la
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorRxy_la
Definition: V0MainDecorator.h:104
InDet::V0MainDecorator::m_decorLaMassErr
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorLaMassErr
Definition: V0MainDecorator.h:54
VertexContainer.h
InDet::V0MainDecorator::m_decorRxyErr_ks
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorRxyErr_ks
Definition: V0MainDecorator.h:86
SG::WriteDecorHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
InDet::V0MainDecorator::V0MainDecorator
V0MainDecorator(const std::string &t, const std::string &n, const IInterface *p)
Definition: V0MainDecorator.cxx:12
InDet::V0MainDecorator::m_decorPt_ks
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorPt_ks
Definition: V0MainDecorator.h:80
InDet::V0MainDecorator::m_masspi
DoubleProperty m_masspi
pion mass (139.57 MeV)
Definition: V0MainDecorator.h:30
InDet::V0MainDecorator::m_decorPz_ks
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorPz_ks
Definition: V0MainDecorator.h:92
InDet::V0MainDecorator::m_decorPx_ks
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorPx_ks
Definition: V0MainDecorator.h:88
InDet::V0MainDecorator::m_decorMass_lb
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorMass_lb
Definition: V0MainDecorator.h:116
InDet::V0MainDecorator::m_decorLbMassErr
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorLbMassErr
Definition: V0MainDecorator.h:58
AthAlgTool
Definition: AthAlgTool.h:26
InDet::V0MainDecorator::m_decorPtErr_lb
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorPtErr_lb
Definition: V0MainDecorator.h:122
InDet::V0MainDecorator::decorateks
StatusCode decorateks(xAOD::VertexContainer *container, const EventContext &ctx) const
Definition: V0MainDecorator.cxx:142
InDet::V0MainDecorator::initialize
StatusCode initialize()
Definition: V0MainDecorator.cxx:26
HepMCHelpers.h
InDet::V0MainDecorator::m_decorMassErr_ks
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorMassErr_ks
Definition: V0MainDecorator.h:78
InDet::V0MainDecorator::m_decorPz_lb
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorPz_lb
Definition: V0MainDecorator.h:132
InDet::V0MainDecorator::m_decorKsMass
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorKsMass
Definition: V0MainDecorator.h:48
InDet::V0MainDecorator::m_decorPx_lb
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_decorPx_lb
Definition: V0MainDecorator.h:128