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 771 of file InDetRecStatisticsAlg.cxx.

773 {
774 double ErrorSum;
775 ErrorSum = sqrt(pow(trkErr, 2) + pow(hitErr, 2));
776 if (ErrorSum != 0) { return residual/ErrorSum; }
777 else { return 0; }
778}
constexpr int pow(int base, int exp) noexcept

◆ 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.

64{
65 return 0;
66}

◆ 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 (RecCollection,
351 RecTracks,
352 GenSignal,
353 TruthMap,
355 m_pixelID,
356 m_sctID,
357 m_trkSummaryTool.operator->(),
359 &inTimeStart,
360 &inTimeEnd);
361
362 counter.m_counter[kN_rec_tracks_processed] += RecCollection->size();
363
364 for ( TrackCollection::const_iterator it = RecCollection->begin() ;
365 it < RecCollection->end(); ++ it){
366 std::vector<const Trk::RIO_OnTrack*> rioOnTracks;
367 Trk::RoT_Extractor::extract( rioOnTracks,
368 (*it)->measurementsOnTrack()->stdcont() );
369 counter.m_counter[kN_spacepoints_processed] += rioOnTracks.size();
370 }
371
372 }
373 m_counter += counter;
374
375 ATH_MSG_DEBUG("leaving execute()");
376 return StatusCode::SUCCESS;
377}
#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.

90{
91 // If we didn't find any symlinks to add, just return the collection
92 // from the base class. Otherwise, return the extended collection.
93 if (!m_extendedExtraObjects.empty()) {
95 }
97}
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 382 of file InDetRecStatisticsAlg.cxx.

382 {
383
384 // Part 1: Get the messaging service, print where you are
385 ATH_MSG_DEBUG("finalize()");
386
388
389 for (std::vector <class TrackStatHelper *>::const_iterator collection =
390 m_SignalCounters.begin(); collection != m_SignalCounters.end();
391 ++collection) {
393 delete (*collection);
394 }
395 m_SignalCounters.clear();
396 return StatusCode::SUCCESS;
397}
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 821 of file InDetRecStatisticsAlg.cxx.

821 {
822 Identifier id;
823 const Trk::CompetingRIOsOnTrack *comprot = nullptr;
824 // identify by ROT:
825 const Trk::RIO_OnTrack *rot =
826 dynamic_cast<const Trk::RIO_OnTrack*>(measurement);
827 if (rot) {
828 id = rot->identify();
829 } else {
830 // identify by CompetingROT:
831 comprot = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(measurement);
832 if (comprot) {
833 rot = &comprot->rioOnTrack(comprot->indexOfMaxAssignProb());
834 id = rot->identify();
835 } else {
836 ATH_MSG_DEBUG("measurement is neither ROT nor competingROT:"
837 <<" can not determine detector type");
838 id.clear();
839 }
840 }
841 delete comprot;
842 return id;
843}
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 400 of file InDetRecStatisticsAlg.cxx.

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

◆ getUnbiasedTrackParameters()

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

Get Unbiased Track Parameters.

Definition at line 780 of file InDetRecStatisticsAlg.cxx.

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

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

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

◆ 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 491 of file InDetRecStatisticsAlg.cxx.

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

◆ 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 529 of file InDetRecStatisticsAlg.cxx.

534{
535 if (! SimTracks) return;
536
537 unsigned int nb_mc_event = SimTracks->size();
538 std::unique_ptr<PileUpType> put = std::make_unique<PileUpType>(SimTracks);
539
542
543 if (put)
544 {
545 inTimeMBbegin = put->in_time_minimum_bias_event_begin();
546 inTimeMBend = put->in_time_minimum_bias_event_end();
547 }
548
549 for(unsigned int ievt=0; ievt<nb_mc_event; ++ievt)
550 {
551 const HepMC::GenEvent* genEvent = SimTracks->at(ievt);
552 counter.m_counter[kN_gen_tracks_processed] += genEvent->particles_size();
553 for (const auto& particle: *genEvent){
554 // require stable particle from generation or simulation
555 if (!MC::isStable(particle)) continue;
556 int pdgCode = particle->pdg_id();
557 if (MC::isNucleus(pdgCode)) continue; // ignore nuclei from hadronic interactions
558 float charge = MC::charge(pdgCode);
559 if (std::abs(charge)<0.5) continue;
560 if (std::abs(particle->momentum().perp()) > m_minPt &&
561 std::abs(particle->momentum().pseudoRapidity()) < m_maxEta ) {
562 std::pair<HepMC::ConstGenParticlePtr,int> thisPair(particle,ievt);
563 GenSignal.push_back(thisPair);
564 }
565 } // End of a particle iteration
566 } // End of one GenEvent iteration
567 }
double charge(const T &p)
Definition AtlasPID.h:997
const T * at(size_type n) const
Access an element, as an rvalue.
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 503 of file InDetRecStatisticsAlg.cxx.

506 {
507
508 for ( TrackCollection::const_iterator it = RecCollection->begin() ;
509 it != RecCollection->end(); ++ it){
510 RecTracks.push_back(*it);
511 const DataVector<const Trk::TrackParameters>* trackpara =
512 (*it)->trackParameters();
513
514 if(!trackpara->empty()){
515 const Trk::TrackParameters* para = trackpara->front();
516 if (para){
517 if (para->pT() > m_minPt && std::abs(para->eta()) < m_maxEta) {
518 RecSignal.push_back(*it);
519 }
520 }
521 }
522 else {
524 }
525 }
526 }
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.

77{
78 return BaseAlg::sysExecute (ctx);
79}

◆ 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.

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