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::stream::EDProducer<> edm::stream::EDProducerBase 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::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

SiStripElectronAlgoalgo_p
 
edm::EDGetTokenT
< SiStripMatchedRecHit2DCollection
matched_sistrips2dtag_
 
edm::EDGetTokenT
< SiStripRecHit2DCollection
rphi_sistrips2dtag_
 
std::string siHitProducer_
 
std::string siMatchedHitCollection_
 
std::string siRphiHitCollection_
 
std::string siStereoHitCollection_
 
std::string siStripElectronsLabel_
 
edm::EDGetTokenT
< SiStripRecHit2DCollection
stereo_sistrips2dtag_
 
std::string superClusterCollection_
 
std::string superClusterProducer_
 
edm::EDGetTokenT
< reco::SuperClusterCollection
superClustertag_
 
std::string trackCandidatesLabel_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 35 of file SiStripElectronProducer.h.

Constructor & Destructor Documentation

SiStripElectronProducer::SiStripElectronProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 45 of file SiStripElectronProducer.cc.

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

46 {
47  // register your products
48  siStripElectronsLabel_ = iConfig.getParameter<std::string>("siStripElectronsLabel");
49  trackCandidatesLabel_ = iConfig.getParameter<std::string>("trackCandidatesLabel");
50  produces<reco::SiStripElectronCollection>(siStripElectronsLabel_);
51  produces<TrackCandidateCollection>(trackCandidatesLabel_);
52 
53  // get parameters
54  siHitProducer_ = iConfig.getParameter<std::string>("siHitProducer");
55  siRphiHitCollection_ = iConfig.getParameter<std::string>("siRphiHitCollection");
56  siStereoHitCollection_ = iConfig.getParameter<std::string>("siStereoHitCollection");
57  siMatchedHitCollection_ = iConfig.getParameter<std::string>("siMatchedHitCollection");
58 
59  superClusterProducer_ = iConfig.getParameter<std::string>("superClusterProducer");
60  superClusterCollection_ = iConfig.getParameter<std::string>("superClusterCollection");
61 
63  consumes<SiStripRecHit2DCollection>(edm::InputTag(siHitProducer_,siRphiHitCollection_));
65  consumes<SiStripRecHit2DCollection>(edm::InputTag(siHitProducer_,siStereoHitCollection_));
67  consumes<SiStripMatchedRecHit2DCollection>(edm::InputTag(siHitProducer_,siMatchedHitCollection_));
69  consumes<reco::SuperClusterCollection>(edm::InputTag(superClusterProducer_,superClusterCollection_));
70 
72  iConfig.getParameter<int32_t>("maxHitsOnDetId"),
73  iConfig.getParameter<double>("originUncertainty"),
74  iConfig.getParameter<double>("phiBandWidth"), // this is in radians
75  iConfig.getParameter<double>("maxNormResid"),
76  iConfig.getParameter<int32_t>("minHits"),
77  iConfig.getParameter<double>("maxReducedChi2"));
78 
79  LogDebug("") << " Welcome to SiStripElectronProducer " ;
80 
81 }
#define LogDebug(id)
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::SuperClusterCollection > superClustertag_
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > matched_sistrips2dtag_
edm::EDGetTokenT< SiStripRecHit2DCollection > stereo_sistrips2dtag_
SiStripElectronAlgo * algo_p
edm::EDGetTokenT< SiStripRecHit2DCollection > rphi_sistrips2dtag_
SiStripElectronProducer::~SiStripElectronProducer ( )

Definition at line 89 of file SiStripElectronProducer.cc.

References algo_p.

90 {
91  // do anything here that needs to be done at desctruction time
92  // (e.g. close files, deallocate resources etc.)
93  delete algo_p;
94 }
SiStripElectronAlgo * algo_p

Member Function Documentation

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

Implements edm::stream::EDProducerBase.

Definition at line 114 of file SiStripElectronProducer.cc.

References algo_p, relval_parameters_module::energy, reco::CaloCluster::energy(), SiStripElectronAlgo::findElectron(), edm::EventSetup::get(), edm::Event::getByToken(), i, LogDebug, matched_sistrips2dtag_, SiStripElectronAlgo::prepareEvent(), edm::Handle< T >::product(), edm::ESHandle< class >::product(), edm::Event::put(), rphi_sistrips2dtag_, siStripElectronsLabel_, stereo_sistrips2dtag_, superClustertag_, and trackCandidatesLabel_.

115 {
116  // Extract data from the event
117  edm::ESHandle<TrackerGeometry> trackerHandle;
118  iSetup.get<TrackerDigiGeometryRecord>().get(trackerHandle);
119 
121  iEvent.getByToken(rphi_sistrips2dtag_, rphiHitsHandle);
122 
124  iEvent.getByToken(stereo_sistrips2dtag_, stereoHitsHandle);
125 
127  iEvent.getByToken(matched_sistrips2dtag_, matchedHitsHandle);
128 
129  edm::ESHandle<MagneticField> magneticFieldHandle;
130  iSetup.get<IdealMagneticFieldRecord>().get(magneticFieldHandle);
131 
133  iEvent.getByToken(superClustertag_, superClusterHandle);
134 
135  // Set up SiStripElectronAlgo for this event
136  algo_p->prepareEvent(trackerHandle, rphiHitsHandle, stereoHitsHandle, matchedHitsHandle, magneticFieldHandle);
137 
138  // Prepare the output electron candidates and clouds to be filled
139  std::auto_ptr<reco::SiStripElectronCollection> electronOut(new reco::SiStripElectronCollection);
140  std::auto_ptr<TrackCandidateCollection> trackCandidateOut(new TrackCandidateCollection);
141 
142  //Retrieve tracker topology from geometry
144  iSetup.get<IdealGeometryRecord>().get(tTopoHand);
145  const TrackerTopology *tTopo=tTopoHand.product();
146 
147  // counter for electron candidates
148  int siStripElectCands = 0 ;
149 
150  std::ostringstream str;
151 
152 
153  // Loop over clusters
154  str << "Starting loop over superclusters."<< "\n" << std::endl;
155  for (unsigned int i = 0; i < superClusterHandle.product()->size(); i++) {
156  const reco::SuperCluster* sc = &(*reco::SuperClusterRef(superClusterHandle, i));
157  double energy = sc->energy();
158 
159  if (algo_p->findElectron(*electronOut, *trackCandidateOut, reco::SuperClusterRef(superClusterHandle, i),tTopo)) {
160  str << "Supercluster energy: " << energy << ", FOUND an electron." << "\n" << std::endl;
161  ++siStripElectCands ;
162  }
163  else {
164  str << "Supercluster energy: " << energy << ", DID NOT FIND an electron."<< "\n" << std::endl;
165  }
166  }
167  str << "Ending loop over superclusters." << "\n" << std::endl;
168 
169  str << " Found " << siStripElectCands
170  << " SiStripElectron Candidates before track fit "
171  << "\n" << std::endl ;
172 
173  LogDebug("SiStripElectronProducer") << str.str();
174 
175  // Put the electron candidates and the tracking trajectories into the event
176  iEvent.put(electronOut, siStripElectronsLabel_);
177  iEvent.put(trackCandidateOut, trackCandidatesLabel_);
178 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
std::vector< TrackCandidate > TrackCandidateCollection
edm::EDGetTokenT< reco::SuperClusterCollection > superClustertag_
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:113
std::vector< SiStripElectron > SiStripElectronCollection
collectin of SiStripElectron objects
double energy() const
cluster energy
Definition: CaloCluster.h:121
bool findElectron(reco::SiStripElectronCollection &electronOut, TrackCandidateCollection &trackCandidateOut, const reco::SuperClusterRef &superclusterIn, const TrackerTopology *tTopo)
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > matched_sistrips2dtag_
T const * product() const
Definition: Handle.h:81
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
edm::EDGetTokenT< SiStripRecHit2DCollection > stereo_sistrips2dtag_
SiStripElectronAlgo * algo_p
edm::EDGetTokenT< SiStripRecHit2DCollection > rphi_sistrips2dtag_
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
edm::EDGetTokenT<SiStripMatchedRecHit2DCollection> SiStripElectronProducer::matched_sistrips2dtag_
private

Definition at line 55 of file SiStripElectronProducer.h.

Referenced by produce(), and SiStripElectronProducer().

edm::EDGetTokenT<SiStripRecHit2DCollection> SiStripElectronProducer::rphi_sistrips2dtag_
private

Definition at line 53 of file SiStripElectronProducer.h.

Referenced by produce(), and SiStripElectronProducer().

std::string SiStripElectronProducer::siHitProducer_
private

Definition at line 44 of file SiStripElectronProducer.h.

Referenced by SiStripElectronProducer().

std::string SiStripElectronProducer::siMatchedHitCollection_
private

Definition at line 47 of file SiStripElectronProducer.h.

Referenced by SiStripElectronProducer().

std::string SiStripElectronProducer::siRphiHitCollection_
private

Definition at line 45 of file SiStripElectronProducer.h.

Referenced by SiStripElectronProducer().

std::string SiStripElectronProducer::siStereoHitCollection_
private

Definition at line 46 of file SiStripElectronProducer.h.

Referenced by SiStripElectronProducer().

std::string SiStripElectronProducer::siStripElectronsLabel_
private

Definition at line 50 of file SiStripElectronProducer.h.

Referenced by produce(), and SiStripElectronProducer().

edm::EDGetTokenT<SiStripRecHit2DCollection> SiStripElectronProducer::stereo_sistrips2dtag_
private

Definition at line 54 of file SiStripElectronProducer.h.

Referenced by produce(), and SiStripElectronProducer().

std::string SiStripElectronProducer::superClusterCollection_
private

Definition at line 49 of file SiStripElectronProducer.h.

Referenced by SiStripElectronProducer().

std::string SiStripElectronProducer::superClusterProducer_
private

Definition at line 48 of file SiStripElectronProducer.h.

Referenced by SiStripElectronProducer().

edm::EDGetTokenT<reco::SuperClusterCollection> SiStripElectronProducer::superClustertag_
private

Definition at line 56 of file SiStripElectronProducer.h.

Referenced by produce(), and SiStripElectronProducer().

std::string SiStripElectronProducer::trackCandidatesLabel_
private

Definition at line 51 of file SiStripElectronProducer.h.

Referenced by produce(), and SiStripElectronProducer().