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
SiStripElectronProducer Class Reference

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

Inheritance diagram for SiStripElectronProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 
 SiStripElectronProducer (const edm::ParameterSet &)
 
 ~SiStripElectronProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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_
 

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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 47 of file SiStripElectronProducer.cc.

References algo_p, edm::ParameterSet::getParameter(), LogDebug, siHitProducer_, siMatchedHitCollection_, siRphiHitCollection_, siStereoHitCollection_, siStripElectronsLabel_, AlCaHLTBitMon_QueryRunRegistry::string, superClusterCollection_, superClusterProducer_, and trackCandidatesLabel_.

48 {
49  // register your products
50  siStripElectronsLabel_ = iConfig.getParameter<std::string>("siStripElectronsLabel");
51  trackCandidatesLabel_ = iConfig.getParameter<std::string>("trackCandidatesLabel");
52  produces<reco::SiStripElectronCollection>(siStripElectronsLabel_);
53  produces<TrackCandidateCollection>(trackCandidatesLabel_);
54 
55  // get parameters
56  siHitProducer_ = iConfig.getParameter<std::string>("siHitProducer");
57  siRphiHitCollection_ = iConfig.getParameter<std::string>("siRphiHitCollection");
58  siStereoHitCollection_ = iConfig.getParameter<std::string>("siStereoHitCollection");
59  siMatchedHitCollection_ = iConfig.getParameter<std::string>("siMatchedHitCollection");
60 
61  superClusterProducer_ = iConfig.getParameter<std::string>("superClusterProducer");
62  superClusterCollection_ = iConfig.getParameter<std::string>("superClusterCollection");
63 
65  iConfig.getParameter<int32_t>("maxHitsOnDetId"),
66  iConfig.getParameter<double>("originUncertainty"),
67  iConfig.getParameter<double>("phiBandWidth"), // this is in radians
68  iConfig.getParameter<double>("maxNormResid"),
69  iConfig.getParameter<int32_t>("minHits"),
70  iConfig.getParameter<double>("maxReducedChi2"));
71 
72  LogDebug("") << " Welcome to SiStripElectronProducer " ;
73 
74 }
#define LogDebug(id)
T getParameter(std::string const &) const
SiStripElectronAlgo * algo_p
SiStripElectronProducer::~SiStripElectronProducer ( )

Definition at line 82 of file SiStripElectronProducer.cc.

References algo_p.

83 {
84  // do anything here that needs to be done at desctruction time
85  // (e.g. close files, deallocate resources etc.)
86  delete algo_p;
87 }
SiStripElectronAlgo * algo_p

Member Function Documentation

void SiStripElectronProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 107 of file SiStripElectronProducer.cc.

References algo_p, relval_parameters_module::energy, reco::CaloCluster::energy(), SiStripElectronAlgo::findElectron(), edm::EventSetup::get(), edm::Event::getByLabel(), i, LogDebug, SiStripElectronAlgo::prepareEvent(), edm::Handle< T >::product(), edm::ESHandle< class >::product(), edm::Event::put(), siHitProducer_, siMatchedHitCollection_, siRphiHitCollection_, siStereoHitCollection_, siStripElectronsLabel_, superClusterCollection_, superClusterProducer_, and trackCandidatesLabel_.

108 {
109  // Extract data from the event
110  edm::ESHandle<TrackerGeometry> trackerHandle;
111  iSetup.get<TrackerDigiGeometryRecord>().get(trackerHandle);
112 
114  iEvent.getByLabel(siHitProducer_, siRphiHitCollection_, rphiHitsHandle);
115 
117  iEvent.getByLabel(siHitProducer_, siStereoHitCollection_, stereoHitsHandle);
118 
120  iEvent.getByLabel(siHitProducer_, siMatchedHitCollection_, matchedHitsHandle);
121 
122  edm::ESHandle<MagneticField> magneticFieldHandle;
123  iSetup.get<IdealMagneticFieldRecord>().get(magneticFieldHandle);
124 
126  iEvent.getByLabel(superClusterProducer_, superClusterCollection_, superClusterHandle);
127 
128  // Set up SiStripElectronAlgo for this event
129  algo_p->prepareEvent(trackerHandle, rphiHitsHandle, stereoHitsHandle, matchedHitsHandle, magneticFieldHandle);
130 
131  // Prepare the output electron candidates and clouds to be filled
132  std::auto_ptr<reco::SiStripElectronCollection> electronOut(new reco::SiStripElectronCollection);
133  std::auto_ptr<TrackCandidateCollection> trackCandidateOut(new TrackCandidateCollection);
134 
135  //Retrieve tracker topology from geometry
137  iSetup.get<IdealGeometryRecord>().get(tTopoHand);
138  const TrackerTopology *tTopo=tTopoHand.product();
139 
140  // counter for electron candidates
141  int siStripElectCands = 0 ;
142 
143  std::ostringstream str;
144 
145 
146  // Loop over clusters
147  str << "Starting loop over superclusters."<< "\n" << std::endl;
148  for (unsigned int i = 0; i < superClusterHandle.product()->size(); i++) {
149  const reco::SuperCluster* sc = &(*reco::SuperClusterRef(superClusterHandle, i));
150  double energy = sc->energy();
151 
152  if (algo_p->findElectron(*electronOut, *trackCandidateOut, reco::SuperClusterRef(superClusterHandle, i),tTopo)) {
153  str << "Supercluster energy: " << energy << ", FOUND an electron." << "\n" << std::endl;
154  ++siStripElectCands ;
155  }
156  else {
157  str << "Supercluster energy: " << energy << ", DID NOT FIND an electron."<< "\n" << std::endl;
158  }
159  }
160  str << "Ending loop over superclusters." << "\n" << std::endl;
161 
162  str << " Found " << siStripElectCands
163  << " SiStripElectron Candidates before track fit "
164  << "\n" << std::endl ;
165 
166  LogDebug("SiStripElectronProducer") << str.str();
167 
168  // Put the electron candidates and the tracking trajectories into the event
169  iEvent.put(electronOut, siStripElectronsLabel_);
170  iEvent.put(trackCandidateOut, trackCandidatesLabel_);
171 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::vector< TrackCandidate > TrackCandidateCollection
edm::Ref< SuperClusterCollection > SuperClusterRef
reference to an object in a collection of SuperCluster objects
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
std::vector< SiStripElectron > SiStripElectronCollection
collectin of SiStripElectron objects
double energy() const
cluster energy
Definition: CaloCluster.h:120
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
bool findElectron(reco::SiStripElectronCollection &electronOut, TrackCandidateCollection &trackCandidateOut, const reco::SuperClusterRef &superclusterIn, const TrackerTopology *tTopo)
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
T const * product() const
Definition: Handle.h:74
SiStripElectronAlgo * algo_p
void prepareEvent(const edm::ESHandle< TrackerGeometry > &tracker, const edm::Handle< SiStripRecHit2DCollection > &rphiHits, const edm::Handle< SiStripRecHit2DCollection > &stereoHits, const edm::Handle< SiStripMatchedRecHit2DCollection > &matchedHits, const edm::ESHandle< MagneticField > &magneticField)

Member Data Documentation

SiStripElectronAlgo* SiStripElectronProducer::algo_p
private
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().