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

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
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

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
 

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_
T get() const
Definition: EventSetup.h:63
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().