CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
EcalZeroSuppressionProducer Class Reference

#include <EcalZeroSuppressionProducer.h>

Inheritance diagram for EcalZeroSuppressionProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 EcalZeroSuppressionProducer (const edm::ParameterSet &params)
 
void initCalibrations (const edm::EventSetup &eventSetup)
 
virtual void produce (edm::Event &event, const edm::EventSetup &eventSetup)
 
virtual ~EcalZeroSuppressionProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

std::string digiProducer_
 
std::string EBdigiCollection_
 
std::string EBZSdigiCollection_
 
std::string EEdigiCollection_
 
std::string EEZSdigiCollection_
 
double glbBarrelThreshold_
 
double glbEndcapThreshold_
 
EcalZeroSuppressor< EBDataFrametheBarrelZeroSuppressor_
 
EcalZeroSuppressor< EEDataFrametheEndcapZeroSuppressor_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 23 of file EcalZeroSuppressionProducer.h.

Constructor & Destructor Documentation

EcalZeroSuppressionProducer::EcalZeroSuppressionProducer ( const edm::ParameterSet params)
explicit

Definition at line 4 of file EcalZeroSuppressionProducer.cc.

References digiProducer_, EBdigiCollection_, EBZSdigiCollection_, EEdigiCollection_, EEZSdigiCollection_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), glbBarrelThreshold_, and glbEndcapThreshold_.

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 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
EcalZeroSuppressionProducer::~EcalZeroSuppressionProducer ( )
virtual

Definition at line 23 of file EcalZeroSuppressionProducer.cc.

24 { }

Member Function Documentation

void EcalZeroSuppressionProducer::initCalibrations ( const edm::EventSetup eventSetup)

Definition at line 119 of file EcalZeroSuppressionProducer.cc.

References edm::EventSetup::get(), edm::ESHandle< class >::product(), EcalZeroSuppressor< C >::setPedestals(), theBarrelZeroSuppressor_, and theEndcapZeroSuppressor_.

Referenced by produce().

119  {
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 }
void setPedestals(const EcalPedestals *pedestals)
can be fetched every event from the EventSetup
EcalZeroSuppressor< EBDataFrame > theBarrelZeroSuppressor_
EcalZeroSuppressor< EEDataFrame > theEndcapZeroSuppressor_
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
void EcalZeroSuppressionProducer::produce ( edm::Event event,
const edm::EventSetup eventSetup 
)
virtual

Produces the EDM products,

Implements edm::EDProducer.

Definition at line 27 of file EcalZeroSuppressionProducer.cc.

References EcalZeroSuppressor< C >::accept(), digiProducer_, EBdigiCollection_, EBZSdigiCollection_, EEdigiCollection_, EEZSdigiCollection_, glbBarrelThreshold_, glbEndcapThreshold_, initCalibrations(), edm::HandleBase::isValid(), edm::Handle< T >::product(), edm::DataFrameContainer::size(), MCScenario_CRAFT1_22X::sorter(), theBarrelZeroSuppressor_, and theEndcapZeroSuppressor_.

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 }
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
EcalZeroSuppressor< EBDataFrame > theBarrelZeroSuppressor_
bool accept(const C &frame, const double &threshold)
void initCalibrations(const edm::EventSetup &eventSetup)
EcalZeroSuppressor< EEDataFrame > theEndcapZeroSuppressor_
bool isValid() const
Definition: HandleBase.h:76
T const * product() const
Definition: Handle.h:74

Member Data Documentation

std::string EcalZeroSuppressionProducer::digiProducer_
private

Definition at line 43 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

std::string EcalZeroSuppressionProducer::EBdigiCollection_
private

Definition at line 44 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

std::string EcalZeroSuppressionProducer::EBZSdigiCollection_
private

Definition at line 46 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

std::string EcalZeroSuppressionProducer::EEdigiCollection_
private

Definition at line 45 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

std::string EcalZeroSuppressionProducer::EEZSdigiCollection_
private

Definition at line 47 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

double EcalZeroSuppressionProducer::glbBarrelThreshold_
private

Definition at line 40 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

double EcalZeroSuppressionProducer::glbEndcapThreshold_
private

Definition at line 41 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

EcalZeroSuppressor<EBDataFrame> EcalZeroSuppressionProducer::theBarrelZeroSuppressor_
private

Definition at line 49 of file EcalZeroSuppressionProducer.h.

Referenced by initCalibrations(), and produce().

EcalZeroSuppressor<EEDataFrame> EcalZeroSuppressionProducer::theEndcapZeroSuppressor_
private

Definition at line 50 of file EcalZeroSuppressionProducer.h.

Referenced by initCalibrations(), and produce().