CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
< EBDigiCollection
ebToken_
 
const std::string ebZSdigiCollection_
 
const std::string eeDigiCollection_
 
const edm::EDGetTokenT
< EEDigiCollection
eeToken_
 
const std::string eeZSdigiCollection_
 
const double glbBarrelThreshold_
 
const double glbEndcapThreshold_
 
const edm::ESGetToken
< EcalPedestals,
EcalPedestalsRcd
pedestalToken_
 
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 ( 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 }
T getUntrackedParameter(std::string const &, T const &) const
const edm::EDGetTokenT< EEDigiCollection > eeToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDGetTokenT< EBDigiCollection > ebToken_
const edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > pedestalToken_
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
EcalZeroSuppressionProducer::~EcalZeroSuppressionProducer ( )
override

Definition at line 19 of file EcalZeroSuppressionProducer.cc.

19 {}

Member Function Documentation

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

Definition at line 101 of file EcalZeroSuppressionProducer.cc.

References edm::EventSetup::getData(), 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
bool getData(T &iHolder) const
Definition: EventSetup.h:122
EcalZeroSuppressor< EBDataFrame > theBarrelZeroSuppressor_
EcalZeroSuppressor< EEDataFrame > theEndcapZeroSuppressor_
const edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > pedestalToken_
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_, glbBarrelThreshold_, glbEndcapThreshold_, initCalibrations(), edm::HandleBase::isValid(), eostools::move(), edm::Handle< T >::product(), edm::DataFrameContainer::size(), MCScenario_CRAFT1_22X::sorter(), theBarrelZeroSuppressor_, and theEndcapZeroSuppressor_.

21  {
22  // Get Inputs
23 
24  initCalibrations(eventSetup);
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_
Log< level::Error, false > LogError
EcalZeroSuppressor< EBDataFrame > theBarrelZeroSuppressor_
bool accept(const C &frame, const double &threshold)
void initCalibrations(const edm::EventSetup &eventSetup)
def move
Definition: eostools.py:511
EcalZeroSuppressor< EEDataFrame > theEndcapZeroSuppressor_
bool isValid() const
Definition: HandleBase.h:70
Log< level::Info, false > LogInfo
T const * product() const
Definition: Handle.h:70
const edm::EDGetTokenT< EBDigiCollection > ebToken_
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator

Member Data Documentation

const std::string EcalZeroSuppressionProducer::digiProducer_
private

Definition at line 36 of file EcalZeroSuppressionProducer.h.

const std::string EcalZeroSuppressionProducer::ebDigiCollection_
private

Definition at line 37 of file EcalZeroSuppressionProducer.h.

Referenced by produce().

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

Definition at line 45 of file EcalZeroSuppressionProducer.h.

Referenced by produce().

const std::string EcalZeroSuppressionProducer::ebZSdigiCollection_
private

Definition at line 39 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

const std::string EcalZeroSuppressionProducer::eeDigiCollection_
private

Definition at line 38 of file EcalZeroSuppressionProducer.h.

Referenced by produce().

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

Definition at line 46 of file EcalZeroSuppressionProducer.h.

Referenced by produce().

const std::string EcalZeroSuppressionProducer::eeZSdigiCollection_
private

Definition at line 40 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

const double EcalZeroSuppressionProducer::glbBarrelThreshold_
private

Definition at line 33 of file EcalZeroSuppressionProducer.h.

Referenced by produce().

const double EcalZeroSuppressionProducer::glbEndcapThreshold_
private

Definition at line 34 of file EcalZeroSuppressionProducer.h.

Referenced by produce().

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

Definition at line 47 of file EcalZeroSuppressionProducer.h.

Referenced by initCalibrations().

EcalZeroSuppressor<EBDataFrame> EcalZeroSuppressionProducer::theBarrelZeroSuppressor_
private

Definition at line 42 of file EcalZeroSuppressionProducer.h.

Referenced by initCalibrations(), and produce().

EcalZeroSuppressor<EEDataFrame> EcalZeroSuppressionProducer::theEndcapZeroSuppressor_
private

Definition at line 43 of file EcalZeroSuppressionProducer.h.

Referenced by initCalibrations(), and produce().