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  EB_token = consumes<EBDigiCollection>(edm::InputTag(digiProducer_));
21  EE_token = consumes<EEDigiCollection>(edm::InputTag(digiProducer_));;
22 
23 }
24 
25 
27 { }
28 
29 
31 {
32 
33  // Get Inputs
34 
35  initCalibrations(eventSetup);
36 
39 
40  const EBDigiCollection* fullBarrelDigis =0;
41  const EEDigiCollection* fullEndcapDigis =0;
42 
43  event.getByToken( EB_token, pEBDigis);
44  if (pEBDigis.isValid()){
45  fullBarrelDigis = pEBDigis.product(); // get a ptr to the produc
46  edm::LogInfo("ZeroSuppressionInfo") << "total # fullBarrelDigis: " << fullBarrelDigis->size() ;
47  } else {
48  edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << EBdigiCollection_.c_str() ;
49  }
50 
51  event.getByToken( EE_token, pEEDigis);
52  if (pEEDigis.isValid()){
53  fullEndcapDigis = pEEDigis.product(); // get a ptr to the product
54  edm::LogInfo("ZeroSuppressionInfo") << "total # fullEndcapDigis: " << fullEndcapDigis->size() ;
55  } else {
56  edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << EEdigiCollection_.c_str() ;
57  }
58 
59  // collection of zero suppressed digis to put in the event
60 
61  std::auto_ptr< EBDigiCollection > gzsBarrelDigis(new EBDigiCollection());
62  std::auto_ptr< EEDigiCollection > gzsEndcapDigis(new EEDigiCollection());
63 
65 
66  // Barrel zero suppression
67 
68  if (fullBarrelDigis) {
69 
70  for(EBDigiCollection::const_iterator digiItr = (*fullBarrelDigis).begin();
71  digiItr != (*fullBarrelDigis).end(); ++digiItr)
72  {
73 
74  bool isAccepted = theBarrelZeroSuppressor_.accept(*digiItr, glbBarrelThreshold_);
75  if (isAccepted) {
76  (*gzsBarrelDigis).push_back(digiItr->id(), digiItr->begin());
77  }
78 
79  }
80  edm::LogInfo("ZeroSuppressionInfo") << "EB Digis: " << gzsBarrelDigis->size();
81 
82 
83  //std::vector<EBDataFrame> sortedDigisEB = sorter.sortedVector(*gzsBarrelDigis);
84  //LogDebug("ZeroSuppressionDump") << "Top 10 EB digis";
85  //for(int i = 0; i < std::min(10,(int) sortedDigisEB.size()); ++i)
86  // {
87  // LogDebug("ZeroSuppressionDump") << sortedDigisEB[i];
88  // }
89  }
90 
91  // Endcap zero suppression
92 
93  if (fullEndcapDigis) {
94 
95  for(EEDigiCollection::const_iterator digiItr = (*fullEndcapDigis).begin();
96  digiItr != (*fullEndcapDigis).end(); ++digiItr)
97  {
98 
99  bool isAccepted = theEndcapZeroSuppressor_.accept(*digiItr, glbEndcapThreshold_);
100  if (isAccepted) {
101  (*gzsEndcapDigis).push_back(digiItr->id(), digiItr->begin());
102  }
103 
104  }
105  edm::LogInfo("ZeroSuppressionInfo") << "EB Digis: " << gzsBarrelDigis->size();
106 
107  // std::vector<EEDataFrame> sortedDigisEE = sorter.sortedVector(*gzsEndcapDigis);
108  //LogDebug("ZeroSuppressionDump") << "Top 10 EE digis";
109  //for(int i = 0; i < std::min(10,(int) sortedDigisEE.size()); ++i)
110  // {
111  // LogDebug("ZeroSuppressionDump") << sortedDigisEE[i];
112  // }
113 
114  }
115  // Step D: Put outputs into event
116  event.put(gzsBarrelDigis, EBZSdigiCollection_);
117  event.put(gzsEndcapDigis, EEZSdigiCollection_);
118 
119 }
120 
121 
123 
124  // Pedestals from event setup
125 
127  eventSetup.get<EcalPedestalsRcd>().get( dbPed );
128  const EcalPedestals * thePedestals=dbPed.product();
129 
130  theBarrelZeroSuppressor_.setPedestals( thePedestals );
131  theEndcapZeroSuppressor_.setPedestals( thePedestals );
132 
133 }
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)
edm::EDGetTokenT< EEDigiCollection > EE_token
EcalZeroSuppressionProducer(const edm::ParameterSet &params)
edm::EDGetTokenT< EBDigiCollection > EB_token
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:75
T const * product() const
Definition: Handle.h:81
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
virtual void produce(edm::Event &event, const edm::EventSetup &eventSetup)