Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:12:38

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