167 m_chrono->chronoStart(
"FPGAOutputValidationAlg::pixel diff");
176 const auto& pixelClusters0 = *handle0;
177 std::unordered_multimap<xAOD::DetectorIDHashType, const xAOD::PixelCluster*> pixelClustersHashIdMap0;
178 for (
const auto* cluster0 : pixelClusters0) {
180 pixelClustersHashIdMap0.insert(std::make_pair(hashId0, cluster0));
182 const std::vector<ClusterPair<xAOD::PixelCluster>> pixelClusterPairsWithCommonRdos = findNonMergedClusters(pixelClustersHashIdMap0);
183 if (pixelClusterPairsWithCommonRdos.size() > 0) {
184 std::stringstream
ss;
185 for (
const auto&
pair : pixelClusterPairsWithCommonRdos) {
186 ss <<
"Found " <<
pair.commonRDOs <<
" common RDOs between clusters with hash "
187 <<
pair.clusters.first->identifierHash() <<
": "
188 <<
pair.clusters.first->identifier() <<
" and "
189 <<
pair.clusters.second->identifier() <<
"\n";
196 std::unordered_multimap<xAOD::DetectorIdentType, const xAOD::PixelCluster*> pixelClustersMap1;
197 std::unordered_multimap<xAOD::DetectorIDHashType, const xAOD::PixelCluster*> pixelClustersHashIdMap1;
198 for (
const auto* cluster1 : pixelClusters1) {
201 pixelClustersMap1.insert(std::make_pair(id1, cluster1));
202 pixelClustersHashIdMap1.insert(std::make_pair(hashId1, cluster1));
205 for (
auto cluster0 : *handle0) {
206 const std::vector<const xAOD::PixelCluster*> matchedClusters = findMatchingCluster(cluster0, pixelClustersMap1, pixelClustersHashIdMap1,
210 if (matchedClusters.size() == 0) {
211 std::vector<std::string>
regions {
"all"};
212 if(
m_pixelid->barrel_ec(cluster0->rdoList()[0]) == 0)
regions.push_back(
"barrel");
213 else regions.push_back(
"endcap");
214 for (
const auto& region :
regions) {
218 Monitored::Scalar<float>(handle0.
key() +
"_UNMATCHED_GLOBALPOSITION_R_" + region, sqrt(cluster0->globalPosition()[0]*cluster0->globalPosition()[0] +
219 cluster0->globalPosition()[1]*cluster0->globalPosition()[1])),
225 if (matchedClusters.size() > 1) {
227 return StatusCode::FAILURE;
232 std::vector<std::string>
regions {
"all"};
233 if(
m_pixelid->barrel_ec(cluster0->rdoList()[0]) == 0)
regions.push_back(
"barrel");
234 else regions.push_back(
"endcap");
236 for(
auto const& region:
regions)
262 cluster0->localPosition<2>()[0] - cluster1->
localPosition<2>()[0]),
264 cluster0->localPosition<2>()[1] - cluster1->
localPosition<2>()[1]),
266 cluster0->localCovariance<2>()(0, 0) - cluster1->
localCovariance<2>()(0, 0)),
268 cluster0->localCovariance<2>()(1, 1) - cluster1->
localCovariance<2>()(1, 1)),
280 m_chrono->chronoStop(
"FPGAOutputValidationAlg::pixel diff");
284 m_chrono->chronoStart(
"FPGAOutputValidationAlg::strip diff");
294 std::unordered_multimap<xAOD::DetectorIDHashType, const xAOD::StripCluster*> stripClustersHashIdMap0;
295 for (
const auto* cluster0 : stripClusters0) {
297 stripClustersHashIdMap0.insert(std::make_pair(hashId0, cluster0));
301 const std::vector<ClusterPair<xAOD::StripCluster>> stripPairsWithCommonRdos = findNonMergedClusters(stripClustersHashIdMap0);
304 if (stripPairsWithCommonRdos.size() > 0) {
305 std::stringstream
ss;
306 for (
const auto&
pair : stripPairsWithCommonRdos) {
307 ss <<
"Found " <<
pair.commonRDOs <<
" common RDOs between clusters with hash "
308 <<
pair.clusters.first->identifierHash() <<
": "
309 <<
pair.clusters.first->identifier() <<
" and "
310 <<
pair.clusters.second->identifier() <<
"\n";
316 std::unordered_multimap<xAOD::DetectorIdentType, const xAOD::StripCluster*> stripClustersMap1;
317 std::unordered_multimap<xAOD::DetectorIDHashType, const xAOD::StripCluster*> stripClustersHashIdMap1;
318 for (
const auto *cluster1 : stripClusters1) {
321 stripClustersMap1.insert(std::make_pair(id1, cluster1));
322 stripClustersHashIdMap1.insert(std::make_pair(hashId1, cluster1));
326 for (
auto cluster0 : *handle0) {
327 const std::vector<const xAOD::StripCluster*> matchedClusters = findMatchingCluster(cluster0, stripClustersMap1, stripClustersHashIdMap1,
331 if (matchedClusters.size() == 0 && handle1->size() > 0) {
332 std::vector<std::string>
regions {
"all"};
333 if(
m_stripid->barrel_ec(cluster0->rdoList()[0]) == 0)
regions.push_back(
"barrel");
334 else regions.push_back(
"endcap");
335 for (
const auto& region :
regions) {
339 Monitored::Scalar<float>(handle0.
key() +
"_UNMATCHED_GLOBALPOSITION_R_" + region, sqrt(cluster0->globalPosition()[0]*cluster0->globalPosition()[0] +
340 cluster0->globalPosition()[1]*cluster0->globalPosition()[1])),
346 if (matchedClusters.size() > 1) {
348 return StatusCode::FAILURE;
353 std::vector<std::string>
regions {
"all"};
354 if(
m_stripid->barrel_ec(cluster0->rdoList()[0]) == 0)
regions.push_back(
"barrel");
355 else regions.push_back(
"endcap");
357 for(
auto const& region:
regions)
379 cluster0->localPosition<1>()[0] - cluster1->
localPosition<1>()[0]),
381 cluster0->localPosition<1>()[0] - cluster1->
localPosition<1>()[0]),
383 cluster0->localCovariance<1>()(0, 0) - cluster1->
localCovariance<1>()(0, 0)),
395 m_chrono->chronoStop(
"FPGAOutputValidationAlg::strip diff");
404 for(
auto cluster : *handle)
406 std::vector<std::string>
regions {
"all"};
407 if(
m_pixelid->barrel_ec(cluster->rdoList()[0]) == 0)
regions.push_back(
"barrel");
408 else regions.push_back(
"endcap");
410 for(
auto const& region:
regions)
435 for(
auto cluster : *handle)
437 std::vector<std::string>
regions {
"all"};
438 if(
m_stripid->barrel_ec(cluster->rdoList()[0]) == 0)
regions.push_back(
"barrel");
439 else regions.push_back(
"endcap");
441 for(
auto const& region:
regions)
457 return StatusCode::SUCCESS;