CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 }
ESZeroSuppressionProducer(const edm::ParameterSet &ps)
const ESDetId & id() const
Definition: ESDataFrame.h:19
Log< level::Error, false > LogError
bool getData(T &iHolder) const
Definition: EventSetup.h:128
const edm::ESGetToken< ESThresholds, ESThresholdsRcd > esthresholdsToken_
def move
Definition: eostools.py:511
const_iterator find(uint32_t rawId) const
const ESSample & sample(int i) const
Definition: ESDataFrame.h:24
bool isValid() const
Definition: HandleBase.h:70
void produce(edm::Event &event, const edm::EventSetup &eventSetup) override
float getTS2Threshold() const
Definition: ESThresholds.h:14
const edm::ESGetToken< ESPedestals, ESPedestalsRcd > espedsToken_
std::vector< Item >::const_iterator const_iterator
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
int adc() const
get the ADC sample (singed 16 bits)
Definition: ESSample.h:16
const edm::EDGetTokenT< ESDigiCollection > ES_token
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283