ATLAS Offline Software
ITkTrackClusterAssValidation.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 #ifndef ITkTrackClusterAssValidation_H
7 #define ITkTrackClusterAssValidation_H
8 
20 #include <string>
21 #include <map>
22 
23 namespace ITk {
24 
25  // Class-algorithm for track cluster association validation
26  //
28  {
29 
31  // Public methods:
33 
34  public:
35 
37  // Standard Algotithm methods
39 
40  TrackClusterAssValidation(const std::string &name, ISvcLocator *pSvcLocator);
43  StatusCode execute(const EventContext& ctx) const;
45 
46  protected:
47 
49  // Protected data
51 
52  BooleanProperty m_usePix{this, "usePixel", true};
53  BooleanProperty m_useStrip{this, "useStrip", true};
54  BooleanProperty m_useOutliers{this, "useOutliers", false};
55  IntegerProperty m_pdg{this, "pdgParticle", 0};
56 
58  mutable std::vector<InDet::TrackCollectionStat_t> m_trackCollectionStat ATLAS_THREAD_SAFE; // Guarded by m_statMutex
59  mutable InDet::EventStat_t m_eventStat ATLAS_THREAD_SAFE; // Guarded by m_statMutex
60 
61  UnsignedIntegerProperty m_spcut{this, "MinNumberSpacePoints", 3};
62  FloatProperty m_ptcutmax{this, "MomentumMaxCut", 1.e20};
63  FloatProperty m_rapcut{this, "RapidityCut", 4.0};
64  FloatProperty m_ptcut{this, "MomentumCut", {}};
65  FloatProperty m_rmin{this, "RadiusMin", 0.};
66  FloatProperty m_rmax{this, "RadiusMax", 20.};
67 
68  FloatArrayProperty m_etabins{this, "EtaBins", {}};
69  FloatArrayProperty m_ptcuts{this, "PtCuts", {}};
70  UnsignedIntegerArrayProperty m_clcuts{this, "MinNumberClustersCuts", {}};
71 
72  float m_tcut = 0;
73 
75  {this, "TracksLocation", {"CombinedITkTracks"}};
77  {this, "SpacePointsStripName", "ITkStripSpacePoints"};
79  {this, "SpacePointsPixelName", "ITkPixelSpacePoints"};
81  {this, "SpacePointsOverlapName", "ITkOverlapSpacePoints"};
83  {this, "StripClusterContainer", "ITkStripClusters"};
85  {this, "PixelClusterContainer", "ITkPixelClusters"};
87  {this, "TruthLocationPixel", "PRD_MultiTruthITkPixel"};
89  {this, "TruthLocationStrip", "PRD_MultiTruthITkStrip"};
90 
91  // For P->T converter of PixelClusters
92  SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_pixelDetEleCollKey{this, "PixelDetEleCollKey", "ITkPixelDetectorElementCollection", "Key of SiDetectorElementCollection for Pixel"};
93  // For P->T converter of StripClusters
94  SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_StripDetEleCollKey{this, "StripDetEleCollKey", "ITkStripDetectorElementCollection", "Key of SiDetectorElementCollection for Strip"};
95 
96  struct EventData_t {
97  public:
98 
99  EventData_t(unsigned int n_collections)
100  : m_nspacepoints(0),
101  m_nclusters(0),
102  m_nqtracks(0),
103  m_truthPix{},
104  m_truthStrip{}
105  {
106  m_particles.resize(n_collections);
107  m_difference.resize(n_collections);
108  m_tracks.resize(n_collections);
109  m_trackCollectionStat.resize(n_collections);
110  }
111 
113  int m_nclusters{} ;
114  int m_nqtracks{} ;
115 
116  std::vector<std::unique_ptr<SG::VarHandleBase> > m_clusterHandles;
117  std::vector<SG::ReadHandle<TrackCollection> > m_trackcontainer;
118  std::vector<SG::ReadHandle<SpacePointContainer> > m_spacePointContainer;
119  std::unique_ptr<SG::ReadHandle<SpacePointOverlapCollection> > m_spacepointsOverlap;
122  std::multimap<int,const Trk::PrepRawData*> m_kinecluster ;
123  std::multimap<int,const Trk::SpacePoint*> m_kinespacepoint ;
124  std::vector<std::list<InDet::PartPropCache> > m_particles ;
125  std::vector<std::list<int> > m_difference ;
126  std::vector<std::multimap<int,int> > m_tracks ;
127  std::vector<InDet::TrackCollectionStat_t> m_trackCollectionStat;
129  };
130 
132  // Protected methods
134 
136  (const EventContext& ctx,
138  void newClustersEvent
139  (const EventContext& ctx,
141  void tracksComparison
142  (const EventContext& ctx,
147  (const ITk::TrackClusterAssValidation::EventData_t &event_data) const;
148 
151  int kine
153  const Trk::PrepRawData*, const Trk::PrepRawData*,
154  int*, int) const;
155  int kine
157  const Trk::PrepRawData*,
158  int*, int) const;
159  static int kine0
161  const Trk::PrepRawData*,
162  int*, int);
163  static bool isTruth
165  const Trk::PrepRawData*);
166  static bool isTheSameDetElement
168  int, const Trk::PrepRawData*);
169  static bool isTheSameDetElement
171  int, const Trk::SpacePoint*);
172 
173  static PRD_MultiTruthCollection::const_iterator findTruth
175  const Trk::PrepRawData*, PRD_MultiTruthCollection::const_iterator&) ;
176 
177  int charge
179  std::pair<int,const Trk::PrepRawData*>, int&, double&) const;
180  int charge
182  std::pair<int,const Trk::PrepRawData*> pa, int& rap) const
183  { double eta; return charge(event_data, pa, rap, eta); };
184 
185  float minpT(float eta) const;
186  unsigned int minclusters(float eta) const;
187 
188  MsgStream& dumptools(MsgStream& out, MSG::Level level) const;
189  static MsgStream& dumpevent
190  (MsgStream& out,
192 
193  };
194 
195  inline float ITk::TrackClusterAssValidation::minpT(float eta) const {
196  float aeta = std::abs(eta);
197  for(int n = int(m_ptcuts.size()-1); n>0; --n) {
198  if(aeta > m_etabins.value().at(n)) return m_ptcuts.value().at(n);
199  }
200  return m_ptcuts.value().at(0);
201  }
202 
203  inline unsigned int ITk::TrackClusterAssValidation::minclusters(float eta) const {
204  float aeta = std::abs(eta);
205  for(int n = int(m_clcuts.size()-1); n>0; --n) {
206  if(aeta > m_etabins.value().at(n)) return m_clcuts.value().at(n);
207  }
208  return m_clcuts.value().at(0);
209  }
210 
211 
212 }
213 #endif // TrackClusterAssValidation_H
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
ITk::TrackClusterAssValidation::m_ptcutmax
FloatProperty m_ptcutmax
Definition: ITkTrackClusterAssValidation.h:62
ITk::TrackClusterAssValidation::finalize
StatusCode finalize()
Definition: ITkTrackClusterAssValidation.cxx:147
Trk::SpacePoint
Definition: Tracking/TrkEvent/TrkSpacePoint/TrkSpacePoint/SpacePoint.h:35
ITk::TrackClusterAssValidation::EventData_t::m_eventStat
InDet::EventStat_t m_eventStat
Definition: ITkTrackClusterAssValidation.h:128
ITk::TrackClusterAssValidation::EventData_t::m_nqtracks
int m_nqtracks
Definition: ITkTrackClusterAssValidation.h:114
ITk::TrackClusterAssValidation::m_ptcut
FloatProperty m_ptcut
Definition: ITkTrackClusterAssValidation.h:64
ITk::TrackClusterAssValidation::EventData_t::EventData_t
EventData_t(unsigned int n_collections)
Definition: ITkTrackClusterAssValidation.h:99
ITk::TrackClusterAssValidation::charge
int charge(const ITk::TrackClusterAssValidation::EventData_t &event_data, std::pair< int, const Trk::PrepRawData * > pa, int &rap) const
Definition: ITkTrackClusterAssValidation.h:181
ITk::TrackClusterAssValidation::m_rmin
FloatProperty m_rmin
Definition: ITkTrackClusterAssValidation.h:65
ITk::TrackClusterAssValidation::EventData_t::m_truthPix
const PRD_MultiTruthCollection * m_truthPix
Definition: ITkTrackClusterAssValidation.h:120
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
ITk::TrackClusterAssValidation::m_spacepointsPixelname
SG::ReadHandleKey< SpacePointContainer > m_spacepointsPixelname
Definition: ITkTrackClusterAssValidation.h:79
PRD_MultiTruthCollection
A PRD is mapped onto all contributing particles.
Definition: PRD_MultiTruthCollection.h:24
ITk::TrackClusterAssValidation::EventData_t::m_truthStrip
const PRD_MultiTruthCollection * m_truthStrip
Definition: ITkTrackClusterAssValidation.h:121
ITk::TrackClusterAssValidation::ATLAS_THREAD_SAFE
std::vector< InDet::TrackCollectionStat_t > m_trackCollectionStat ATLAS_THREAD_SAFE
Definition: ITkTrackClusterAssValidation.h:58
ITk::TrackClusterAssValidation::EventData_t::m_kinespacepoint
std::multimap< int, const Trk::SpacePoint * > m_kinespacepoint
Definition: ITkTrackClusterAssValidation.h:123
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
ITk::TrackClusterAssValidation::EventData_t::m_spacePointContainer
std::vector< SG::ReadHandle< SpacePointContainer > > m_spacePointContainer
Definition: ITkTrackClusterAssValidation.h:118
ITk::TrackClusterAssValidation::EventData_t::m_clusterHandles
std::vector< std::unique_ptr< SG::VarHandleBase > > m_clusterHandles
Definition: ITkTrackClusterAssValidation.h:116
SG::HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:38
SG::ReadHandleKey< SpacePointContainer >
ITk::TrackClusterAssValidation
Definition: ITkTrackClusterAssValidation.h:28
ITk::TrackClusterAssValidation::m_spcut
UnsignedIntegerProperty m_spcut
Definition: ITkTrackClusterAssValidation.h:61
ITk::TrackClusterAssValidation::m_ptcuts
FloatArrayProperty m_ptcuts
Definition: ITkTrackClusterAssValidation.h:69
ITk::TrackClusterAssValidation::newClustersEvent
void newClustersEvent(const EventContext &ctx, ITk::TrackClusterAssValidation::EventData_t &event_data) const
Definition: ITkTrackClusterAssValidation.cxx:674
SpacePointContainer.h
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
ITk::TrackClusterAssValidation::m_statMutex
std::mutex m_statMutex
Definition: ITkTrackClusterAssValidation.h:57
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
ITk::TrackClusterAssValidation::isTheSameDetElement
static bool isTheSameDetElement(const ITk::TrackClusterAssValidation::EventData_t &event_data, int, const Trk::PrepRawData *)
Definition: ITkTrackClusterAssValidation.cxx:1226
ITk::TrackClusterAssValidation::m_tracklocation
SG::ReadHandleKeyArray< TrackCollection > m_tracklocation
Definition: ITkTrackClusterAssValidation.h:75
ITk::TrackClusterAssValidation::qualityTracksSelection
int qualityTracksSelection(ITk::TrackClusterAssValidation::EventData_t &event_data) const
Definition: ITkTrackClusterAssValidation.cxx:851
ITk::TrackClusterAssValidation::TrackClusterAssValidation
TrackClusterAssValidation(const std::string &name, ISvcLocator *pSvcLocator)
Definition: ITkTrackClusterAssValidation.cxx:24
ITk::TrackClusterAssValidation::ATLAS_THREAD_SAFE
InDet::EventStat_t m_eventStat ATLAS_THREAD_SAFE
Definition: ITkTrackClusterAssValidation.h:59
ITk::TrackClusterAssValidation::m_StripDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_StripDetEleCollKey
Definition: ITkTrackClusterAssValidation.h:94
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ITk::TrackClusterAssValidation::initialize
StatusCode initialize()
Definition: ITkTrackClusterAssValidation.cxx:36
ITk::TrackClusterAssValidation::EventData_t::m_nspacepoints
int m_nspacepoints
Definition: ITkTrackClusterAssValidation.h:112
ITk::TrackClusterAssValidation::noReconstructedParticles
bool noReconstructedParticles(const ITk::TrackClusterAssValidation::EventData_t &event_data) const
Definition: ITkTrackClusterAssValidation.cxx:1283
ITk::TrackClusterAssValidation::m_clustersStripname
SG::ReadHandleKey< InDet::SiClusterContainer > m_clustersStripname
Definition: ITkTrackClusterAssValidation.h:83
ITk::TrackClusterAssValidation::efficiencyReconstruction
void efficiencyReconstruction(ITk::TrackClusterAssValidation::EventData_t &event_data) const
Definition: ITkTrackClusterAssValidation.cxx:1070
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ITk::TrackClusterAssValidation::findTruth
static PRD_MultiTruthCollection::const_iterator findTruth(const ITk::TrackClusterAssValidation::EventData_t &event_data, const Trk::PrepRawData *, PRD_MultiTruthCollection::const_iterator &)
Definition: ITkTrackClusterAssValidation.cxx:1364
ITk::TrackClusterAssValidation::EventData_t::m_nclusters
int m_nclusters
Definition: ITkTrackClusterAssValidation.h:113
ITk::TrackClusterAssValidation::EventData_t
Definition: ITkTrackClusterAssValidation.h:96
ITk::TrackClusterAssValidation::EventData_t::m_trackcontainer
std::vector< SG::ReadHandle< TrackCollection > > m_trackcontainer
Definition: ITkTrackClusterAssValidation.h:117
TrackClusterAssValidationUtils.h
ITk::TrackClusterAssValidation::minclusters
unsigned int minclusters(float eta) const
Definition: ITkTrackClusterAssValidation.h:203
ITk::TrackClusterAssValidation::newSpacePointsEvent
void newSpacePointsEvent(const EventContext &ctx, ITk::TrackClusterAssValidation::EventData_t &event_data) const
Definition: ITkTrackClusterAssValidation.cxx:760
ITk::TrackClusterAssValidation::dumptools
MsgStream & dumptools(MsgStream &out, MSG::Level level) const
Definition: ITkTrackClusterAssValidation.cxx:592
TrackCollection.h
SpacePointOverlapCollection.h
ITk::TrackClusterAssValidation::m_pixelDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
Definition: ITkTrackClusterAssValidation.h:92
ITk::TrackClusterAssValidation::m_tcut
float m_tcut
Definition: ITkTrackClusterAssValidation.h:72
ReadCondHandleKey.h
ITk::TrackClusterAssValidation::m_truth_locationPixel
SG::ReadHandleKey< PRD_MultiTruthCollection > m_truth_locationPixel
Definition: ITkTrackClusterAssValidation.h:87
AthReentrantAlgorithm.h
Trk::PrepRawData
Definition: PrepRawData.h:62
ITk::TrackClusterAssValidation::EventData_t::m_spacepointsOverlap
std::unique_ptr< SG::ReadHandle< SpacePointOverlapCollection > > m_spacepointsOverlap
Definition: ITkTrackClusterAssValidation.h:119
ITk::TrackClusterAssValidation::kine
int kine(const ITk::TrackClusterAssValidation::EventData_t &event_data, const Trk::PrepRawData *, const Trk::PrepRawData *, int *, int) const
Definition: ITkTrackClusterAssValidation.cxx:1118
ITk
Definition: ITkPixelOfflineCalibCondAlg.cxx:14
ITk::TrackClusterAssValidation::m_usePix
BooleanProperty m_usePix
Definition: ITkTrackClusterAssValidation.h:52
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ITk::TrackClusterAssValidation::m_rmax
FloatProperty m_rmax
Definition: ITkTrackClusterAssValidation.h:66
ITk::TrackClusterAssValidation::EventData_t::m_particles
std::vector< std::list< InDet::PartPropCache > > m_particles
Definition: ITkTrackClusterAssValidation.h:124
ITk::TrackClusterAssValidation::kine0
static int kine0(const ITk::TrackClusterAssValidation::EventData_t &event_data, const Trk::PrepRawData *, int *, int)
Definition: ITkTrackClusterAssValidation.cxx:1190
ITk::TrackClusterAssValidation::~TrackClusterAssValidation
virtual ~TrackClusterAssValidation()
SiDetectorElementCollection.h
ITk::TrackClusterAssValidation::m_truth_locationStrip
SG::ReadHandleKey< PRD_MultiTruthCollection > m_truth_locationStrip
Definition: ITkTrackClusterAssValidation.h:89
ITk::TrackClusterAssValidation::isTruth
static bool isTruth(const ITk::TrackClusterAssValidation::EventData_t &, const Trk::PrepRawData *)
Definition: ITkTrackClusterAssValidation.cxx:1214
ITk::TrackClusterAssValidation::EventData_t::m_trackCollectionStat
std::vector< InDet::TrackCollectionStat_t > m_trackCollectionStat
Definition: ITkTrackClusterAssValidation.h:127
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection >
ITk::TrackClusterAssValidation::m_etabins
FloatArrayProperty m_etabins
Definition: ITkTrackClusterAssValidation.h:68
ITk::TrackClusterAssValidation::m_pdg
IntegerProperty m_pdg
Definition: ITkTrackClusterAssValidation.h:55
SiClusterContainer.h
ITk::TrackClusterAssValidation::dumpevent
static MsgStream & dumpevent(MsgStream &out, const ITk::TrackClusterAssValidation::EventData_t &event_data)
Definition: ITkTrackClusterAssValidation.cxx:647
ITk::TrackClusterAssValidation::m_useStrip
BooleanProperty m_useStrip
Definition: ITkTrackClusterAssValidation.h:53
ITk::TrackClusterAssValidation::execute
StatusCode execute(const EventContext &ctx) const
Definition: ITkTrackClusterAssValidation.cxx:90
ITk::TrackClusterAssValidation::m_clcuts
UnsignedIntegerArrayProperty m_clcuts
Definition: ITkTrackClusterAssValidation.h:70
ITk::TrackClusterAssValidation::m_spacepointsOverlapname
SG::ReadHandleKey< SpacePointOverlapCollection > m_spacepointsOverlapname
Definition: ITkTrackClusterAssValidation.h:81
InDet::EventStat_t
Definition: TrackClusterAssValidationUtils.h:96
ITk::TrackClusterAssValidation::m_clustersPixelname
SG::ReadHandleKey< InDet::SiClusterContainer > m_clustersPixelname
Definition: ITkTrackClusterAssValidation.h:85
ITk::TrackClusterAssValidation::m_rapcut
FloatProperty m_rapcut
Definition: ITkTrackClusterAssValidation.h:63
PRD_MultiTruthCollection.h
ITk::TrackClusterAssValidation::m_spacepointsStripname
SG::ReadHandleKey< SpacePointContainer > m_spacepointsStripname
Definition: ITkTrackClusterAssValidation.h:77
ITk::TrackClusterAssValidation::EventData_t::m_kinecluster
std::multimap< int, const Trk::PrepRawData * > m_kinecluster
Definition: ITkTrackClusterAssValidation.h:122
ITk::TrackClusterAssValidation::tracksComparison
void tracksComparison(const EventContext &ctx, ITk::TrackClusterAssValidation::EventData_t &event_data) const
Definition: ITkTrackClusterAssValidation.cxx:957
ITk::TrackClusterAssValidation::charge
int charge(const ITk::TrackClusterAssValidation::EventData_t &event_data, std::pair< int, const Trk::PrepRawData * >, int &, double &) const
Definition: ITkTrackClusterAssValidation.cxx:1392
checker_macros.h
Define macros for attributes used to control the static checker.
ITk::TrackClusterAssValidation::m_useOutliers
BooleanProperty m_useOutliers
Definition: ITkTrackClusterAssValidation.h:54
ITk::TrackClusterAssValidation::EventData_t::m_difference
std::vector< std::list< int > > m_difference
Definition: ITkTrackClusterAssValidation.h:125
ITk::TrackClusterAssValidation::EventData_t::m_tracks
std::vector< std::multimap< int, int > > m_tracks
Definition: ITkTrackClusterAssValidation.h:126
ITk::TrackClusterAssValidation::minpT
float minpT(float eta) const
Definition: ITkTrackClusterAssValidation.h:195