CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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_);
24  const ESThresholds *thresholds = esthresholds_.product();
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::auto_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(ESZSDigis, ESZSdigiCollection_);
58 }
59 
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
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
edm::ESHandle< ESThresholds > esthresholds_
const_iterator find(uint32_t rawId) const
const ESSample & sample(int i) const
Definition: ESDataFrame.h:26
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool isValid() const
Definition: HandleBase.h:75
virtual void produce(edm::Event &event, const edm::EventSetup &eventSetup) override
float getTS2Threshold() const
Definition: ESThresholds.h:16
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
std::vector< Item >::const_iterator const_iterator
int adc() const
get the ADC sample (singed 16 bits)
Definition: ESSample.h:18