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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

const std::string digiProducer_
 
const std::string ebDigiCollection_
 
const edm::EDGetTokenT< EBDigiCollectionebToken_
 
const std::string ebZSdigiCollection_
 
const std::string eeDigiCollection_
 
const edm::EDGetTokenT< EEDigiCollectioneeToken_
 
const std::string eeZSdigiCollection_
 
const double glbBarrelThreshold_
 
const double glbEndcapThreshold_
 
const edm::ESGetToken< EcalPedestals, EcalPedestalsRcdpedestalToken_
 
EcalZeroSuppressor< EBDataFrametheBarrelZeroSuppressor_
 
EcalZeroSuppressor< EEDataFrametheEndcapZeroSuppressor_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 22 of file EcalZeroSuppressionProducer.h.

Constructor & Destructor Documentation

◆ EcalZeroSuppressionProducer()

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

Definition at line 4 of file EcalZeroSuppressionProducer.cc.

References ebZSdigiCollection_, and eeZSdigiCollection_.

5  : glbBarrelThreshold_(params.getUntrackedParameter<double>("glbBarrelThreshold", 0.2)),
6  glbEndcapThreshold_(params.getUntrackedParameter<double>("glbEndcapThreshold", 0.4)),
7  digiProducer_(params.getParameter<std::string>("digiProducer")),
8  ebDigiCollection_(params.getParameter<std::string>("EBdigiCollection")),
9  eeDigiCollection_(params.getParameter<std::string>("EEdigiCollection")),
10  ebZSdigiCollection_(params.getParameter<std::string>("EBZSdigiCollection")),
11  eeZSdigiCollection_(params.getParameter<std::string>("EEZSdigiCollection")),
12  ebToken_(consumes<EBDigiCollection>(edm::InputTag(digiProducer_))),
13  eeToken_(consumes<EEDigiCollection>(edm::InputTag(digiProducer_))),
15  produces<EBDigiCollection>(ebZSdigiCollection_);
16  produces<EEDigiCollection>(eeZSdigiCollection_);
17 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
const edm::EDGetTokenT< EEDigiCollection > eeToken_
const edm::EDGetTokenT< EBDigiCollection > ebToken_
const edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > pedestalToken_

◆ ~EcalZeroSuppressionProducer()

EcalZeroSuppressionProducer::~EcalZeroSuppressionProducer ( )
override

Definition at line 19 of file EcalZeroSuppressionProducer.cc.

19 {}

Member Function Documentation

◆ initCalibrations()

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

Definition at line 101 of file EcalZeroSuppressionProducer.cc.

References options_cfi::eventSetup, pedestalToken_, EcalZeroSuppressor< C >::setPedestals(), theBarrelZeroSuppressor_, and theEndcapZeroSuppressor_.

Referenced by produce().

101  {
102  // Pedestals from event setup
103  const auto &thePedestals = eventSetup.getData(pedestalToken_);
104 
105  theBarrelZeroSuppressor_.setPedestals(&thePedestals);
106  theEndcapZeroSuppressor_.setPedestals(&thePedestals);
107 }
void setPedestals(const EcalPedestals *pedestals)
can be fetched every event from the EventSetup
EcalZeroSuppressor< EBDataFrame > theBarrelZeroSuppressor_
EcalZeroSuppressor< EEDataFrame > theEndcapZeroSuppressor_
const edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > pedestalToken_

◆ produce()

void EcalZeroSuppressionProducer::produce ( edm::Event event,
const edm::EventSetup eventSetup 
)
override

Produces the EDM products,

Definition at line 21 of file EcalZeroSuppressionProducer.cc.

References EcalZeroSuppressor< C >::accept(), ebDigiCollection_, ebToken_, ebZSdigiCollection_, eeDigiCollection_, eeToken_, eeZSdigiCollection_, options_cfi::eventSetup, glbBarrelThreshold_, glbEndcapThreshold_, initCalibrations(), edm::HandleBase::isValid(), eostools::move(), edm::Handle< T >::product(), edm::DataFrameContainer::size(), l1ctLayer2EG_cff::sorter, theBarrelZeroSuppressor_, and theEndcapZeroSuppressor_.

21  {
22  // Get Inputs
23 
25 
28 
29  const EBDigiCollection *fullBarrelDigis = nullptr;
30  const EEDigiCollection *fullEndcapDigis = nullptr;
31 
32  event.getByToken(ebToken_, pEBDigis);
33  if (pEBDigis.isValid()) {
34  fullBarrelDigis = pEBDigis.product(); // get a ptr to the produc
35  edm::LogInfo("ZeroSuppressionInfo") << "total # fullBarrelDigis: " << fullBarrelDigis->size();
36  } else {
37  edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << ebDigiCollection_.c_str();
38  }
39 
40  event.getByToken(eeToken_, pEEDigis);
41  if (pEEDigis.isValid()) {
42  fullEndcapDigis = pEEDigis.product(); // get a ptr to the product
43  edm::LogInfo("ZeroSuppressionInfo") << "total # fullEndcapDigis: " << fullEndcapDigis->size();
44  } else {
45  edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << eeDigiCollection_.c_str();
46  }
47 
48  // collection of zero suppressed digis to put in the event
49 
50  auto gzsBarrelDigis = std::make_unique<EBDigiCollection>();
51  auto gzsEndcapDigis = std::make_unique<EEDigiCollection>();
52 
54 
55  // Barrel zero suppression
56 
57  if (fullBarrelDigis) {
58  for (EBDigiCollection::const_iterator digiItr = (*fullBarrelDigis).begin(); digiItr != (*fullBarrelDigis).end();
59  ++digiItr) {
60  bool isAccepted = theBarrelZeroSuppressor_.accept(*digiItr, glbBarrelThreshold_);
61  if (isAccepted) {
62  (*gzsBarrelDigis).push_back(digiItr->id(), digiItr->begin());
63  }
64  }
65  edm::LogInfo("ZeroSuppressionInfo") << "EB Digis: " << gzsBarrelDigis->size();
66 
67  // std::vector<EBDataFrame> sortedDigisEB =
68  // sorter.sortedVector(*gzsBarrelDigis); LogDebug("ZeroSuppressionDump") <<
69  // "Top 10 EB digis"; for(int i = 0; i < std::min(10,(int)
70  // sortedDigisEB.size()); ++i)
71  // {
72  // LogDebug("ZeroSuppressionDump") << sortedDigisEB[i];
73  // }
74  }
75 
76  // Endcap zero suppression
77 
78  if (fullEndcapDigis) {
79  for (EEDigiCollection::const_iterator digiItr = (*fullEndcapDigis).begin(); digiItr != (*fullEndcapDigis).end();
80  ++digiItr) {
81  bool isAccepted = theEndcapZeroSuppressor_.accept(*digiItr, glbEndcapThreshold_);
82  if (isAccepted) {
83  (*gzsEndcapDigis).push_back(digiItr->id(), digiItr->begin());
84  }
85  }
86  edm::LogInfo("ZeroSuppressionInfo") << "EB Digis: " << gzsBarrelDigis->size();
87 
88  // std::vector<EEDataFrame> sortedDigisEE =
89  // sorter.sortedVector(*gzsEndcapDigis);
90  // LogDebug("ZeroSuppressionDump") << "Top 10 EE digis";
91  // for(int i = 0; i < std::min(10,(int) sortedDigisEE.size()); ++i)
92  // {
93  // LogDebug("ZeroSuppressionDump") << sortedDigisEE[i];
94  // }
95  }
96  // Step D: Put outputs into event
97  event.put(std::move(gzsBarrelDigis), ebZSdigiCollection_);
98  event.put(std::move(gzsEndcapDigis), eeZSdigiCollection_);
99 }
const edm::EDGetTokenT< EEDigiCollection > eeToken_
T const * product() const
Definition: Handle.h:70
Log< level::Error, false > LogError
EcalZeroSuppressor< EBDataFrame > theBarrelZeroSuppressor_
bool accept(const C &frame, const double &threshold)
void initCalibrations(const edm::EventSetup &eventSetup)
EcalZeroSuppressor< EEDataFrame > theEndcapZeroSuppressor_
Log< level::Info, false > LogInfo
const edm::EDGetTokenT< EBDigiCollection > ebToken_
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
bool isValid() const
Definition: HandleBase.h:70
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ digiProducer_

const std::string EcalZeroSuppressionProducer::digiProducer_
private

Definition at line 36 of file EcalZeroSuppressionProducer.h.

◆ ebDigiCollection_

const std::string EcalZeroSuppressionProducer::ebDigiCollection_
private

Definition at line 37 of file EcalZeroSuppressionProducer.h.

Referenced by produce().

◆ ebToken_

const edm::EDGetTokenT<EBDigiCollection> EcalZeroSuppressionProducer::ebToken_
private

Definition at line 45 of file EcalZeroSuppressionProducer.h.

Referenced by produce().

◆ ebZSdigiCollection_

const std::string EcalZeroSuppressionProducer::ebZSdigiCollection_
private

Definition at line 39 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

◆ eeDigiCollection_

const std::string EcalZeroSuppressionProducer::eeDigiCollection_
private

Definition at line 38 of file EcalZeroSuppressionProducer.h.

Referenced by produce().

◆ eeToken_

const edm::EDGetTokenT<EEDigiCollection> EcalZeroSuppressionProducer::eeToken_
private

Definition at line 46 of file EcalZeroSuppressionProducer.h.

Referenced by produce().

◆ eeZSdigiCollection_

const std::string EcalZeroSuppressionProducer::eeZSdigiCollection_
private

Definition at line 40 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

◆ glbBarrelThreshold_

const double EcalZeroSuppressionProducer::glbBarrelThreshold_
private

Definition at line 33 of file EcalZeroSuppressionProducer.h.

Referenced by produce().

◆ glbEndcapThreshold_

const double EcalZeroSuppressionProducer::glbEndcapThreshold_
private

Definition at line 34 of file EcalZeroSuppressionProducer.h.

Referenced by produce().

◆ pedestalToken_

const edm::ESGetToken<EcalPedestals, EcalPedestalsRcd> EcalZeroSuppressionProducer::pedestalToken_
private

Definition at line 47 of file EcalZeroSuppressionProducer.h.

Referenced by initCalibrations().

◆ theBarrelZeroSuppressor_

EcalZeroSuppressor<EBDataFrame> EcalZeroSuppressionProducer::theBarrelZeroSuppressor_
private

Definition at line 42 of file EcalZeroSuppressionProducer.h.

Referenced by initCalibrations(), and produce().

◆ theEndcapZeroSuppressor_

EcalZeroSuppressor<EEDataFrame> EcalZeroSuppressionProducer::theEndcapZeroSuppressor_
private

Definition at line 43 of file EcalZeroSuppressionProducer.h.

Referenced by initCalibrations(), and produce().