166 m_chrono->chronoStart(
"FPGAOutputValidationAlg::pixel diff");
175 const auto& pixelClusters0 = *handle0;
176 std::unordered_multimap<xAOD::DetectorIDHashType, const xAOD::PixelCluster*> pixelClustersHashIdMap0;
177 for (
const auto* cluster0 : pixelClusters0) {
179 pixelClustersHashIdMap0.insert(std::make_pair(hashId0, cluster0));
181 const std::vector<ClusterPair<xAOD::PixelCluster>> pixelClusterPairsWithCommonRdos = findNonMergedClusters(pixelClustersHashIdMap0);
182 if (pixelClusterPairsWithCommonRdos.size() > 0) {
183 std::stringstream
ss;
184 for (
const auto&
pair : pixelClusterPairsWithCommonRdos) {
185 ss <<
"Found " <<
pair.commonRDOs <<
" common RDOs between clusters with hash "
186 <<
pair.clusters.first->identifierHash() <<
": "
187 <<
pair.clusters.first->identifier() <<
" and "
188 <<
pair.clusters.second->identifier() <<
"\n";
195 std::unordered_multimap<xAOD::DetectorIdentType, const xAOD::PixelCluster*> pixelClustersMap1;
196 std::unordered_multimap<xAOD::DetectorIDHashType, const xAOD::PixelCluster*> pixelClustersHashIdMap1;
197 for (
const auto* cluster1 : pixelClusters1) {
200 pixelClustersMap1.insert(std::make_pair(id1, cluster1));
201 pixelClustersHashIdMap1.insert(std::make_pair(hashId1, cluster1));
204 for (
auto cluster0 : *handle0) {
205 const std::vector<const xAOD::PixelCluster*> matchedClusters = findMatchingCluster(cluster0, pixelClustersMap1, pixelClustersHashIdMap1,
209 if (matchedClusters.size() == 0) {
210 std::vector<std::string>
regions {
"all"};
211 if(
m_pixelid->barrel_ec(cluster0->rdoList()[0]) == 0)
regions.push_back(
"barrel");
212 else regions.push_back(
"endcap");
213 for (
const auto& region :
regions) {
217 Monitored::Scalar<float>(handle0.
key() +
"_UNMATCHED_GLOBALPOSITION_R_" + region, sqrt(cluster0->globalPosition()[0]*cluster0->globalPosition()[0] +
218 cluster0->globalPosition()[1]*cluster0->globalPosition()[1])),
224 if (matchedClusters.size() > 1) {
226 return StatusCode::FAILURE;
231 std::vector<std::string>
regions {
"all"};
232 if(
m_pixelid->barrel_ec(cluster0->rdoList()[0]) == 0)
regions.push_back(
"barrel");
233 else regions.push_back(
"endcap");
235 for(
auto const& region:
regions)
261 cluster0->localPosition<2>()[0] - cluster1->
localPosition<2>()[0]),
263 cluster0->localPosition<2>()[1] - cluster1->
localPosition<2>()[1]),
265 cluster0->localCovariance<2>()(0, 0) - cluster1->
localCovariance<2>()(0, 0)),
267 cluster0->localCovariance<2>()(1, 1) - cluster1->
localCovariance<2>()(1, 1)),
279 m_chrono->chronoStop(
"FPGAOutputValidationAlg::pixel diff");
283 m_chrono->chronoStart(
"FPGAOutputValidationAlg::strip diff");
293 std::unordered_multimap<xAOD::DetectorIDHashType, const xAOD::StripCluster*> stripClustersHashIdMap0;
294 for (
const auto* cluster0 : stripClusters0) {
296 stripClustersHashIdMap0.insert(std::make_pair(hashId0, cluster0));
300 const std::vector<ClusterPair<xAOD::StripCluster>> stripPairsWithCommonRdos = findNonMergedClusters(stripClustersHashIdMap0);
303 if (stripPairsWithCommonRdos.size() > 0) {
304 std::stringstream
ss;
305 for (
const auto&
pair : stripPairsWithCommonRdos) {
306 ss <<
"Found " <<
pair.commonRDOs <<
" common RDOs between clusters with hash "
307 <<
pair.clusters.first->identifierHash() <<
": "
308 <<
pair.clusters.first->identifier() <<
" and "
309 <<
pair.clusters.second->identifier() <<
"\n";
315 std::unordered_multimap<xAOD::DetectorIdentType, const xAOD::StripCluster*> stripClustersMap1;
316 std::unordered_multimap<xAOD::DetectorIDHashType, const xAOD::StripCluster*> stripClustersHashIdMap1;
317 for (
const auto *cluster1 : stripClusters1) {
320 stripClustersMap1.insert(std::make_pair(id1, cluster1));
321 stripClustersHashIdMap1.insert(std::make_pair(hashId1, cluster1));
325 for (
auto cluster0 : *handle0) {
326 const std::vector<const xAOD::StripCluster*> matchedClusters = findMatchingCluster(cluster0, stripClustersMap1, stripClustersHashIdMap1,
330 if (matchedClusters.size() == 0 && handle1->size() > 0) {
331 std::vector<std::string>
regions {
"all"};
332 if(
m_stripid->barrel_ec(cluster0->rdoList()[0]) == 0)
regions.push_back(
"barrel");
333 else regions.push_back(
"endcap");
334 for (
const auto& region :
regions) {
338 Monitored::Scalar<float>(handle0.
key() +
"_UNMATCHED_GLOBALPOSITION_R_" + region, sqrt(cluster0->globalPosition()[0]*cluster0->globalPosition()[0] +
339 cluster0->globalPosition()[1]*cluster0->globalPosition()[1])),
345 if (matchedClusters.size() > 1) {
347 return StatusCode::FAILURE;
352 std::vector<std::string>
regions {
"all"};
353 if(
m_stripid->barrel_ec(cluster0->rdoList()[0]) == 0)
regions.push_back(
"barrel");
354 else regions.push_back(
"endcap");
356 for(
auto const& region:
regions)
378 cluster0->localPosition<1>()[0] - cluster1->
localPosition<1>()[0]),
380 cluster0->localPosition<1>()[0] - cluster1->
localPosition<1>()[0]),
382 cluster0->localCovariance<1>()(0, 0) - cluster1->
localCovariance<1>()(0, 0)),
394 m_chrono->chronoStop(
"FPGAOutputValidationAlg::strip diff");
403 for(
auto cluster : *handle)
405 std::vector<std::string>
regions {
"all"};
406 if(
m_pixelid->barrel_ec(cluster->rdoList()[0]) == 0)
regions.push_back(
"barrel");
407 else regions.push_back(
"endcap");
409 for(
auto const& region:
regions)
434 for(
auto cluster : *handle)
436 std::vector<std::string>
regions {
"all"};
437 if(
m_stripid->barrel_ec(cluster->rdoList()[0]) == 0)
regions.push_back(
"barrel");
438 else regions.push_back(
"endcap");
440 for(
auto const& region:
regions)
456 return StatusCode::SUCCESS;