File indexing completed on 2024-04-06 12:26:30
0001 #ifndef RECOLOCALTRACKER_SISTRIPZEROSUPPRESSION_SISTRIPPEDESTALSSUBTRACTOR_H
0002 #define RECOLOCALTRACKER_SISTRIPZEROSUPPRESSION_SISTRIPPEDESTALSSUBTRACTOR_H
0003
0004 #include "FWCore/Framework/interface/EventSetup.h"
0005 #include "FWCore/Framework/interface/ESWatcher.h"
0006 #include "FWCore/Framework/interface/ConsumesCollector.h"
0007
0008 #include "DataFormats/Common/interface/DetSetVector.h"
0009 #include "DataFormats/SiStripDigi/interface/SiStripRawDigi.h"
0010 #include "CondFormats/SiStripObjects/interface/SiStripPedestals.h"
0011 #include "CondFormats/DataRecord/interface/SiStripPedestalsRcd.h"
0012 #include <vector>
0013
0014 class SiStripPedestalsSubtractor {
0015 friend class SiStripRawProcessingFactory;
0016
0017 public:
0018 void subtract(const edm::DetSet<SiStripRawDigi>& input, std::vector<int16_t>& output);
0019 void subtract(uint32_t detId, uint16_t firstAPV, std::vector<int16_t>& adcs);
0020 void init(const edm::EventSetup&);
0021
0022 private:
0023 SiStripPedestalsSubtractor(bool mode, edm::ConsumesCollector iC)
0024 : pedestalsToken_(iC.esConsumes<SiStripPedestals, SiStripPedestalsRcd>()), fedmode_(mode) {}
0025 edm::ESGetToken<SiStripPedestals, SiStripPedestalsRcd> pedestalsToken_;
0026 edm::ESWatcher<SiStripPedestalsRcd> pedestalsWatcher_;
0027 const SiStripPedestals* pedestalsHandle;
0028 std::vector<int> pedestals;
0029 bool fedmode_;
0030
0031 template <class input_t>
0032 void subtract_(uint32_t detId, uint16_t firstAPV, const input_t& input, std::vector<int16_t>& output);
0033 int16_t eval(int16_t in) { return in; }
0034 uint16_t eval(SiStripRawDigi in) { return in.adc(); }
0035 };
0036 #endif