#include <RecoEgamma/EgammaElectronProducers/interface/SiStripElectronProducer.h>
Public Member Functions | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
SiStripElectronProducer (const edm::ParameterSet &) | |
~SiStripElectronProducer () | |
Private Attributes | |
SiStripElectronAlgo * | algo_p |
std::string | siHitProducer_ |
std::string | siMatchedHitCollection_ |
std::string | siRphiHitCollection_ |
std::string | siStereoHitCollection_ |
std::string | siStripElectronsLabel_ |
std::string | superClusterCollection_ |
std::string | superClusterProducer_ |
std::string | trackCandidatesLabel_ |
Description: <one line="" class="" summary>="">
Usage: <usage>
Definition at line 34 of file SiStripElectronProducer.h.
SiStripElectronProducer::SiStripElectronProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 48 of file SiStripElectronProducer.cc.
References algo_p, edm::ParameterSet::getParameter(), LogDebug, siHitProducer_, siMatchedHitCollection_, siRphiHitCollection_, siStereoHitCollection_, siStripElectronsLabel_, superClusterCollection_, superClusterProducer_, and trackCandidatesLabel_.
{ // register your products siStripElectronsLabel_ = iConfig.getParameter<std::string>("siStripElectronsLabel"); trackCandidatesLabel_ = iConfig.getParameter<std::string>("trackCandidatesLabel"); produces<reco::SiStripElectronCollection>(siStripElectronsLabel_); produces<TrackCandidateCollection>(trackCandidatesLabel_); // get parameters siHitProducer_ = iConfig.getParameter<std::string>("siHitProducer"); siRphiHitCollection_ = iConfig.getParameter<std::string>("siRphiHitCollection"); siStereoHitCollection_ = iConfig.getParameter<std::string>("siStereoHitCollection"); siMatchedHitCollection_ = iConfig.getParameter<std::string>("siMatchedHitCollection"); superClusterProducer_ = iConfig.getParameter<std::string>("superClusterProducer"); superClusterCollection_ = iConfig.getParameter<std::string>("superClusterCollection"); algo_p = new SiStripElectronAlgo( iConfig.getParameter<int32_t>("maxHitsOnDetId"), iConfig.getParameter<double>("originUncertainty"), iConfig.getParameter<double>("phiBandWidth"), // this is in radians iConfig.getParameter<double>("maxNormResid"), iConfig.getParameter<int32_t>("minHits"), iConfig.getParameter<double>("maxReducedChi2")); LogDebug("") << " Welcome to SiStripElectronProducer " ; }
SiStripElectronProducer::~SiStripElectronProducer | ( | ) |
Definition at line 83 of file SiStripElectronProducer.cc.
References algo_p.
{ // do anything here that needs to be done at desctruction time // (e.g. close files, deallocate resources etc.) delete algo_p; }
void SiStripElectronProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 108 of file SiStripElectronProducer.cc.
References algo_p, reco::CaloCluster::energy(), relval_parameters_module::energy, SiStripElectronAlgo::findElectron(), edm::EventSetup::get(), edm::Event::getByLabel(), i, LogDebug, SiStripElectronAlgo::prepareEvent(), edm::Handle< T >::product(), edm::Event::put(), siHitProducer_, siMatchedHitCollection_, siRphiHitCollection_, siStereoHitCollection_, siStripElectronsLabel_, superClusterCollection_, superClusterProducer_, and trackCandidatesLabel_.
{ // Extract data from the event edm::ESHandle<TrackerGeometry> trackerHandle; iSetup.get<TrackerDigiGeometryRecord>().get(trackerHandle); edm::Handle<SiStripRecHit2DCollection> rphiHitsHandle; iEvent.getByLabel(siHitProducer_, siRphiHitCollection_, rphiHitsHandle); edm::Handle<SiStripRecHit2DCollection> stereoHitsHandle; iEvent.getByLabel(siHitProducer_, siStereoHitCollection_, stereoHitsHandle); edm::Handle<SiStripMatchedRecHit2DCollection> matchedHitsHandle; iEvent.getByLabel(siHitProducer_, siMatchedHitCollection_, matchedHitsHandle); edm::ESHandle<MagneticField> magneticFieldHandle; iSetup.get<IdealMagneticFieldRecord>().get(magneticFieldHandle); edm::Handle<reco::SuperClusterCollection> superClusterHandle; iEvent.getByLabel(superClusterProducer_, superClusterCollection_, superClusterHandle); // Set up SiStripElectronAlgo for this event algo_p->prepareEvent(trackerHandle, rphiHitsHandle, stereoHitsHandle, matchedHitsHandle, magneticFieldHandle); // Prepare the output electron candidates and clouds to be filled std::auto_ptr<reco::SiStripElectronCollection> electronOut(new reco::SiStripElectronCollection); std::auto_ptr<TrackCandidateCollection> trackCandidateOut(new TrackCandidateCollection); // counter for electron candidates int siStripElectCands = 0 ; std::ostringstream str; // Loop over clusters str << "Starting loop over superclusters."<< "\n" << std::endl; for (unsigned int i = 0; i < superClusterHandle.product()->size(); i++) { const reco::SuperCluster* sc = &(*reco::SuperClusterRef(superClusterHandle, i)); double energy = sc->energy(); if (algo_p->findElectron(*electronOut, *trackCandidateOut, reco::SuperClusterRef(superClusterHandle, i))) { str << "Supercluster energy: " << energy << ", FOUND an electron." << "\n" << std::endl; ++siStripElectCands ; } else { str << "Supercluster energy: " << energy << ", DID NOT FIND an electron."<< "\n" << std::endl; } } str << "Ending loop over superclusters." << "\n" << std::endl; str << " Found " << siStripElectCands << " SiStripElectron Candidates before track fit " << "\n" << std::endl ; LogDebug("SiStripElectronProducer") << str.str(); // Put the electron candidates and the tracking trajectories into the event iEvent.put(electronOut, siStripElectronsLabel_); iEvent.put(trackCandidateOut, trackCandidatesLabel_); }
Definition at line 52 of file SiStripElectronProducer.h.
Referenced by produce(), SiStripElectronProducer(), and ~SiStripElectronProducer().
std::string SiStripElectronProducer::siHitProducer_ [private] |
Definition at line 43 of file SiStripElectronProducer.h.
Referenced by produce(), and SiStripElectronProducer().
std::string SiStripElectronProducer::siMatchedHitCollection_ [private] |
Definition at line 46 of file SiStripElectronProducer.h.
Referenced by produce(), and SiStripElectronProducer().
std::string SiStripElectronProducer::siRphiHitCollection_ [private] |
Definition at line 44 of file SiStripElectronProducer.h.
Referenced by produce(), and SiStripElectronProducer().
std::string SiStripElectronProducer::siStereoHitCollection_ [private] |
Definition at line 45 of file SiStripElectronProducer.h.
Referenced by produce(), and SiStripElectronProducer().
std::string SiStripElectronProducer::siStripElectronsLabel_ [private] |
Definition at line 49 of file SiStripElectronProducer.h.
Referenced by produce(), and SiStripElectronProducer().
std::string SiStripElectronProducer::superClusterCollection_ [private] |
Definition at line 48 of file SiStripElectronProducer.h.
Referenced by produce(), and SiStripElectronProducer().
std::string SiStripElectronProducer::superClusterProducer_ [private] |
Definition at line 47 of file SiStripElectronProducer.h.
Referenced by produce(), and SiStripElectronProducer().
std::string SiStripElectronProducer::trackCandidatesLabel_ [private] |
Definition at line 50 of file SiStripElectronProducer.h.
Referenced by produce(), and SiStripElectronProducer().