|
ATLAS Offline Software
|
Go to the documentation of this file.
16 ISvcLocator *pSvcLocator)
64 return StatusCode::SUCCESS;
69 const EventContext &ctx = Gaudi::Hive::currentContext();
104 std::map< const xAOD::Vertex*, std::vector<const xAOD::Jet*> > jetsInVertex;
105 std::map< const xAOD::Jet*, std::map< const xAOD::Vertex*, int> > jetVertexPt;
112 jetsInVertex[
vertex] = {};
127 float weighted_sumDZ = 0;
128 float weighted_deltaZ = 0;
129 float weighted_modsumDZ = 0;
130 float weighted_z_asym = 0;
133 std::vector<float> track_deltaZ;
135 for (
size_t i = 0;
i <
vertex->nTrackParticles();
i++) {
139 if(!trackTmp)
continue;
141 sumPt += trackTmp->
pt();
143 track_deltaZ.push_back(
deltaZ);
145 float trk_weight =
vertex->trackWeight(
i);
146 weighted_deltaZ =
deltaZ * trk_weight;
149 modsumDZ += std::abs(
deltaZ);
150 weighted_sumDZ += weighted_deltaZ;
151 weighted_modsumDZ += std::abs(weighted_deltaZ);
155 z_asym = sumDZ / modsumDZ;
157 if (weighted_modsumDZ > 0) {
158 weighted_z_asym = weighted_sumDZ / weighted_modsumDZ;
161 float mean_Dz = sumDZ / track_deltaZ.size();
162 float number_tracks = track_deltaZ.size();
168 for (
auto i : track_deltaZ)
170 float z_zbar = (
i - mean_Dz);
175 if (number_tracks > 1 && z_var > 0) {
176 z_var /= (number_tracks - 1);
177 float z_sd = std::sqrt(z_var);
178 z_skew /= (number_tracks - 1) *
std::pow(z_sd, 3);
179 z_kurt /= (number_tracks - 1) *
std::pow(z_sd, 4);
188 dec_ntrk(*
vertex) = number_tracks;
189 dec_sumPt(*
vertex) = sumPt;
193 dec_z_asym(*
vertex) = z_asym;
194 dec_weighted_z_asym(*
vertex) = weighted_z_asym;
195 dec_z_kurt(*
vertex) = z_kurt;
196 dec_z_skew(*
vertex) = z_skew;
200 if (std::isnan(acc_deltaZ(*
vertex))) {
202 dec_photon_deltaz(*
vertex) = -999;
209 dec_photon_deltaz(*
vertex) = -999;
212 if (std::isnan(acc_deltaPhi(*
vertex))) {
214 dec_photon_deltaPhi(*
vertex) = -999;
221 dec_photon_deltaPhi(*
vertex) = -999;
225 std::vector<ElementLink<xAOD::ElectronContainer>> electronLinks;
229 if(!id_trk)
continue;
231 for(
size_t i = 0;
i <
vertex->nTrackParticles();
i++){
233 if(trk && id_trk == trk) {
237 electronLinks.push_back(elLink);
242 dec_electronLinks(*
vertex) = electronLinks;
244 std::vector<ElementLink<xAOD::PhotonContainer>> photonLinks;
249 photonLinks.push_back(phLink);
251 dec_photonLinks(*
vertex) = photonLinks;
253 float maxPtFrac = -1;
254 const xAOD::Jet* uniqueJetAddress =
nullptr;
256 std::vector<ElementLink<xAOD::JetContainer>> jetLinks;
262 if( !jtrk )
continue;
264 if(jetTrackVertex) jetVertexPt[
jet][*jetTrackVertex] += jtrk->pt();
266 if(jetVertexPt[
jet][
vertex] > maxPtFrac){
268 uniqueJetAddress =
jet;
273 if(uniqueJetAddress ==
jet){
277 jetLinks.push_back(jetLink);
281 dec_jetLinks(*
vertex) = jetLinks;
283 std::vector<ElementLink<xAOD::MuonContainer>> muonLinks;
286 auto tp =
muon->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
288 for (
size_t i = 0;
i <
vertex->nTrackParticles();
i++){
290 if(trk &&
tp == trk){
294 muonLinks.push_back(muonLink);
299 dec_muonLinks(*
vertex) = muonLinks;
305 return StatusCode::SUCCESS;
virtual double pt() const override final
The transverse momentum ( ) of the particle.
SG::ReadHandleKey< xAOD::PhotonContainer > m_photonsInKey
SG::ReadDecorHandleKey< xAOD::PhotonContainer > m_caloPointingZKey
SG::ReadDecorHandleKey< xAOD::PhotonContainer > m_zCommonErrorKey
StatusCode initialize() override
SG::ReadHandleKey< xAOD::EventInfo > m_eventInKey
DataVector adapter that acts like it holds const pointers.
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_photonLinksKey
float vz() const
The z origin for the parameters.
float z0() const
Returns the parameter.
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexInKey
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.
ToolHandle< GNNTool > m_gnnTool
ToolHandle< CP::TrackVertexAssociationTool > m_trkVtxAssociationTool
Handle class for reading a decoration on an object.
Helper class to provide type-safe access to aux data.
::StatusCode StatusCode
StatusCode definition for legacy code.
Handle class for adding a decoration to an object.
SG::ReadDecorHandleKey< xAOD::VertexContainer > m_deltaPhiKey
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
ElementLink implementation for ROOT usage.
bool setElement(ElementType element)
Set to point to an element.
SG::ReadDecorHandleKey< xAOD::VertexContainer > m_deltaZKey
bool setStorableObject(BaseConstReference data, bool replace=false, IProxyDict *sg=0)
Set link to point to a new container (storable).
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_electronLinksKey
VertexDecoratorAlg(const std::string &name, ISvcLocator *pSvcLocator)
Class describing a Vertex.
#define ATH_MSG_WARNING(x)
const xAOD::TrackParticle * getOriginalTrackParticle(const xAOD::Electron *el)
Helper function for getting the "Original" Track Particle (i.e before GSF) via the electron.
SG::ReadHandleKey< xAOD::JetContainer > m_jetsInKey
SG::ReadDecorHandleKey< xAOD::PhotonContainer > m_zCommonKey
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_jetLinksKey
Class describing a TrackParticle.
StatusCode execute() override
SG::ReadHandleKey< xAOD::ElectronContainer > m_electronsInKey
constexpr int pow(int base, int exp) noexcept
bool isAvailable()
Test to see if this variable exists in the store, for the referenced object.
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_muonLinksKey
SG::ReadHandleKey< xAOD::MuonContainer > m_muonsInKey
float actualInteractionsPerCrossing() const
Average interactions per crossing for the current BCID - for in-time pile-up.