ATLAS Offline Software
TrkObserverTool.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // TrkObserverTool.h
8 // Header file for class TrkObserverTool
9 // Author: C.Rauchegger<christoph.rauchegger@cern.ch>
11 #ifndef TRK_TRKOBSERVERTOOL_H
12 #define TRK_TRKOBSERVERTOOL_H
13 
14 // STL includes
15 #include <string>
16 
17 // FrameWork includes
19 #include "GaudiKernel/ServiceHandle.h"
20 #include "GaudiKernel/ToolHandle.h"
22 
23 // TrkObserverInterface includes
25 
26 //need to include the following, since its a typedef and can't be forward declared.
28 
29 // for creating xAOD with TrackParticle
34 
35 
36 namespace Trk {
37 
38  class ITrackParticleCreatorTool;
39 
40  class TrkObserverTool : virtual public Trk::ITrkObserverTool, public :: AthAlgTool {
41  public:
42  TrkObserverTool(const std::string& type, const std::string& name, const IInterface* parent);
43  virtual ~TrkObserverTool();
44  // athena algtool's Hooks
45  virtual StatusCode initialize();
46  virtual StatusCode finalize();
47  // const methods
49  void updateScore(int uid, double score) const;
51  void addInputTrack(int uid, const Trk::Track& track) const;
52  void addSubTrack(int track_uid, int parent_uid, const Trk::Track& track) const;
53  ObservedTrackMap* getTrackMap(const EventContext& ctx) const;
54  int saveTracksToStore(const EventContext& ctx, const ObservedTrackMap* trk_map) const;
59 
60  private:
61  // name of the observed (saved) track collection
64 
66  struct CacheEntry {
67  EventContext::ContextEvt_t m_evt{EventContext::INVALID_CONTEXT_EVT};
68  // map with observed tracks and information
70  };
71  mutable SG::SlotSpecificObj<CacheEntry> m_cache ATLAS_THREAD_SAFE; // Guarded by m_mutex
72 
73  void newEvent(CacheEntry* ent) const;
74  void dumpTrackMap(const ObservedTrackMap* trk_map) const;
76  static int getNFinalTracks(const ObservedTrackMap* trk_map) ;
77  static int getNObservedTracks(const ObservedTrackMap* trk_map) ;
78  static const std::map<xAOD::RejectionStep, std::string> m_rejectStep_descriptions;
79  static const std::map<xAOD::RejectionReason, std::string> m_rejectReason_descriptions;
80  };
81 }
82 
83 #endif // TRK_TRKOBSERVERTOOL_H
ITrkObserverTool.h
xAOD::numSharedOrSplit
@ numSharedOrSplit
Definition: TrackingPrimitives.h:521
xAOD::hasIBLHit
@ hasIBLHit
Definition: TrackingPrimitives.h:527
xAOD::numWeightedShared
@ numWeightedShared
Definition: TrackingPrimitives.h:541
xAOD::numUnused
@ numUnused
Definition: TrackingPrimitives.h:535
Trk::TrkObserverTool::m_savedTracksMapWriteKey
SG::WriteHandleKey< ObservedTrackMap > m_savedTracksMapWriteKey
Definition: TrkObserverTool.h:63
Trk::TrkObserverTool::updateHolesSharedHits
void updateHolesSharedHits(int uid, int numPixelHoles, int numSCTHoles, int numSplitSharedPixel, int numSplitSharedSCT, int numSharedOrSplit, int numSharedOrSplitPixels, int numShared, int isPatternTrack, int totalSiHits, int inROI, int hasIBLHit, int hasSharedIBLHit, int hasSharedPixel, int firstPixIsShared, int numPixelDeadSensor, int numSCTDeadSensor, int numPixelHits, int numSCTHits, int numUnused, int numTRT_Unused, int numSCT_Unused, int numPseudo, float averageSplit1, float averageSplit2, int numWeightedShared) const
Definition: TrkObserverTool.cxx:302
xAOD::isPatternTrack
@ isPatternTrack
Definition: TrackingPrimitives.h:524
xAOD::averageSplit2
@ averageSplit2
Definition: TrackingPrimitives.h:540
xAOD::hasSharedIBLHit
@ hasSharedIBLHit
Definition: TrackingPrimitives.h:528
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
Trk::TrkObserverTool::finalize
virtual StatusCode finalize()
Definition: TrkObserverTool.cxx:85
Trk::TrkObserverTool::addInputTrack
void addInputTrack(int uid, const Trk::Track &track) const
Definition: TrkObserverTool.cxx:168
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
Trk::TrkObserverTool::rejectTrack
void rejectTrack(int uid, xAOD::RejectionStep rejectStep, xAOD::RejectionReason rejectReason) const
Definition: TrkObserverTool.cxx:145
xAOD::numSplitSharedPixel
@ numSplitSharedPixel
Definition: TrackingPrimitives.h:519
ITrackParticleCreatorTool.h
xAOD::numPseudo
@ numPseudo
Definition: TrackingPrimitives.h:538
Trk::TrkObserverTool::CacheEntry::m_evt
EventContext::ContextEvt_t m_evt
Definition: TrkObserverTool.h:67
xAOD::firstPixIsShared
@ firstPixIsShared
Definition: TrackingPrimitives.h:530
Trk::TrkObserverTool::m_rejectReason_descriptions
static const std::map< xAOD::RejectionReason, std::string > m_rejectReason_descriptions
Definition: TrkObserverTool.h:79
xAOD::hasSharedPixel
@ hasSharedPixel
Definition: TrackingPrimitives.h:529
Trk::TrkObserverTool::updateTrackMap
void updateTrackMap(int uid, double score, xAOD::RejectionStep rejectStep, xAOD::RejectionReason rejectReason) const
Definition: TrkObserverTool.cxx:102
Trk::TrkObserverTool::dumpRejection
static std::string dumpRejection(xAOD::RejectionStep rejectStep, xAOD::RejectionReason rejectReason)
Definition: TrkObserverTool.cxx:391
ObservedTrackMap
std::map< int, std::tuple< Trk::Track *, double, xAOD::RejectionStep, xAOD::RejectionReason, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, float, float, int, std::vector< xAOD::RejectionStep >, std::vector< xAOD::RejectionReason > > > ObservedTrackMap
Definition: ObservedTrackMap.h:50
xAOD::numSCTDeadSensor
@ numSCTDeadSensor
Definition: TrackingPrimitives.h:532
Trk::ITrkObserverTool
Definition: ITrkObserverTool.h:30
SG::SlotSpecificObj
Maintain a set of objects, one per slot.
Definition: AthenaKernel/AthenaKernel/SlotSpecificObj.h:70
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
TrackParticleAuxContainer.h
xAOD::totalSiHits
@ totalSiHits
Definition: TrackingPrimitives.h:525
xAOD::numPixelHits
@ numPixelHits
Definition: TrackingPrimitives.h:533
Trk::TrkObserverTool::saveTracksToStore
int saveTracksToStore(const EventContext &ctx, const ObservedTrackMap *trk_map) const
Definition: TrkObserverTool.cxx:242
Trk::TrkObserverTool::initialize
virtual StatusCode initialize()
Definition: TrkObserverTool.cxx:74
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
TrackCollection.h
Trk::TrkObserverTool::getTrackMap
ObservedTrackMap * getTrackMap(const EventContext &ctx) const
Definition: TrkObserverTool.cxx:230
xAOD::numSharedOrSplitPixels
@ numSharedOrSplitPixels
Definition: TrackingPrimitives.h:522
xAOD::numSCTHits
@ numSCTHits
Definition: TrackingPrimitives.h:534
test_pyathena.parent
parent
Definition: test_pyathena.py:15
xAOD::rejectStep
@ rejectStep
Definition: TrackingPrimitives.h:514
Trk::TrkObserverTool::CacheEntry
Definition: TrkObserverTool.h:66
xAOD::RejectionReason
RejectionReason
Definition: TrackingPrimitives.h:471
xAOD::numSCT_Unused
@ numSCT_Unused
Definition: TrackingPrimitives.h:537
Trk::TrkObserverTool::newEvent
void newEvent(CacheEntry *ent) const
Definition: TrkObserverTool.cxx:93
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
xAOD::inROI
@ inROI
Definition: TrackingPrimitives.h:526
Trk::TrkObserverTool::getNFinalTracks
static int getNFinalTracks(const ObservedTrackMap *trk_map)
Definition: TrkObserverTool.cxx:418
Trk::TrkObserverTool::addSubTrack
void addSubTrack(int track_uid, int parent_uid, const Trk::Track &track) const
Definition: TrkObserverTool.cxx:194
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Trk::TrkObserverTool
Definition: TrkObserverTool.h:40
xAOD::averageSplit1
@ averageSplit1
Definition: TrackingPrimitives.h:539
Trk::TrkObserverTool::ATLAS_THREAD_SAFE
SG::SlotSpecificObj< CacheEntry > m_cache ATLAS_THREAD_SAFE
Definition: TrkObserverTool.h:71
xAOD::score
@ score
Definition: TrackingPrimitives.h:513
Trk::TrkObserverTool::CacheEntry::m_observedTrkMap
ObservedTrackMap * m_observedTrkMap
Definition: TrkObserverTool.h:69
TrackParticle.h
Trk::TrkObserverTool::~TrkObserverTool
virtual ~TrkObserverTool()
Trk::TrkObserverTool::m_mutex
std::mutex m_mutex
Definition: TrkObserverTool.h:65
Trk::TrkObserverTool::getNObservedTracks
static int getNObservedTracks(const ObservedTrackMap *trk_map)
Definition: TrkObserverTool.cxx:427
xAOD::rejectReason
@ rejectReason
Definition: TrackingPrimitives.h:515
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Trk::TrkObserverTool::dumpTrackMap
void dumpTrackMap(const ObservedTrackMap *trk_map) const
Definition: TrkObserverTool.cxx:349
SlotSpecificObj.h
Maintain a set of objects, one per slot.
xAOD::numPixelHoles
@ numPixelHoles
Definition: TrackingPrimitives.h:517
xAOD::numTRT_Unused
@ numTRT_Unused
Definition: TrackingPrimitives.h:536
xAOD::numSCTHoles
@ numSCTHoles
Definition: TrackingPrimitives.h:518
xAOD::numSplitSharedSCT
@ numSplitSharedSCT
Definition: TrackingPrimitives.h:520
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
AthAlgTool
Definition: AthAlgTool.h:26
xAOD::numShared
@ numShared
Definition: TrackingPrimitives.h:523
Trk::TrkObserverTool::TrkObserverTool
TrkObserverTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TrkObserverTool.cxx:61
Trk::TrkObserverTool::m_savedTracksWriteKey
SG::WriteHandleKey< TrackCollection > m_savedTracksWriteKey
Definition: TrkObserverTool.h:62
xAOD::RejectionStep
RejectionStep
Definition: TrackingPrimitives.h:457
TrackParticleContainer.h
xAOD::numPixelDeadSensor
@ numPixelDeadSensor
Definition: TrackingPrimitives.h:531
Trk::TrkObserverTool::m_rejectStep_descriptions
static const std::map< xAOD::RejectionStep, std::string > m_rejectStep_descriptions
Definition: TrkObserverTool.h:78
Trk::TrkObserverTool::updateScore
void updateScore(int uid, double score) const
Definition: TrkObserverTool.cxx:126