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 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_, EB_token, EBdigiCollection_, EBZSdigiCollection_, EE_token, EEdigiCollection_, EEZSdigiCollection_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), glbBarrelThreshold_, glbEndcapThreshold_, and AlCaHLTBitMon_QueryRunRegistry::string.

4  {
5  digiProducer_ = params.getParameter<std::string>("digiProducer");
6  EBdigiCollection_ = params.getParameter<std::string>("EBdigiCollection");
7  EEdigiCollection_ = params.getParameter<std::string>("EEdigiCollection");
8  EBZSdigiCollection_ = params.getParameter<std::string>("EBZSdigiCollection");
9  EEZSdigiCollection_ = params.getParameter<std::string>("EEZSdigiCollection");
10 
11  // initialize the default values for the thresholds in number of noise sigmas
12 
13  glbBarrelThreshold_ = params.getUntrackedParameter<double>("glbBarrelThreshold", 0.2);
14  glbEndcapThreshold_ = params.getUntrackedParameter<double>("glbEndcapThreshold", 0.4);
15 
16  produces<EBDigiCollection>(EBZSdigiCollection_);
17  produces<EEDigiCollection>(EEZSdigiCollection_);
18 
19  EB_token = consumes<EBDigiCollection>(edm::InputTag(digiProducer_));
20  EE_token = consumes<EEDigiCollection>(edm::InputTag(digiProducer_));
21  ;
22 }
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 24 of file EcalZeroSuppressionProducer.cc.

24 {}

Member Function Documentation

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

Definition at line 106 of file EcalZeroSuppressionProducer.cc.

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

Referenced by produce().

106  {
107  // Pedestals from event setup
108 
110  eventSetup.get<EcalPedestalsRcd>().get(dbPed);
111  const EcalPedestals *thePedestals = dbPed.product();
112 
115 }
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:71
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 26 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_.

26  {
27  // Get Inputs
28 
29  initCalibrations(eventSetup);
30 
33 
34  const EBDigiCollection *fullBarrelDigis = nullptr;
35  const EEDigiCollection *fullEndcapDigis = nullptr;
36 
37  event.getByToken(EB_token, pEBDigis);
38  if (pEBDigis.isValid()) {
39  fullBarrelDigis = pEBDigis.product(); // get a ptr to the produc
40  edm::LogInfo("ZeroSuppressionInfo") << "total # fullBarrelDigis: " << fullBarrelDigis->size();
41  } else {
42  edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << EBdigiCollection_.c_str();
43  }
44 
45  event.getByToken(EE_token, pEEDigis);
46  if (pEEDigis.isValid()) {
47  fullEndcapDigis = pEEDigis.product(); // get a ptr to the product
48  edm::LogInfo("ZeroSuppressionInfo") << "total # fullEndcapDigis: " << fullEndcapDigis->size();
49  } else {
50  edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << EEdigiCollection_.c_str();
51  }
52 
53  // collection of zero suppressed digis to put in the event
54 
55  std::unique_ptr<EBDigiCollection> gzsBarrelDigis(new EBDigiCollection());
56  std::unique_ptr<EEDigiCollection> gzsEndcapDigis(new EEDigiCollection());
57 
59 
60  // Barrel zero suppression
61 
62  if (fullBarrelDigis) {
63  for (EBDigiCollection::const_iterator digiItr = (*fullBarrelDigis).begin(); digiItr != (*fullBarrelDigis).end();
64  ++digiItr) {
65  bool isAccepted = theBarrelZeroSuppressor_.accept(*digiItr, glbBarrelThreshold_);
66  if (isAccepted) {
67  (*gzsBarrelDigis).push_back(digiItr->id(), digiItr->begin());
68  }
69  }
70  edm::LogInfo("ZeroSuppressionInfo") << "EB Digis: " << gzsBarrelDigis->size();
71 
72  // std::vector<EBDataFrame> sortedDigisEB =
73  // sorter.sortedVector(*gzsBarrelDigis); LogDebug("ZeroSuppressionDump") <<
74  // "Top 10 EB digis"; for(int i = 0; i < std::min(10,(int)
75  // sortedDigisEB.size()); ++i)
76  // {
77  // LogDebug("ZeroSuppressionDump") << sortedDigisEB[i];
78  // }
79  }
80 
81  // Endcap zero suppression
82 
83  if (fullEndcapDigis) {
84  for (EEDigiCollection::const_iterator digiItr = (*fullEndcapDigis).begin(); digiItr != (*fullEndcapDigis).end();
85  ++digiItr) {
86  bool isAccepted = theEndcapZeroSuppressor_.accept(*digiItr, glbEndcapThreshold_);
87  if (isAccepted) {
88  (*gzsEndcapDigis).push_back(digiItr->id(), digiItr->begin());
89  }
90  }
91  edm::LogInfo("ZeroSuppressionInfo") << "EB Digis: " << gzsBarrelDigis->size();
92 
93  // std::vector<EEDataFrame> sortedDigisEE =
94  // sorter.sortedVector(*gzsEndcapDigis);
95  // LogDebug("ZeroSuppressionDump") << "Top 10 EE digis";
96  // for(int i = 0; i < std::min(10,(int) sortedDigisEE.size()); ++i)
97  // {
98  // LogDebug("ZeroSuppressionDump") << sortedDigisEE[i];
99  // }
100  }
101  // Step D: Put outputs into event
102  event.put(std::move(gzsBarrelDigis), EBZSdigiCollection_);
103  event.put(std::move(gzsEndcapDigis), EEZSdigiCollection_);
104 }
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:74
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

std::string EcalZeroSuppressionProducer::digiProducer_
private

Definition at line 40 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer().

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

Definition at line 49 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

std::string EcalZeroSuppressionProducer::EBdigiCollection_
private

Definition at line 41 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

std::string EcalZeroSuppressionProducer::EBZSdigiCollection_
private

Definition at line 43 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

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

Definition at line 50 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

std::string EcalZeroSuppressionProducer::EEdigiCollection_
private

Definition at line 42 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

std::string EcalZeroSuppressionProducer::EEZSdigiCollection_
private

Definition at line 44 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

double EcalZeroSuppressionProducer::glbBarrelThreshold_
private

Definition at line 37 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

double EcalZeroSuppressionProducer::glbEndcapThreshold_
private

Definition at line 38 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

EcalZeroSuppressor<EBDataFrame> EcalZeroSuppressionProducer::theBarrelZeroSuppressor_
private

Definition at line 46 of file EcalZeroSuppressionProducer.h.

Referenced by initCalibrations(), and produce().

EcalZeroSuppressor<EEDataFrame> EcalZeroSuppressionProducer::theEndcapZeroSuppressor_
private

Definition at line 47 of file EcalZeroSuppressionProducer.h.

Referenced by initCalibrations(), and produce().