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::EDConsumerBase 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 ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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_, glbEndcapThreshold_, and AlCaHLTBitMon_QueryRunRegistry::string.

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:81

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().