CMS 3D CMS Logo

ESZeroSuppressionProducer.cc
Go to the documentation of this file.
4 
6  : digiProducer_(ps.getParameter<std::string>("digiProducer")),
7  ESdigiCollection_(ps.getParameter<std::string>("ESdigiCollection")),
8  ESZSdigiCollection_(ps.getParameter<std::string>("ESZSdigiCollection")),
9  ES_token(consumes<ESDigiCollection>(edm::InputTag(digiProducer_))),
10  esthresholdsToken_(esConsumes()),
11  espedsToken_(esConsumes()) {
12  produces<ESDigiCollection>(ESZSdigiCollection_);
13 }
14 
16 
19  const ESPedestals &pedestals = eventSetup.getData(espedsToken_);
20 
21  float ts2Threshold = thresholds.getTS2Threshold();
22 
24 
25  bool fullESDigis = true;
26  event.getByToken(ES_token, ESDigis);
27  if (!ESDigis.isValid()) {
28  edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << ESdigiCollection_.c_str();
29  fullESDigis = false;
30  }
31 
32  std::unique_ptr<ESDigiCollection> ESZSDigis(new ESDigiCollection());
33 
34  if (fullESDigis) {
35  for (ESDigiCollection::const_iterator i(ESDigis->begin()); i != ESDigis->end(); ++i) {
36  ESDataFrame dataframe = (*i);
37 
38  ESPedestals::const_iterator it_ped = pedestals.find(dataframe.id());
39 
40  if (dataframe.sample(1).adc() > (ts2Threshold + it_ped->getMean())) {
41  // std::cout<<dataframe.sample(1).adc()<<"
42  // "<<ts2Threshold+it_ped->getMean()<<std::endl;
43  (*ESZSDigis).push_back(*i);
44  }
45  }
46  }
47 
48  event.put(std::move(ESZSDigis), ESZSdigiCollection_);
49 }
const ESDetId & id() const
Definition: ESDataFrame.h:19
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
ESZeroSuppressionProducer(const edm::ParameterSet &ps)
Log< level::Error, false > LogError
const_iterator find(uint32_t rawId) const
int adc() const
get the ADC sample (singed 16 bits)
Definition: ESSample.h:16
const ESSample & sample(int i) const
Definition: ESDataFrame.h:24
const edm::ESGetToken< ESThresholds, ESThresholdsRcd > esthresholdsToken_
void produce(edm::Event &event, const edm::EventSetup &eventSetup) override
const_iterator end() const
const edm::ESGetToken< ESPedestals, ESPedestalsRcd > espedsToken_
const_iterator begin() const
The iterator returned can not safely be used across threads.
std::vector< Item >::const_iterator const_iterator
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
bool isValid() const
Definition: HandleBase.h:70
HLT enums.
const edm::EDGetTokenT< ESDigiCollection > ES_token
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1