65 {
66
67
71
74 const InDetDD::SiDetectorElementCollection* pixelDetEle = pixelDetEleHandle.
cptr();
75
76
77 const MeasurementToTruthParticleAssociation* measToTruth(nullptr);
81 measToTruth = measToTruthHandle.
cptr();
82 }
83
84
85
87 ATH_CHECK(xaod.
record(std::make_unique<xAOD::TrackMeasurementValidationContainer>(),
88 std::make_unique<xAOD::TrackMeasurementValidationAuxContainer>()));
89
90
93
95 SG::WriteDecorHandle<xAOD::TrackMeasurementValidationContainer, int> decor_waferID (
m_measurement_waferID, ctx );
96 SG::WriteDecorHandle<xAOD::TrackMeasurementValidationContainer, int> decor_bec (
m_measurement_bec, ctx );
97 SG::WriteDecorHandle<xAOD::TrackMeasurementValidationContainer, int> decor_layer (
m_measurement_layer, ctx );
98 SG::WriteDecorHandle<xAOD::TrackMeasurementValidationContainer, int> decor_sizePhi (
m_measurement_sizePhi, ctx );
99 SG::WriteDecorHandle<xAOD::TrackMeasurementValidationContainer, int> decor_sizeZ (
m_measurement_sizeZ, ctx );
100 SG::WriteDecorHandle<xAOD::TrackMeasurementValidationContainer, int> decor_SiWidth(
m_measurement_SiWidth, ctx );
101 SG::WriteDecorHandle<xAOD::TrackMeasurementValidationContainer, int> decor_eta_module (
m_measurement_eta_module, ctx );
102 SG::WriteDecorHandle<xAOD::TrackMeasurementValidationContainer, int> decor_phi_module (
m_measurement_phi_module, ctx );
103 SG::WriteDecorHandle<xAOD::TrackMeasurementValidationContainer, float> decor_omegax (
m_measurement_omegax, ctx );
104 SG::WriteDecorHandle<xAOD::TrackMeasurementValidationContainer, float> decor_omegay (
m_measurement_omegay, ctx );
105 SG::WriteDecorHandle<xAOD::TrackMeasurementValidationContainer, float> decor_LorentzShift (
m_measurement_LorentzShift, ctx );
108 SG::WriteDecorHandle<xAOD::TrackMeasurementValidationContainer, int> decor_side (
m_measurement_side, ctx );
109
110 SG::WriteDecorHandle<xAOD::TrackMeasurementValidationContainer, std::vector<int>> decor_tots (
m_measurement_tots, ctx );
111
112
113 std::vector<bool> keepClusterCollection {};
116
117
119 if (not keepClusterCollection[i]) continue;
121
125 measurements->
back()->index() );
126
128 decorator_measurement_link(*cluster) = std::move(mlink);
129
132
134 if ( not element ) {
135 ATH_MSG_FATAL(
"Invalid pixel detector element for hash " << hashId );
136 return StatusCode::FAILURE;
137 }
138
141 std::vector< std::uint64_t > rdoIdentifierList;
142 rdoIdentifierList.reserve(rdoList.size());
143 int rowmin = std::numeric_limits<int>::max();
144 int rowmax = std::numeric_limits<int>::min();
145 int colmin = std::numeric_limits<int>::max();
146 int colmax = std::numeric_limits<int>::min();
147 for( const Identifier::value_type& hitIdentifierValue : rdoList ){
148 Identifier hitIdentifier(hitIdentifierValue);
149 rdoIdentifierList.push_back( hitIdentifier.get_compact() );
150
153 rowmin = std::min(rowmin, row);
154 rowmax = std::max(rowmax, row);
155 colmin = std::min(colmin, col);
156 colmax = std::max(colmax, col);
157 }
158
159
160 const InDetDD::PixelModuleDesign* design = dynamic_cast<const InDetDD::PixelModuleDesign*>(&element->design());
161 if (not design) {
163 return StatusCode::FAILURE;
164 }
165 InDetDD::SiLocalPosition pos1 = design->positionFromColumnRow(colmin,rowmin);
166 InDetDD::SiLocalPosition pos2 = design->positionFromColumnRow(colmax,rowmin);
167 InDetDD::SiLocalPosition pos3 = design->positionFromColumnRow(colmin,rowmax);
168 InDetDD::SiLocalPosition pos4 = design->positionFromColumnRow(colmax,rowmax);
169 InDetDD::SiLocalPosition centroid = 0.25 * (pos1 + pos2 + pos3 + pos4);
170
171
174
175
178
179
182
185
188
190 decor_detectorElementID(*measurement) = hashId;
191 decor_waferID(*measurement) = waferId.
get_compact();
193 decor_layer(*measurement) =
m_PixelHelper->layer_disk(waferId);
197 decor_eta_module(*measurement) =
m_PixelHelper->eta_module(waferId);
198 decor_phi_module(*measurement) =
m_PixelHelper->phi_module(waferId);
199 decor_omegax(*measurement) = omegax;
200 decor_omegay(*measurement) = omegay;
202 decor_centroid_xphi(*measurement) = centroid.
xPhi();
203 decor_centroid_xeta(*measurement) = centroid.
xEta();
204 decor_side(*measurement) = 0;
205 decor_tots(*measurement) = cluster->
totList();
206 }
207
208
209
211 SG::WriteDecorHandle<xAOD::TrackMeasurementValidationContainer, std::vector<unsigned int>> decor_truth_indices(
m_measurement_truth_indices, ctx );
212 SG::WriteDecorHandle<xAOD::TrackMeasurementValidationContainer, std::vector<unsigned int>> decor_truth_barcode(
m_measurement_truth_barcodes, ctx );
213
214
215 std::size_t measurementIndex = 0;
217 if (not keepClusterCollection[i]) continue;
220
221
224 return StatusCode::FAILURE;
225 }
226
227
228
229 if (cluster->index() >= measToTruth->size()) {
230 ATH_MSG_ERROR(
"PRD index "<< cluster->index() <<
" not present in the measurement to truth vector with size " << measToTruth->size() );
231 return StatusCode::FAILURE;
232 }
233
234 auto tps = measToTruth->at(cluster->index());
235
236 std::vector<unsigned int> tp_indices;
237 std::vector<unsigned int> tp_barcodes;
238 for (const auto& tp : tps) {
239 tp_indices.push_back(tp->index());
241 }
242
243
244 decor_truth_indices(*measurement) = std::move(tp_indices);
245 decor_truth_barcode(*measurement) = std::move(tp_barcodes);
246 ++measurementIndex;
247 }
248 }
249
250 ATH_MSG_DEBUG(
" recorded PixelPrepData objects: size " << measurements->
size() );
251 return StatusCode::SUCCESS;
252}
#define ATH_CHECK
Evaluate an expression and check for errors.
ElementLink()
Default constructor.
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
const PixelID * m_PixelHelper
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_sizeZ
SG::WriteDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_measurement_centroid_xeta
SG::WriteHandleKey< xAOD::TrackMeasurementValidationContainer > m_write_xaod_key
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
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 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.
value_type get_compact() const
Get the compact id.
const SiDetectorElement * getDetectorElement(const IdentifierHash &hash) const
double xPhi() const
position along phi direction:
double xEta() const
position along eta direction:
const_pointer_type cptr()
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.
SG::ConstAccessor< SG::JaggedVecElt< Identifier::value_type > >::element_type rdoList() const
Returns the list of identifiers 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,...
ConstVectorMap< 3 > globalPosition() const
Returns the global position of the pixel cluster.
SG::ConstAccessor< SG::JaggedVecElt< int > >::element_type totList() const
Returns the list of ToT of the channels building the 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.
row
Appending html table to final .html summary file.
SG::ConstAccessor< T, ALLOC > ConstAccessor
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:
long unsigned int DetectorIdentType
PixelCluster_v1 PixelCluster
Define the version of the pixel cluster class.
TrackMeasurementValidationContainer_v1 TrackMeasurementValidationContainer
Definition of the current "TrackMeasurementValidation container version".
unsigned int DetectorIDHashType
@ detector ID element hash