Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:26:12

0001 /** \Class GEMMaskReClusterizer
0002  *  \author J.C. Sanabria -- UniAndes, Bogota
0003  */
0004 #include "RecoLocalMuon/GEMRecHit/interface/GEMCluster.h"
0005 #include "RecoLocalMuon/GEMRecHit/interface/GEMMaskReClusterizer.h"
0006 
0007 GEMClusterContainer GEMMaskReClusterizer::doAction(const GEMDetId& id,
0008                                                    GEMClusterContainer& initClusters,
0009                                                    const EtaPartitionMask& mask) const {
0010   GEMClusterContainer finClusters;
0011   if (initClusters.empty())
0012     return finClusters;
0013 
0014   GEMCluster prev = *initClusters.begin();
0015   for (auto cl = std::next(initClusters.begin()); cl != initClusters.end(); ++cl) {
0016     // Merge this cluster if it is adjacent by 1 masked strip
0017     // Note that the GEMClusterContainer collection is sorted in DECREASING ORDER of strip #
0018     // So the prev. cluster is placed after the current cluster (check the < operator of GEMCluster carefully)
0019     if ((prev.firstStrip() - cl->lastStrip()) == 2 and this->get(mask, cl->lastStrip() + 1) and prev.bx() == cl->bx()) {
0020       prev = GEMCluster(cl->firstStrip(), prev.lastStrip(), cl->bx());
0021     } else {
0022       finClusters.insert(prev);
0023       prev = *cl;
0024     }
0025   }
0026 
0027   // Finalize by putting the last cluster to the collection
0028   finClusters.insert(prev);
0029 
0030   return finClusters;
0031 }
0032 
0033 bool GEMMaskReClusterizer::get(const EtaPartitionMask& mask, int strip) const { return mask.test(strip); }