44#include " RecoLocalTracker/SiStripZeroSuppression/interface/SiStripRawProcessingFactory.h"
55
66#include " RecoLocalTracker/SiStripClusterizer/interface/StripClusterizerAlgorithm.h"
7- #include " RecoLocalTracker/SiStripClusterizer/interface/ThreeThresholdAlgorithm.h"
87#include " RecoLocalTracker/SiStripZeroSuppression/interface/SiStripRawProcessingAlgorithms.h"
98
109#include " DataFormats/SiStripCluster/interface/SiStripCluster.h"
@@ -90,11 +89,10 @@ namespace {
9089 return buffer;
9190 }
9291
93- template <class AlgoT >
9492 class ClusterFiller final : public StripClusterizerAlgorithm::output_t ::Getter {
9593 public:
9694 ClusterFiller (const FEDRawDataCollection& irawColl,
97- const AlgoT & iclusterizer,
95+ StripClusterizerAlgorithm & iclusterizer,
9896 SiStripRawProcessingAlgorithms& irawAlgos,
9997 bool idoAPVEmulatorCheck,
10098 bool legacy,
@@ -121,7 +119,7 @@ namespace {
121119
122120 const FEDRawDataCollection& rawColl;
123121
124- const AlgoT & clusterizer;
122+ StripClusterizerAlgorithm & clusterizer;
125123 const SiStripClusterizerConditions& conditions;
126124 SiStripRawProcessingAlgorithms& rawAlgos;
127125
@@ -183,7 +181,7 @@ class SiStripClusterizerFromRaw final : public edm::stream::EDProducer<> {
183181 legacy_(conf.getParameter<bool >(" LegacyUnpacker" )),
184182 hybridZeroSuppressed_(conf.getParameter<bool >(" HybridZeroSuppressed" )) {
185183 productToken_ = consumes<FEDRawDataCollection>(conf.getParameter <edm::InputTag>(" ProductLabel" ));
186- produces<edmNew::DetSetVector<SiStripCluster>>();
184+ produces<edmNew::DetSetVector<SiStripCluster> >();
187185 assert (clusterizer_.get ());
188186 assert (rawAlgos_.get ());
189187 }
@@ -195,23 +193,12 @@ class SiStripClusterizerFromRaw final : public edm::stream::EDProducer<> {
195193 edm::Handle<FEDRawDataCollection> rawData;
196194 ev.getByToken (productToken_, rawData);
197195
198- const ThreeThresholdAlgorithm* clusterizer3 = dynamic_cast <const ThreeThresholdAlgorithm*>(clusterizer_.get ());
199- std::unique_ptr<edmNew::DetSetVector<SiStripCluster>> output;
200- if (onDemand) {
201- if (clusterizer3 == nullptr )
202- output = std::make_unique<edmNew::DetSetVector<SiStripCluster>>(edmNew::DetSetVector<SiStripCluster>(
203- std::shared_ptr<edmNew::DetSetVector<SiStripCluster>::Getter>(
204- std::make_shared<ClusterFiller<StripClusterizerAlgorithm>>(
205- *rawData, *clusterizer_, *rawAlgos_, doAPVEmulatorCheck_, legacy_, hybridZeroSuppressed_)),
206- clusterizer_->conditions ().allDetIds ()));
207- else
208- output = std::make_unique<edmNew::DetSetVector<SiStripCluster>>(edmNew::DetSetVector<SiStripCluster>(
209- std::shared_ptr<edmNew::DetSetVector<SiStripCluster>::Getter>(
210- std::make_shared<ClusterFiller<ThreeThresholdAlgorithm>>(
211- *rawData, *clusterizer3, *rawAlgos_, doAPVEmulatorCheck_, legacy_, hybridZeroSuppressed_)),
212- clusterizer_->conditions ().allDetIds ()));
213- } else
214- output = std::make_unique<edmNew::DetSetVector<SiStripCluster>>(edmNew::DetSetVector<SiStripCluster>());
196+ std::unique_ptr<edmNew::DetSetVector<SiStripCluster> > output (
197+ onDemand ? new edmNew::DetSetVector<SiStripCluster>(
198+ std::shared_ptr<edmNew::DetSetVector<SiStripCluster>::Getter>(std::make_shared<ClusterFiller>(
199+ *rawData, *clusterizer_, *rawAlgos_, doAPVEmulatorCheck_, legacy_, hybridZeroSuppressed_)),
200+ clusterizer_->conditions ().allDetIds ())
201+ : new edmNew::DetSetVector<SiStripCluster>());
215202
216203 if (onDemand)
217204 assert (output->onDemand ());
@@ -279,38 +266,20 @@ void SiStripClusterizerFromRaw::initialize(const edm::EventSetup& es) {
279266}
280267
281268void SiStripClusterizerFromRaw::run (const FEDRawDataCollection& rawColl, edmNew::DetSetVector<SiStripCluster>& output) {
282- const ThreeThresholdAlgorithm* clusterizer3 = dynamic_cast <const ThreeThresholdAlgorithm*>(clusterizer_.get ());
283- if (clusterizer3 == nullptr ) {
284- ClusterFiller<StripClusterizerAlgorithm> filler (
285- rawColl, *clusterizer_, *rawAlgos_, doAPVEmulatorCheck_, legacy_, hybridZeroSuppressed_);
269+ ClusterFiller filler (rawColl, *clusterizer_, *rawAlgos_, doAPVEmulatorCheck_, legacy_, hybridZeroSuppressed_);
286270
287- // loop over good det in cabling
288- for (auto idet : clusterizer_->conditions ().allDetIds ()) {
289- StripClusterizerAlgorithm::output_t ::TSFastFiller record (output, idet);
271+ // loop over good det in cabling
272+ for (auto idet : clusterizer_->conditions ().allDetIds ()) {
273+ StripClusterizerAlgorithm::output_t ::TSFastFiller record (output, idet);
290274
291- filler.fill (record);
275+ filler.fill (record);
292276
293- if (record.empty ())
294- record.abort ();
295- } // end loop over dets
296- } else {
297- ClusterFiller<ThreeThresholdAlgorithm> filler (
298- rawColl, *clusterizer3, *rawAlgos_, doAPVEmulatorCheck_, legacy_, hybridZeroSuppressed_);
299-
300- // loop over good det in cabling
301- for (auto idet : clusterizer_->conditions ().allDetIds ()) {
302- StripClusterizerAlgorithm::output_t ::TSFastFiller record (output, idet);
303-
304- filler.fill (record);
305-
306- if (record.empty ())
307- record.abort ();
308- } // end loop over dets
309- }
277+ if (record.empty ())
278+ record.abort ();
279+ } // end loop over dets
310280}
311281
312282namespace {
313- template <class AlgoT >
314283 class StripByStripAdder {
315284 public:
316285 typedef std::output_iterator_tag iterator_category;
@@ -319,7 +288,7 @@ namespace {
319288 typedef void pointer;
320289 typedef void reference;
321290
322- StripByStripAdder (const AlgoT & clusterizer,
291+ StripByStripAdder (StripClusterizerAlgorithm & clusterizer,
323292 StripClusterizerAlgorithm::State& state,
324293 StripClusterizerAlgorithm::output_t ::TSFastFiller& record)
325294 : clusterizer_(clusterizer), state_(state), record_(record) {}
@@ -334,7 +303,7 @@ namespace {
334303 StripByStripAdder& operator ++(int ) { return *this ; }
335304
336305 private:
337- const AlgoT & clusterizer_;
306+ StripClusterizerAlgorithm & clusterizer_;
338307 StripClusterizerAlgorithm::State& state_;
339308 StripClusterizerAlgorithm::output_t ::TSFastFiller& record_;
340309 };
@@ -357,8 +326,7 @@ namespace {
357326 };
358327} // namespace
359328
360- template <class AlgoT >
361- void ClusterFiller<AlgoT>::fill(StripClusterizerAlgorithm::output_t ::TSFastFiller& record) const {
329+ void ClusterFiller::fill (StripClusterizerAlgorithm::output_t ::TSFastFiller& record) const {
362330 try { // edmNew::CapacityExaustedException
363331 incReady ();
364332
@@ -425,7 +393,7 @@ void ClusterFiller<AlgoT>::fill(StripClusterizerAlgorithm::output_t::TSFastFille
425393
426394 using namespace sistrip ;
427395 if LIKELY (fedchannelunpacker::isZeroSuppressed (mode, legacy_, lmode)) {
428- auto perStripAdder = StripByStripAdder<AlgoT> (clusterizer, state, record);
396+ auto perStripAdder = StripByStripAdder (clusterizer, state, record);
429397 const auto isNonLite = fedchannelunpacker::isNonLiteZS (mode, legacy_, lmode);
430398 const uint8_t pCode = (isNonLite ? buffer->packetCode (legacy_, fedCh) : 0 );
431399 auto st_ch = fedchannelunpacker::StatusCode::SUCCESS;
0 commit comments