6#include "Acts/EventData/TrackStateType.hpp"
15 ISvcLocator* pSvcLocator)
27 return StatusCode::SUCCESS;
33 std::array<std::string, kNStat>{
35 "N. Pixel Measurements",
36 "N. Strip Measurements",
37 "N. Hgtd Measurements"
39 return StatusCode::SUCCESS;
50 ATH_MSG_DEBUG(
" \\__ Number of retrieved tracks: " << tracks->size());
58 inputPrdMap = inputPrdMapHandle.
cptr();
59 ATH_MSG_DEBUG(
" \\__ Number of already used measurement from previous passes: " << inputPrdMap->
size());
64 if (inputPrdMap ==
nullptr) {
65 ATH_CHECK( outputPrdMapHandle.
record( std::make_unique< ActsTrk::PrepRawDataAssociation >() ) );
67 ATH_CHECK( outputPrdMapHandle.
record( std::make_unique< ActsTrk::PrepRawDataAssociation >( *inputPrdMap ) ) );
72 enum class RecordStatus :
int {UNKNOWN=0,
SUCCESS, NOSOURCELINK, NULLSOURCELINK, ALREADYSTORED};
73 std::size_t nMeasurements = 0ul;
74 RecordStatus status = RecordStatus::UNKNOWN;
76 for (std::size_t i(0ul); i<tracks->size(); ++i) {
77 tracks->trackStateContainer().visitBackwards(tracks->getTrack(i).tipIndex(),
78 [&prdMap, &nMeasurements, &status,
this]
79 (
const auto state) ->
bool
82 if (not state.typeFlags().test(Acts::TrackStateFlag::MeasurementFlag)) return true;
85 if ( not state.hasUncalibratedSourceLink() ) {
86 status = RecordStatus::NOSOURCELINK;
92 status = RecordStatus::NULLSOURCELINK;
97 switch(uncalibMeas.
type()) {
114 status = RecordStatus::ALREADYSTORED;
117 status = RecordStatus::SUCCESS;
120 if (status == RecordStatus::SUCCESS)
continue;
123 case RecordStatus::NOSOURCELINK:
124 {
ATH_MSG_ERROR(
"There was a problem when storing the Prd collections");
126 return StatusCode::FAILURE;
127 case RecordStatus::NULLSOURCELINK:
128 {
ATH_MSG_ERROR(
"There was a problem when storing the Prd collections");
130 return StatusCode::FAILURE;
131 case RecordStatus::ALREADYSTORED:
134 {
ATH_MSG_DEBUG(
"There was a problem when storing the Prd collections");
138 {
ATH_MSG_WARNING(
"There was a problem when storing the Prd collections");
144 ATH_MSG_DEBUG(
"Number of used measurements: " << prdMap->size() <<
" from " << tracks->size() <<
" tracks");
145 ATH_MSG_DEBUG(
" \\__ Found a total of " << nMeasurements <<
" measurements");
147 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
TableUtils::StatTable< T > makeTable(const std::array< T, N > &counter, const std::array< std::string, N > &label)
SG::ReadHandleKey< ActsTrk::TrackContainer > m_inputTrackCollections
SG::ReadHandleKey< ActsTrk::PrepRawDataAssociation > m_inputPrdMap
virtual StatusCode finalize() override
PrdAssociationAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::WriteHandleKey< ActsTrk::PrepRawDataAssociation > m_outputPrdMap
virtual StatusCode initialize() override
virtual StatusCode execute(const EventContext &ctx) const override
std::pair< typename std::unordered_set< xAOD::DetectorIdentType >::iterator, bool > markAsUsed(xAOD::DetectorIdentType id)
An algorithm that can be simultaneously executed in multiple threads.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
DetectorIdentType identifier() const
Returns the full Identifier of the measurement.
virtual xAOD::UncalibMeasType type() const =0
Returns the type of the measurement type as a simple enumeration.
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
const xAOD::UncalibratedMeasurement & getUncalibratedMeasurement(const ATLASUncalibSourceLink &source_link)
const xAOD::UncalibratedMeasurement * ATLASUncalibSourceLink
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.