diff --git a/DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h b/DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h index 825551016e0c5..159820b3618f4 100644 --- a/DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h +++ b/DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h @@ -13,21 +13,24 @@ class SiStripApproximateCluster { public: SiStripApproximateCluster() {} - explicit SiStripApproximateCluster(float barycenter, uint8_t width, float avgCharge) { + explicit SiStripApproximateCluster(float barycenter, uint8_t width, float avgCharge, bool isSaturated) { barycenter_ = barycenter; width_ = width; avgCharge_ = avgCharge; + isSaturated_ = isSaturated; } - explicit SiStripApproximateCluster(const SiStripCluster& cluster); + explicit SiStripApproximateCluster(const SiStripCluster& cluster, unsigned int maxNSat); float barycenter() const { return barycenter_; } uint8_t width() const { return width_; } float avgCharge() const { return avgCharge_; } + bool isSaturated() const { return isSaturated_; } private: float barycenter_ = 0; uint8_t width_ = 0; float avgCharge_ = 0; + bool isSaturated_ = false; }; #endif // DATAFORMATS_SiStripApproximateCluster_H diff --git a/DataFormats/SiStripCluster/src/SiStripApproximateCluster.cc b/DataFormats/SiStripCluster/src/SiStripApproximateCluster.cc index 2b70fe270f783..8d3d9dc0b3bb1 100644 --- a/DataFormats/SiStripCluster/src/SiStripApproximateCluster.cc +++ b/DataFormats/SiStripCluster/src/SiStripApproximateCluster.cc @@ -1,7 +1,27 @@ #include "DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h" -SiStripApproximateCluster::SiStripApproximateCluster(const SiStripCluster& cluster) { +SiStripApproximateCluster::SiStripApproximateCluster(const SiStripCluster& cluster, unsigned int maxNSat) { barycenter_ = cluster.barycenter(); width_ = cluster.size(); avgCharge_ = cluster.charge() / cluster.size(); + isSaturated_ = false; + + //mimicing the algorithm used in StripSubClusterShapeTrajectoryFilter... + //Looks for 3 adjacent saturated strips (ADC>=254) + const auto& ampls = cluster.amplitudes(); + unsigned int thisSat = (ampls[0] >= 254), maxSat = thisSat; + for (unsigned int i = 1, n = ampls.size(); i < n; ++i) { + if (ampls[i] >= 254) { + thisSat++; + } else if (thisSat > 0) { + maxSat = std::max(maxSat, thisSat); + thisSat = 0; + } + } + if (thisSat > 0) { + maxSat = std::max(maxSat, thisSat); + } + if (maxSat >= maxNSat) { + isSaturated_ = true; + } } diff --git a/DataFormats/SiStripCluster/src/classes_def.xml b/DataFormats/SiStripCluster/src/classes_def.xml index fd5bb58c09e56..506a910944f60 100755 --- a/DataFormats/SiStripCluster/src/classes_def.xml +++ b/DataFormats/SiStripCluster/src/classes_def.xml @@ -24,8 +24,8 @@ - - + + diff --git a/RecoLocalTracker/SiStripClusterizer/plugins/SiStripApprox2ApproxClusters.cc b/RecoLocalTracker/SiStripClusterizer/plugins/SiStripApprox2ApproxClusters.cc index ea4f3aedaa44c..910e8c8eb54a2 100644 --- a/RecoLocalTracker/SiStripClusterizer/plugins/SiStripApprox2ApproxClusters.cc +++ b/RecoLocalTracker/SiStripClusterizer/plugins/SiStripApprox2ApproxClusters.cc @@ -59,6 +59,7 @@ void SiStripApprox2ApproxClusters::produce(edm::Event& event, edm::EventSetup co float barycenter = cluster.barycenter(); uint8_t width = cluster.width(); float avgCharge = cluster.avgCharge(); + bool isSaturated = cluster.isSaturated(); switch (approxVersion) { case 0: //ORIGINAL @@ -85,7 +86,7 @@ void SiStripApprox2ApproxClusters::produce(edm::Event& event, edm::EventSetup co break; } - ff.push_back(SiStripApproximateCluster(barycenter, width, avgCharge)); + ff.push_back(SiStripApproximateCluster(barycenter, width, avgCharge, isSaturated)); } } diff --git a/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusters2ApproxClusters.cc b/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusters2ApproxClusters.cc index 2e311c92ca6a4..2f4d32f672aea 100644 --- a/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusters2ApproxClusters.cc +++ b/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusters2ApproxClusters.cc @@ -25,10 +25,13 @@ class SiStripClusters2ApproxClusters : public edm::stream::EDProducer<> { private: edm::InputTag inputClusters; edm::EDGetTokenT > clusterToken; + + unsigned int maxNSat; }; SiStripClusters2ApproxClusters::SiStripClusters2ApproxClusters(const edm::ParameterSet& conf) { inputClusters = conf.getParameter("inputClusters"); + maxNSat = conf.getParameter("maxSaturatedStrips"); clusterToken = consumes >(inputClusters); produces >(); @@ -42,7 +45,7 @@ void SiStripClusters2ApproxClusters::produce(edm::Event& event, edm::EventSetup edmNew::DetSetVector::FastFiller ff{*result, detClusters.id()}; for (const auto& cluster : detClusters) - ff.push_back(SiStripApproximateCluster(cluster)); + ff.push_back(SiStripApproximateCluster(cluster, maxNSat)); } event.put(std::move(result)); @@ -51,7 +54,8 @@ void SiStripClusters2ApproxClusters::produce(edm::Event& event, edm::EventSetup void SiStripClusters2ApproxClusters::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add("inputClusters", edm::InputTag("siStripClusters")); + desc.add("maxSaturatedStrips", 3); descriptions.add("SiStripClusters2ApproxClusters", desc); } -DEFINE_FWK_MODULE(SiStripClusters2ApproxClusters); \ No newline at end of file +DEFINE_FWK_MODULE(SiStripClusters2ApproxClusters);