CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
ESZeroSuppressionProducer Class Reference

#include <ESZeroSuppressionProducer.h>

Inheritance diagram for ESZeroSuppressionProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 ESZeroSuppressionProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &event, const edm::EventSetup &eventSetup)
 
virtual ~ESZeroSuppressionProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 19 of file ESZeroSuppressionProducer.h.

Constructor & Destructor Documentation

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

Definition at line 5 of file ESZeroSuppressionProducer.cc.

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

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

Definition at line 14 of file ESZeroSuppressionProducer.cc.

14  {
15 
16 }

Member Function Documentation

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

Produces the EDM products,

Implements edm::EDProducer.

Definition at line 18 of file ESZeroSuppressionProducer.cc.

References ESSample::adc(), digiProducer_, ESdigiCollection_, espeds_, esthresholds_, ESZSdigiCollection_, ESCondObjectContainer< T >::find(), edm::EventSetup::get(), ESThresholds::getTS2Threshold(), i, ESDataFrame::id(), edm::HandleBase::isValid(), edm::ESHandle< class >::product(), and ESDataFrame::sample().

18  {
19 
20  eventSetup.get<ESThresholdsRcd>().get(esthresholds_);
21  const ESThresholds *thresholds = esthresholds_.product();
22 
23  eventSetup.get<ESPedestalsRcd>().get(espeds_);
24  const ESPedestals *pedestals = espeds_.product();
25 
26  float ts2Threshold = thresholds->getTS2Threshold();
27 
29 
30  bool fullESDigis = true;
31  event.getByLabel(digiProducer_, ESDigis);
32  if (!ESDigis.isValid()) {
33  edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << ESdigiCollection_.c_str() ;
34  fullESDigis = false;
35  }
36 
37  std::auto_ptr<ESDigiCollection> ESZSDigis(new ESDigiCollection());
38 
39  if (fullESDigis) {
40  for (ESDigiCollection::const_iterator i (ESDigis->begin());
41  i!=ESDigis->end(); ++i) {
42 
43  ESDataFrame dataframe = (*i);
44 
45  ESPedestals::const_iterator it_ped = pedestals->find(dataframe.id());
46 
47  if (dataframe.sample(1).adc() > (ts2Threshold+it_ped->getMean())) {
48  //std::cout<<dataframe.sample(1).adc()<<" "<<ts2Threshold+it_ped->getMean()<<std::endl;
49  (*ESZSDigis).push_back(*i);
50  }
51  }
52  }
53 
54  event.put(ESZSDigis, ESZSdigiCollection_);
55 }
int i
Definition: DBlmapReader.cc:9
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
edm::ESHandle< ESPedestals > espeds_
const ESDetId & id() const
Definition: ESDataFrame.h:21
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:76
float getTS2Threshold() const
Definition: ESThresholds.h:14
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
std::vector< Item >::const_iterator const_iterator
int adc() const
get the ADC sample (singed 16 bits)
Definition: ESSample.h:18

Member Data Documentation

std::string ESZeroSuppressionProducer::digiProducer_
private

Definition at line 32 of file ESZeroSuppressionProducer.h.

Referenced by ESZeroSuppressionProducer(), and produce().

std::string ESZeroSuppressionProducer::ESdigiCollection_
private

Definition at line 33 of file ESZeroSuppressionProducer.h.

Referenced by ESZeroSuppressionProducer(), and produce().

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

Definition at line 37 of file ESZeroSuppressionProducer.h.

Referenced by produce().

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

Definition at line 36 of file ESZeroSuppressionProducer.h.

Referenced by produce().

std::string ESZeroSuppressionProducer::ESZSdigiCollection_
private

Definition at line 34 of file ESZeroSuppressionProducer.h.

Referenced by ESZeroSuppressionProducer(), and produce().