|
ATLAS Offline Software
|
#include <TrackFindingValidationAlg.h>
|
virtual StatusCode | initialize () override |
|
virtual StatusCode | finalize () override |
|
virtual StatusCode | execute (const EventContext &ctx) const override |
|
| TrackTruthMatchingBaseAlg (const std::string &name, ISvcLocator *pSvcLocator) |
|
virtual StatusCode | sysInitialize () override |
| Override sysInitialize. More...
|
|
virtual bool | isClonable () const override |
| Specify if the algorithm is clonable. More...
|
|
virtual unsigned int | cardinality () const override |
| Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant. More...
|
|
virtual StatusCode | sysExecute (const EventContext &ctx) override |
| Execute an algorithm. More...
|
|
virtual const DataObjIDColl & | extraOutputDeps () const override |
| Return the list of extra output dependencies. More...
|
|
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 . More...
|
|
const ServiceHandle< StoreGateSvc > & | evtStore () const |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | detStore () const |
| The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
virtual StatusCode | sysStart () override |
| Handle START transition. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override |
| Return this algorithm's input handles. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override |
| Return this algorithm's output handles. More...
|
|
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Property< T > &t) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc="none") |
| Declare a new Gaudi property. More...
|
|
void | updateVHKA (Gaudi::Details::PropertyBase &) |
|
MsgStream & | msg () const |
|
MsgStream & | msg (const MSG::Level lvl) const |
|
bool | msgLvl (const MSG::Level lvl) const |
|
|
enum | ECounter {
NTracksTotal,
NTruthWithCountsTotal,
MissingTruthParticleHitCounts,
NoAssociatedTruthParticle,
NoSelectedTruthParticle,
TruthParticleNoNoiseMismatch,
kNCounter
} |
|
enum | ECategorisedCounter {
kNTotalParticles,
kNParticleWithAssociatedTrack,
kNParticleWithMultipleAssociatedTracks,
kNTotalTracks,
kNCategorisedCounter
} |
|
enum | ECategorisedStat { kHitEfficiency,
kHitPurity,
kMatchProbability,
kNCategorisedStat
} |
|
template<class Base > |
using | Property = std::conditional< TrackFindingValidationDetailedStat, Gaudi::Property< Base >, DummyProperty< Base > >::type |
|
typedef ServiceHandle< StoreGateSvc > | StoreGateSvc_t |
|
|
void | checkBinOrder (const std::vector< float > &bin_edges, const std::string &bin_label) const |
| check that bins are in increasing order. More...
|
|
std::size_t | getPtEtaStatCategory (float pt, float eta) const |
| Return the category based on the provided eta value. More...
|
|
std::size_t | getPtPdgIdStatCategory (float pt, int pdg_id) const |
| Return the category based on the PDG ID. More...
|
|
void | initStatTables () |
|
void | printStatTables () const |
|
void | printCategories (const std::vector< std::string > &pt_category_labels, const std::vector< std::string > &eta_category_labels, std::vector< std::string > &counter_labels, std::vector< std::array< ActsUtils::Stat, kNCategorisedStat > > &stat_per_category, std::vector< std::array< std::size_t, kNCategorisedCounter > > &counts_per_category, const std::string &top_left_label, bool print_sub_categories) const |
|
void | printData2D (const std::vector< std::string > &row_category_labels, const std::vector< std::string > &col_category_labels, const std::string &top_left_label, std::vector< std::array< ActsUtils::Stat, kNCategorisedStat > > &stat_per_category, std::vector< std::array< std::size_t, kNCategorisedCounter > > &counts_per_category, bool rotate) const |
|
StatusCode | checkMatchWeights () |
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKey> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &) |
| specialization for handling Gaudi::Property<SG::VarHandleBase> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &) |
| specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
|
|
|
SG::ReadHandleKey< TrackToTruthParticleAssociation > | m_trackToTruth {this, "TrackToTruthAssociationMap","", "Association map from tracks to generator particles." } |
|
SG::ReadHandleKey< TruthParticleHitCounts > | m_truthHitCounts {this, "TruthParticleHitCounts","", "Map from truth particle to hit counts." } |
|
Gaudi::Property< std::vector< float > > | m_weightsForProb |
|
Gaudi::Property< std::vector< float > > | m_weights |
|
Property< std::vector< float > > | m_statEtaBins {this, "StatisticEtaBins", {-4, -2.6, -2, 0, 2., 2.6, 4}, "Gather statistics separately for these eta bins."} |
|
Property< std::vector< float > > | m_statPtBins {this, "StatisticPtBins", {1.e3,2.5e3,10e3, 100e3}, "Gather statistics separately for these pt bins."} |
|
Property< bool > | m_pdgIdCategorisation {this, "PdgIdCategorisation", false, "Categorise by pdg id."} |
|
Property< bool > | m_showRawCounts {this, "ShowRawCounts", false, "Show all counters."} |
|
Property< bool > | m_printDetails {this, "ShowDetailedTables", false, "Show more details; stat. uncert., RMS, entries"} |
|
Property< bool > | m_computeTrackRecoEfficiency {this, "ComputeTrackRecoEfficiency", true, "Compute and print track reconstruction efficiency."} |
|
ToolHandle< IAthSelectionTool > | m_truthSelectionTool {this, "TruthSelectionTool","AthTruthSelectionTool", "Truth selection tool (for efficiencies and resolutions)"} |
|
DebugCounter< TrackFindingValidationDebugHists > | m_debugCounter |
|
bool | m_useAbsEtaForStat = false |
|
std::mutex m_statMutex | ATLAS_THREAD_SAFE |
|
std::array< std::size_t, kNCounter > m_counter | ATLAS_THREAD_SAFE {} |
|
std::vector< int > m_pdgId | ATLAS_THREAD_SAFE |
|
BaseStat< TrackFindingValidationDetailedStat > m_detailedStat | ATLAS_THREAD_SAFE |
|
DataObjIDColl | m_extendedExtraObjects |
| Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks. More...
|
|
StoreGateSvc_t | m_evtStore |
| Pointer to StoreGate (event store by default) More...
|
|
StoreGateSvc_t | m_detStore |
| Pointer to StoreGate (detector store by default) More...
|
|
std::vector< SG::VarHandleKeyArray * > | m_vhka |
|
bool | m_varHandleArraysDeclared |
|
Definition at line 23 of file TrackFindingValidationAlg.h.
◆ EventStat
◆ Property
◆ StoreGateSvc_t
◆ ECategorisedCounter
Enumerator |
---|
kNTotalParticles | |
kNParticleWithAssociatedTrack | |
kNParticleWithMultipleAssociatedTracks | |
kNTotalTracks | |
kNCategorisedCounter | |
Definition at line 244 of file TrackTruthMatchingBaseAlg.h.
◆ ECategorisedStat
◆ ECounter
Enumerator |
---|
NTracksTotal | |
NTruthWithCountsTotal | |
MissingTruthParticleHitCounts | |
NoAssociatedTruthParticle | |
NoSelectedTruthParticle | |
TruthParticleNoNoiseMismatch | |
kNCounter | |
Definition at line 234 of file TrackTruthMatchingBaseAlg.h.
◆ analyseTrackTruth()
- Parameters
-
return | tuple containing pointer to best matching truth particle, matching probability, hit purity and hit efficiency. |
Definition at line 209 of file TrackTruthMatchingBaseAlg.cxx.
213 TruthMatchResult ret{};
215 std::array<float,2> best_match_prob {};
218 std::array<float,2> best_match_prob_nonoise{};
220 const HitCounterArray &total_counts = track_hit_counts.totalCounts();
221 const HitCounterArray &noise_counts = track_hit_counts.noiseCounts();
226 double total_sum_for_prob_nonoise=total_sum_for_prob;
227 total_sum_for_prob += noise_sum;
229 if (total_sum_for_prob>0.) {
233 unsigned int truth_i=0;
235 for (
const std::pair<const xAOD::TruthParticle *, HitCounterArray > &
236 hit_counts_for_associated_truth_particle : track_hit_counts.countsPerTruthParticle() ) {
239 float match_prob_nonoise = truth_sum_for_prob /total_sum_for_prob_nonoise;
240 float match_prob = truth_sum_for_prob /total_sum_for_prob;
241 if (match_prob>1 || match_prob<0.) {
242 ATH_MSG_ERROR(
"Negative or too large truth match \"probability\". This should not happen."
243 <<
" Track hits: " << dumpCounts(total_counts)
244 <<
" noise hits of those: " << dumpCounts(noise_counts)
245 <<
" truth hits: " << dumpCounts(hit_counts_for_associated_truth_particle.second));
247 if (match_prob>best_match_prob[1]) {
248 int dest_i=match_prob<best_match_prob[0];
249 best_match_i[1]=best_match_i[0];
250 best_match_prob[1]=best_match_prob[0];
251 best_match_prob[dest_i]=match_prob;
252 best_match_i[dest_i]=truth_i;
254 if (match_prob_nonoise>best_match_prob_nonoise[1]) {
255 int dest_i=match_prob_nonoise<best_match_prob_nonoise[0];
256 best_match_i_nonoise[1]=best_match_i_nonoise[0];
257 best_match_prob_nonoise[1]=best_match_prob_nonoise[0];
258 best_match_prob_nonoise[dest_i]=match_prob_nonoise;
259 best_match_i_nonoise[dest_i]=truth_i;
265 if (best_match_i_nonoise[0] != best_match_i[0]) {
266 ++event_stat.m_nTruthParticleNonoiseMismatches;
268 if ( best_match_i[0] < track_hit_counts.countsPerTruthParticle().size()
269 && track_hit_counts.countsPerTruthParticle()[ best_match_i[0] ].first) {
270 ret.m_truthParticle = track_hit_counts.countsPerTruthParticle()[ best_match_i[0] ].first;
271 ret.m_matchProbability = best_match_prob[0];
273 const xAOD::TruthParticle *best_match = track_hit_counts.countsPerTruthParticle()[ best_match_i[0] ].first;
275 event_stat.m_truthSelectionCuts.add( event_stat.m_nTruthCuts -
accept.missingCuts() );
278 double common_truth_sum=
weightedCountSum(track_hit_counts.countsPerTruthParticle()[ best_match_i[0] ].second,
m_weights.value() );
280 float hit_efficiency = 0.;
281 std::unordered_map<const xAOD::TruthParticle *,HitCounterArray>::const_iterator
282 best_truth_particle_counts_iter = truth_particle_hit_counts.find( best_match );
284 if (best_truth_particle_counts_iter != truth_particle_hit_counts.end()) {
287 hit_efficiency = truth_sum > 0
u ? (common_truth_sum/truth_sum) : 0.;
292 ++event_stat.m_nTruthParticleWithoutAssociatedCounts;
299 float hit_purity = common_truth_sum / total_sum;
300 ret.m_hitPurity = hit_purity;
301 ret.m_hitEfficiency = hit_efficiency;
305 float best_match_pt = best_match->
pt();
308 event_stat.fill( eta_category_i, pdg_id_category_i, hit_efficiency, hit_purity, best_match_prob[0], best_match );
313 ++event_stat.m_nTracksWithoutSelectedTruthParticle;
320 ++event_stat.m_nTracksWithoutAssociatedTruthParticle;
321 if (!track_hit_counts.countsPerTruthParticle().empty()) {
322 ATH_MSG_ERROR(
"Failed to select best matching truth particle out of " << track_hit_counts.countsPerTruthParticle().size()
323 <<
". This should not happen." );
◆ cardinality()
unsigned int AthReentrantAlgorithm::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.
Override this to return 0 for reentrant algorithms.
Definition at line 55 of file AthReentrantAlgorithm.cxx.
◆ checkBinOrder()
void ActsTrk::TrackTruthMatchingBaseAlg::checkBinOrder |
( |
const std::vector< float > & |
bin_edges, |
|
|
const std::string & |
bin_label |
|
) |
| const |
|
privateinherited |
check that bins are in increasing order.
will cause a FATAL error if bins are not in increasing order.
Definition at line 403 of file TrackTruthMatchingBaseAlg.cxx.
404 if (!bin_edges.empty())
406 float last_eta = bin_edges[0];
407 for (
float eta : bin_edges)
411 ATH_MSG_FATAL(bin_label +
" bins for statistics counter not in ascending order.");
◆ checkMatchWeights()
StatusCode ActsTrk::TrackTruthMatchingBaseAlg::checkMatchWeights |
( |
| ) |
|
|
privateinherited |
Definition at line 777 of file TrackTruthMatchingBaseAlg.cxx.
779 ATH_MSG_FATAL(
"There must be exactly one weight per measurement type. But got "
781 return StatusCode::FAILURE;
784 ATH_MSG_FATAL(
"There must be exactly one weight for computing the matching probability per measurement type. But got "
786 return StatusCode::FAILURE;
790 ATH_MSG_FATAL(
"Invalid weights (should be positive) or inconsistency of weights which are zero (match prob. weights, weights):"
792 return StatusCode::FAILURE;
795 return StatusCode::SUCCESS;
◆ declareGaudiProperty() [1/4]
specialization for handling Gaudi::Property<SG::VarHandleKeyArray>
Definition at line 170 of file AthCommonDataStore.h.
175 hndl.documentation());
◆ declareGaudiProperty() [2/4]
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
161 hndl.documentation());
◆ declareGaudiProperty() [3/4]
specialization for handling Gaudi::Property<SG::VarHandleBase>
Definition at line 184 of file AthCommonDataStore.h.
189 hndl.documentation());
◆ declareGaudiProperty() [4/4]
◆ declareProperty() [1/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleBase
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 245 of file AthCommonDataStore.h.
250 this->declare(hndl.
vhKey());
251 hndl.
vhKey().setOwner(
this);
◆ declareProperty() [2/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleKey
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 221 of file AthCommonDataStore.h.
◆ declareProperty() [3/6]
◆ declareProperty() [4/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This is the generic version, for types that do not derive from SG::VarHandleKey
. It just forwards to the base class version of declareProperty
.
Definition at line 333 of file AthCommonDataStore.h.
◆ declareProperty() [5/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This dispatches to either the generic declareProperty
or the one for VarHandle/Key/KeyArray.
Definition at line 352 of file AthCommonDataStore.h.
◆ declareProperty() [6/6]
◆ detStore()
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ execute()
StatusCode ActsTrk::TrackFindingValidationAlg::execute |
( |
const EventContext & |
ctx | ) |
const |
|
overridevirtual |
Definition at line 23 of file TrackFindingValidationAlg.cxx.
27 if (!track_to_truth_handle.
isValid()) {
29 return StatusCode::FAILURE;
35 track_to_truth_handle->size());
37 for(
const HitCountsPerTrack &track_hit_counts : *track_to_truth_handle) {
43 track_to_truth_handle->size(),
45 return StatusCode::SUCCESS;
◆ extraDeps_update_handler()
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 & AthReentrantAlgorithm::extraOutputDeps |
( |
| ) |
const |
|
overridevirtualinherited |
Return the list of extra output dependencies.
This list is extended to include symlinks implied by inheritance relations.
Definition at line 79 of file AthReentrantAlgorithm.cxx.
86 return Algorithm::extraOutputDeps();
◆ filterPassed()
virtual bool AthReentrantAlgorithm::filterPassed |
( |
const EventContext & |
ctx | ) |
const |
|
inlinevirtualinherited |
◆ finalize()
StatusCode ActsTrk::TrackFindingValidationAlg::finalize |
( |
| ) |
|
|
overridevirtual |
◆ getPtEtaStatCategory()
std::size_t ActsTrk::TrackTruthMatchingBaseAlg::getPtEtaStatCategory |
( |
float |
pt, |
|
|
float |
eta |
|
) |
| const |
|
inlineprivateinherited |
Return the category based on the provided eta value.
- Parameters
-
pt | the pt of the truth particle |
eta | the eta of the truth particle |
- Returns
- a bin assigned to the give eta value
Definition at line 368 of file TrackTruthMatchingBaseAlg.cxx.
370 std::vector<float>::const_iterator pt_bin_iter = std::upper_bound(
m_statPtBins.begin(),
373 std::vector<float>::const_iterator eta_bin_iter = std::upper_bound(
m_statEtaBins.begin(),
377 +
static_cast<std::size_t
>(eta_bin_iter -
m_statEtaBins.begin());
◆ getPtPdgIdStatCategory()
std::size_t ActsTrk::TrackTruthMatchingBaseAlg::getPtPdgIdStatCategory |
( |
float |
pt, |
|
|
int |
pdg_id |
|
) |
| const |
|
privateinherited |
Return the category based on the PDG ID.
- Parameters
-
pt | the pt of the truth particle |
pdg_id | the PDG ID |
- Returns
- 0 or a slot associated to a single PDG ID (absolut value)
Definition at line 379 of file TrackTruthMatchingBaseAlg.cxx.
380 std::vector<float>::const_iterator pt_bin_iter = std::upper_bound(
m_statPtBins.begin(),
384 std::vector< int >::const_iterator iter =
std::find(m_pdgId.begin(), m_pdgId.end(), abs_pdg_id);
385 if (iter == m_pdgId.end()){
386 if (m_pdgId.size() < m_pdgId.capacity()) {
387 std::lock_guard<std::mutex> lock(m_statMutex);
389 iter =
std::find(m_pdgId.begin(), m_pdgId.end(), abs_pdg_id);
390 if (iter == m_pdgId.end()){
391 m_pdgId.push_back(abs_pdg_id);
392 iter = m_pdgId.end()-1;
396 iter=m_pdgId.begin();
399 return (m_pdgId.capacity()) *
static_cast<std::size_t
>(pt_bin_iter -
m_statPtBins.begin())
400 + (iter - m_pdgId.begin());
◆ getTruthParticleHitCounts()
Definition at line 60 of file TrackTruthMatchingBaseAlg.h.
62 if (!truth_particle_hit_counts_handle.
isValid()) {
64 std::runtime_error(
"Failed to get truth particle hit count map");
66 return *truth_particle_hit_counts_handle;
◆ initialize()
StatusCode ActsTrk::TrackFindingValidationAlg::initialize |
( |
| ) |
|
|
overridevirtual |
◆ initStatTables()
void ActsTrk::TrackTruthMatchingBaseAlg::initStatTables |
( |
| ) |
|
|
privateinherited |
◆ inputHandles()
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()
bool AthReentrantAlgorithm::isClonable |
( |
| ) |
const |
|
overridevirtualinherited |
Specify if the algorithm is clonable.
Reentrant algorithms are clonable.
Reimplemented in Simulation::BeamEffectsAlg, InDet::SiTrackerSpacePointFinder, InDet::SCT_Clusterization, InDet::SiSPSeededTrackFinder, SCTRawDataProvider, InDet::GNNSeedingTrackMaker, SCT_PrepDataToxAOD, RoIBResultToxAOD, SCT_CablingCondAlgFromCoraCool, SCT_ReadCalibDataTestAlg, SCT_CablingCondAlgFromText, InDet::SiSPGNNTrackMaker, SCT_ReadCalibChipDataTestAlg, SCT_TestCablingAlg, SCT_ConfigurationConditionsTestAlg, ITkPixelCablingAlg, ITkStripCablingAlg, SCTEventFlagWriter, SCT_ConditionsSummaryTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_TdaqEnabledTestAlg, SCT_SiliconConditionsTestAlg, SCTSiLorentzAngleTestAlg, SCT_ByteStreamErrorsTestAlg, SCT_ConditionsParameterTestAlg, SCT_FlaggedConditionTestAlg, SCT_StripVetoTestAlg, SCT_RawDataToxAOD, and SCTSiPropertiesTestAlg.
Definition at line 44 of file AthReentrantAlgorithm.cxx.
◆ msg() [1/2]
◆ msg() [2/2]
◆ msgLvl()
◆ noiseCorrection()
|
inlinestaticprivateinherited |
Definition at line 808 of file TrackTruthMatchingBaseAlg.cxx.
810 assert(
weights.size() == noise_counts.size());
812 for (
unsigned int count_i=0; count_i < noise_counts.size(); ++count_i) {
813 sum -=
weights[count_i] * noise_counts[count_i] - noise_counts[count_i];
◆ outputHandles()
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.
◆ perEtaSize()
std::size_t ActsTrk::TrackTruthMatchingBaseAlg::perEtaSize |
( |
| ) |
const |
|
inlineprotectedinherited |
◆ perPdgIdSize()
std::size_t ActsTrk::TrackTruthMatchingBaseAlg::perPdgIdSize |
( |
| ) |
const |
|
inlineprotectedinherited |
◆ postProcessEventStat()
Definition at line 331 of file TrackTruthMatchingBaseAlg.cxx.
337 for(
const std::pair<const xAOD::TruthParticle * const,ActsTrk::HitCounterArray> &truth_particle : truth_particle_hit_counts) {
342 float truth_particle_pt = truth_particle.first->pt();
343 std::size_t eta_category_i =
getPtEtaStatCategory(truth_particle_pt, truth_particle.first->eta());
344 std::size_t pdg_id_category_i =
getPtPdgIdStatCategory(truth_particle_pt, truth_particle.first->pdg_id());
345 event_stat.incrementTotal(eta_category_i, pdg_id_category_i);
354 std::lock_guard<std::mutex> lock(m_statMutex);
363 m_detailedStat += event_stat;
◆ printCategories()
void ActsTrk::TrackTruthMatchingBaseAlg::printCategories |
( |
const std::vector< std::string > & |
pt_category_labels, |
|
|
const std::vector< std::string > & |
eta_category_labels, |
|
|
std::vector< std::string > & |
counter_labels, |
|
|
std::vector< std::array< ActsUtils::Stat, kNCategorisedStat > > & |
stat_per_category, |
|
|
std::vector< std::array< std::size_t, kNCategorisedCounter > > & |
counts_per_category, |
|
|
const std::string & |
top_left_label, |
|
|
bool |
print_sub_categories |
|
) |
| const |
|
privateinherited |
Definition at line 570 of file TrackTruthMatchingBaseAlg.cxx.
577 if (!row_category_labels.empty() && !col_category_labels.empty()) {
578 if (row_category_labels.size() * col_category_labels.size() > counts_per_category.size() ) {
579 ATH_MSG_ERROR(
"Mismatch between category labels and number of counters (logic error -> fix needed):"
580 << row_category_labels.size() <<
" * " << col_category_labels.size()
581 <<
" > " << counts_per_category.size() );
583 constexpr std::size_t stat_column_width=14*4 + 3*3+4 + 9;
584 assert( stat_per_category.size() == counts_per_category.size());
585 const unsigned int n_rows = row_category_labels.size();
586 const unsigned int n_cols = stat_per_category.size() / n_rows;
589 assert( stat_per_category.size() % n_rows == 0 );
590 for(
unsigned int row_i=(print_sub_categories ? 0 : n_rows-1); row_i<n_rows; ++row_i) {
592 std::vector<std::string> stat_labels { std::string(
"Hit Efficiency") };
594 .columnWidth(stat_column_width)
595 .labelPrefix(row_category_labels.at(row_i)+
" ")
596 .precision(std::vector<unsigned int>{3})
600 std::vector<std::string> stat_labels { std::string(
"Hit Purity") };
602 .columnWidth(stat_column_width)
603 .labelPrefix(row_category_labels.at(row_i)+
" ")
604 .precision(std::vector<unsigned int>{3})
608 std::vector<std::string> stat_labels { std::string(
"Match probability") };
610 .columnWidth(stat_column_width)
611 .labelPrefix(row_category_labels.at(row_i)+
" ")
612 .precision(std::vector<unsigned int>{3})
617 .labelPrefix(row_category_labels.at(row_i)+
" ")
622 std::vector< std::array< float, 2> >
eff;
623 eff.reserve(m_pdgId.size());
624 for (
unsigned int category_i=0; category_i< col_category_labels.size(); ++category_i) {
628 std::vector<std::string> eff_labels { std::string(
"reco efficiency"),
629 std::string(
"stat. uncertainty") };
631 .labelPrefix(row_category_labels.at(row_i)+
" ")
632 .precision(std::vector<unsigned int>{3,3})
◆ printData2D()
void ActsTrk::TrackTruthMatchingBaseAlg::printData2D |
( |
const std::vector< std::string > & |
row_category_labels, |
|
|
const std::vector< std::string > & |
col_category_labels, |
|
|
const std::string & |
top_left_label, |
|
|
std::vector< std::array< ActsUtils::Stat, kNCategorisedStat > > & |
stat_per_category, |
|
|
std::vector< std::array< std::size_t, kNCategorisedCounter > > & |
counts_per_category, |
|
|
bool |
rotate |
|
) |
| const |
|
privateinherited |
Definition at line 717 of file TrackTruthMatchingBaseAlg.cxx.
724 if (!row_category_labels.empty() && !col_category_labels.empty()) {
725 if (row_category_labels.size() * col_category_labels.size() > counts_per_category.size() ) {
726 ATH_MSG_ERROR(
"Mismatch between category labels and number of counters (logic error -> fix needed):"
727 << row_category_labels.size() <<
" * " << col_category_labels.size()
728 <<
" > " << counts_per_category.size() );
730 std::vector<unsigned int> column_precision;
731 column_precision.resize(
rotate ? row_category_labels.size() : col_category_labels.size(), 3
u);
732 assert( stat_per_category.size() == counts_per_category.size());
733 msg() <<
"Hit efficiency : contributing hits over all hits of best matching truth particle" << std::endl
734 << create2DTable( row_category_labels, col_category_labels, top_left_label, stat_per_category,
735 [](
const std::array< ActsUtils::Stat, kNCategorisedStat> &
stat) {
740 .precision(std::vector<unsigned int>(column_precision))
742 msg() <<
"Hit purity : contributing hits of best matching truth particle over all hits on track" << std::endl
743 << create2DTable( row_category_labels, col_category_labels, top_left_label, stat_per_category,
744 [](
const std::array< ActsUtils::Stat, kNCategorisedStat> &
stat) {
749 .precision(std::vector<unsigned int>(column_precision))
751 msg() <<
"Match probability : weighted common hit sum of best matching truth particle over total track weighted hit sum" << std::endl
752 << create2DTable( row_category_labels, col_category_labels, top_left_label, stat_per_category,
753 [](
const std::array< ActsUtils::Stat, kNCategorisedStat> &
stat) {
758 .precision(std::vector<unsigned int>(column_precision))
762 msg() <<
"Reco efficiency : tracks with assoc. truth particle over all selected truth particles with assoc. measurements."
764 << create2DTable( row_category_labels, col_category_labels, top_left_label, counts_per_category,
765 [](
const std::array< std::size_t, kNCategorisedCounter> &
counter) {
771 .precision(std::move(column_precision))
◆ printStatTables()
void ActsTrk::TrackTruthMatchingBaseAlg::printStatTables |
( |
| ) |
const |
|
privateinherited |
Definition at line 548 of file TrackTruthMatchingBaseAlg.cxx.
552 msg() << MSG::INFO << std::endl;
555 std::array<std::string, kNCounter> counter_labels { std::string(
"Number of tracks"),
556 std::string(
"Number of truth particles with hit counts"),
557 std::string(
"Associated truth particles without hit counts"),
558 std::string(
"Tracks without associated truth particle"),
559 std::string(
"Tracks without selected, associated truth particle"),
560 std::string(
"Best truth particle without noise correction mismatch")
562 msg() <<
makeTable( m_counter, counter_labels) << std::endl;
◆ renounce()
◆ renounceArray()
◆ setFilterPassed()
virtual void AthReentrantAlgorithm::setFilterPassed |
( |
bool |
state, |
|
|
const EventContext & |
ctx |
|
) |
| const |
|
inlinevirtualinherited |
◆ sysExecute()
StatusCode AthReentrantAlgorithm::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 67 of file AthReentrantAlgorithm.cxx.
69 return Gaudi::Algorithm::sysExecute (ctx);
◆ sysInitialize()
StatusCode AthReentrantAlgorithm::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 InputMakerBase, and HypoBase.
Definition at line 96 of file AthReentrantAlgorithm.cxx.
107 if ( cs.retrieve().isFailure() ) {
109 return StatusCode::SUCCESS;
111 if (cs->regHandle(
this,*
h).isFailure()) {
112 sc = StatusCode::FAILURE;
113 ATH_MSG_ERROR(
"unable to register WriteCondHandle " <<
h->fullKey()
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ TrackTruthMatchingBaseAlg()
ActsTrk::TrackTruthMatchingBaseAlg::TrackTruthMatchingBaseAlg |
◆ truthSelectionTool()
◆ updateVHKA()
◆ weightedCountSum()
|
inlinestaticprivateinherited |
◆ ATLAS_THREAD_SAFE [1/4]
std::mutex m_statMutex ActsTrk::TrackTruthMatchingBaseAlg::ATLAS_THREAD_SAFE |
|
mutableprivateinherited |
◆ ATLAS_THREAD_SAFE [2/4]
std::array< std::size_t, kNCounter > m_counter ActsTrk::TrackTruthMatchingBaseAlg::ATLAS_THREAD_SAFE {} |
|
mutableprivateinherited |
◆ ATLAS_THREAD_SAFE [3/4]
std::vector< int > m_pdgId ActsTrk::TrackTruthMatchingBaseAlg::ATLAS_THREAD_SAFE |
|
mutableprivateinherited |
◆ ATLAS_THREAD_SAFE [4/4]
◆ m_computeTrackRecoEfficiency
Property<bool> ActsTrk::TrackTruthMatchingBaseAlg::m_computeTrackRecoEfficiency {this, "ComputeTrackRecoEfficiency", true, "Compute and print track reconstruction efficiency."} |
|
privateinherited |
◆ m_debugCounter
◆ m_detStore
◆ m_evtStore
◆ m_extendedExtraObjects
DataObjIDColl AthReentrantAlgorithm::m_extendedExtraObjects |
|
privateinherited |
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
Empty if no symlinks were found.
Definition at line 153 of file AthReentrantAlgorithm.h.
◆ m_pdgIdCategorisation
Property<bool> ActsTrk::TrackTruthMatchingBaseAlg::m_pdgIdCategorisation {this, "PdgIdCategorisation", false, "Categorise by pdg id."} |
|
privateinherited |
◆ m_printDetails
Property<bool> ActsTrk::TrackTruthMatchingBaseAlg::m_printDetails {this, "ShowDetailedTables", false, "Show more details; stat. uncert., RMS, entries"} |
|
privateinherited |
◆ m_showRawCounts
Property<bool> ActsTrk::TrackTruthMatchingBaseAlg::m_showRawCounts {this, "ShowRawCounts", false, "Show all counters."} |
|
privateinherited |
◆ m_statEtaBins
Property<std::vector<float> > ActsTrk::TrackTruthMatchingBaseAlg::m_statEtaBins {this, "StatisticEtaBins", {-4, -2.6, -2, 0, 2., 2.6, 4}, "Gather statistics separately for these eta bins."} |
|
privateinherited |
◆ m_statPtBins
Property<std::vector<float> > ActsTrk::TrackTruthMatchingBaseAlg::m_statPtBins {this, "StatisticPtBins", {1.e3,2.5e3,10e3, 100e3}, "Gather statistics separately for these pt bins."} |
|
privateinherited |
◆ m_trackToTruth
◆ m_truthHitCounts
◆ m_truthSelectionTool
◆ m_useAbsEtaForStat
bool ActsTrk::TrackTruthMatchingBaseAlg::m_useAbsEtaForStat = false |
|
privateinherited |
◆ m_varHandleArraysDeclared
◆ m_vhka
◆ m_weights
Gaudi::Property<std::vector<float> > ActsTrk::TrackTruthMatchingBaseAlg::m_weights |
|
privateinherited |
Initial value:{this, "CountWeights", {}, "Weights applied to the counts per measurement type for weighted sums"
" which are used to compute hit efficiencies and purities." }
Definition at line 158 of file TrackTruthMatchingBaseAlg.h.
◆ m_weightsForProb
Gaudi::Property<std::vector<float> > ActsTrk::TrackTruthMatchingBaseAlg::m_weightsForProb |
|
privateinherited |
Initial value:{this, "MatchWeights", {}, "Weights applied to the counts per measurement type for weighted sums"
" which are used compute the match probability." }
Definition at line 155 of file TrackTruthMatchingBaseAlg.h.
◆ s_NMeasurementTypes
constexpr static unsigned int ActsTrk::TrackTruthMatchingBaseAlg::s_NMeasurementTypes = static_cast<unsigned int>(xAOD::UncalibMeasType::nTypes) - 1u |
|
staticconstexprprivateinherited |
◆ s_pdgIdMax
constexpr static int ActsTrk::TrackTruthMatchingBaseAlg::s_pdgIdMax = 1000000000 |
|
staticconstexprprivateinherited |
The documentation for this class was generated from the following files:
void postProcessEventStat(const TruthParticleHitCounts &truth_particle_hit_counts, std::size_t n_tracks, EventStat &event_stat) const
@ kNParticleWithMultipleAssociatedTracks
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
void rotate(double angler, GeoTrf::Vector2D &vector)
Gaudi::Property< std::vector< float > > m_weightsForProb
std::string find(const std::string &s)
return a remapped string
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
virtual StatusCode initialize() override
StatusCode accept(const xAOD::Muon *mu)
Property< bool > m_printDetails
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)
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool msgLvl(const MSG::Level lvl) const
EventStatBase< TrackFindingValidationDetailedStat > EventStat
const std::string & key() const
Return the StoreGate ID for the referenced object.
SG::ReadHandleKey< TrackToTruthParticleAssociation > m_trackToTruth
int pdg_id() const
PDG ID code.
const IAthSelectionTool & truthSelectionTool() const
@ u
Enums for curvilinear frames.
virtual void setOwner(IDataHandleHolder *o)=0
static double weightedCountSum(const ActsTrk::HitCounterArray &counts, const std::vector< float > &weights)
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
std::size_t getPtPdgIdStatCategory(float pt, int pdg_id) const
Return the category based on the PDG ID.
void fillTruthMatchProb(const std::array< float, 2 > &best_match_prob) const
@ NoAssociatedTruthParticle
Property< std::vector< float > > m_statEtaBins
constexpr static unsigned int s_NMeasurementTypes
AthReentrantAlgorithm()
Default constructor:
TableUtils::StatTable< T > makeTable(const std::array< T, N > &counter, const std::array< std::string, N > &label)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
::StatusCode StatusCode
StatusCode definition for legacy code.
Class describing a truth particle in the MC record.
std::size_t getPtEtaStatCategory(float pt, float eta) const
Return the category based on the provided eta value.
@ TruthParticleNoNoiseMismatch
void checkBinOrder(const std::vector< float > &bin_edges, const std::string &bin_label) const
check that bins are in increasing order.
Property< std::vector< float > > m_statPtBins
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
void fillMeasForTruthParticleWithoutCount(double weighted_measurement_sum) const
virtual bool isValid() override final
Can the handle be successfully dereferenced?
DataObjIDColl m_extendedExtraObjects
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
std::size_t perEtaSize() const
Property< bool > m_computeTrackRecoEfficiency
virtual StatusCode sysInitialize() override
Override sysInitialize.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
std::unordered_map< const xAOD::TruthParticle *, HitCounterArray > TruthParticleHitCounts
@ kNParticleWithAssociatedTrack
constexpr bool TrackFindingValidationDetailedStat
constexpr static int s_pdgIdMax
ToolHandle< IAthSelectionTool > m_truthSelectionTool
Property< bool > m_showRawCounts
#define ATH_MSG_WARNING(x)
@ MissingTruthParticleHitCounts
static constexpr bool doDetail
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
SG::ReadHandleKey< TruthParticleHitCounts > m_truthHitCounts
Gaudi::Property< std::vector< float > > m_weights
DebugCounter< TrackFindingValidationDebugHists > m_debugCounter
TruthMatchResult analyseTrackTruth(const TruthParticleHitCounts &truth_particle_hit_counts, const HitCountsPerTrack &track_hit_counts, EventStat &event_stat) const
static double noiseCorrection(const ActsTrk::HitCounterArray &noise_counts, const std::vector< float > &weights)
@ NoSelectedTruthParticle
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
const TruthParticleHitCounts & getTruthParticleHitCounts(const EventContext &ctx) const
std::size_t perPdgIdSize() const
Property< bool > m_pdgIdCategorisation
float computeRatio(std::size_t numerator, std::size_t denominator)
virtual StatusCode finalize() override