ATLAS Offline Software
Loading...
Searching...
No Matches
InDet::InDetRecStatisticsAlg Class Reference

#include <InDetRecStatisticsAlg.h>

Inheritance diagram for InDet::InDetRecStatisticsAlg:

Classes

struct  Counter

Public Member Functions

 InDetRecStatisticsAlg (const std::string &name, ISvcLocator *pSvcLocator)
 Default Constructor.
StatusCode initialize ()
 Initialization of services, track collections, creates TrackStatHelper for each Track Collection.
StatusCode execute (const EventContext &ctx) const
 Calculation of statistics.
StatusCode finalize ()
 Statistics table printed, collection cleared.
StatusCode getServices ()
 Get various services such as StoreGate, dictionaries, detector managers etc.
StatusCode resetStatistics ()
 Clear statistics counters, called before each track collection is processed.
void printStatistics ()
 Print tracking statistics calculated with TrackStatHelper.
void printTrackSummary (MsgStream &out, enum eta_region)
 Print track statistics for all and low proability tracks.
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual unsigned int cardinality () const override
 Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
virtual void setFilterPassed (bool state, const EventContext &ctx) const
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

enum  ECounter {
  kN_rec_tracks_without_perigee , kN_unknown_hits , kN_rec_tracks_processed , kN_gen_tracks_processed ,
  kN_spacepoints_processed , kNCounter
}
using CounterLocal = Counter<int>
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

void selectGenSignal (const McEventCollection *, std::vector< std::pair< HepMC::ConstGenParticlePtr, int > > &, unsigned int, unsigned int, CounterLocal &counter) const
 Select charged,stable particles which pass pt and eta cuts for analysis.
void selectRecSignal (const TrackCollection *, std::vector< const Trk::Track * > &, std::vector< const Trk::Track * > &, CounterLocal &counter) const
 Select for analysis reconstructed tracks passing Pt and eta cuts.
const Trk::TrackParametersgetUnbiasedTrackParameters (const Trk::TrackParameters *, const Trk::MeasurementBase *)
 Get Unbiased Track Parameters.
Identifier getIdentifier (const Trk::MeasurementBase *measurement)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Static Private Member Functions

static float calculatePull (const float, const float, const float)
 Calculate pull from residual, track and hit error.

Private Attributes

std::vector< class TrackStatHelper * > m_SignalCounters
 Vector of TrackStatHelper objects, one for each track collection.
const AtlasDetectorIDm_idHelper
 Used to find out the sub-det from PRD->identify().
const PixelIDm_pixelID
 get pixel layer from hit ID
const SCT_IDm_sctID
 get sct layer from hit ID
const TRT_IDm_trtID
 get trt layer from hit ID
const IdDictManagerm_idDictMgr
ToolHandle< Trk::ITruthToTrackm_truthToTrack
 tool to create track parameters from a gen particle
ToolHandle< Trk::IExtendedTrackSummaryToolm_trkSummaryTool
 tool to get track summary information from track
ToolHandle< Trk::IUpdatorm_updatorHandle
 Tool handle of updator for unbiased states.
Trk::IUpdatorm_updator
 updator for unbiased states
ToolHandle< Trk::IResidualPullCalculatorm_residualPullCalculator
 The residual and pull calculator tool handle.
SG::ReadHandleKey< McEventCollectionm_McTrackCollection_key
ToolHandle< Trk::ITrackSelectorToolm_trackSelectorTool
bool m_UseTrackSummary
 Flag to print detailed statistics for each track collection.
bool m_printSecondary
 Flag to print hit information for secondary tracks.
float m_minPt
 Minimum Pt cut for tracks used by the algorithm.
float m_maxEta
 Maximum Eta cut for tracks used by the algorithm.
float m_maxEtaBarrel
 define max eta of barrel region
float m_maxEtaTransition
 define max eta of transition region
float m_maxEtaEndcap
 define max eta of eta region
float m_fakeTrackCut
 Maximum probability for which a track will be considered a fake.
float m_fakeTrackCut2
 Second definition of maximum probability for which a track will be considered a fake.
float m_matchTrackCut
 Minimum number of hits from a truth track to be considered a matched reco track.
float m_maxRStartPrimary
 Maximum R of start vertex to be considered primary.
float m_maxRStartSecondary
 Maximum R of start vertex to be considered secondary.
float m_maxZStartPrimary
 Maximum Z of start vertex to be considered primary.
float m_maxZStartSecondary
 Maximum Z of start vertex to be considered secondary.
float m_minREndPrimary
 If track has end vertex, this is min R of end vertex to be considered primary.
float m_minREndSecondary
 If track has end vertex, this is min R of end vertex to be considered secondary.
float m_minZEndPrimary
 If track has end vertex, this is min Z of end vertex to be considered primary.
float m_minZEndSecondary
 If track has end vertex, this is min Z of end vertex to be considered secondary.
bool m_useTrackSelection
 Use track selector tool.
bool m_doTruth
 Use truth information.
float m_minEtaFORWARD
float m_maxEtaFORWARD
SG::ReadHandleKeyArray< TrackCollectionm_RecTrackCollection_keys
SG::ReadHandleKeyArray< TrackTruthCollectionm_TrackTruthCollection_keys
std::atomic< bool > m_pullWarning {}
 warn only once, if pull cannot be calculated
std::atomic< bool > m_UpdatorWarning {}
 warn only once, if unbiased track states can not be calculated
std::atomic< int > m_isUnbiased
 if can get unbiased residuals
std::atomic< long > m_events_processed
 number of events processed
Counter< std::atomic< long > > m_counter ATLAS_THREAD_SAFE
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 46 of file InDetRecStatisticsAlg.h.

Member Typedef Documentation

◆ CounterLocal

Definition at line 79 of file InDetRecStatisticsAlg.h.

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ ECounter

Enumerator
kN_rec_tracks_without_perigee 

number of tracks w/o perigee

kN_unknown_hits 

number of hits without track

kN_rec_tracks_processed 

number of reconstructed tracks processed

kN_gen_tracks_processed 

number of generated tracks processed

kN_spacepoints_processed 

number of space points processed

kNCounter 

Definition at line 147 of file InDetRecStatisticsAlg.h.

147 {
154 };
@ kN_gen_tracks_processed
number of generated tracks processed
@ kN_rec_tracks_processed
number of reconstructed tracks processed
@ kN_rec_tracks_without_perigee
number of tracks w/o perigee
@ kN_spacepoints_processed
number of space points processed
@ kN_unknown_hits
number of hits without track

Constructor & Destructor Documentation

◆ InDetRecStatisticsAlg()

InDet::InDetRecStatisticsAlg::InDetRecStatisticsAlg ( const std::string & name,
ISvcLocator * pSvcLocator )

Default Constructor.

Definition at line 74 of file InDetRecStatisticsAlg.cxx.

74 :
75 AthReentrantAlgorithm(name, pSvcLocator),
76 m_trtID (nullptr),
77 m_idDictMgr (nullptr),
78 m_truthToTrack ("Trk::TruthToTrack"),
79 m_trkSummaryTool ("Trk::TrackSummaryTool/InDetTrackSummaryTool"),
80 m_updatorHandle ("Trk::KalmanUpdator/TrkKalmanUpdator"),
81 m_updator (nullptr),
82 m_residualPullCalculator ("Trk::ResidualPullCalculator/ResidualPullCalculator"),
83 m_McTrackCollection_key ("TruthEvent"),
84 m_trackSelectorTool ("InDet::InDetDetailedTrackSelectorTool"),
85 m_UseTrackSummary (true),
86 m_printSecondary (false),
87 m_minPt (1000),
88 m_maxEta (4.2),
89 m_maxEtaBarrel (0.8),
91 m_maxEtaEndcap (2.5),
92 m_fakeTrackCut (0.9),
93 m_fakeTrackCut2 (0.7),
94 m_matchTrackCut (0.5),
95 m_maxRStartPrimary ( 25.0*CLHEP::mm),
96 m_maxRStartSecondary ( 360.0*CLHEP::mm),
97 m_maxZStartPrimary ( 200.0*CLHEP::mm),
98 m_maxZStartSecondary (2000.0*CLHEP::mm),
99 m_minREndPrimary ( 400.0*CLHEP::mm),
100 m_minREndSecondary (1000.0*CLHEP::mm),
101 m_minZEndPrimary (2300.0*CLHEP::mm),
102 //m_maxZIndet (),
103 m_minZEndSecondary (3200.0*CLHEP::mm),
104 m_useTrackSelection (false),
105 m_doTruth (true),
106 m_minEtaFORWARD (2.5),
107 m_maxEtaFORWARD (4.2),
108 m_isUnbiased (0),
110{
111 // m_RecTrackCollection_keys.push_back(std::string("Tracks"));
112 // m_TrackTruthCollection_keys.push_back(std::string("TrackTruthCollection"));
113
114 // Algorithm properties
115 declareProperty("SummaryTool", m_trkSummaryTool);
116 declareProperty("TruthToTrackTool", m_truthToTrack);
117 declareProperty("UpdatorTool", m_updatorHandle,
118 "Measurement updator to calculate unbiased track states");
119 declareProperty("ResidualPullCalculatorTool", m_residualPullCalculator,
120 "Tool to calculate residuals and pulls");
121 declareProperty("TrackCollectionKeys", m_RecTrackCollection_keys);
122 declareProperty("McTrackCollectionKey", m_McTrackCollection_key);
123 declareProperty("TrackTruthCollectionKeys", m_TrackTruthCollection_keys);
124 declareProperty("UseTrackSelection" , m_useTrackSelection);
125 declareProperty("DoTruth" , m_doTruth);
126 declareProperty("TrackSelectorTool" , m_trackSelectorTool);
127 declareProperty("UseTrackSummary", m_UseTrackSummary);
128 declareProperty("PrintSecondary", m_printSecondary);
129 declareProperty("minPt", m_minPt);
130 declareProperty("maxEta", m_maxEta);
131 declareProperty("maxEtaBarrel", m_maxEtaBarrel );
132 declareProperty("maxEtaTransition", m_maxEtaTransition);
133 declareProperty("maxEtaEndcap", m_maxEtaEndcap);
134 declareProperty("maxEtaFORWARD", m_maxEtaFORWARD);
135 declareProperty("minEtaFORWARD", m_minEtaFORWARD);
136 declareProperty("fakeTrackCut", m_fakeTrackCut);
137 declareProperty("fakeTrackCut2", m_fakeTrackCut2);
138 declareProperty("matchTrackCut", m_matchTrackCut);
139 declareProperty("maxRStartPrimary", m_maxRStartPrimary);
140 declareProperty("maxRStartSecondary", m_maxRStartSecondary);
141 declareProperty("maxZStartPrimary", m_maxZStartPrimary);
142 declareProperty("maxZStartSecondary", m_maxZStartSecondary);
143 declareProperty("minREndPrimary", m_minREndPrimary);
144 declareProperty("minREndSecondary", m_minREndSecondary);
145 declareProperty("minZEndPrimary", m_minZEndPrimary);
146 declareProperty("minZEndSecondary", m_minZEndSecondary);
147 m_idHelper = nullptr;
148 m_pixelID = nullptr;
149 m_sctID = nullptr;
150 m_UpdatorWarning = false;
151 m_pullWarning = false;
152}
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const TRT_ID * m_trtID
get trt layer from hit ID
float m_minZEndSecondary
If track has end vertex, this is min Z of end vertex to be considered secondary.
ToolHandle< Trk::ITruthToTrack > m_truthToTrack
tool to create track parameters from a gen particle
std::atomic< long > m_events_processed
number of events processed
Trk::IUpdator * m_updator
updator for unbiased states
std::atomic< int > m_isUnbiased
if can get unbiased residuals
float m_maxEta
Maximum Eta cut for tracks used by the algorithm.
SG::ReadHandleKey< McEventCollection > m_McTrackCollection_key
float m_minREndSecondary
If track has end vertex, this is min R of end vertex to be considered secondary.
float m_maxRStartSecondary
Maximum R of start vertex to be considered secondary.
const AtlasDetectorID * m_idHelper
Used to find out the sub-det from PRD->identify().
SG::ReadHandleKeyArray< TrackTruthCollection > m_TrackTruthCollection_keys
std::atomic< bool > m_pullWarning
warn only once, if pull cannot be calculated
float m_minZEndPrimary
If track has end vertex, this is min Z of end vertex to be considered primary.
float m_maxZStartPrimary
Maximum Z of start vertex to be considered primary.
bool m_printSecondary
Flag to print hit information for secondary tracks.
const PixelID * m_pixelID
get pixel layer from hit ID
float m_minREndPrimary
If track has end vertex, this is min R of end vertex to be considered primary.
float m_fakeTrackCut2
Second definition of maximum probability for which a track will be considered a fake.
float m_maxRStartPrimary
Maximum R of start vertex to be considered primary.
float m_maxEtaEndcap
define max eta of eta region
bool m_doTruth
Use truth information.
ToolHandle< Trk::IResidualPullCalculator > m_residualPullCalculator
The residual and pull calculator tool handle.
float m_maxEtaTransition
define max eta of transition region
std::atomic< bool > m_UpdatorWarning
warn only once, if unbiased track states can not be calculated
ToolHandle< Trk::IUpdator > m_updatorHandle
Tool handle of updator for unbiased states.
const SCT_ID * m_sctID
get sct layer from hit ID
ToolHandle< Trk::IExtendedTrackSummaryTool > m_trkSummaryTool
tool to get track summary information from track
SG::ReadHandleKeyArray< TrackCollection > m_RecTrackCollection_keys
ToolHandle< Trk::ITrackSelectorTool > m_trackSelectorTool
float m_minPt
Minimum Pt cut for tracks used by the algorithm.
bool m_UseTrackSummary
Flag to print detailed statistics for each track collection.
float m_fakeTrackCut
Maximum probability for which a track will be considered a fake.
float m_maxEtaBarrel
define max eta of barrel region
bool m_useTrackSelection
Use track selector tool.
float m_maxZStartSecondary
Maximum Z of start vertex to be considered secondary.
float m_matchTrackCut
Minimum number of hits from a truth track to be considered a matched reco track.

Member Function Documentation

◆ calculatePull()

float InDet::InDetRecStatisticsAlg::calculatePull ( const float residual,
const float trkErr,
const float hitErr )
staticprivate

Calculate pull from residual, track and hit error.

Definition at line 772 of file InDetRecStatisticsAlg.cxx.

774 {
775 double ErrorSum;
776 ErrorSum = sqrt(pow(trkErr, 2) + pow(hitErr, 2));
777 if (ErrorSum != 0) { return residual/ErrorSum; }
778 else { return 0; }
779}
constexpr int pow(int x)
Definition conifer.h:27

◆ cardinality()

unsigned int AthCommonReentrantAlgorithm< Gaudi::Algorithm >::cardinality ( ) const
overridevirtualinherited

Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.

Override this to return 0 for reentrant algorithms.

Definition at line 75 of file AthCommonReentrantAlgorithm.cxx.

62{
63 return 0;
64}

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode InDet::InDetRecStatisticsAlg::execute ( const EventContext & ctx) const

Calculation of statistics.

Definition at line 265 of file InDetRecStatisticsAlg.cxx.

265 {
266
267 ATH_MSG_DEBUG("entering execute()");
268
269 // Get reconstructed tracks , generated tracks, and truth from storegate
270
271 SG::ReadHandle<McEventCollection> SimTracks;
272
273 if (m_doTruth) {
274 SimTracks=SG::ReadHandle<McEventCollection>(m_McTrackCollection_key,ctx);
275 if (!SimTracks.isValid()) {
276 // @TODO warning ?
277 ATH_MSG_WARNING("Error retrieving collections !");
278 return StatusCode::SUCCESS;
279 }
280 }
281
282 // Doesn't take account of pileup:
283 //m_gen_tracks_processed += (*(SimTracks->begin()))->particles_size();
286
287 // select charged and stable generated tracks
288 // apply pt, eta etc cuts to generated tracks
289 // devide generated tracks into primary, truncated, secondary
290
291 std::vector <std::pair<HepMC::ConstGenParticlePtr,int> > GenSignal;
292 // GenSignalPrimary, GenSignalTruncated, GenSignalSecondary;
293 unsigned int inTimeStart = 0;
294 unsigned int inTimeEnd = 0;
295 if (m_doTruth) selectGenSignal ((SimTracks.isValid() ? &(*SimTracks) : nullptr), GenSignal, inTimeStart, inTimeEnd, counter);
296
297 // step through the various reconstructed TrackCollections and
298 // corresponding TrackTruthCollections and produce statistics for each
299
300 if (m_SignalCounters.empty()) {
301 ATH_MSG_ERROR("No reco track collection specified! Aborting.");
302 return StatusCode::FAILURE;
303 }
304
305 std::vector< SG::ReadHandle<TrackCollection> > rec_track_collections = m_RecTrackCollection_keys.makeHandles(ctx);
306 std::vector< SG::ReadHandle<TrackTruthCollection> > truth_track_collections;
307 if (m_doTruth && !m_TrackTruthCollection_keys.empty()) {
308 truth_track_collections = m_TrackTruthCollection_keys.makeHandles(ctx);
309 if (truth_track_collections.size() != rec_track_collections.size()) {
310 ATH_MSG_ERROR("Different number of reco and truth track collections (" << rec_track_collections.size() << "!=" << truth_track_collections.size() << ")" );
311 }
312 }
313 if (m_SignalCounters.size() != rec_track_collections.size()) {
314 ATH_MSG_ERROR("Number expected reco track collections does not match the actual number of such collections ("
315 << m_SignalCounters.size() << "!=" << rec_track_collections.size() << ")" );
316 }
317
318 std::vector< SG::ReadHandle<TrackCollection> >::iterator rec_track_collections_iter = rec_track_collections.begin();
319 std::vector< SG::ReadHandle<TrackTruthCollection> >::iterator truth_track_collections_iter = truth_track_collections.begin();
320 for (std::vector <class TrackStatHelper *>::const_iterator statHelper
321 = m_SignalCounters.begin();
322 statHelper != m_SignalCounters.end();
323 ++statHelper, ++rec_track_collections_iter) {
324 assert( rec_track_collections_iter != rec_track_collections.end());
325
326 ATH_MSG_DEBUG("Acessing TrackCollection " << m_RecTrackCollection_keys.at(rec_track_collections_iter - rec_track_collections.begin()).key());
327 const TrackCollection * RecCollection = &(**rec_track_collections_iter);
328 const TrackTruthCollection * TruthMap = nullptr;
329
330 if (RecCollection) ATH_MSG_DEBUG("Retrieved " << RecCollection->size() << " reconstructed tracks from storegate");
331
332 if (m_doTruth) {
333 ATH_MSG_DEBUG("Acessing TrackTruthCollection " << m_TrackTruthCollection_keys.at(truth_track_collections_iter - truth_track_collections.begin()).key());
334 assert( truth_track_collections_iter != truth_track_collections.end());
335 TruthMap = &(**truth_track_collections_iter);
336 if (TruthMap) ATH_MSG_DEBUG("Retrieved " << TruthMap->size() << " TrackTruth elements from storegate");
337 ++truth_track_collections_iter;
338 }
339
340 //start process of getting correct track summary
341
342 std::vector <const Trk::Track *> RecTracks, RecSignal;
343 selectRecSignal (RecCollection, RecTracks,RecSignal,counter);
344
346 " RecTracks.size()=" << RecTracks.size()
347 << ", GenSignal.size()=" << GenSignal.size());
348
349 ATH_MSG_DEBUG("Accumulating Statistics...");
350 (*statHelper)->addEvent (ctx,
351 RecCollection,
352 RecTracks,
353 GenSignal,
354 TruthMap,
356 m_pixelID,
357 m_sctID,
358 m_trkSummaryTool.operator->(),
360 &inTimeStart,
361 &inTimeEnd);
362
363 counter.m_counter[kN_rec_tracks_processed] += RecCollection->size();
364
365 for ( TrackCollection::const_iterator it = RecCollection->begin() ;
366 it < RecCollection->end(); ++ it){
367 std::vector<const Trk::RIO_OnTrack*> rioOnTracks;
368 Trk::RoT_Extractor::extract( rioOnTracks,
369 (*it)->measurementsOnTrack()->stdcont() );
370 counter.m_counter[kN_spacepoints_processed] += rioOnTracks.size();
371 }
372
373 }
374 m_counter += counter;
375
376 ATH_MSG_DEBUG("leaving execute()");
377 return StatusCode::SUCCESS;
378}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
void selectGenSignal(const McEventCollection *, std::vector< std::pair< HepMC::ConstGenParticlePtr, int > > &, unsigned int, unsigned int, CounterLocal &counter) const
Select charged,stable particles which pass pt and eta cuts for analysis.
std::vector< class TrackStatHelper * > m_SignalCounters
Vector of TrackStatHelper objects, one for each track collection.
void selectRecSignal(const TrackCollection *, std::vector< const Trk::Track * > &, std::vector< const Trk::Track * > &, CounterLocal &counter) const
Select for analysis reconstructed tracks passing Pt and eta cuts.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
static void extract(std::vector< const RIO_OnTrack * > &rots, const std::vector< const MeasurementBase * > &measurements)

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthCommonReentrantAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 94 of file AthCommonReentrantAlgorithm.cxx.

88{
89 // If we didn't find any symlinks to add, just return the collection
90 // from the base class. Otherwise, return the extended collection.
91 if (!m_extendedExtraObjects.empty()) {
93 }
95}
An algorithm that can be simultaneously executed in multiple threads.

◆ filterPassed()

virtual bool AthCommonReentrantAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Definition at line 96 of file AthCommonReentrantAlgorithm.h.

96 {
97 return execState( ctx ).filterPassed();
98 }
virtual bool filterPassed(const EventContext &ctx) const

◆ finalize()

StatusCode InDet::InDetRecStatisticsAlg::finalize ( )

Statistics table printed, collection cleared.

Definition at line 383 of file InDetRecStatisticsAlg.cxx.

383 {
384
385 // Part 1: Get the messaging service, print where you are
386 ATH_MSG_DEBUG("finalize()");
387
389
390 for (std::vector <class TrackStatHelper *>::const_iterator collection =
391 m_SignalCounters.begin(); collection != m_SignalCounters.end();
392 ++collection) {
394 delete (*collection);
395 }
396 m_SignalCounters.clear();
397 return StatusCode::SUCCESS;
398}
static const char *const s_linestr2
void printStatistics()
Print tracking statistics calculated with TrackStatHelper.

◆ getIdentifier()

Identifier InDet::InDetRecStatisticsAlg::getIdentifier ( const Trk::MeasurementBase * measurement)
private

Definition at line 822 of file InDetRecStatisticsAlg.cxx.

822 {
823 Identifier id;
824 const Trk::CompetingRIOsOnTrack *comprot = nullptr;
825 // identify by ROT:
826 const Trk::RIO_OnTrack *rot =
827 dynamic_cast<const Trk::RIO_OnTrack*>(measurement);
828 if (rot) {
829 id = rot->identify();
830 } else {
831 // identify by CompetingROT:
832 comprot = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(measurement);
833 if (comprot) {
834 rot = &comprot->rioOnTrack(comprot->indexOfMaxAssignProb());
835 id = rot->identify();
836 } else {
837 ATH_MSG_DEBUG("measurement is neither ROT nor competingROT:"
838 <<" can not determine detector type");
839 id.clear();
840 }
841 }
842 delete comprot;
843 return id;
844}
unsigned int indexOfMaxAssignProb() const
Index of the ROT with the highest assignment probability.
virtual const RIO_OnTrack & rioOnTrack(unsigned int) const =0
returns the RIO_OnTrack (also known as ROT) objects depending on the integer.
Identifier identify() const
return the identifier -extends MeasurementBase

◆ getServices()

StatusCode InDet::InDetRecStatisticsAlg::getServices ( )

Get various services such as StoreGate, dictionaries, detector managers etc.

Definition at line 401 of file InDetRecStatisticsAlg.cxx.

402{
403 //Set up ATLAS ID helper to be able to identify the RIO's det-subsystem.
404
405 // Get the dictionary manager from the detector store
406 const IdDictManager* idDictMgr = nullptr;
407 StatusCode sc = detStore()->retrieve(idDictMgr, "IdDict");
408 if (sc.isFailure()) {
409 ATH_MSG_FATAL("Could not get IdDictManager !");
410 return StatusCode::FAILURE;
411 }
412
413 // Initialize the helper with the dictionary information.
414 sc = detStore()->retrieve(m_idHelper, "AtlasID");
415 if (sc.isFailure()) {
416 ATH_MSG_FATAL("Could not get AtlasDetectorID helper.");
417 return StatusCode::FAILURE;
418 }
419
420 //get Pixel, SCT, TRT managers and helpers
421
422 if (detStore()->retrieve(m_pixelID, "PixelID").isFailure()) {
423 msg(MSG::FATAL) << "Could not get Pixel ID helper" << endmsg;
424 return StatusCode::FAILURE;
425 }
426 if (detStore()->retrieve(m_sctID, "SCT_ID").isFailure()) {
427 msg(MSG::FATAL) << "Could not get SCT ID helper" << endmsg;
428 return StatusCode::FAILURE;
429 }
430
431 //retrieve the TRT helper only if not-SLHC layout used
432 sc = detStore()->retrieve(m_idDictMgr, "IdDict");
433 if (sc.isFailure()) {
434 ATH_MSG_FATAL("Could not get IdDictManager !");
435 return StatusCode::FAILURE;
436 }
437 const IdDictDictionary* dict = m_idDictMgr->manager()->find_dictionary("InnerDetector");
438 if(!dict) {
439 ATH_MSG_FATAL(" Cannot access InnerDetector dictionary ");
440 return StatusCode::FAILURE;
441 }
442
443 bool isSLHC = false;
444 if (dict->file_name().find("SLHC")!=std::string::npos) isSLHC=true;
445
446 if(!isSLHC){
447 if (detStore()->retrieve(m_trtID, "TRT_ID").isFailure()) {
448 msg(MSG::FATAL) << "Could not get TRT ID helper" << endmsg;
449 return StatusCode::FAILURE;
450 }
451 }
452 //
453
454 if (m_UseTrackSummary) {
455 if (m_trkSummaryTool.retrieve().isFailure() ) {
456 ATH_MSG_FATAL("Failed to retrieve tool "
458 return StatusCode::FAILURE;
459 } else {
460 ATH_MSG_INFO("Retrieved tool " << m_trkSummaryTool);
461 }
462 } else {
463 m_trkSummaryTool.disable();
464 }
465
466 // AG: init truthToTrack
467 if (m_doTruth) {
468 if (m_truthToTrack.retrieve().isFailure() ) {
469 ATH_MSG_FATAL("Failed to retrieve tool " << m_truthToTrack);
470 return StatusCode::FAILURE;
471 } else {
472 ATH_MSG_INFO("Retrieved tool " << m_truthToTrack);
473 }
474 } else {
475 m_truthToTrack.disable();
476 }
477
478 //adding track selector tool
480 if ( m_trackSelectorTool.retrieve().isFailure() ) {
481 ATH_MSG_FATAL("Failed to retrieve tool " << m_trackSelectorTool);
482 return StatusCode::FAILURE;
483 } else {
484 ATH_MSG_INFO("Retrieved tool " << m_trackSelectorTool);
485 }
486 } else {
487 m_trackSelectorTool.disable();
488 }
489 return StatusCode :: SUCCESS;
490}
#define endmsg
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
static Double_t sc
const ServiceHandle< StoreGateSvc > & detStore() const
const std::string & file_name() const
Access to file name.
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ getUnbiasedTrackParameters()

const Trk::TrackParameters * InDet::InDetRecStatisticsAlg::getUnbiasedTrackParameters ( const Trk::TrackParameters * trkParameters,
const Trk::MeasurementBase * measurement )
private

Get Unbiased Track Parameters.

Definition at line 781 of file InDetRecStatisticsAlg.cxx.

781 {
782
783
784 const Trk::TrackParameters *unbiasedTrkParameters = nullptr;
785
786 // -----------------------------------------
787 // use unbiased track states or normal ones?
788 // unbiased track parameters are tried to retrieve if the updator tool
789 // is available and if unbiased track states could be produced before
790 // for the current track (ie. if one trial to get unbiased track states
791 // fail
792
793 if (m_updator && (m_isUnbiased==1) ) {
794 if ( trkParameters->covariance() ) {
795 // Get unbiased state
796 ATH_MSG_VERBOSE(" getting unbiased params");
797 unbiasedTrkParameters =
798 m_updator->removeFromState( *trkParameters,
799 measurement->localParameters(),
800 measurement->localCovariance()).release();
801
802 if (!unbiasedTrkParameters) {
803 ATH_MSG_WARNING("Could not get unbiased track parameters, "
804 <<"use normal parameters");
805 m_isUnbiased = 0;
806 }
807 } else if(!m_UpdatorWarning) {
808 // warn only once!
809 ATH_MSG_WARNING("TrackParameters contain no covariance: "
810 <<"Unbiased track states can not be calculated "
811 <<"(ie. pulls and residuals will be too small)");
812 m_UpdatorWarning = true;
813 m_isUnbiased = 0;
814 } else {
815 m_isUnbiased = 0;
816 }
817 } // end if no measured track parameter
818 return unbiasedTrkParameters;
819}
#define ATH_MSG_VERBOSE(x)
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
ParametersBase< TrackParametersDim, Charged > TrackParameters

◆ initialize()

StatusCode InDet::InDetRecStatisticsAlg::initialize ( )

Initialization of services, track collections, creates TrackStatHelper for each Track Collection.

Definition at line 156 of file InDetRecStatisticsAlg.cxx.

156 {
157
158 // Part 1: Get the messaging service, print where you are
159 ATH_MSG_DEBUG("initialize()");
160
161 StatusCode sc1 = getServices(); // retrieve store gate service etc
162 if (sc1.isFailure()) {
163 ATH_MSG_FATAL("Error retrieving services !");
164 return StatusCode::FAILURE;
165 }
166
167 if (m_RecTrackCollection_keys.empty()) {
168 ATH_MSG_ERROR("No reco track collection specified! Aborting.");
169 return StatusCode::FAILURE;
170 }
171
173 ATH_MSG_ERROR("You have specified "
175 << " TrackCollection keys, and " << m_TrackTruthCollection_keys.size()
176 << " TrackTruthCollection keys."
177 << " You have to specify one TrackTruthCollection for each"
178 << " TrackCollection! Exiting."
179 );
180 return StatusCode::FAILURE;
181 }
182
183 // ----------------------------------
184 // use updator to get unbiased states
185 if ( ! m_updatorHandle.empty() ) {
186 if (m_updatorHandle.retrieve().isFailure()) {
187 ATH_MSG_FATAL("Could not retrieve measurement updator tool: "
188 << m_updatorHandle);
189 return StatusCode::FAILURE;
190 }
191 m_updator = &(*m_updatorHandle);
192 } else {
194 "No Updator for unbiased track states given, use normal states!");
195 m_updator = nullptr;
196 }
197
198
199 //get residual and pull calculator
200 if (m_residualPullCalculator.empty()) {
202 "No residual/pull calculator for general hit residuals configured."
203 );
205 "It is recommended to give R/P calculators to the det-specific tool"
206 << " handle lists then.");
207 } else if (m_residualPullCalculator.retrieve().isFailure()) {
208 ATH_MSG_FATAL("Could not retrieve "<< m_residualPullCalculator
209 <<" (to calculate residuals and pulls) ");
210
211 } else {
212 ATH_MSG_INFO("Generic hit residuals&pulls will be calculated in one or both "
213 << "available local coordinates");
214 }
215
216 // create one TrackStatHelper object of each trackCollection --- this is used to accumulate track and hit statistics
217
218 struct cuts ct;
219 ct.maxEtaBarrel= m_maxEtaBarrel;
220 ct.maxEtaTransition= m_maxEtaTransition;
221 ct.maxEtaEndcap= m_maxEtaEndcap;
222 ct.fakeTrackCut= m_fakeTrackCut;
223 ct.fakeTrackCut2= m_fakeTrackCut2;
224 ct.matchTrackCut = m_matchTrackCut;
225 ct.maxRStartPrimary = m_maxRStartPrimary;
226 ct.maxRStartSecondary = m_maxRStartSecondary;
227 ct.maxZStartPrimary = m_maxZStartPrimary;
228 ct.maxZStartSecondary = m_maxZStartSecondary;
229 ct.minREndPrimary = m_minREndPrimary;
230 ct.minREndSecondary = m_minREndSecondary;
231 ct.minZEndPrimary = m_minZEndPrimary;
232 ct.minZEndSecondary = m_minZEndSecondary;
233 ct.minPt = m_minPt;
234 ct.minEtaFORWARD = m_minEtaFORWARD;
235 ct.maxEtaFORWARD = m_maxEtaFORWARD;
236
237 unsigned int nCollections = 0;
238 for (SG::ReadHandleKeyArray<TrackCollection>::const_iterator
239 it = m_RecTrackCollection_keys.begin();
240 it < m_RecTrackCollection_keys.end(); ++ it) {
241 InDet::TrackStatHelper * collection =
242 new TrackStatHelper(it->key(),(m_doTruth ? m_TrackTruthCollection_keys[nCollections].key() : ""), m_doTruth);
243 nCollections ++;
244 collection->SetCuts(ct);
245 m_SignalCounters.push_back(collection);
246 }
247
248 StatusCode sc3 = resetStatistics(); // reset all statistic counters
249 if (sc3.isFailure()) {
250 ATH_MSG_FATAL("Error in resetStatistics !");
251 return StatusCode::FAILURE;
252 }
253
254 ATH_CHECK( m_RecTrackCollection_keys.initialize() );
257
258 return StatusCode :: SUCCESS;
259
260}
#define ATH_CHECK
Evaluate an expression and check for errors.
StatusCode getServices()
Get various services such as StoreGate, dictionaries, detector managers etc.
StatusCode resetStatistics()
Clear statistics counters, called before each track collection is processed.
void SetCuts(const struct cuts &)
Sets the cuts such as the eta regions (barrel, transition,endcap) and the hit fraction fake cuts and ...

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isClonable()

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ printStatistics()

void InDet::InDetRecStatisticsAlg::printStatistics ( )

Print tracking statistics calculated with TrackStatHelper.

Definition at line 584 of file InDetRecStatisticsAlg.cxx.

584 {
585 if (!msgLvl(MSG::INFO)) return;
586
587 ATH_MSG_INFO(" ********** Beginning InDetRecStatistics Statistics Table ***********");
588 ATH_MSG_INFO("For documentation see https://twiki.cern.ch/twiki/bin/view/Atlas/InDetRecStatistics");
589 ATH_MSG_INFO("(or for guaranteed latest version: http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/offline/InnerDetector/InDetValidation/InDetRecStatistics/doc/mainpage.h?&view=markup )");
590 ATH_MSG_INFO(" ********************************************************************");
591
592 std::stringstream outstr;
593 int def_precision(outstr.precision());
594 outstr << "\n"
595 << MSG::INFO
596 << std::setiosflags(std::ios::fixed | std::ios::showpoint)
597 << std::setw(7) << std::setprecision(2)
598 << s_linestr << "\n"
599 << "Summary" << "\n"
600 << "\tProcessed : " << m_events_processed
601 << " events, " << m_counter.m_counter[kN_rec_tracks_processed]
602 << " reconstructed tracks with " << m_counter.m_counter[kN_spacepoints_processed]
603 << " hits, and " << m_counter.m_counter[kN_gen_tracks_processed]
604 << " truth particles" << "\n"
605 << "\tProblem objects : " << m_counter.m_counter[kN_rec_tracks_without_perigee]
606 << " tracks without perigee, "
607 << m_counter.m_counter[kN_unknown_hits] << " unknown hits" << "\n"
608 << "\t" << "Reco TrackCollections : ";
609 bool first = true;
610 for (std::vector <class TrackStatHelper *>::const_iterator collection =
611 m_SignalCounters.begin();
612 collection != m_SignalCounters.end(); ++collection)
613 {
614 if (first) {
615 first = false;
616 }
617 else {
618 outstr << ", ";
619 }
620 outstr << "\"" << (*collection)->key() << "\"";
621 }
622 ATH_MSG_INFO(outstr.str());
623 outstr.str("");
624
625 if (m_doTruth)
626 {
627 outstr.str("");
628 outstr << "\n"
629 << "\t" << "TrackTruthCollections : ";
630 first = true;
631 for (std::vector <class TrackStatHelper *>::const_iterator collection = m_SignalCounters.begin();
632 collection != m_SignalCounters.end(); ++collection)
633 {
634 if (first) {
635 first = false;
636 }
637 else {
638 outstr << ", ";
639 }
640 outstr << "\"" << (*collection)->Truthkey() << "\"";
641 }
642 ATH_MSG_INFO(outstr.str());
643 outstr.str("");
644 }
645 outstr.str("");
646 outstr << "\n"
647 << s_linestr2 << "\n"
648 << "Cuts and Settings for Statistics Table" << "\n"
649 << "\t" << "TrackSummary Statistics" << "\t"
650 << (m_UseTrackSummary ? "YES" : "NO") << "\n"
651 << "\t" << "Signal \t" << "pT > "
652 << m_minPt/1000 << " GeV/c, |eta| < " << m_maxEta << "\t\t"
653 << "\t" << "Primary track start \t" << "R < "
654 << m_maxRStartPrimary << "mm and |z| < "
655 << m_maxZStartPrimary << "mm" << "\n"
656 << "\t" << "Barrel \t" << 0.0
657 << "< |eta| < " << m_maxEtaBarrel << "\t\t\t"
658 << "\t" << "Primary track end \t" << "R > "
659 << m_minREndPrimary << "mm or |z| > " << m_minZEndPrimary
660 << "mm" << "\n"
661 << "\t" << "Transition Region \t" << m_maxEtaBarrel
662 << "< |eta| < " << m_maxEtaTransition << "\t\t\t"
663 << "\t" << "Secondary (non-Primary) start \t"
664 << " R < " << m_maxRStartSecondary << "mm and"
665 << " |z| < " << m_maxZStartSecondary << " mm" << "\n"
666 << "\t" << "Endcap \t" << m_maxEtaTransition
667 << "< |eta| < " << m_maxEtaEndcap << "\t\t\t"
668 << "\t" << "Secondary (non-primary) end \t"
669 << " R > " << m_minREndSecondary << "mm or"
670 << " |z| > " << m_minREndSecondary << "mm" << "\n"
671 << "\t" << "Forward \t"
672 << "|eta| > " << m_minEtaFORWARD << "\n"
673 << "\t" << "Low prob tracks #1 \t" << "< "
674 << m_fakeTrackCut << " of hits from single Truth Track "
675 << "\n"
676 << "\t" << "Low prob tracks #2 \t" << "< "
677 << m_fakeTrackCut2 << " of hits from single Truth Track "
678 << "\n"
679 << "\t" << "No link tracks \t Track has no link associated to an HepMC Particle" << "\n"
680 << "\t" << "Good reco tracks \t" << "> "
681 << m_matchTrackCut << " of hits from single Truth Track + a link !";
682 ATH_MSG_INFO(outstr.str());
683 outstr.str("");
684
685 MsgStream &out = msg(MSG::INFO);
686 {
687 RestoreStream<MsgStream> restore(out);
688 out << "\n" << s_linestr2 << "\n";
689 m_SignalCounters.back()->print(out);
690
691 if (m_UseTrackSummary) {
692 std::string track_stummary_type_header = TrackStatHelper::getSummaryTypeHeader();
693 out << "\n"
694 << s_linestr2 << "\n"
695 << "Detailed Statistics for Hits on Reconstructed tracks, using TrackSummary: (Preselection of tracks as described above.)" << "\n"
696 << s_linestr2 << "\n"
697 << "----------------------------------------------------------------------------------------------------------------------------------------------------" << "\n"
698 << " Reco Tracks .........................................hits/track....................................................... " << "\n"
699 << "----------------------------------------------------------------------------------------------------------------------------------------------------" << "\n"
700 << " in BARREL tracks/event " << track_stummary_type_header << "\n"
701 << "----------------------------------------------------------------------------------------------------------------------------------------------------" << "\n";
702 printTrackSummary (out, ETA_BARREL);
703
704 out<< "\n"
705 << "----------------------------------------------------------------------------------------------------------------------------------------------------" << "\n"
706 << " in TRANSITION region tracks/event " << track_stummary_type_header << "\n"
707 << "----------------------------------------------------------------------------------------------------------------------------------------------------"
708 << "\n";
709 printTrackSummary (out, ETA_TRANSITION);
710
711 out << "\n"
712 << "----------------------------------------------------------------------------------------------------------------------------------------------------" << "\n"
713 << " in ENDCAP tracks/event " << track_stummary_type_header << "\n"
714 << "----------------------------------------------------------------------------------------------------------------------------------------------------" << "\n";
715 printTrackSummary (out, ETA_ENDCAP);
716
717 out << "\n"
718 << "----------------------------------------------------------------------------------------------------------------------------------------------------" << "\n"
719 << " in FORWARD region tracks/event " << track_stummary_type_header << "\n"
720 << "----------------------------------------------------------------------------------------------------------------------------------------------------" << "\n";
721 printTrackSummary (out, ETA_FORWARD);
722 }
723
725 outstr.str("");
726 outstr << "\n" << std::setprecision(def_precision)
727 <<s_linestr<<"\n"
728 <<"Statistics for Secondaries (non-Primaries)"<<"\n"
729 << "\t" << "Secondary track start \t"
730 << " R < " << m_maxRStartSecondary << "mm and"
731 << " |z| < " << m_maxZStartSecondary << " mm" << "\n"
732 << "\t" << "Secondary track end \t"
733 << " R > " << m_minREndSecondary << "mm or"
734 << " |z| > " << m_minZEndSecondary << "mm";
735 ATH_MSG_INFO(outstr.str());
736 outstr.str("");
737 out << "\n" << s_linestr2 << "\n";
738 m_SignalCounters.back()->printSecondary(out);
739
740 }
741 }
742 out << endmsg;
743
744 ATH_MSG_INFO(" ********** Ending InDetRecStatistics Statistics Table ***********");
745 ATH_MSG_INFO( "\n"
746 << s_linestr );
747}
static const char *const s_linestr
bool msgLvl(const MSG::Level lvl) const
void printTrackSummary(MsgStream &out, enum eta_region)
Print track statistics for all and low proability tracks.
static std::string getSummaryTypeHeader()
bool first
Definition DeMoScan.py:534

◆ printTrackSummary()

void InDet::InDetRecStatisticsAlg::printTrackSummary ( MsgStream & out,
enum eta_region eta_reg )

Print track statistics for all and low proability tracks.

Definition at line 750 of file InDetRecStatisticsAlg.cxx.

751{
752 bool printed = m_SignalCounters.back()->printTrackSummaryRegion(out, TRACK_ALL, eta_reg);
753
754 if (printed) {
755 out << "\n"
756 << "----------------------------------------------------------------------------------------------------------------------------------------------" << "\n";
757 }
758
759 printed = m_SignalCounters.back()->printTrackSummaryRegion(out, TRACK_LOWTRUTHPROB, eta_reg);
760 if (printed) {
761 out << "\n"
762 << "----------------------------------------------------------------------------------------------------------------------------------------------" << "\n";
763 }
764
765 m_SignalCounters.back()->printTrackSummaryRegion(out, TRACK_LOWTRUTHPROB2, eta_reg);
766
767}

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ resetStatistics()

StatusCode InDet::InDetRecStatisticsAlg::resetStatistics ( )

Clear statistics counters, called before each track collection is processed.

Definition at line 492 of file InDetRecStatisticsAlg.cxx.

492 {
493 m_counter.reset();
495
496 for (std::vector<InDet::TrackStatHelper *>::const_iterator counter =
497 m_SignalCounters.begin();
498 counter != m_SignalCounters.end(); ++ counter) {
499 (*counter)->reset();
500 }
501 return StatusCode :: SUCCESS;
502}

◆ selectGenSignal()

void InDet::InDetRecStatisticsAlg::selectGenSignal ( const McEventCollection * SimTracks,
std::vector< std::pair< HepMC::ConstGenParticlePtr, int > > & GenSignal,
unsigned int ,
unsigned int ,
CounterLocal & counter ) const
private

Select charged,stable particles which pass pt and eta cuts for analysis.

Classify truth tracks as primary, secondary or truncated

Definition at line 530 of file InDetRecStatisticsAlg.cxx.

535{
536 if (! SimTracks) return;
537
538 unsigned int nb_mc_event = SimTracks->size();
539 std::unique_ptr<PileUpType> put = std::make_unique<PileUpType>(SimTracks);
540
543
544 if (put)
545 {
546 inTimeMBbegin = put->in_time_minimum_bias_event_begin();
547 inTimeMBend = put->in_time_minimum_bias_event_end();
548 }
549
550 for(unsigned int ievt=0; ievt<nb_mc_event; ++ievt)
551 {
552 const HepMC::GenEvent* genEvent = SimTracks->at(ievt);
553 counter.m_counter[kN_gen_tracks_processed] += genEvent->particles_size();
554 for (const auto& particle: *genEvent){
555 // require stable particle from generation or simulation
556 if (!MC::isStable(particle)) continue;
557 int pdgCode = particle->pdg_id();
558 if (MC::isNucleus(pdgCode)) continue; // ignore nuclei from hadronic interactions
559 float charge = MC::charge(pdgCode);
560 if (std::abs(charge)<0.5) continue;
561 if (std::abs(particle->momentum().perp()) > m_minPt &&
562 std::abs(particle->momentum().pseudoRapidity()) < m_maxEta ) {
563 std::pair<HepMC::ConstGenParticlePtr,int> thisPair(particle,ievt);
564 GenSignal.push_back(thisPair);
565 }
566 } // End of a particle iteration
567 } // End of one GenEvent iteration
568 }
double charge(const T &p)
Definition AtlasPID.h:997
const T * at(size_type n) const
Access an element, as an rvalue.
std::pair< const_iterator, bool > put(val_t key, size_t hash, val_t val, bool overwrite, const typename Updater_t::Context_t &ctx)
Add an entry to the table.
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
double charge(const T &p)
bool isNucleus(const T &p)
PDG rule 16 Nuclear codes are given as 10-digit numbers ±10LZZZAAAI.
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses

◆ selectRecSignal()

void InDet::InDetRecStatisticsAlg::selectRecSignal ( const TrackCollection * RecCollection,
std::vector< const Trk::Track * > & RecTracks,
std::vector< const Trk::Track * > & RecSignal,
CounterLocal & counter ) const
private

Select for analysis reconstructed tracks passing Pt and eta cuts.

Definition at line 504 of file InDetRecStatisticsAlg.cxx.

507 {
508
509 for ( TrackCollection::const_iterator it = RecCollection->begin() ;
510 it != RecCollection->end(); ++ it){
511 RecTracks.push_back(*it);
512 const DataVector<const Trk::TrackParameters>* trackpara =
513 (*it)->trackParameters();
514
515 if(!trackpara->empty()){
516 const Trk::TrackParameters* para = trackpara->front();
517 if (para){
518 if (para->pT() > m_minPt && std::abs(para->eta()) < m_maxEta) {
519 RecSignal.push_back(*it);
520 }
521 }
522 }
523 else {
525 }
526 }
527 }
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const T * front() const
Access the first element in the collection as an rvalue.
bool empty() const noexcept
Returns true if the collection is empty.
double eta() const
Access method for pseudorapidity - from momentum.
double pT() const
Access method for transverse momentum.

◆ setFilterPassed()

virtual void AthCommonReentrantAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Definition at line 100 of file AthCommonReentrantAlgorithm.h.

100 {
102 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const

◆ sysExecute()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Definition at line 85 of file AthCommonReentrantAlgorithm.cxx.

75{
76 return BaseAlg::sysExecute (ctx);
77}

◆ sysInitialize()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in HypoBase, and InputMakerBase.

Definition at line 61 of file AthCommonReentrantAlgorithm.cxx.

105 {
107
108 if (sc.isFailure()) {
109 return sc;
110 }
111
112 ServiceHandle<ICondSvc> cs("CondSvc",name());
113 for (auto h : outputHandles()) {
114 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
115 // do this inside the loop so we don't create the CondSvc until needed
116 if ( cs.retrieve().isFailure() ) {
117 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
118 return StatusCode::SUCCESS;
119 }
120 if (cs->regHandle(this,*h).isFailure()) {
122 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
123 << " with CondSvc");
124 }
125 }
126 }
127 return sc;
128}
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

Counter<std::atomic<long> > m_counter InDet::InDetRecStatisticsAlg::ATLAS_THREAD_SAFE
mutableprivate

Definition at line 170 of file InDetRecStatisticsAlg.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doTruth

bool InDet::InDetRecStatisticsAlg::m_doTruth
private

Use truth information.

Definition at line 135 of file InDetRecStatisticsAlg.h.

◆ m_events_processed

std::atomic<long> InDet::InDetRecStatisticsAlg::m_events_processed
mutableprivate

number of events processed

Definition at line 145 of file InDetRecStatisticsAlg.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonReentrantAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 114 of file AthCommonReentrantAlgorithm.h.

◆ m_fakeTrackCut

float InDet::InDetRecStatisticsAlg::m_fakeTrackCut
private

Maximum probability for which a track will be considered a fake.

Definition at line 122 of file InDetRecStatisticsAlg.h.

◆ m_fakeTrackCut2

float InDet::InDetRecStatisticsAlg::m_fakeTrackCut2
private

Second definition of maximum probability for which a track will be considered a fake.

Definition at line 123 of file InDetRecStatisticsAlg.h.

◆ m_idDictMgr

const IdDictManager* InDet::InDetRecStatisticsAlg::m_idDictMgr
private

Definition at line 103 of file InDetRecStatisticsAlg.h.

◆ m_idHelper

const AtlasDetectorID* InDet::InDetRecStatisticsAlg::m_idHelper
private

Used to find out the sub-det from PRD->identify().

Definition at line 98 of file InDetRecStatisticsAlg.h.

◆ m_isUnbiased

std::atomic<int> InDet::InDetRecStatisticsAlg::m_isUnbiased
mutableprivate

if can get unbiased residuals

Definition at line 143 of file InDetRecStatisticsAlg.h.

◆ m_matchTrackCut

float InDet::InDetRecStatisticsAlg::m_matchTrackCut
private

Minimum number of hits from a truth track to be considered a matched reco track.

Definition at line 124 of file InDetRecStatisticsAlg.h.

◆ m_maxEta

float InDet::InDetRecStatisticsAlg::m_maxEta
private

Maximum Eta cut for tracks used by the algorithm.

Definition at line 118 of file InDetRecStatisticsAlg.h.

◆ m_maxEtaBarrel

float InDet::InDetRecStatisticsAlg::m_maxEtaBarrel
private

define max eta of barrel region

Definition at line 119 of file InDetRecStatisticsAlg.h.

◆ m_maxEtaEndcap

float InDet::InDetRecStatisticsAlg::m_maxEtaEndcap
private

define max eta of eta region

Definition at line 121 of file InDetRecStatisticsAlg.h.

◆ m_maxEtaFORWARD

float InDet::InDetRecStatisticsAlg::m_maxEtaFORWARD
private

Definition at line 137 of file InDetRecStatisticsAlg.h.

◆ m_maxEtaTransition

float InDet::InDetRecStatisticsAlg::m_maxEtaTransition
private

define max eta of transition region

Definition at line 120 of file InDetRecStatisticsAlg.h.

◆ m_maxRStartPrimary

float InDet::InDetRecStatisticsAlg::m_maxRStartPrimary
private

Maximum R of start vertex to be considered primary.

Definition at line 126 of file InDetRecStatisticsAlg.h.

◆ m_maxRStartSecondary

float InDet::InDetRecStatisticsAlg::m_maxRStartSecondary
private

Maximum R of start vertex to be considered secondary.

Definition at line 127 of file InDetRecStatisticsAlg.h.

◆ m_maxZStartPrimary

float InDet::InDetRecStatisticsAlg::m_maxZStartPrimary
private

Maximum Z of start vertex to be considered primary.

Definition at line 128 of file InDetRecStatisticsAlg.h.

◆ m_maxZStartSecondary

float InDet::InDetRecStatisticsAlg::m_maxZStartSecondary
private

Maximum Z of start vertex to be considered secondary.

Definition at line 129 of file InDetRecStatisticsAlg.h.

◆ m_McTrackCollection_key

SG::ReadHandleKey<McEventCollection> InDet::InDetRecStatisticsAlg::m_McTrackCollection_key
private

Definition at line 112 of file InDetRecStatisticsAlg.h.

◆ m_minEtaFORWARD

float InDet::InDetRecStatisticsAlg::m_minEtaFORWARD
private

Definition at line 136 of file InDetRecStatisticsAlg.h.

◆ m_minPt

float InDet::InDetRecStatisticsAlg::m_minPt
private

Minimum Pt cut for tracks used by the algorithm.

Definition at line 117 of file InDetRecStatisticsAlg.h.

◆ m_minREndPrimary

float InDet::InDetRecStatisticsAlg::m_minREndPrimary
private

If track has end vertex, this is min R of end vertex to be considered primary.

Definition at line 130 of file InDetRecStatisticsAlg.h.

◆ m_minREndSecondary

float InDet::InDetRecStatisticsAlg::m_minREndSecondary
private

If track has end vertex, this is min R of end vertex to be considered secondary.

Definition at line 131 of file InDetRecStatisticsAlg.h.

◆ m_minZEndPrimary

float InDet::InDetRecStatisticsAlg::m_minZEndPrimary
private

If track has end vertex, this is min Z of end vertex to be considered primary.

Definition at line 132 of file InDetRecStatisticsAlg.h.

◆ m_minZEndSecondary

float InDet::InDetRecStatisticsAlg::m_minZEndSecondary
private

If track has end vertex, this is min Z of end vertex to be considered secondary.

Definition at line 133 of file InDetRecStatisticsAlg.h.

◆ m_pixelID

const PixelID* InDet::InDetRecStatisticsAlg::m_pixelID
private

get pixel layer from hit ID

Definition at line 99 of file InDetRecStatisticsAlg.h.

◆ m_printSecondary

bool InDet::InDetRecStatisticsAlg::m_printSecondary
private

Flag to print hit information for secondary tracks.

Definition at line 116 of file InDetRecStatisticsAlg.h.

◆ m_pullWarning

std::atomic<bool> InDet::InDetRecStatisticsAlg::m_pullWarning {}
mutableprivate

warn only once, if pull cannot be calculated

Definition at line 141 of file InDetRecStatisticsAlg.h.

141{};

◆ m_RecTrackCollection_keys

SG::ReadHandleKeyArray<TrackCollection> InDet::InDetRecStatisticsAlg::m_RecTrackCollection_keys
private

Definition at line 138 of file InDetRecStatisticsAlg.h.

◆ m_residualPullCalculator

ToolHandle<Trk::IResidualPullCalculator> InDet::InDetRecStatisticsAlg::m_residualPullCalculator
private

The residual and pull calculator tool handle.

Definition at line 109 of file InDetRecStatisticsAlg.h.

◆ m_sctID

const SCT_ID* InDet::InDetRecStatisticsAlg::m_sctID
private

get sct layer from hit ID

Definition at line 100 of file InDetRecStatisticsAlg.h.

◆ m_SignalCounters

std::vector<class TrackStatHelper *> InDet::InDetRecStatisticsAlg::m_SignalCounters
private

Vector of TrackStatHelper objects, one for each track collection.

Definition at line 97 of file InDetRecStatisticsAlg.h.

◆ m_trackSelectorTool

ToolHandle<Trk::ITrackSelectorTool> InDet::InDetRecStatisticsAlg::m_trackSelectorTool
private

Definition at line 113 of file InDetRecStatisticsAlg.h.

◆ m_TrackTruthCollection_keys

SG::ReadHandleKeyArray<TrackTruthCollection> InDet::InDetRecStatisticsAlg::m_TrackTruthCollection_keys
private

Definition at line 139 of file InDetRecStatisticsAlg.h.

◆ m_trkSummaryTool

ToolHandle<Trk::IExtendedTrackSummaryTool> InDet::InDetRecStatisticsAlg::m_trkSummaryTool
private

tool to get track summary information from track

Definition at line 105 of file InDetRecStatisticsAlg.h.

◆ m_trtID

const TRT_ID* InDet::InDetRecStatisticsAlg::m_trtID
private

get trt layer from hit ID

Definition at line 101 of file InDetRecStatisticsAlg.h.

◆ m_truthToTrack

ToolHandle<Trk::ITruthToTrack> InDet::InDetRecStatisticsAlg::m_truthToTrack
private

tool to create track parameters from a gen particle

Definition at line 104 of file InDetRecStatisticsAlg.h.

◆ m_updator

Trk::IUpdator* InDet::InDetRecStatisticsAlg::m_updator
private

updator for unbiased states

Definition at line 108 of file InDetRecStatisticsAlg.h.

◆ m_updatorHandle

ToolHandle<Trk::IUpdator> InDet::InDetRecStatisticsAlg::m_updatorHandle
private

Tool handle of updator for unbiased states.

Definition at line 107 of file InDetRecStatisticsAlg.h.

◆ m_UpdatorWarning

std::atomic<bool> InDet::InDetRecStatisticsAlg::m_UpdatorWarning {}
mutableprivate

warn only once, if unbiased track states can not be calculated

Definition at line 142 of file InDetRecStatisticsAlg.h.

142{};

◆ m_useTrackSelection

bool InDet::InDetRecStatisticsAlg::m_useTrackSelection
private

Use track selector tool.

Definition at line 134 of file InDetRecStatisticsAlg.h.

◆ m_UseTrackSummary

bool InDet::InDetRecStatisticsAlg::m_UseTrackSummary
private

Flag to print detailed statistics for each track collection.

Definition at line 115 of file InDetRecStatisticsAlg.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: