CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
EcalZeroSuppressionProducer Class Reference

#include <EcalZeroSuppressionProducer.h>

Inheritance diagram for EcalZeroSuppressionProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EcalZeroSuppressionProducer (const edm::ParameterSet &params)
 
void initCalibrations (const edm::EventSetup &eventSetup)
 
void produce (edm::Event &event, const edm::EventSetup &eventSetup) override
 
 ~EcalZeroSuppressionProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

std::string digiProducer_
 
edm::EDGetTokenT< EBDigiCollectionEB_token
 
std::string EBdigiCollection_
 
std::string EBZSdigiCollection_
 
edm::EDGetTokenT< EEDigiCollectionEE_token
 
std::string EEdigiCollection_
 
std::string EEZSdigiCollection_
 
double glbBarrelThreshold_
 
double glbEndcapThreshold_
 
EcalZeroSuppressor< EBDataFrametheBarrelZeroSuppressor_
 
EcalZeroSuppressor< EEDataFrametheEndcapZeroSuppressor_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 24 of file EcalZeroSuppressionProducer.h.

Constructor & Destructor Documentation

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

Definition at line 4 of file EcalZeroSuppressionProducer.cc.

References digiProducer_, EB_token, EBdigiCollection_, EBZSdigiCollection_, EE_token, 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  EB_token = consumes<EBDigiCollection>(edm::InputTag(digiProducer_));
21  EE_token = consumes<EEDigiCollection>(edm::InputTag(digiProducer_));;
22 
23 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< EEDigiCollection > EE_token
edm::EDGetTokenT< EBDigiCollection > EB_token
EcalZeroSuppressionProducer::~EcalZeroSuppressionProducer ( )
override

Definition at line 26 of file EcalZeroSuppressionProducer.cc.

27 { }

Member Function Documentation

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

Definition at line 122 of file EcalZeroSuppressionProducer.cc.

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

Referenced by produce().

122  {
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 }
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:86
void EcalZeroSuppressionProducer::produce ( edm::Event event,
const edm::EventSetup eventSetup 
)
override

Produces the EDM products,

Definition at line 30 of file EcalZeroSuppressionProducer.cc.

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

31 {
32 
33  // Get Inputs
34 
35  initCalibrations(eventSetup);
36 
39 
40  const EBDigiCollection* fullBarrelDigis =nullptr;
41  const EEDigiCollection* fullEndcapDigis =nullptr;
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::unique_ptr< EBDigiCollection > gzsBarrelDigis(new EBDigiCollection());
62  std::unique_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(std::move(gzsBarrelDigis), EBZSdigiCollection_);
117  event.put(std::move(gzsEndcapDigis), EEZSdigiCollection_);
118 
119 }
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)
edm::EDGetTokenT< EEDigiCollection > EE_token
edm::EDGetTokenT< EBDigiCollection > EB_token
EcalZeroSuppressor< EEDataFrame > theEndcapZeroSuppressor_
bool isValid() const
Definition: HandleBase.h:74
T const * product() const
Definition: Handle.h:81
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

std::string EcalZeroSuppressionProducer::digiProducer_
private

Definition at line 44 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer().

edm::EDGetTokenT<EBDigiCollection> EcalZeroSuppressionProducer::EB_token
private

Definition at line 53 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

std::string EcalZeroSuppressionProducer::EBdigiCollection_
private

Definition at line 45 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

std::string EcalZeroSuppressionProducer::EBZSdigiCollection_
private

Definition at line 47 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

edm::EDGetTokenT<EEDigiCollection> EcalZeroSuppressionProducer::EE_token
private

Definition at line 54 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

std::string EcalZeroSuppressionProducer::EEdigiCollection_
private

Definition at line 46 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

std::string EcalZeroSuppressionProducer::EEZSdigiCollection_
private

Definition at line 48 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

double EcalZeroSuppressionProducer::glbBarrelThreshold_
private

Definition at line 41 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

double EcalZeroSuppressionProducer::glbEndcapThreshold_
private

Definition at line 42 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

EcalZeroSuppressor<EBDataFrame> EcalZeroSuppressionProducer::theBarrelZeroSuppressor_
private

Definition at line 50 of file EcalZeroSuppressionProducer.h.

Referenced by initCalibrations(), and produce().

EcalZeroSuppressor<EEDataFrame> EcalZeroSuppressionProducer::theEndcapZeroSuppressor_
private

Definition at line 51 of file EcalZeroSuppressionProducer.h.

Referenced by initCalibrations(), and produce().