ATLAS Offline Software
OfflineObjectDecorHelper.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef INDETTRACKPERFMON_OFFLINEOBJECTDECORHELPER_H
6 #define INDETTRACKPERFMON_OFFLINEOBJECTDECORHELPER_H
7 
19 #include "xAODMuon/MuonContainer.h"
22 
24 #include <string>
25 
26 
27 namespace IDTPM {
28 
30  template < typename container_t >
32  const std::string& decoName ) {
33  using elementLink_t = ElementLink< container_t >;
34  const SG::ConstAccessor< elementLink_t > acc( decoName );
35  return ( not acc.isAvailable( track ) );
36  }
37 
39  template < typename container_t >
40  typename container_t::const_value_type getLinkedObject(
42  const std::string& decoName )
43  {
44  using elementLink_t = ElementLink< container_t >;
45 
46  if( isUnlinkedObject< container_t >( track, decoName ) ) return nullptr;
47 
48  const SG::ConstAccessor< elementLink_t > acc( decoName );
49  elementLink_t eleLink = acc( track );
50 
51  if( not eleLink.isValid() ) return nullptr;
52 
53  return *eleLink;
54  }
55 
59  const std::string& quality="All" );
60 
63  const std::string& quality="All" );
64 
67  const int requiredNtracks,
68  const std::string& type="RNN",
69  const std::string& quality="" );
70 
73  inline bool isUnlinkedTruth( const xAOD::TruthParticle& ) { return false; }; // dummy - to avoid compilation errors
74 
76  inline float getTruthMatchProb( const xAOD::TruthParticle& ) { return -1.; }; // dummy - to avoid compilation errors
77 
79  const float truthProbCut=0. );
81  const xAOD::TruthParticle&, const float ) { return nullptr; }; // dummy - to avoid compilation errors
82 
83  bool isFakeTruth( const xAOD::TrackParticle& track, const float truthProbCut=0., const bool unlinkedAsFakes=false );
84  inline bool isFakeTruth( const xAOD::TruthParticle&, const float, const bool ) { return false; }; // dummy - to avoid compilation errors
85 
86  bool isReconstructable( const xAOD::TruthParticle& truth, const std::vector<unsigned int>& minSilHits, const std::vector<float>& etaBins);
87  inline bool isReconstructable( const xAOD::TrackParticle&, const std::vector<unsigned int>& , const std::vector<float>& ) { return false; }; // dummy - to avoid compilation errors
88 
89 } // namespace IDTPM
90 
91 #endif // > ! INDETTRACKPERFMON_OFFLINEOBJECTDECORHELPER_H
IDTPM::getTruthMatchProb
float getTruthMatchProb(const xAOD::TrackParticle &track)
getTruthMatchProb
Definition: OfflineObjectDecorHelper.cxx:53
IDTPM::getLinkedTau
const xAOD::TauJet * getLinkedTau(const xAOD::TrackParticle &track, const int requiredNtracks, const std::string &type, const std::string &quality)
getLinkedTau
Definition: OfflineObjectDecorHelper.cxx:34
IDTPM::getLinkedTruth
const xAOD::TruthParticle * getLinkedTruth(const xAOD::TrackParticle &track, const float truthProbCut)
getLinkedTruth
Definition: OfflineObjectDecorHelper.cxx:59
TruthParticleContainer.h
ConvertOldUJHistosToNewHistos.etaBins
list etaBins
Definition: ConvertOldUJHistosToNewHistos.py:145
IDTPM::getLinkedElectron
const xAOD::Electron * getLinkedElectron(const xAOD::TrackParticle &track, const std::string &quality)
getLinkedElectron
Definition: OfflineObjectDecorHelper.cxx:18
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
ElectronContainer.h
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
xAOD::TauJet_v3
Class describing a tau jet.
Definition: TauJet_v3.h:41
IDTPM::getLinkedMuon
const xAOD::Muon * getLinkedMuon(const xAOD::TrackParticle &track, const std::string &quality)
getLinkedMuon
Definition: OfflineObjectDecorHelper.cxx:26
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
TauJetContainer.h
xAOD::Electron_v1
Definition: Electron_v1.h:34
MuonContainer.h
TrackParticle.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
IDTPM::getLinkedObject
container_t::const_value_type getLinkedObject(const xAOD::TrackParticle &track, const std::string &decoName)
Templated method to retrieve object linked to a track.
Definition: OfflineObjectDecorHelper.h:40
IDTPM::isUnlinkedObject
bool isUnlinkedObject(const xAOD::TrackParticle &track, const std::string &decoName)
Templated method to check if a track is not linked to an object.
Definition: OfflineObjectDecorHelper.h:31
IDTPM::isReconstructable
bool isReconstructable(const xAOD::TruthParticle &truth, const std::vector< unsigned int > &minSilHits, const std::vector< float > &etaBins)
isReconstructable
Definition: OfflineObjectDecorHelper.cxx:81
IDTPM::isFakeTruth
bool isFakeTruth(const xAOD::TrackParticle &track, const float truthProbCut, const bool unlinkedAsFakes)
isFake
Definition: OfflineObjectDecorHelper.cxx:70
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
IDTPM
Athena include(s).
Definition: IPlotsDefinitionSvc.h:25
IDTPM::isUnlinkedTruth
bool isUnlinkedTruth(const xAOD::TrackParticle &track)
isUnlinkedTruth
Definition: OfflineObjectDecorHelper.cxx:45