Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:51:20

0001 #include "DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h"
0002 #include "DataFormats/SiStripCluster/interface/SiStripCluster.h"
0003 #include <algorithm>
0004 #include <cmath>
0005 
0006 SiStripApproximateCluster::SiStripApproximateCluster(const SiStripCluster& cluster, unsigned int maxNSat) {
0007   barycenter_ = std::round(cluster.barycenter() * 10);
0008   width_ = cluster.size();
0009   avgCharge_ = cluster.charge() / cluster.size();
0010   isSaturated_ = false;
0011 
0012   //mimicing the algorithm used in StripSubClusterShapeTrajectoryFilter...
0013   //Looks for 3 adjacent saturated strips (ADC>=254)
0014   const auto& ampls = cluster.amplitudes();
0015   unsigned int thisSat = (ampls[0] >= 254), maxSat = thisSat;
0016   for (unsigned int i = 1, n = ampls.size(); i < n; ++i) {
0017     if (ampls[i] >= 254) {
0018       thisSat++;
0019     } else if (thisSat > 0) {
0020       maxSat = std::max<int>(maxSat, thisSat);
0021       thisSat = 0;
0022     }
0023   }
0024   if (thisSat > 0) {
0025     maxSat = std::max<int>(maxSat, thisSat);
0026   }
0027   if (maxSat >= maxNSat) {
0028     isSaturated_ = true;
0029   }
0030 }