ATLAS Offline Software
Classes | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ActsTrk::TrackToTruthAssociationAlg Class Reference

#include <TrackToTruthAssociationAlg.h>

Inheritance diagram for ActsTrk::TrackToTruthAssociationAlg:
Collaboration diagram for ActsTrk::TrackToTruthAssociationAlg:

Classes

struct  AssociationCounter
 

Public Member Functions

 TrackToTruthAssociationAlg (const std::string &name, ISvcLocator *pSvcLocator)
 
virtual StatusCode initialize () override
 
virtual StatusCode finalize () override
 
virtual StatusCode execute (const EventContext &ctx) const override
 
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
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
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. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

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

Private Attributes

ToolHandle< IActsTrackingGeometryToolm_trackingGeometryTool {this, "TrackingGeometryTool", ""}
 
SG::ReadHandleKey< ActsTrk::TrackContainerm_tracksContainerKey {this, "ACTSTracksLocation", "","Track collection (ActsTrk variant)"}
 
SG::ReadHandleKey< MeasurementToTruthParticleAssociationm_pixelClustersToTruth {this, "PixelClustersToTruthAssociationMap", "", "Association map from pixel measurements to generator particles." }
 
SG::ReadHandleKey< MeasurementToTruthParticleAssociationm_stripClustersToTruth {this, "StripClustersToTruthAssociationMap", "", "Association map from strip measurements to generator particles." }
 
SG::WriteHandleKey< TrackToTruthParticleAssociationm_trackToTruthOut {this, "AssociationMapOut", "", "Output association map from measurements to generator particles." }
 
Gaudi::Property< float > m_maxEnergyLoss {this, "MaxEnergyLoss", 10e12, "Stop moving up the decay chain if the energy loss is above this value." }
 
ElasticDecayUtil< TrackToTruthParticleAssociationDebugHistsm_elasticDecayUtil
 
std::conditional< TrackToTruthParticleAssociationDebugHists, Gaudi::Property< std::vector< float > >, EmptyProperty >::type m_energyLossBinning {this, "EnergyLossBinning", {20.,0.,5.*s_unitGeV}, "Binning to be used for the energy loss histograms." }
 
AssociationCounter< TrackToTruthParticleAssociationDebugHistsm_associationCounter
 
std::array< std::atomic< std::size_t >, s_NCounterForAssociatedTruth > m_nTracksWithAssociatedTruth ATLAS_THREAD_SAFE {}
 
std::atomic< std::size_t > m_nIncompatibleMeasurementContainer {}
 
std::atomic< std::size_t > m_nCcompatibleMeasurementContainer {}
 
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
 

Static Private Attributes

static constexpr float s_unitGeV = 1e3
 
static constexpr unsigned int s_NCounterForAssociatedTruth = 4
 

Detailed Description

Definition at line 44 of file TrackToTruthAssociationAlg.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TrackToTruthAssociationAlg()

ActsTrk::TrackToTruthAssociationAlg::TrackToTruthAssociationAlg ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 30 of file TrackToTruthAssociationAlg.cxx.

32  : AthReentrantAlgorithm(name, pSvcLocator)
33  {
34  }

Member Function Documentation

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

56 {
57  return 0;
58 }

◆ declareGaudiProperty() [1/4]

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

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

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

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

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

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

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

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

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation 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.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation 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.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation 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.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation 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.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

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

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

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

95 { return m_detStore; }

◆ evtStore() [1/2]

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.

85 { return m_evtStore; }

◆ evtStore() [2/2]

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

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

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ execute()

StatusCode ActsTrk::TrackToTruthAssociationAlg::execute ( const EventContext &  ctx) const
overridevirtual

Definition at line 111 of file TrackToTruthAssociationAlg.cxx.

112  {
113  std::unique_ptr<TrackToTruthParticleAssociation>
114  track_association( std::make_unique<TrackToTruthParticleAssociation>() );
115 
117  if (!pixelClustersToTruthAssociation.isValid()) {
118  ATH_MSG_ERROR("No pixel clusterss for key " << m_pixelClustersToTruth.key() );
119  return StatusCode::FAILURE;
120  }
122  if (!stripClustersToTruthAssociation.isValid()) {
123  ATH_MSG_ERROR("No strip clusterss for key " << m_stripClustersToTruth.key() );
124  return StatusCode::FAILURE;
125  }
127  if (!tracksContainer.isValid()) {
128  ATH_MSG_ERROR("No tracks for key " << m_tracksContainerKey.key() );
129  return StatusCode::FAILURE;
130  }
131  track_association->resize( tracksContainer->size() );
132  track_association->setSourceContainer(DataLink<ActsTrk::TrackContainer>(*tracksContainer,ctx));
133  Acts::GeometryContext tgContext = m_trackingGeometryTool->getGeometryContext(ctx).context();
134 
137  measurement_to_truth_association_maps{};
138  measurement_to_truth_association_maps[to_underlying(xAOD::UncalibMeasType::PixelClusterType)]=pixelClustersToTruthAssociation.cptr();
139  measurement_to_truth_association_maps[to_underlying(xAOD::UncalibMeasType::StripClusterType)]=stripClustersToTruthAssociation.cptr();
140  ATH_MSG_DEBUG("Measurement association entries: " << measurement_to_truth_association_maps[to_underlying(xAOD::UncalibMeasType::PixelClusterType)]->size()
141  << " + " << measurement_to_truth_association_maps[to_underlying(xAOD::UncalibMeasType::StripClusterType)]->size()
142  );
143  unsigned int track_i=0;
144  std::array<unsigned int,s_NCounterForAssociatedTruth> tracks_with_associated_truth{};
145  std::pair<unsigned int, unsigned int> compatible_assoc_container_counts{};
147  // used to suppress reoccurring error messages
149  ++compatible_assoc_container_counts.second;
150  }
151 
152  std::vector<unsigned int> counted_truth_particles;
153  counted_truth_particles.reserve(10);
154  --track_i; // to have track_i at the begining of the loop
155  for (const typename ActsTrk::TrackContainer::ConstTrackProxy track : *tracksContainer) {
156  ++track_i;
157  const auto lastMeasurementIndex = track.tipIndex();
158 
159  unsigned int n_measurements=0u;
160 
161  HitCounterArray &reco_hits = track_association->at(track_i).totalCounts();
162  HitCounterArray &noise_hits = track_association->at(track_i).noiseCounts();
163  ActsTrk::HitCountsPerTrack::container &truth_particle_counts = track_association->at(track_i).countsPerTruthParticle();
164  tracksContainer->trackStateContainer().visitBackwards(
165  lastMeasurementIndex,
166  [this,
167  &n_measurements,
168  &measurement_to_truth_association_maps,
169  &truth_particle_counts,
170  &reco_hits,
171  &noise_hits,
172  &counted_truth_particles,
173  &compatible_assoc_container_counts
174  ](const typename ActsTrk::TrackStateBackend::ConstTrackStateProxy &state) -> void
175  {
176  if (!state.typeFlags().test(Acts::TrackStateFlag::OutlierFlag) && state.hasUncalibratedSourceLink()) {
177  auto sl = state.getUncalibratedSourceLink().template get<ATLASUncalibSourceLink>();
178  assert( sl != nullptr );
179  const xAOD::UncalibratedMeasurement &uncalibMeas = getUncalibratedMeasurement(sl);
180 
181 
182  const ActsTrk::MeasurementToTruthParticleAssociation *association_map = measurement_to_truth_association_maps.at(to_underlying(uncalibMeas.type()));
183  if (association_map) {
184  if (!association_map->isCompatibleWith(dynamic_cast< const xAOD::UncalibratedMeasurementContainer *>(uncalibMeas.container()))) {
185  if (compatible_assoc_container_counts.second==0) {
186  ATH_MSG_ERROR("MeasurementToTruthParticleAssociation for measurement type " << to_underlying(uncalibMeas.type())
187  << " is not compatible with the measurement on track.");
188  }
189  ++compatible_assoc_container_counts.second;
190  return;
191  }
192  else {
193  ++compatible_assoc_container_counts.first;
194  }
195  ++n_measurements;
196  counted_truth_particles.clear();
197  for (const xAOD::TruthParticle *truth_particle : association_map->at(uncalibMeas.index()) ) {
198  const xAOD::TruthParticle *mother_particle = m_elasticDecayUtil.getMother(*truth_particle, m_maxEnergyLoss.value());
199 
200  // do not count hits of associated truth particles again if they are associated to the same elastic decay chain:
201  if (std::find(counted_truth_particles.begin(), counted_truth_particles.end(), mother_particle->index())
202  ==counted_truth_particles.end()) {
203  counted_truth_particles.push_back(mother_particle->index());
204 
205  ActsTrk::HitCountsPerTrack::container::iterator
206  hit_count_iter = std::find_if(truth_particle_counts.begin(),
207  truth_particle_counts.end(),
208  [mother_particle](const std::pair<const xAOD::TruthParticle *, HitCounterArray > &a) {
209  return a.first == mother_particle;
210  });
211  if (hit_count_iter == truth_particle_counts.end()) {
212  truth_particle_counts.push_back( std::make_pair(mother_particle, HitCounterArray{}));
213  hit_count_iter = truth_particle_counts.end()-1;
214  }
215  ++(hit_count_iter->second.at( to_underlying(uncalibMeas.type())));
216  }
217  }
218  if (association_map->at(uncalibMeas.index()).empty()) {
219  ++noise_hits.at( to_underlying(uncalibMeas.type()));
220  }
221  }
222  ++reco_hits.at( to_underlying(uncalibMeas.type()));
223  }
224 
225  });
226  std::sort( truth_particle_counts.begin(),
227  truth_particle_counts.end(),
228  [](const std::pair<const xAOD::TruthParticle *, HitCounterArray > &a,
229  const std::pair<const xAOD::TruthParticle *, HitCounterArray > &b) {
230  return std::accumulate(a.second.begin(),a.second.end(),0u) > std::accumulate(b.second.begin(),b.second.end(),0u);
231  });
232  m_associationCounter.fillStatistics(n_measurements, truth_particle_counts.size());
233  ++(tracks_with_associated_truth[std::min(truth_particle_counts.size(),tracks_with_associated_truth.size()-1u)]);
234  }
235  unsigned int idx=0;
236  for (unsigned int elm : tracks_with_associated_truth) {
237  m_nTracksWithAssociatedTruth[idx] += elm;
238  ++idx;
239  }
240  m_nIncompatibleMeasurementContainer += compatible_assoc_container_counts.second;
241  m_nCcompatibleMeasurementContainer += compatible_assoc_container_counts.first;
242 
244  if (associationOutHandle.record( std::move(track_association)).isFailure()) {
245  ATH_MSG_ERROR("Failed to record track to truth assocition with key " << m_trackToTruthOut.key() );
246  return StatusCode::FAILURE;
247  }
248  return StatusCode::SUCCESS;
249  }

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

80 {
81  // If we didn't find any symlinks to add, just return the collection
82  // from the base class. Otherwise, return the extended collection.
83  if (!m_extendedExtraObjects.empty()) {
85  }
86  return Algorithm::extraOutputDeps();
87 }

◆ filterPassed()

virtual bool AthReentrantAlgorithm::filterPassed ( const EventContext &  ctx) const
inlinevirtualinherited

Definition at line 135 of file AthReentrantAlgorithm.h.

135  {
136  return execState( ctx ).filterPassed();
137  }

◆ finalize()

StatusCode ActsTrk::TrackToTruthAssociationAlg::finalize ( )
overridevirtual

Definition at line 76 of file TrackToTruthAssociationAlg.cxx.

77  {
79  ATH_MSG_WARNING( "Encountered measurements not compaible with provided association maps in "
81  }
82  if (msgLvl(MSG::INFO)) {
83  msg(MSG::INFO) << "-- Statistics:" << std::endl;
84  unsigned int idx=0;
85  for (const std::atomic<std::size_t> &elm : m_nTracksWithAssociatedTruth) {
86  msg() << std::setw(20) << elm << " "
87  << (idx==0
88  ? std::string(" tracks without associated truth particles.")
89  : (idx==m_nTracksWithAssociatedTruth.size()-1
90  ? makeLabel(" tracks with more than",
91  m_nTracksWithAssociatedTruth.size()-1,
92  "associated truth particles.")
93  : makeLabel(" tracks with",
94  idx,
95  "associated truth particle(s).")));
96  if (idx!=m_nTracksWithAssociatedTruth.size()-1 || TrackToTruthParticleAssociationDebugHists) {
97  msg() << std::endl;
98  }
99  ++idx;
100  }
103  msg() << std::endl;
105  }
106  msg() << endmsg;
107  }
108  return StatusCode::SUCCESS;
109  }

◆ initialize()

StatusCode ActsTrk::TrackToTruthAssociationAlg::initialize ( )
overridevirtual

Definition at line 36 of file TrackToTruthAssociationAlg.cxx.

37  {
38  ATH_CHECK( m_trackingGeometryTool.retrieve() );
40  ATH_CHECK( m_pixelClustersToTruth.initialize() );
41  ATH_CHECK( m_stripClustersToTruth.initialize() );
42 
43  ATH_CHECK( m_trackToTruthOut.initialize() );
44 
46  return StatusCode::SUCCESS;
47  }

◆ 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()

bool AthReentrantAlgorithm::isClonable ( ) const
overridevirtualinherited

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

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

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

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

◆ 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();
383  PBASE::renounce (h);
384  }

◆ 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  {
365  handlesArray.renounce();
366  }

◆ setFilterPassed()

virtual void AthReentrantAlgorithm::setFilterPassed ( bool  state,
const EventContext &  ctx 
) const
inlinevirtualinherited

Definition at line 139 of file AthReentrantAlgorithm.h.

139  {
140  execState( ctx ).setFilterPassed( state );
141  }

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

68 {
69  return Gaudi::Algorithm::sysExecute (ctx);
70 }

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

96  {
98 
99  if (sc.isFailure()) {
100  return sc;
101  }
102 
103  ServiceHandle<ICondSvc> cs("CondSvc",name());
104  for (auto h : outputHandles()) {
105  if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
106  // do this inside the loop so we don't create the CondSvc until needed
107  if ( cs.retrieve().isFailure() ) {
108  ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
109  return StatusCode::SUCCESS;
110  }
111  if (cs->regHandle(this,*h).isFailure()) {
112  sc = StatusCode::FAILURE;
113  ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
114  << " with CondSvc");
115  }
116  }
117  }
118  return sc;
119 }

◆ 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) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::array<std::atomic<std::size_t>,s_NCounterForAssociatedTruth> m_nTracksWithAssociatedTruth ActsTrk::TrackToTruthAssociationAlg::ATLAS_THREAD_SAFE {}
mutableprivate

Definition at line 101 of file TrackToTruthAssociationAlg.h.

◆ m_associationCounter

AssociationCounter<TrackToTruthParticleAssociationDebugHists> ActsTrk::TrackToTruthAssociationAlg::m_associationCounter
private

Definition at line 99 of file TrackToTruthAssociationAlg.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_elasticDecayUtil

ElasticDecayUtil<TrackToTruthParticleAssociationDebugHists> ActsTrk::TrackToTruthAssociationAlg::m_elasticDecayUtil
private

Definition at line 72 of file TrackToTruthAssociationAlg.h.

◆ m_energyLossBinning

std::conditional<TrackToTruthParticleAssociationDebugHists, Gaudi::Property<std::vector<float> >, EmptyProperty >::type ActsTrk::TrackToTruthAssociationAlg::m_energyLossBinning {this, "EnergyLossBinning", {20.,0.,5.*s_unitGeV}, "Binning to be used for the energy loss histograms." }
private

Definition at line 76 of file TrackToTruthAssociationAlg.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 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_maxEnergyLoss

Gaudi::Property<float> ActsTrk::TrackToTruthAssociationAlg::m_maxEnergyLoss {this, "MaxEnergyLoss", 10e12, "Stop moving up the decay chain if the energy loss is above this value." }
private

Definition at line 69 of file TrackToTruthAssociationAlg.h.

◆ m_nCcompatibleMeasurementContainer

std::atomic<std::size_t> ActsTrk::TrackToTruthAssociationAlg::m_nCcompatibleMeasurementContainer {}
mutableprivate

Definition at line 103 of file TrackToTruthAssociationAlg.h.

◆ m_nIncompatibleMeasurementContainer

std::atomic<std::size_t> ActsTrk::TrackToTruthAssociationAlg::m_nIncompatibleMeasurementContainer {}
mutableprivate

Definition at line 102 of file TrackToTruthAssociationAlg.h.

◆ m_pixelClustersToTruth

SG::ReadHandleKey<MeasurementToTruthParticleAssociation> ActsTrk::TrackToTruthAssociationAlg::m_pixelClustersToTruth {this, "PixelClustersToTruthAssociationMap", "", "Association map from pixel measurements to generator particles." }
private

Definition at line 61 of file TrackToTruthAssociationAlg.h.

◆ m_stripClustersToTruth

SG::ReadHandleKey<MeasurementToTruthParticleAssociation> ActsTrk::TrackToTruthAssociationAlg::m_stripClustersToTruth {this, "StripClustersToTruthAssociationMap", "", "Association map from strip measurements to generator particles." }
private

Definition at line 63 of file TrackToTruthAssociationAlg.h.

◆ m_trackingGeometryTool

ToolHandle<IActsTrackingGeometryTool> ActsTrk::TrackToTruthAssociationAlg::m_trackingGeometryTool {this, "TrackingGeometryTool", ""}
private

Definition at line 55 of file TrackToTruthAssociationAlg.h.

◆ m_tracksContainerKey

SG::ReadHandleKey<ActsTrk::TrackContainer> ActsTrk::TrackToTruthAssociationAlg::m_tracksContainerKey {this, "ACTSTracksLocation", "","Track collection (ActsTrk variant)"}
private

Definition at line 58 of file TrackToTruthAssociationAlg.h.

◆ m_trackToTruthOut

SG::WriteHandleKey<TrackToTruthParticleAssociation> ActsTrk::TrackToTruthAssociationAlg::m_trackToTruthOut {this, "AssociationMapOut", "", "Output association map from measurements to generator particles." }
private

Definition at line 66 of file TrackToTruthAssociationAlg.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.

◆ s_NCounterForAssociatedTruth

constexpr unsigned int ActsTrk::TrackToTruthAssociationAlg::s_NCounterForAssociatedTruth = 4
staticconstexprprivate

Definition at line 100 of file TrackToTruthAssociationAlg.h.

◆ s_unitGeV

constexpr float ActsTrk::TrackToTruthAssociationAlg::s_unitGeV = 1e3
staticconstexprprivate

Definition at line 73 of file TrackToTruthAssociationAlg.h.


The documentation for this class was generated from the following files:
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
ActsTrk::TrackToTruthAssociationAlg::m_associationCounter
AssociationCounter< TrackToTruthParticleAssociationDebugHists > m_associationCounter
Definition: TrackToTruthAssociationAlg.h:99
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
xAOD::UncalibMeasType::StripClusterType
@ StripClusterType
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
AthCommonDataStore::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 > renounce(T &h)
Definition: AthCommonDataStore.h:380
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
AthCommonMsg< Gaudi::Algorithm >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
ActsTrk::MeasurementToTruthParticleAssociation
Definition: MeasurementToTruthParticleAssociation.h:18
ActsTrk::to_underlying
constexpr std::underlying_type< T_EnumClass >::type to_underlying(T_EnumClass an_enum)
Helper to convert class enum into an integer.
Definition: HitSummaryDataUtils.h:24
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:83
ElasticDecayUtil::dumpStatistics
void dumpStatistics(T_OutStream &out) const
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
ActsTrk::TrackToTruthAssociationAlg::AssociationCounter::fillStatistics
void fillStatistics(unsigned int n_measurements, unsigned int n_particles) const
Definition: TrackToTruthAssociationAlg.cxx:60
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:269
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
ActsTrk::HitCountsPerTrack::container
boost::container::small_vector< std::pair< const xAOD::TruthParticle *, HitCounterArray >, NTruthParticlesPerTrack > container
Definition: TrackToTruthParticleAssociation.h:39
AthCommonDataStore
Definition: AthCommonDataStore.h:52
AthReentrantAlgorithm::AthReentrantAlgorithm
AthReentrantAlgorithm()
Default constructor:
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ActsTrk::TrackToTruthAssociationAlg::m_elasticDecayUtil
ElasticDecayUtil< TrackToTruthParticleAssociationDebugHists > m_elasticDecayUtil
Definition: TrackToTruthAssociationAlg.h:72
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
AthReentrantAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
Definition: AthReentrantAlgorithm.h:153
ActsTrk::TrackToTruthAssociationAlg::m_stripClustersToTruth
SG::ReadHandleKey< MeasurementToTruthParticleAssociation > m_stripClustersToTruth
Definition: TrackToTruthAssociationAlg.h:64
min
#define min(a, b)
Definition: cfImp.cxx:40
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
lumiFormat.array
array
Definition: lumiFormat.py:98
xAOD::UncalibMeasType::nTypes
@ nTypes
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
AthReentrantAlgorithm::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition: AthReentrantAlgorithm.cxx:96
ActsTrk::TrackToTruthAssociationAlg::m_energyLossBinning
std::conditional< TrackToTruthParticleAssociationDebugHists, Gaudi::Property< std::vector< float > >, EmptyProperty >::type m_energyLossBinning
Definition: TrackToTruthAssociationAlg.h:77
ActsTrk::TrackToTruthAssociationAlg::m_nCcompatibleMeasurementContainer
std::atomic< std::size_t > m_nCcompatibleMeasurementContainer
Definition: TrackToTruthAssociationAlg.h:103
ActsTrk::TrackToTruthParticleAssociationDebugHists
constexpr bool TrackToTruthParticleAssociationDebugHists
Definition: TrackToTruthAssociationAlg.h:42
ActsTrk::TrackToTruthAssociationAlg::m_trackingGeometryTool
ToolHandle< IActsTrackingGeometryTool > m_trackingGeometryTool
Definition: TrackToTruthAssociationAlg.h:56
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
ActsTrk::TrackToTruthAssociationAlg::m_pixelClustersToTruth
SG::ReadHandleKey< MeasurementToTruthParticleAssociation > m_pixelClustersToTruth
Definition: TrackToTruthAssociationAlg.h:62
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ActsTrk::TrackToTruthAssociationAlg::m_nIncompatibleMeasurementContainer
std::atomic< std::size_t > m_nIncompatibleMeasurementContainer
Definition: TrackToTruthAssociationAlg.h:102
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AthCommonMsg< Gaudi::Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
ActsTrk::TrackToTruthAssociationAlg::m_tracksContainerKey
SG::ReadHandleKey< ActsTrk::TrackContainer > m_tracksContainerKey
Definition: TrackToTruthAssociationAlg.h:59
ActsTrk::TrackToTruthAssociationAlg::AssociationCounter::dumpStatistics
void dumpStatistics(T_OutStream &out) const
Definition: TrackToTruthAssociationAlg.cxx:51
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
ElasticDecayUtil::setEnergyLossBinning
void setEnergyLossBinning(const typename std::conditional< IsDebug, std::vector< float >, EmptyProperty >::type &binning)
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
xAOD::UncalibMeasType::PixelClusterType
@ PixelClusterType
fitman.k
k
Definition: fitman.py:528
ActsTrk::TrackToTruthAssociationAlg::m_trackToTruthOut
SG::WriteHandleKey< TrackToTruthParticleAssociation > m_trackToTruthOut
Definition: TrackToTruthAssociationAlg.h:67
ServiceHandle< ICondSvc >