CMS 3D CMS Logo

SiStripElectronProducer Class Reference

Description: <one line="" class="" summary>="">. More...

#include <RecoEgamma/EgammaElectronProducers/interface/SiStripElectronProducer.h>

Inheritance diagram for SiStripElectronProducer:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 SiStripElectronProducer (const edm::ParameterSet &)
 ~SiStripElectronProducer ()

Private Attributes

SiStripElectronAlgoalgo_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_


Detailed Description

Description: <one line="" class="" summary>="">.

Usage: <usage>

Definition at line 34 of file SiStripElectronProducer.h.


Constructor & Destructor Documentation

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_.

00049 {
00050    // register your products
00051    siStripElectronsLabel_ = iConfig.getParameter<std::string>("siStripElectronsLabel");
00052    trackCandidatesLabel_ = iConfig.getParameter<std::string>("trackCandidatesLabel");
00053    produces<reco::SiStripElectronCollection>(siStripElectronsLabel_);
00054    produces<TrackCandidateCollection>(trackCandidatesLabel_);
00055 
00056    // get parameters
00057    siHitProducer_ = iConfig.getParameter<std::string>("siHitProducer");
00058    siRphiHitCollection_ = iConfig.getParameter<std::string>("siRphiHitCollection");
00059    siStereoHitCollection_ = iConfig.getParameter<std::string>("siStereoHitCollection");
00060    siMatchedHitCollection_ = iConfig.getParameter<std::string>("siMatchedHitCollection");
00061 
00062    superClusterProducer_ = iConfig.getParameter<std::string>("superClusterProducer");
00063    superClusterCollection_ = iConfig.getParameter<std::string>("superClusterCollection");
00064    
00065    algo_p = new SiStripElectronAlgo(
00066       iConfig.getParameter<int32_t>("maxHitsOnDetId"),
00067       iConfig.getParameter<double>("originUncertainty"),
00068       iConfig.getParameter<double>("phiBandWidth"),      // this is in radians
00069       iConfig.getParameter<double>("maxNormResid"),
00070       iConfig.getParameter<int32_t>("minHits"),
00071       iConfig.getParameter<double>("maxReducedChi2"));
00072 
00073    LogDebug("") << " Welcome to SiStripElectronProducer " ;
00074 
00075 }

SiStripElectronProducer::~SiStripElectronProducer (  ) 

Definition at line 83 of file SiStripElectronProducer.cc.

References algo_p.

00084 {
00085    // do anything here that needs to be done at desctruction time
00086    // (e.g. close files, deallocate resources etc.)
00087    delete algo_p;
00088 }


Member Function Documentation

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, lat::endl(), 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_.

00109 {
00110    // Extract data from the event
00111    edm::ESHandle<TrackerGeometry> trackerHandle;
00112    iSetup.get<TrackerDigiGeometryRecord>().get(trackerHandle);
00113 
00114    edm::Handle<SiStripRecHit2DCollection> rphiHitsHandle;
00115    iEvent.getByLabel(siHitProducer_, siRphiHitCollection_, rphiHitsHandle);
00116 
00117    edm::Handle<SiStripRecHit2DCollection> stereoHitsHandle;
00118    iEvent.getByLabel(siHitProducer_, siStereoHitCollection_, stereoHitsHandle);
00119 
00120    edm::Handle<SiStripMatchedRecHit2DCollection> matchedHitsHandle;
00121    iEvent.getByLabel(siHitProducer_, siMatchedHitCollection_, matchedHitsHandle);
00122 
00123    edm::ESHandle<MagneticField> magneticFieldHandle;
00124    iSetup.get<IdealMagneticFieldRecord>().get(magneticFieldHandle);
00125 
00126    edm::Handle<reco::SuperClusterCollection> superClusterHandle;
00127    iEvent.getByLabel(superClusterProducer_, superClusterCollection_, superClusterHandle);
00128 
00129    // Set up SiStripElectronAlgo for this event
00130    algo_p->prepareEvent(trackerHandle, rphiHitsHandle, stereoHitsHandle, matchedHitsHandle, magneticFieldHandle);
00131 
00132    // Prepare the output electron candidates and clouds to be filled
00133    std::auto_ptr<reco::SiStripElectronCollection> electronOut(new reco::SiStripElectronCollection);
00134    std::auto_ptr<TrackCandidateCollection> trackCandidateOut(new TrackCandidateCollection);
00135 
00136    // counter for electron candidates
00137    int siStripElectCands = 0 ;
00138 
00139    std::ostringstream str;
00140 
00141 
00142    // Loop over clusters
00143    str << "Starting loop over superclusters."<< "\n" << std::endl;
00144    for (unsigned int i = 0;  i < superClusterHandle.product()->size();  i++) {
00145       const reco::SuperCluster* sc = &(*reco::SuperClusterRef(superClusterHandle, i));
00146       double energy = sc->energy();
00147 
00148       if (algo_p->findElectron(*electronOut, *trackCandidateOut, reco::SuperClusterRef(superClusterHandle, i))) {
00149         str << "Supercluster energy: " << energy << ", FOUND an electron." << "\n" << std::endl;
00150          ++siStripElectCands ;
00151       }
00152       else {
00153          str << "Supercluster energy: " << energy << ", DID NOT FIND an electron."<< "\n" << std::endl;
00154       }
00155    }
00156    str << "Ending loop over superclusters." << "\n" << std::endl;
00157    
00158    str << " Found " << siStripElectCands 
00159                     << " SiStripElectron Candidates before track fit " 
00160                     << "\n" << std::endl ;
00161 
00162    LogDebug("SiStripElectronProducer") << str.str();
00163 
00164    // Put the electron candidates and the tracking trajectories into the event
00165    iEvent.put(electronOut, siStripElectronsLabel_);
00166    iEvent.put(trackCandidateOut, trackCandidatesLabel_);
00167 }


Member Data Documentation

SiStripElectronAlgo* SiStripElectronProducer::algo_p [private]

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().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:32:20 2009 for CMSSW by  doxygen 1.5.4