CMS 3D CMS Logo

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

#include <ESZeroSuppressionProducer.h>

Inheritance diagram for ESZeroSuppressionProducer:
edm::stream::EDProducer<>

Public Member Functions

 ESZeroSuppressionProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &event, const edm::EventSetup &eventSetup) override
 
 ~ESZeroSuppressionProducer () 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 edm::EDGetTokenT< ESDigiCollectionES_token
 
const std::string ESdigiCollection_
 
const edm::ESGetToken< ESPedestals, ESPedestalsRcdespedsToken_
 
const edm::ESGetToken< ESThresholds, ESThresholdsRcdesthresholdsToken_
 
const std::string ESZSdigiCollection_
 

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 20 of file ESZeroSuppressionProducer.h.

Constructor & Destructor Documentation

◆ ESZeroSuppressionProducer()

ESZeroSuppressionProducer::ESZeroSuppressionProducer ( const edm::ParameterSet ps)
explicit

Definition at line 5 of file ESZeroSuppressionProducer.cc.

References ESZSdigiCollection_.

6  : digiProducer_(ps.getParameter<std::string>("digiProducer")),
7  ESdigiCollection_(ps.getParameter<std::string>("ESdigiCollection")),
8  ESZSdigiCollection_(ps.getParameter<std::string>("ESZSdigiCollection")),
9  ES_token(consumes<ESDigiCollection>(edm::InputTag(digiProducer_))),
12  produces<ESDigiCollection>(ESZSdigiCollection_);
13 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::ESGetToken< ESThresholds, ESThresholdsRcd > esthresholdsToken_
const edm::ESGetToken< ESPedestals, ESPedestalsRcd > espedsToken_
const edm::EDGetTokenT< ESDigiCollection > ES_token

◆ ~ESZeroSuppressionProducer()

ESZeroSuppressionProducer::~ESZeroSuppressionProducer ( )
override

Definition at line 15 of file ESZeroSuppressionProducer.cc.

15 {}

Member Function Documentation

◆ produce()

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

Produces the EDM products,

Definition at line 17 of file ESZeroSuppressionProducer.cc.

References ESSample::adc(), edm::DataFrameContainer::begin(), edm::DataFrameContainer::end(), ES_token, ESdigiCollection_, espedsToken_, esthresholdsToken_, ESZSdigiCollection_, options_cfi::eventSetup, ESCondObjectContainer< T >::find(), mps_fire::i, ESDataFrame::id(), edm::HandleBase::isValid(), eostools::move(), ESDataFrame::sample(), and particleFlowZeroSuppressionECAL_cff::thresholds.

17  {
19  const ESPedestals &pedestals = eventSetup.getData(espedsToken_);
20 
21  float ts2Threshold = thresholds.getTS2Threshold();
22 
24 
25  bool fullESDigis = true;
26  event.getByToken(ES_token, ESDigis);
27  if (!ESDigis.isValid()) {
28  edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << ESdigiCollection_.c_str();
29  fullESDigis = false;
30  }
31 
32  std::unique_ptr<ESDigiCollection> ESZSDigis(new ESDigiCollection());
33 
34  if (fullESDigis) {
35  for (ESDigiCollection::const_iterator i(ESDigis->begin()); i != ESDigis->end(); ++i) {
36  ESDataFrame dataframe = (*i);
37 
38  ESPedestals::const_iterator it_ped = pedestals.find(dataframe.id());
39 
40  if (dataframe.sample(1).adc() > (ts2Threshold + it_ped->getMean())) {
41  // std::cout<<dataframe.sample(1).adc()<<"
42  // "<<ts2Threshold+it_ped->getMean()<<std::endl;
43  (*ESZSDigis).push_back(*i);
44  }
45  }
46  }
47 
48  event.put(std::move(ESZSDigis), ESZSdigiCollection_);
49 }
const ESDetId & id() const
Definition: ESDataFrame.h:19
Log< level::Error, false > LogError
const_iterator find(uint32_t rawId) const
int adc() const
get the ADC sample (singed 16 bits)
Definition: ESSample.h:16
const ESSample & sample(int i) const
Definition: ESDataFrame.h:24
const edm::ESGetToken< ESThresholds, ESThresholdsRcd > esthresholdsToken_
const_iterator end() const
const edm::ESGetToken< ESPedestals, ESPedestalsRcd > espedsToken_
const_iterator begin() const
The iterator returned can not safely be used across threads.
std::vector< Item >::const_iterator const_iterator
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
bool isValid() const
Definition: HandleBase.h:70
const edm::EDGetTokenT< ESDigiCollection > ES_token
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ digiProducer_

const std::string ESZeroSuppressionProducer::digiProducer_
private

Definition at line 29 of file ESZeroSuppressionProducer.h.

◆ ES_token

const edm::EDGetTokenT<ESDigiCollection> ESZeroSuppressionProducer::ES_token
private

Definition at line 33 of file ESZeroSuppressionProducer.h.

Referenced by produce().

◆ ESdigiCollection_

const std::string ESZeroSuppressionProducer::ESdigiCollection_
private

Definition at line 30 of file ESZeroSuppressionProducer.h.

Referenced by produce().

◆ espedsToken_

const edm::ESGetToken<ESPedestals, ESPedestalsRcd> ESZeroSuppressionProducer::espedsToken_
private

Definition at line 35 of file ESZeroSuppressionProducer.h.

Referenced by produce().

◆ esthresholdsToken_

const edm::ESGetToken<ESThresholds, ESThresholdsRcd> ESZeroSuppressionProducer::esthresholdsToken_
private

Definition at line 34 of file ESZeroSuppressionProducer.h.

Referenced by produce().

◆ ESZSdigiCollection_

const std::string ESZeroSuppressionProducer::ESZSdigiCollection_
private

Definition at line 31 of file ESZeroSuppressionProducer.h.

Referenced by ESZeroSuppressionProducer(), and produce().