CMS 3D CMS Logo

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

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
 SiStripElectronProducer (const edm::ParameterSet &)
 
 ~SiStripElectronProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Attributes

SiStripElectronAlgoalgo_p
 
edm::EDGetTokenT< SiStripMatchedRecHit2DCollectionmatched_sistrips2dtag_
 
edm::EDGetTokenT< SiStripRecHit2DCollectionrphi_sistrips2dtag_
 
std::string siHitProducer_
 
std::string siMatchedHitCollection_
 
std::string siRphiHitCollection_
 
std::string siStereoHitCollection_
 
std::string siStripElectronsLabel_
 
edm::EDGetTokenT< SiStripRecHit2DCollectionstereo_sistrips2dtag_
 
std::string superClusterCollection_
 
std::string superClusterProducer_
 
edm::EDGetTokenT< reco::SuperClusterCollectionsuperClustertag_
 
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, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

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

47 {
48  // register your products
49  siStripElectronsLabel_ = iConfig.getParameter<std::string>("siStripElectronsLabel");
50  trackCandidatesLabel_ = iConfig.getParameter<std::string>("trackCandidatesLabel");
51  produces<reco::SiStripElectronCollection>(siStripElectronsLabel_);
52  produces<TrackCandidateCollection>(trackCandidatesLabel_);
53 
54  // get parameters
55  siHitProducer_ = iConfig.getParameter<std::string>("siHitProducer");
56  siRphiHitCollection_ = iConfig.getParameter<std::string>("siRphiHitCollection");
57  siStereoHitCollection_ = iConfig.getParameter<std::string>("siStereoHitCollection");
58  siMatchedHitCollection_ = iConfig.getParameter<std::string>("siMatchedHitCollection");
59 
60  superClusterProducer_ = iConfig.getParameter<std::string>("superClusterProducer");
61  superClusterCollection_ = iConfig.getParameter<std::string>("superClusterCollection");
62 
64  consumes<SiStripRecHit2DCollection>(edm::InputTag(siHitProducer_,siRphiHitCollection_));
66  consumes<SiStripRecHit2DCollection>(edm::InputTag(siHitProducer_,siStereoHitCollection_));
68  consumes<SiStripMatchedRecHit2DCollection>(edm::InputTag(siHitProducer_,siMatchedHitCollection_));
70  consumes<reco::SuperClusterCollection>(edm::InputTag(superClusterProducer_,superClusterCollection_));
71 
73  iConfig.getParameter<int32_t>("maxHitsOnDetId"),
74  iConfig.getParameter<double>("originUncertainty"),
75  iConfig.getParameter<double>("phiBandWidth"), // this is in radians
76  iConfig.getParameter<double>("maxNormResid"),
77  iConfig.getParameter<int32_t>("minHits"),
78  iConfig.getParameter<double>("maxReducedChi2"));
79 
80  LogDebug("") << " Welcome to SiStripElectronProducer " ;
81 
82 }
#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 ( )
override

Definition at line 90 of file SiStripElectronProducer.cc.

References algo_p.

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

Member Function Documentation

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

Definition at line 115 of file SiStripElectronProducer.cc.

References algo_p, reco::CaloCluster::energy(), SiStripElectronAlgo::findElectron(), edm::EventSetup::get(), edm::Event::getByToken(), mps_fire::i, LogDebug, matched_sistrips2dtag_, eostools::move(), SiStripElectronAlgo::prepareEvent(), edm::Handle< T >::product(), edm::Event::put(), rphi_sistrips2dtag_, SimDataFormats::CaloAnalysis::sc, siStripElectronsLabel_, stereo_sistrips2dtag_, str, superClustertag_, and trackCandidatesLabel_.

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