CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalZeroSuppressionProducer.cc
Go to the documentation of this file.
1 
3 
5 {
6  digiProducer_ = params.getParameter<std::string>("digiProducer");
7  EBdigiCollection_ = params.getParameter<std::string>("EBdigiCollection");
8  EEdigiCollection_ = params.getParameter<std::string>("EEdigiCollection");
9  EBZSdigiCollection_ = params.getParameter<std::string>("EBZSdigiCollection");
10  EEZSdigiCollection_ = params.getParameter<std::string>("EEZSdigiCollection");
11 
12  // initialize the default values for the thresholds in number of noise sigmas
13 
14  glbBarrelThreshold_ = params.getUntrackedParameter<double>("glbBarrelThreshold",0.2);
15  glbEndcapThreshold_ = params.getUntrackedParameter<double>("glbEndcapThreshold",0.4);
16 
17  produces<EBDigiCollection>(EBZSdigiCollection_);
18  produces<EEDigiCollection>(EEZSdigiCollection_);
19 
20 }
21 
22 
24 { }
25 
26 
28 {
29 
30  // Get Inputs
31 
32  initCalibrations(eventSetup);
33 
36 
37  const EBDigiCollection* fullBarrelDigis =0;
38  const EEDigiCollection* fullEndcapDigis =0;
39 
40  event.getByLabel( digiProducer_, pEBDigis);
41  if (pEBDigis.isValid()){
42  fullBarrelDigis = pEBDigis.product(); // get a ptr to the produc
43  edm::LogInfo("ZeroSuppressionInfo") << "total # fullBarrelDigis: " << fullBarrelDigis->size() ;
44  } else {
45  edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << EBdigiCollection_.c_str() ;
46  }
47 
48  event.getByLabel( digiProducer_, pEEDigis);
49  if (pEEDigis.isValid()){
50  fullEndcapDigis = pEEDigis.product(); // get a ptr to the product
51  edm::LogInfo("ZeroSuppressionInfo") << "total # fullEndcapDigis: " << fullEndcapDigis->size() ;
52  } else {
53  edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << EEdigiCollection_.c_str() ;
54  }
55 
56  // collection of zero suppressed digis to put in the event
57 
58  std::auto_ptr< EBDigiCollection > gzsBarrelDigis(new EBDigiCollection());
59  std::auto_ptr< EEDigiCollection > gzsEndcapDigis(new EEDigiCollection());
60 
62 
63  // Barrel zero suppression
64 
65  if (fullBarrelDigis) {
66 
67  for(EBDigiCollection::const_iterator digiItr = (*fullBarrelDigis).begin();
68  digiItr != (*fullBarrelDigis).end(); ++digiItr)
69  {
70 
71  bool isAccepted = theBarrelZeroSuppressor_.accept(*digiItr, glbBarrelThreshold_);
72  if (isAccepted) {
73  (*gzsBarrelDigis).push_back(digiItr->id(), digiItr->begin());
74  }
75 
76  }
77  edm::LogInfo("ZeroSuppressionInfo") << "EB Digis: " << gzsBarrelDigis->size();
78 
79 
80  //std::vector<EBDataFrame> sortedDigisEB = sorter.sortedVector(*gzsBarrelDigis);
81  //LogDebug("ZeroSuppressionDump") << "Top 10 EB digis";
82  //for(int i = 0; i < std::min(10,(int) sortedDigisEB.size()); ++i)
83  // {
84  // LogDebug("ZeroSuppressionDump") << sortedDigisEB[i];
85  // }
86  }
87 
88  // Endcap zero suppression
89 
90  if (fullEndcapDigis) {
91 
92  for(EEDigiCollection::const_iterator digiItr = (*fullEndcapDigis).begin();
93  digiItr != (*fullEndcapDigis).end(); ++digiItr)
94  {
95 
96  bool isAccepted = theEndcapZeroSuppressor_.accept(*digiItr, glbEndcapThreshold_);
97  if (isAccepted) {
98  (*gzsEndcapDigis).push_back(digiItr->id(), digiItr->begin());
99  }
100 
101  }
102  edm::LogInfo("ZeroSuppressionInfo") << "EB Digis: " << gzsBarrelDigis->size();
103 
104  // std::vector<EEDataFrame> sortedDigisEE = sorter.sortedVector(*gzsEndcapDigis);
105  //LogDebug("ZeroSuppressionDump") << "Top 10 EE digis";
106  //for(int i = 0; i < std::min(10,(int) sortedDigisEE.size()); ++i)
107  // {
108  // LogDebug("ZeroSuppressionDump") << sortedDigisEE[i];
109  // }
110 
111  }
112  // Step D: Put outputs into event
113  event.put(gzsBarrelDigis, EBZSdigiCollection_);
114  event.put(gzsEndcapDigis, EEZSdigiCollection_);
115 
116 }
117 
118 
120 
121  // Pedestals from event setup
122 
124  eventSetup.get<EcalPedestalsRcd>().get( dbPed );
125  const EcalPedestals * thePedestals=dbPed.product();
126 
127  theBarrelZeroSuppressor_.setPedestals( thePedestals );
128  theEndcapZeroSuppressor_.setPedestals( thePedestals );
129 
130 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
void setPedestals(const EcalPedestals *pedestals)
can be fetched every event from the EventSetup
EcalZeroSuppressor< EBDataFrame > theBarrelZeroSuppressor_
bool accept(const C &frame, const double &threshold)
void initCalibrations(const edm::EventSetup &eventSetup)
EcalZeroSuppressionProducer(const edm::ParameterSet &params)
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
EcalZeroSuppressor< EEDataFrame > theEndcapZeroSuppressor_
bool isValid() const
Definition: HandleBase.h:76
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
virtual void produce(edm::Event &event, const edm::EventSetup &eventSetup)
T const * product() const
Definition: Handle.h:81