![]() |
![]() |
#include <RecHitFilter.h>
Public Member Functions | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
RecHitFilter (const edm::ParameterSet &ps) | |
~RecHitFilter () | |
Private Attributes | |
std::string | hitCollection_ |
std::string | hitProducer_ |
double | noiseThreshold_ |
std::string | reducedHitCollection_ |
simple filter of EcalRecHits
simple filter of EcalRecHits
Definition at line 23 of file RecHitFilter.h.
RecHitFilter::RecHitFilter | ( | const edm::ParameterSet & | ps | ) |
Definition at line 31 of file RecHitFilter.cc.
References edm::ParameterSet::getParameter(), hitCollection_, hitProducer_, noiseThreshold_, and reducedHitCollection_.
{ noiseThreshold_ = ps.getParameter<double>("noiseThreshold"); hitProducer_ = ps.getParameter<std::string>("hitProducer"); hitCollection_ = ps.getParameter<std::string>("hitCollection"); reducedHitCollection_ = ps.getParameter<std::string>("reducedHitCollection"); produces< EcalRecHitCollection >(reducedHitCollection_); }
RecHitFilter::~RecHitFilter | ( | ) |
Definition at line 43 of file RecHitFilter.cc.
{ }
void RecHitFilter::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | es | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 48 of file RecHitFilter.cc.
References edm::SortedCollection< T, SORT >::begin(), gather_cfg::cout, edm::SortedCollection< T, SORT >::end(), edm::Event::getByLabel(), hitCollection_, hitProducer_, edm::HandleBase::isValid(), noiseThreshold_, edm::Handle< T >::product(), edm::Event::put(), reducedHitCollection_, and edm::SortedCollection< T, SORT >::size().
{ // get the hit collection from the event: edm::Handle<EcalRecHitCollection> rhcHandle; evt.getByLabel(hitProducer_, hitCollection_, rhcHandle); if (!(rhcHandle.isValid())) { std::cout << "could not get a handle on the EcalRecHitCollection!" << std::endl; return; } const EcalRecHitCollection* hit_collection = rhcHandle.product(); int nTot = hit_collection->size(); int nRed = 0; // create an auto_ptr to a BasicClusterCollection, copy the clusters into it and put in the Event: std::auto_ptr< EcalRecHitCollection > redCollection(new EcalRecHitCollection); //clusters_p->assign(clusters.begin(), clusters.end()); for(EcalRecHitCollection::const_iterator it = hit_collection->begin(); it != hit_collection->end(); ++it) { //std::cout << *it << std::endl; if(it->energy() > noiseThreshold_) { nRed++; redCollection->push_back( EcalRecHit(*it) ); } } std::cout << "total # hits: " << nTot << " #hits with E > " << noiseThreshold_ << " GeV : " << nRed << std::endl; evt.put(redCollection, reducedHitCollection_); //std::cout << "BasicClusterCollection added to the Event! :-)" << std::endl; }
std::string RecHitFilter::hitCollection_ [private] |
Definition at line 38 of file RecHitFilter.h.
Referenced by produce(), and RecHitFilter().
std::string RecHitFilter::hitProducer_ [private] |
Definition at line 37 of file RecHitFilter.h.
Referenced by produce(), and RecHitFilter().
double RecHitFilter::noiseThreshold_ [private] |
Definition at line 35 of file RecHitFilter.h.
Referenced by produce(), and RecHitFilter().
std::string RecHitFilter::reducedHitCollection_ [private] |
Definition at line 36 of file RecHitFilter.h.
Referenced by produce(), and RecHitFilter().