CMS 3D CMS Logo

ESZeroSuppressionProducer.cc
Go to the documentation of this file.
4 
6 
7  digiProducer_ = ps.getParameter<std::string>("digiProducer");
8  ESdigiCollection_ = ps.getParameter<std::string>("ESdigiCollection");
9  ESZSdigiCollection_ = ps.getParameter<std::string>("ESZSdigiCollection");
10 
11  produces<ESDigiCollection>(ESZSdigiCollection_);
12 
13  ES_token = consumes<ESDigiCollection>(edm::InputTag(digiProducer_));;
14 
15 }
16 
18 
19 }
20 
22 
23  eventSetup.get<ESThresholdsRcd>().get(esthresholds_);
25 
26  eventSetup.get<ESPedestalsRcd>().get(espeds_);
27  const ESPedestals *pedestals = espeds_.product();
28 
29  float ts2Threshold = thresholds->getTS2Threshold();
30 
32 
33  bool fullESDigis = true;
34  event.getByToken(ES_token, ESDigis);
35  if (!ESDigis.isValid()) {
36  edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << ESdigiCollection_.c_str() ;
37  fullESDigis = false;
38  }
39 
40  std::unique_ptr<ESDigiCollection> ESZSDigis(new ESDigiCollection());
41 
42  if (fullESDigis) {
43  for (ESDigiCollection::const_iterator i (ESDigis->begin());
44  i!=ESDigis->end(); ++i) {
45 
46  ESDataFrame dataframe = (*i);
47 
48  ESPedestals::const_iterator it_ped = pedestals->find(dataframe.id());
49 
50  if (dataframe.sample(1).adc() > (ts2Threshold+it_ped->getMean())) {
51  //std::cout<<dataframe.sample(1).adc()<<" "<<ts2Threshold+it_ped->getMean()<<std::endl;
52  (*ESZSDigis).push_back(*i);
53  }
54  }
55  }
56 
57  event.put(std::move(ESZSDigis), ESZSdigiCollection_);
58 }
59 
T getParameter(std::string const &) const
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
ESZeroSuppressionProducer(const edm::ParameterSet &ps)
edm::ESHandle< ESPedestals > espeds_
const ESDetId & id() const
Definition: ESDataFrame.h:21
edm::EDGetTokenT< ESDigiCollection > ES_token
const_iterator begin() const
edm::ESHandle< ESThresholds > esthresholds_
const_iterator find(uint32_t rawId) const
const ESSample & sample(int i) const
Definition: ESDataFrame.h:26
bool isValid() const
Definition: HandleBase.h:74
void produce(edm::Event &event, const edm::EventSetup &eventSetup) override
float getTS2Threshold() const
Definition: ESThresholds.h:16
std::vector< Item >::const_iterator const_iterator
const_iterator end() const
T get() const
Definition: EventSetup.h:63
int adc() const
get the ADC sample (singed 16 bits)
Definition: ESSample.h:18
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:510
Definition: event.py:1