Public Member Functions | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
ReduceHcalRecHitCollectionProducer (const edm::ParameterSet &) | |
~ReduceHcalRecHitCollectionProducer () | |
Private Attributes | |
edm::InputTag | inputCollection_ |
TrackAssociatorParameters | parameters_ |
double | ptcut_ |
edm::InputTag | recHitsLabel_ |
std::string | reducedHitsCollection_ |
TrackDetectorAssociator | trackAssociator_ |
Definition at line 66 of file ReduceHcalRecHitCollectionProducer.cc.
ReduceHcalRecHitCollectionProducer::ReduceHcalRecHitCollectionProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 93 of file ReduceHcalRecHitCollectionProducer.cc.
References edm::ParameterSet::getParameter(), inputCollection_, TrackAssociatorParameters::loadParameters(), ExpressReco_HICollisions_FallBack::parameters, parameters_, ptcut_, recHitsLabel_, reducedHitsCollection_, trackAssociator_, and TrackDetectorAssociator::useDefaultPropagator().
{ recHitsLabel_ = iConfig.getParameter< edm::InputTag > ("recHitsLabel"); reducedHitsCollection_ = iConfig.getParameter<std::string>("reducedHitsCollection"); //register your products produces< HBHERecHitCollection > (reducedHitsCollection_) ; inputCollection_ = iConfig.getParameter< edm::InputTag >("inputCollection"); ptcut_= iConfig.getParameter< double >("TrackPt"); produces< DetIdCollection >() ; // TrackAssociator parameters edm::ParameterSet parameters = iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters"); parameters_.loadParameters( parameters ); trackAssociator_.useDefaultPropagator(); }
ReduceHcalRecHitCollectionProducer::~ReduceHcalRecHitCollectionProducer | ( | ) |
Definition at line 113 of file ReduceHcalRecHitCollectionProducer.cc.
{ // do anything here that needs to be done at desctruction time // (e.g. close files, deallocate resources etc.) }
void ReduceHcalRecHitCollectionProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 128 of file ReduceHcalRecHitCollectionProducer.cc.
References TrackDetectorAssociator::associate(), TrackDetMatchInfo::crossedHcalIds, edm::Event::getByLabel(), TrackDetMatchInfo::hcalRecHits, info, inputCollection_, TrackDetectorAssociator::InsideOut, ExpressReco_HICollisions_FallBack::interestingDetIdCollection, parameters_, ptcut_, edm::Event::put(), recHitsLabel_, reducedHitsCollection_, and trackAssociator_.
{ using namespace edm; using namespace std; using reco::TrackCollection; Handle<HBHERecHitCollection> recHitsHandle; iEvent.getByLabel(recHitsLabel_,recHitsHandle); if( !recHitsHandle.isValid() ) { edm::LogError("ReduceHcalRecHitCollectionProducer") << "RecHit collection not found"; return; } //Create empty output collections std::auto_ptr< HBHERecHitCollection > miniRecHitCollection (new HBHERecHitCollection) ; //loop through tracks. Handle<TrackCollection> tkTracks; iEvent.getByLabel(inputCollection_,tkTracks); std::auto_ptr< DetIdCollection > interestingDetIdCollection( new DetIdCollection() ) ; for(TrackCollection::const_iterator itTrack = tkTracks->begin(); itTrack != tkTracks->end(); ++itTrack) { if(itTrack->pt()>ptcut_){ TrackDetMatchInfo info = trackAssociator_.associate(iEvent, iSetup, *itTrack, parameters_, TrackDetectorAssociator::InsideOut); if(info.crossedHcalIds.size()>0){ //loop through hits in the cone for(std::vector<const HBHERecHit*>::const_iterator hit = info.hcalRecHits.begin(); hit != info.hcalRecHits.end(); ++hit) { DetId hitid=(*hit)->id(); HBHERecHitCollection::const_iterator iRecHit = recHitsHandle->find(hitid); if ( (iRecHit != recHitsHandle->end()) && (miniRecHitCollection->find(hitid) == miniRecHitCollection->end()) ) miniRecHitCollection->push_back(*iRecHit); } } } } iEvent.put( miniRecHitCollection,reducedHitsCollection_ ); }
Definition at line 74 of file ReduceHcalRecHitCollectionProducer.cc.
Referenced by produce(), and ReduceHcalRecHitCollectionProducer().
Definition at line 76 of file ReduceHcalRecHitCollectionProducer.cc.
Referenced by produce(), and ReduceHcalRecHitCollectionProducer().
double ReduceHcalRecHitCollectionProducer::ptcut_ [private] |
Definition at line 77 of file ReduceHcalRecHitCollectionProducer.cc.
Referenced by produce(), and ReduceHcalRecHitCollectionProducer().
Definition at line 72 of file ReduceHcalRecHitCollectionProducer.cc.
Referenced by produce(), and ReduceHcalRecHitCollectionProducer().
std::string ReduceHcalRecHitCollectionProducer::reducedHitsCollection_ [private] |
Definition at line 73 of file ReduceHcalRecHitCollectionProducer.cc.
Referenced by produce(), and ReduceHcalRecHitCollectionProducer().
Definition at line 75 of file ReduceHcalRecHitCollectionProducer.cc.
Referenced by produce(), and ReduceHcalRecHitCollectionProducer().