17 ISvcLocator *pSvcLocator) :
62 return StatusCode::SUCCESS;
69 ATH_CHECK(PixelClusterContainer.isValid());
81 measToTruth = measToTruthHandle.
cptr();
87 ATH_CHECK(xaod.
record(std::make_unique<xAOD::TrackMeasurementValidationContainer>(),
88 std::make_unique<xAOD::TrackMeasurementValidationAuxContainer>()));
113 std::vector<bool> keepClusterCollection {};
118 for (std::size_t i(0); i<clusters->size(); ++i) {
119 if (not keepClusterCollection[i])
continue;
128 decorator_measurement_link(*cluster) = std::move(mlink);
135 ATH_MSG_FATAL(
"Invalid pixel detector element for hash " << hashId );
136 return StatusCode::FAILURE;
139 const std::vector<Identifier> rdoList = cluster->
rdoList();
140 std::vector< std::uint64_t > rdoIdentifierList;
141 rdoIdentifierList.reserve(rdoList.size());
142 int rowmin = std::numeric_limits<int>::max();
143 int rowmax = std::numeric_limits<int>::min();
144 int colmin = std::numeric_limits<int>::max();
145 int colmax = std::numeric_limits<int>::min();
146 for(
const Identifier& hitIdentifier : rdoList ){
147 rdoIdentifierList.push_back( hitIdentifier.get_compact() );
151 rowmin = std::min(rowmin, row);
152 rowmax = std::max(rowmax, row);
153 colmin = std::min(colmin, col);
154 colmax = std::max(colmax, col);
161 return StatusCode::FAILURE;
188 decor_detectorElementID(*measurement) = hashId;
189 decor_waferID(*measurement) = waferId.
get_compact();
191 decor_layer(*measurement) =
m_PixelHelper->layer_disk(waferId);
195 decor_eta_module(*measurement) =
m_PixelHelper->eta_module(waferId);
196 decor_phi_module(*measurement) =
m_PixelHelper->phi_module(waferId);
197 decor_omegax(*measurement) = omegax;
198 decor_omegay(*measurement) = omegay;
200 decor_centroid_xphi(*measurement) = centroid.
xPhi();
201 decor_centroid_xeta(*measurement) = centroid.
xEta();
202 decor_side(*measurement) = 0;
203 decor_tots(*measurement) = cluster->
totList();
213 std::size_t measurementIndex = 0;
214 for (std::size_t i(0); i<clusters->size(); ++i) {
215 if (not keepClusterCollection[i])
continue;
222 return StatusCode::FAILURE;
227 if (cluster->
index() >= measToTruth->size()) {
228 ATH_MSG_ERROR(
"PRD index "<< cluster->
index() <<
" not present in the measurement to truth vector with size " << measToTruth->size() );
229 return StatusCode::FAILURE;
232 auto tps = measToTruth->at(cluster->
index());
234 std::vector<unsigned int> tp_indices;
235 std::vector<unsigned int> tp_barcodes;
236 for (
const auto& tp : tps) {
237 tp_indices.push_back(tp->index());
242 decor_truth_indices(*measurement) = std::move(tp_indices);
243 decor_truth_barcode(*measurement) = std::move(tp_barcodes);
248 ATH_MSG_DEBUG(
" recorded PixelPrepData objects: size " << measurements->
size() );
249 return StatusCode::SUCCESS;
254 std::vector<bool>& labels)
const
258 labels.resize(clusters.size(),
true);
259 return StatusCode::SUCCESS;
261 labels.resize(clusters.size(),
false);
277 std::optional<ActsTrk::TrackContainer::ConstTrackProxy> optional_track = *trackLink;
278 if ( not optional_track.has_value() ) {
279 ATH_MSG_ERROR(
"Invalid track link for particle " << trackParticle->index());
280 return StatusCode::FAILURE;
282 ActsTrk::TrackContainer::ConstTrackProxy track = optional_track.value();
285 track.container().trackStateContainer()
286 .visitBackwards(track.tipIndex(),
288 (
const typename ActsTrk::TrackContainer::ConstTrackStateProxy& state)
290 auto flags = state.typeFlags();
291 if (not flags.test(Acts::TrackStateFlag::MeasurementFlag) and
292 not flags.test(Acts::TrackStateFlag::OutlierFlag)) return;
294 auto sl = state.getUncalibratedSourceLink().template get<ATLASUncalibSourceLink>();
295 if (sl == nullptr) return;
297 const xAOD::UncalibratedMeasurement &cluster = getUncalibratedMeasurement(sl);
298 if (cluster.type() != xAOD::UncalibMeasType::PixelClusterType) return;
299 labels.at(cluster.index()) = true;
304 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
ATLAS-specific HepMC functions.
Handle class for reading a decoration on an object.
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_centroid_xphi
SG::ReadHandleKey< xAOD::PixelClusterContainer > m_clustercontainer_key
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_LorentzShift
SG::ReadHandleKey< ActsTrk::MeasurementToTruthParticleAssociation > m_associationMap_key
virtual StatusCode execute(const EventContext &ctx) const override
const PixelID * m_PixelHelper
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_sizeZ
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_centroid_xeta
virtual StatusCode initialize() override
SG::WriteHandleKey< xAOD::TrackMeasurementValidationContainer > m_write_xaod_key
PixelClusterTruthDecoratorAlg(const std::string &name, ISvcLocator *pSvcLocator)
Gaudi::Property< bool > m_keepOnlyOnTrackMeasurements
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
Gaudi::Property< bool > m_useTruthInfo
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_omegay
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_truth_barcodes
StatusCode labelMeasurementToKeep(const EventContext &ctx, const xAOD::PixelClusterContainer &clusters, std::vector< bool > &labels) const
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_omegax
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_side
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_detectorElementID
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_truth_indices
SG::ReadHandleKeyArray< xAOD::TrackParticleContainer > m_trackParticlesKey
ToolHandle< ISiLorentzAngleTool > m_lorentzAngleTool
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_phi_module
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_sizePhi
SG::WriteDecorHandleKey< xAOD::PixelClusterContainer > m_trackMeasurement_link
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_eta_module
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_layer
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_waferID
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_tots
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_bec
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_SiWidth
const ServiceHandle< StoreGateSvc > & detStore() const
An algorithm that can be simultaneously executed in multiple threads.
const T * back() const
Access the last element in the collection as an rvalue.
const T * at(size_type n) const
Access an element, as an rvalue.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
ElementLink implementation for ROOT usage.
bool isValid() const
Test to see if the link can be dereferenced.
value_type get_compact() const
Get the compact id.
Class used to describe the design of a module (diode segmentation and readout scheme)
SiLocalPosition positionFromColumnRow(const int column, const int row) const
Given row and column index of a diode, return position of diode center ALTERNATIVE/PREFERED way is to...
Class to hold the SiDetectorElement objects to be put in the detector store.
const SiDetectorElement * getDetectorElement(const IdentifierHash &hash) const
Class to hold geometrical description of a silicon detector element.
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
Class to represent a position in the natural frame of a silicon sensor, for Pixel and SCT For Pixel: ...
double xPhi() const
position along phi direction:
double xEta() const
position along eta direction:
size_t index() const
Return the index of this element within its container.
Helper class to provide constant type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
const_pointer_type cptr()
Property holding a SG store/key/clid from which a ReadHandle is made.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
Handle class for adding a decoration to an object.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
const std::vector< int > & totList() const
Returns the list of ToT of the channels building the cluster.
int channelsInPhi() const
Returns the dimensions of the cluster in numbers of channels in phi (x) and eta (y) directions,...
const std::vector< Identifier > rdoList() const
Returns the list of identifiers of the channels building the cluster.
ConstVectorMap< 3 > globalPosition() const
Returns the global position of the pixel cluster.
int channelsInEta() const
void setRdoIdentifierList(const std::vector< uint64_t > &rdoIdentifierList)
Sets the list of RDO identifiers.
uint64_t identifier() const
void setLocalPositionError(float localXError, float localYError, float localXYCorrelation)
Sets the local position error.
void setLocalPosition(float localX, float localY)
Sets the local position.
void setIdentifier(uint64_t identifier)
Sets the identifier.
void setGlobalPosition(float globalX, float globalY, float globalZ)
Sets the global position.
ConstMatrixMap< N > localCovariance() const
Returns the local covariance of the measurement.
DetectorIDHashType identifierHash() const
Returns the IdentifierHash of the measurement (corresponds to the detector element IdentifierHash)
DetectorIdentType identifier() const
Returns the full Identifier of the measurement.
ConstVectorMap< N > localPosition() const
Returns the local position of the measurement.
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
std::pair< float, float > computeOmegas(const xAOD::PixelCluster &cluster, const PixelID &pixelID)
PixelClusterContainer_v1 PixelClusterContainer
Define the version of the pixel cluster container.
TrackMeasurementValidation_v1 TrackMeasurementValidation
Reference the current persistent version:
TrackParticle_v1 TrackParticle
Reference the current persistent version:
long unsigned int DetectorIdentType
PixelCluster_v1 PixelCluster
Define the version of the pixel cluster class.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
TrackMeasurementValidationContainer_v1 TrackMeasurementValidationContainer
Definition of the current "TrackMeasurementValidation container version".
unsigned int DetectorIDHashType
@ detector ID element hash