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

Private Attributes

std::string digiProducer_
 
edm::EDGetTokenT< ESDigiCollectionES_token
 
std::string ESdigiCollection_
 
edm::ESHandle< ESPedestalsespeds_
 
edm::ESHandle< ESThresholdsesthresholds_
 
std::string ESZSdigiCollection_
 

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

Constructor & Destructor Documentation

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

Definition at line 5 of file ESZeroSuppressionProducer.cc.

References digiProducer_, ES_token, ESdigiCollection_, ESZSdigiCollection_, edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

5  {
6  digiProducer_ = ps.getParameter<std::string>("digiProducer");
7  ESdigiCollection_ = ps.getParameter<std::string>("ESdigiCollection");
8  ESZSdigiCollection_ = ps.getParameter<std::string>("ESZSdigiCollection");
9 
10  produces<ESDigiCollection>(ESZSdigiCollection_);
11 
12  ES_token = consumes<ESDigiCollection>(edm::InputTag(digiProducer_));
13  ;
14 }
T getParameter(std::string const &) const
edm::EDGetTokenT< ESDigiCollection > ES_token
ESZeroSuppressionProducer::~ESZeroSuppressionProducer ( )
override

Definition at line 16 of file ESZeroSuppressionProducer.cc.

16 {}

Member Function Documentation

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

Produces the EDM products,

Definition at line 18 of file ESZeroSuppressionProducer.cc.

References ESSample::adc(), edm::DataFrameContainer::begin(), edm::DataFrameContainer::end(), ES_token, ESdigiCollection_, espeds_, esthresholds_, ESZSdigiCollection_, ESCondObjectContainer< T >::find(), edm::EventSetup::get(), ESThresholds::getTS2Threshold(), mps_fire::i, ESDataFrame::id(), edm::HandleBase::isValid(), eostools::move(), edm::ESHandle< T >::product(), ESDataFrame::sample(), and particleFlowZeroSuppressionECAL_cff::thresholds.

18  {
19  eventSetup.get<ESThresholdsRcd>().get(esthresholds_);
21 
22  eventSetup.get<ESPedestalsRcd>().get(espeds_);
23  const ESPedestals *pedestals = espeds_.product();
24 
25  float ts2Threshold = thresholds->getTS2Threshold();
26 
28 
29  bool fullESDigis = true;
30  event.getByToken(ES_token, ESDigis);
31  if (!ESDigis.isValid()) {
32  edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << ESdigiCollection_.c_str();
33  fullESDigis = false;
34  }
35 
36  std::unique_ptr<ESDigiCollection> ESZSDigis(new ESDigiCollection());
37 
38  if (fullESDigis) {
39  for (ESDigiCollection::const_iterator i(ESDigis->begin()); i != ESDigis->end(); ++i) {
40  ESDataFrame dataframe = (*i);
41 
42  ESPedestals::const_iterator it_ped = pedestals->find(dataframe.id());
43 
44  if (dataframe.sample(1).adc() > (ts2Threshold + it_ped->getMean())) {
45  // std::cout<<dataframe.sample(1).adc()<<"
46  // "<<ts2Threshold+it_ped->getMean()<<std::endl;
47  (*ESZSDigis).push_back(*i);
48  }
49  }
50  }
51 
52  event.put(std::move(ESZSDigis), ESZSdigiCollection_);
53 }
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
edm::ESHandle< ESPedestals > espeds_
const ESDetId & id() const
Definition: ESDataFrame.h:21
edm::EDGetTokenT< ESDigiCollection > ES_token
const_iterator begin() const
edm::ESHandle< ESThresholds > esthresholds_
const_iterator find(uint32_t rawId) const
const ESSample & sample(int i) const
Definition: ESDataFrame.h:26
bool isValid() const
Definition: HandleBase.h:74
float getTS2Threshold() const
Definition: ESThresholds.h:16
std::vector< Item >::const_iterator const_iterator
const_iterator end() const
T get() const
Definition: EventSetup.h:71
int adc() const
get the ADC sample (singed 16 bits)
Definition: ESSample.h:18
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

std::string ESZeroSuppressionProducer::digiProducer_
private

Definition at line 29 of file ESZeroSuppressionProducer.h.

Referenced by ESZeroSuppressionProducer().

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

Definition at line 36 of file ESZeroSuppressionProducer.h.

Referenced by ESZeroSuppressionProducer(), and produce().

std::string ESZeroSuppressionProducer::ESdigiCollection_
private

Definition at line 30 of file ESZeroSuppressionProducer.h.

Referenced by ESZeroSuppressionProducer(), and produce().

edm::ESHandle<ESPedestals> ESZeroSuppressionProducer::espeds_
private

Definition at line 34 of file ESZeroSuppressionProducer.h.

Referenced by produce().

edm::ESHandle<ESThresholds> ESZeroSuppressionProducer::esthresholds_
private

Definition at line 33 of file ESZeroSuppressionProducer.h.

Referenced by produce().

std::string ESZeroSuppressionProducer::ESZSdigiCollection_
private

Definition at line 31 of file ESZeroSuppressionProducer.h.

Referenced by ESZeroSuppressionProducer(), and produce().