CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
LowPtGsfElectronSeedProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: ElectronProducers
4 // Class: LowPtGsfElectronSeedProducer
5 //
11 // Original Author: Robert Bainbridge
12 
54 
56 
58  : public edm::stream::EDProducer<edm::GlobalCache<lowptgsfeleseed::HeavyObjectCache> > {
59 public:
60  using TrackIndxMap = std::unordered_map<reco::TrackRef::key_type, size_t>;
62 
63  static std::unique_ptr<lowptgsfeleseed::HeavyObjectCache> initializeGlobalCache(const edm::ParameterSet& conf) {
64  return std::make_unique<lowptgsfeleseed::HeavyObjectCache>(lowptgsfeleseed::HeavyObjectCache(conf));
65  }
66 
68 
69  void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
70 
71  void produce(edm::Event&, const edm::EventSetup&) override;
72 
74 
75 private: // member functions
76  template <typename T>
77  void loop(const edm::Handle<std::vector<T> >& handle,
80  reco::PreIdCollection& ecalPreIds,
81  reco::PreIdCollection& hcalPreIds,
82  TrackIndxMap& trksToPreIdIndx,
83  edm::Event&,
84  const edm::EventSetup&);
85 
86  // Overloaded methods to retrieve reco::TrackRef
87 
88  reco::TrackRef getBaseRef(edm::Handle<std::vector<reco::Track> > handle, int idx) const;
89  reco::TrackRef getBaseRef(edm::Handle<std::vector<reco::PFRecTrack> > handle, int idx) const;
90 
91  // Overloaded methods to populate PreIds (using PF or KF tracks)
92 
93  void propagateTrackToCalo(const reco::PFRecTrackRef& pfTrackRef,
95  const edm::Handle<reco::PFClusterCollection>& hcalClusters,
96  std::vector<int>& matchedEcalClusters,
97  std::vector<int>& matchedHcalClusters,
98  reco::PreId& ecalPreId,
99  reco::PreId& hcalPreId);
100 
101  void propagateTrackToCalo(const reco::PFRecTrackRef& pfTrackRef,
103  std::vector<int>& matchedClusters,
104  reco::PreId& preId,
105  bool ecal);
106 
109  const edm::Handle<reco::PFClusterCollection>& hcalClusters,
110  std::vector<int>& matchedEcalClusters,
111  std::vector<int>& matchedHcalClusters,
112  reco::PreId& ecalPreId,
113  reco::PreId& hcalPreId);
114  template <typename CollType>
116  const TrackIndxMap& trksToPreIdIndx,
117  const edm::OrphanHandle<reco::PreIdCollection>& preIdHandle,
119 
120  // Overloaded methods to evaluate BDTs (using PF or KF tracks)
121 
122  bool decision(const reco::PFRecTrackRef& pfTrackRef,
123  reco::PreId& ecal,
124  reco::PreId& hcal,
125  double rho,
126  const reco::BeamSpot& spot,
127  noZS::EcalClusterLazyTools& ecalTools);
128 
129  bool decision(const reco::TrackRef& kfTrackRef,
130  reco::PreId& ecal,
131  reco::PreId& hcal,
132  double rho,
133  const reco::BeamSpot& spot,
134  noZS::EcalClusterLazyTools& ecalTools);
135 
136  // Perform lightweight GSF tracking
138 
139 private: // member data
141  std::unique_ptr<TrajectoryFitter> fitterPtr_;
142  std::unique_ptr<TrajectorySmoother> smootherPtr_;
151 
157 
158  const bool passThrough_;
159  const bool usePfTracks_;
160  const double minPtThreshold_;
161  const double maxPtThreshold_;
162 
163  // pow( sinh(1.65), 2. )
164  static constexpr double boundary_ = 2.50746495928 * 2.50746495928;
165  // pow( ele_mass, 2. )
166  static constexpr double mass_ = 0.000511 * 0.000511;
167 };
168 
170 //
173  : field_(),
174  fitterPtr_(),
175  smootherPtr_(),
176  kfTracks_(),
177  pfTracks_(),
178  ecalClusters_{consumes(conf.getParameter<edm::InputTag>("ecalClusters"))},
179  hcalClusters_(),
180  ebRecHits_{consumes(conf.getParameter<edm::InputTag>("EBRecHits"))},
181  eeRecHits_{consumes(conf.getParameter<edm::InputTag>("EERecHits"))},
182  rho_(consumes(conf.getParameter<edm::InputTag>("rho"))),
183  beamSpot_(consumes(conf.getParameter<edm::InputTag>("BeamSpot"))),
184  trajectoryFitterToken_{esConsumes(conf.getParameter<edm::ESInputTag>("Fitter"))},
185  trajectorySmootherToken_{esConsumes(conf.getParameter<edm::ESInputTag>("Smoother"))},
186  builderToken_{esConsumes(conf.getParameter<edm::ESInputTag>("TTRHBuilder"))},
187  magToken_{esConsumes<edm::Transition::BeginLuminosityBlock>()},
188  ecalClusterToolsESGetTokens_{consumesCollector()},
189  passThrough_(conf.getParameter<bool>("PassThrough")),
190  usePfTracks_(conf.getParameter<bool>("UsePfTracks")),
191  minPtThreshold_(conf.getParameter<double>("MinPtThreshold")),
192  maxPtThreshold_(conf.getParameter<double>("MaxPtThreshold")) {
193  if (usePfTracks_) {
194  pfTracks_ = consumes(conf.getParameter<edm::InputTag>("pfTracks"));
195  hcalClusters_ = consumes(conf.getParameter<edm::InputTag>("hcalClusters"));
196  }
197  kfTracks_ = consumes(conf.getParameter<edm::InputTag>("tracks"));
198 
199  produces<reco::ElectronSeedCollection>();
200  produces<reco::PreIdCollection>();
201  produces<reco::PreIdCollection>("HCAL");
202  produces<edm::ValueMap<reco::PreIdRef> >(); // indexed by edm::Ref<ElectronSeed>.index()
203 }
204 
206 //
208  field_ = setup.getHandle(magToken_);
209 }
210 
212 //
214  // Products
215  auto seeds = std::make_unique<reco::ElectronSeedCollection>();
216  auto ecalPreIds = std::make_unique<reco::PreIdCollection>();
217  auto hcalPreIds = std::make_unique<reco::PreIdCollection>();
218 
219  const edm::RefProd<reco::PreIdCollection> preIdsRefProd = event.getRefBeforePut<reco::PreIdCollection>();
220 
221  // HCAL clusters (only used with PF tracks)
223 
224  //we always need kftracks as we link the preids to them
226  event.getByToken(kfTracks_, kfTracks);
227 
228  TrackIndxMap trksToPreIdIndx;
229  if (usePfTracks_) {
231  event.getByToken(pfTracks_, pfTracks);
232  event.getByToken(hcalClusters_, hcalClusters);
233 
234  //check consistency between kfTracks and pfTracks collection
235  for (auto& trk : *pfTracks) {
236  if (trk.trackRef().isNonnull()) {
237  if (trk.trackRef().id() != kfTracks.id()) {
238  throw cms::Exception("ConfigError")
239  << "kfTracks is not the collection that pfTracks was built from, please fix this";
240  }
241  break; //we only need one valid track ref to check this so end the loop
242  }
243  }
244 
245  loop(pfTracks, // PF tracks
246  hcalClusters,
247  *seeds,
248  *ecalPreIds,
249  *hcalPreIds,
250  trksToPreIdIndx,
251  event,
252  setup);
253 
254  } else {
255  loop(kfTracks, // KF tracks
256  hcalClusters,
257  *seeds,
258  *ecalPreIds,
259  *hcalPreIds,
260  trksToPreIdIndx,
261  event,
262  setup);
263  }
264 
265  auto ecalPreIdsHandle = event.put(std::move(ecalPreIds));
266  event.put(std::move(hcalPreIds), "HCAL");
267  event.put(std::move(seeds));
268 
269  auto preIdVMOut = std::make_unique<edm::ValueMap<reco::PreIdRef> >();
270  edm::ValueMap<reco::PreIdRef>::Filler mapFiller(*preIdVMOut);
271  fillPreIdRefValueMap(kfTracks, trksToPreIdIndx, ecalPreIdsHandle, mapFiller);
272  mapFiller.fill();
273  event.put(std::move(preIdVMOut));
274 }
275 
277 // Return reco::Track from edm::Ref<T>
278 
279 reco::TrackRef LowPtGsfElectronSeedProducer::getBaseRef(edm::Handle<std::vector<reco::Track> > handle, int idx) const {
280  return reco::TrackRef(handle, idx);
281 }
282 
284  int idx) const {
285  return reco::PFRecTrackRef(handle, idx)->trackRef();
286 }
287 
289 // Template function, instantiated for both reco::Tracks and reco::PFRecTracks
290 template <typename T>
291 void LowPtGsfElectronSeedProducer::loop(const edm::Handle<std::vector<T> >& handle, // PF or KF tracks
294  reco::PreIdCollection& ecalPreIds,
295  reco::PreIdCollection& hcalPreIds,
296  TrackIndxMap& trksToPreIdIndx,
297  edm::Event& event,
298  const edm::EventSetup& setup) {
299  // Pileup
300  auto const& rho = event.get(rho_);
301 
302  // Beam spot
303  auto const& spot = event.get(beamSpot_);
304 
305  // Track fitter
306  fitterPtr_ = setup.getData(trajectoryFitterToken_).clone();
307 
308  // Track smoother
309  smootherPtr_.reset(setup.getData(trajectorySmootherToken_).clone());
310 
311  // RecHit cloner
312  TkClonerImpl hitCloner = static_cast<TkTransientTrackingRecHitBuilder const&>(setup.getData(builderToken_)).cloner();
313  fitterPtr_->setHitCloner(&hitCloner);
314  smootherPtr_->setHitCloner(&hitCloner);
315 
316  // ECAL clusters
317  auto ecalClusters = event.getHandle(ecalClusters_);
318 
319  // Utility to access to shower shape vars
321 
322  // Ensure each cluster is only matched once to a track
323  std::vector<int> matchedEcalClusters;
324  std::vector<int> matchedHcalClusters;
325 
326  // Reserve
327  seeds.reserve(handle->size());
328  ecalPreIds.reserve(handle->size());
329  hcalPreIds.reserve(handle->size());
330 
331  // Iterate through (PF or KF) tracks
332  for (unsigned int itrk = 0; itrk < handle.product()->size(); itrk++) {
333  edm::Ref<std::vector<T> > templatedRef(handle, itrk); // TrackRef or PFRecTrackRef
334  reco::TrackRef trackRef = getBaseRef(handle, itrk);
335 
336  if (!(trackRef->quality(reco::TrackBase::qualityByName("highPurity")))) {
337  continue;
338  }
339  if (!passThrough_ && (trackRef->pt() < minPtThreshold_)) {
340  continue;
341  }
342 
343  // Create ElectronSeed
344  reco::ElectronSeed seed(*(trackRef->seedRef()));
345  if (seed.nHits() == 0) { //if DeepCore is used in jetCore iteration the seed are hitless, in case skip
346  continue;
347  }
348  seed.setCtfTrack(trackRef);
349 
350  // Create PreIds
351  unsigned int nModels = globalCache()->modelNames().size();
352  reco::PreId ecalPreId(nModels);
353  reco::PreId hcalPreId(nModels);
354 
355  // Add track ref to PreId
356  ecalPreId.setTrack(trackRef);
357  hcalPreId.setTrack(trackRef);
358 
359  // Add Track-Calo matching variables to PreIds
361  templatedRef, ecalClusters, hcalClusters, matchedEcalClusters, matchedHcalClusters, ecalPreId, hcalPreId);
362 
363  // Add variables related to GSF tracks to PreId
364  lightGsfTracking(ecalPreId, trackRef, seed);
365 
366  // Decision based on BDT
367  bool result = decision(templatedRef, ecalPreId, hcalPreId, rho, spot, ecalTools);
368 
369  // If fails BDT, do not store seed
370  if (!result) {
371  continue;
372  }
373 
374  // Store PreId
375  ecalPreIds.push_back(ecalPreId);
376  hcalPreIds.push_back(hcalPreId);
377  trksToPreIdIndx[trackRef.index()] = ecalPreIds.size() - 1;
378 
379  // Store ElectronSeed and corresponding edm::Ref<PreId>.index()
380  seeds.push_back(seed);
381  }
382 }
383 
385 // Template instantiation for reco::Tracks
386 template void LowPtGsfElectronSeedProducer::loop<reco::Track>(const edm::Handle<std::vector<reco::Track> >&,
389  reco::PreIdCollection& ecalPreIds,
390  reco::PreIdCollection& hcalPreIds,
391  TrackIndxMap& trksToPreIdIndx,
392  edm::Event&,
393  const edm::EventSetup&);
394 
396 // Template instantiation for reco::PFRecTracks
397 template void LowPtGsfElectronSeedProducer::loop<reco::PFRecTrack>(const edm::Handle<std::vector<reco::PFRecTrack> >&,
400  reco::PreIdCollection& ecalPreIds,
401  reco::PreIdCollection& hcalPreIds,
402  TrackIndxMap& trksToPreIdIndx,
403  edm::Event&,
404  const edm::EventSetup&);
405 
407 // Loops through both ECAL and HCAL clusters
410  const edm::Handle<reco::PFClusterCollection>& hcalClusters,
411  std::vector<int>& matchedEcalClusters,
412  std::vector<int>& matchedHcalClusters,
413  reco::PreId& ecalPreId,
414  reco::PreId& hcalPreId) {
415  propagateTrackToCalo(pfTrackRef, ecalClusters, matchedEcalClusters, ecalPreId, true);
416  propagateTrackToCalo(pfTrackRef, hcalClusters, matchedHcalClusters, hcalPreId, false);
417 }
418 
420 // Loops through ECAL or HCAL clusters (called twice)
423  std::vector<int>& matched,
424  reco::PreId& preId,
425  bool ecal) {
426  // Store info for PreId
427  struct Info {
429  float dr2min = 1.e6;
430  float deta = 1.e6;
431  float dphi = 1.e6;
432  math::XYZPoint showerPos = math::XYZPoint(0., 0., 0.);
433  } info;
434 
435  // Find closest "seed cluster" to KF track extrapolated to ECAL (or HCAL)
437  if (ecal) {
438  point = pfTrackRef->extrapolatedPoint(reco::PFTrajectoryPoint::LayerType::ECALShowerMax);
439  } else {
440  point = pfTrackRef->extrapolatedPoint(reco::PFTrajectoryPoint::LayerType::HCALEntrance);
441  }
442 
443  if (point.isValid()) {
444  Info info;
445  for (unsigned int iclu = 0; iclu < clusters.product()->size(); iclu++) {
446  if (std::find(matched.begin(), matched.end(), iclu) == matched.end()) {
447  reco::PFClusterRef cluRef(clusters, iclu);
448 
449  // Determine dR squared
450  float dr2 = reco::deltaR2(cluRef->positionREP(), point.positionREP());
451 
452  if (dr2 < info.dr2min) {
453  info.dr2min = dr2;
454  info.cluRef = cluRef;
455  info.deta = cluRef->positionREP().eta() - point.positionREP().eta();
456  info.dphi =
457  reco::deltaPhi(cluRef->positionREP().phi(), point.positionREP().phi()) * pfTrackRef->trackRef()->charge();
458  info.showerPos = point.position();
459  }
460  }
461  }
462 
463  // Set PreId content if match found
464  if (info.dr2min < 1.e5) {
465  float ep = info.cluRef->correctedEnergy() / std::sqrt(pfTrackRef->trackRef()->innerMomentum().mag2());
466  preId.setECALMatchingProperties(info.cluRef,
467  point.position(), // ECAL or HCAL surface
468  info.showerPos, //
469  info.deta,
470  info.dphi,
471  0.f, // chieta
472  0.f, // chiphi
473  pfTrackRef->trackRef()->normalizedChi2(), // chi2
474  ep);
475  }
476 
477  } // clusters
478 }
479 
481 // Original implementation in GoodSeedProducer, loops over ECAL clusters only
483  const reco::TrackRef& kfTrackRef,
485  const edm::Handle<reco::PFClusterCollection>& hcalClusters, // not used
486  std::vector<int>& matchedEcalClusters,
487  std::vector<int>& matchedHcalClusters, // not used
488  reco::PreId& ecalPreId,
489  reco::PreId& hcalPreId /* not used */) {
490  // Store info for PreId
491  struct Info {
493  float dr2min = 1.e6;
494  float deta = 1.e6;
495  float dphi = 1.e6;
496  math::XYZPoint showerPos = math::XYZPoint(0., 0., 0.);
497  } info;
498 
499  // Propagate 'electron' to ECAL surface
500  float energy = sqrt(mass_ + kfTrackRef->outerMomentum().Mag2());
502  kfTrackRef->outerMomentum().x(), kfTrackRef->outerMomentum().y(), kfTrackRef->outerMomentum().z(), energy);
504  kfTrackRef->outerPosition().x(), kfTrackRef->outerPosition().y(), kfTrackRef->outerPosition().z(), 0.);
505  math::XYZVector field(field_->inTesla(GlobalPoint(0, 0, 0)));
506  BaseParticlePropagator particle(RawParticle(mom, pos, kfTrackRef->charge()), 0, 0, field.z());
507  particle.propagateToEcalEntrance(false);
508  if (particle.getSuccess() == 0) {
509  return;
510  }
511 
512  // ECAL entry point for track
513  GlobalPoint ecal_pos(
514  particle.particle().vertex().x(), particle.particle().vertex().y(), particle.particle().vertex().z());
515 
516  // Preshower limit
517  bool below_ps = pow(ecal_pos.z(), 2.) > boundary_ * ecal_pos.perp2();
518 
519  // Iterate through ECAL clusters
520  for (unsigned int iclu = 0; iclu < ecalClusters.product()->size(); iclu++) {
521  reco::PFClusterRef cluRef(ecalClusters, iclu);
522 
523  // Correct ecal_pos for shower depth
524  double shower_depth = reco::PFCluster::getDepthCorrection(cluRef->correctedEnergy(), below_ps, false);
525  GlobalPoint showerPos = ecal_pos + GlobalVector(particle.particle().momentum().x(),
526  particle.particle().momentum().y(),
527  particle.particle().momentum().z())
528  .unit() *
529  shower_depth;
530 
531  // Determine dR squared
532  float dr2 = reco::deltaR2(cluRef->positionREP(), showerPos);
533 
534  // Find nearest ECAL cluster
535  if (dr2 < info.dr2min) {
536  info.dr2min = dr2;
537  info.cluRef = cluRef;
538  info.deta = std::abs(cluRef->positionREP().eta() - showerPos.eta());
539  info.dphi = std::abs(reco::deltaPhi(cluRef->positionREP().phi(), showerPos.phi())) * kfTrackRef->charge();
540  info.showerPos = showerPos;
541  }
542  }
543 
544  // Populate PreId object
545  math::XYZPoint point(ecal_pos.x(), ecal_pos.y(), ecal_pos.z());
546 
547  // Set PreId content
548  ecalPreId.setECALMatchingProperties(
549  info.cluRef,
550  point,
551  info.showerPos,
552  info.deta,
553  info.dphi,
554  0.f, // chieta
555  0.f, // chiphi
556  kfTrackRef->normalizedChi2(), // chi2
557  info.cluRef->correctedEnergy() / std::sqrt(kfTrackRef->innerMomentum().mag2())); // E/p
558 }
559 
561 // Original implementation for "lightweight" GSF tracking
563  const reco::TrackRef& trackRef,
564  const reco::ElectronSeed& seed) {
566  for (unsigned int ihit = 0; ihit < trackRef->recHitsSize(); ++ihit) {
567  hits.push_back(trackRef->recHit(ihit)->cloneSH());
568  }
569 
570  GlobalVector gv(trackRef->innerMomentum().x(), trackRef->innerMomentum().y(), trackRef->innerMomentum().z());
571  GlobalPoint gp(trackRef->innerPosition().x(), trackRef->innerPosition().y(), trackRef->innerPosition().z());
572 
573  GlobalTrajectoryParameters gtps(gp, gv, trackRef->charge(), &*field_);
574 
575  TrajectoryStateOnSurface tsos(gtps, trackRef->innerStateCovariance(), *hits[0]->surface());
576 
577  // Track fitted and smoothed under electron hypothesis
578  Trajectory traj1 = fitterPtr_->fitOne(seed, hits, tsos);
579  if (!traj1.isValid()) {
580  return false;
581  }
582  Trajectory traj2 = smootherPtr_->trajectory(traj1);
583  if (!traj2.isValid()) {
584  return false;
585  }
586 
587  // Set PreId content
588  float chi2Ratio = trackRef->chi2() > 0. ? traj2.chiSquared() / trackRef->chi2() : -1.;
589  float gsfReducedChi2 = chi2Ratio > -1. ? chi2Ratio * trackRef->normalizedChi2() : -1.;
590  float ptOut = traj2.firstMeasurement().updatedState().globalMomentum().perp();
591  float ptIn = traj2.lastMeasurement().updatedState().globalMomentum().perp();
592  float gsfDpt = (ptIn > 0) ? fabs(ptOut - ptIn) / ptIn : 0.;
593  preId.setTrackProperties(gsfReducedChi2, chi2Ratio, gsfDpt);
594 
595  return true;
596 }
597 
599 // Decision based on OR of outputs from list of models
601  reco::PreId& ecalPreId,
602  reco::PreId& hcalPreId,
603  double rho,
604  const reco::BeamSpot& spot,
605  noZS::EcalClusterLazyTools& ecalTools) {
606  bool result = false;
607  for (auto& name : globalCache()->modelNames()) {
608  result |= globalCache()->eval(name, ecalPreId, hcalPreId, rho, spot, ecalTools);
609  }
610  return passThrough_ || (pfTrackRef->trackRef()->pt() > maxPtThreshold_) || result;
611 }
612 
614 //
616  reco::PreId& ecalPreId,
617  reco::PreId& hcalPreId,
618  double rho,
619  const reco::BeamSpot& spot,
620  noZS::EcalClusterLazyTools& ecalTools) {
621  // No implementation currently
622  return passThrough_;
623 }
624 
625 template <typename CollType>
627  const TrackIndxMap& trksToPreIdIndx,
628  const edm::OrphanHandle<reco::PreIdCollection>& preIdHandle,
630  std::vector<reco::PreIdRef> values;
631 
632  unsigned ntracks = tracksHandle->size();
633  for (unsigned itrack = 0; itrack < ntracks; ++itrack) {
634  edm::Ref<CollType> trackRef(tracksHandle, itrack);
635  auto preIdRefIt = trksToPreIdIndx.find(trackRef.index());
636  if (preIdRefIt == trksToPreIdIndx.end()) {
637  values.push_back(reco::PreIdRef());
638  } else {
639  edm::Ref<reco::PreIdCollection> preIdRef(preIdHandle, preIdRefIt->second);
640  values.push_back(preIdRef);
641  }
642  }
643  filler.insert(tracksHandle, values.begin(), values.end());
644 }
645 
647 //
650  desc.add<edm::InputTag>("tracks", edm::InputTag("generalTracks"));
651  desc.add<edm::InputTag>("pfTracks", edm::InputTag("lowPtGsfElePfTracks"));
652  desc.add<edm::InputTag>("ecalClusters", edm::InputTag("particleFlowClusterECAL"));
653  desc.add<edm::InputTag>("hcalClusters", edm::InputTag("particleFlowClusterHCAL"));
654  desc.add<edm::InputTag>("EBRecHits", edm::InputTag("ecalRecHit", "EcalRecHitsEB"));
655  desc.add<edm::InputTag>("EERecHits", edm::InputTag("ecalRecHit", "EcalRecHitsEE"));
656  desc.add<edm::InputTag>("rho", edm::InputTag("fixedGridRhoFastjetAllTmp"));
657  desc.add<edm::InputTag>("BeamSpot", edm::InputTag("offlineBeamSpot"));
658  desc.add<edm::ESInputTag>("Fitter", edm::ESInputTag{"", "GsfTrajectoryFitter_forPreId"});
659  desc.add<edm::ESInputTag>("Smoother", edm::ESInputTag{"", "GsfTrajectorySmoother_forPreId"});
660  desc.add<edm::ESInputTag>("TTRHBuilder", edm::ESInputTag{"", "WithAngleAndTemplate"});
661  desc.add<std::vector<std::string> >("ModelNames", {});
662  desc.add<std::vector<std::string> >("ModelWeights", {});
663  desc.add<std::vector<double> >("ModelThresholds", {});
664  desc.add<bool>("PassThrough", false);
665  desc.add<bool>("UsePfTracks", true);
666  desc.add<double>("MinPtThreshold", 1.0);
667  desc.add<double>("MaxPtThreshold", 15.);
668  descriptions.add("lowPtGsfElectronSeeds", desc);
669 }
670 
672 //
const REPPoint & positionREP() const
trajectory position in (rho, eta, phi) base
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
edm::ESHandle< MagneticField > field_
std::unique_ptr< TrajectorySmoother > smootherPtr_
static const TGPicture * info(bool iBackgroundIsBlack)
LowPtGsfElectronSeedProducer(const edm::ParameterSet &, const lowptgsfeleseed::HeavyObjectCache *)
void setECALMatchingProperties(PFClusterRef clusterRef, const math::XYZPoint &ecalpos, const math::XYZPoint &meanShower, float deta, float dphi, float chieta, float chiphi, float chi2, float eop)
Definition: PreId.h:33
std::vector< reco::PreId > PreIdCollection
Definition: PreIdFwd.h:6
T perp() const
Definition: PV3DBase.h:69
void propagateTrackToCalo(const reco::PFRecTrackRef &pfTrackRef, const edm::Handle< reco::PFClusterCollection > &ecalClusters, const edm::Handle< reco::PFClusterCollection > &hcalClusters, std::vector< int > &matchedEcalClusters, std::vector< int > &matchedHcalClusters, reco::PreId &ecalPreId, reco::PreId &hcalPreId)
ProductID id() const
Definition: HandleBase.cc:29
bool decision(const reco::PFRecTrackRef &pfTrackRef, reco::PreId &ecal, reco::PreId &hcal, double rho, const reco::BeamSpot &spot, noZS::EcalClusterLazyTools &ecalTools)
bool lightGsfTracking(reco::PreId &, const reco::TrackRef &, const reco::ElectronSeed &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
double z() const
z of vertex
Definition: RawParticle.h:284
const math::XYZPoint & position() const
cartesian position (x, y, z)
const edm::EDGetTokenT< reco::PFClusterCollection > ecalClusters_
static void globalEndJob(lowptgsfeleseed::HeavyObjectCache const *)
edm::EDGetTokenT< reco::PFClusterCollection > hcalClusters_
tuple pfTrack
Definition: pfTrack_cfi.py:3
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:53
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magToken_
key_type index() const
Definition: Ref.h:253
std::unordered_map< reco::TrackRef::key_type, size_t > TrackIndxMap
const edm::ESGetToken< TrajectorySmoother, TrajectoryFitter::Record > trajectorySmootherToken_
const edm::EDGetTokenT< reco::BeamSpot > beamSpot_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const edm::ESGetToken< TrajectoryFitter, TrajectoryFitter::Record > trajectoryFitterToken_
const noZS::EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
void setCtfTrack(const CtfTrackRef &)
Set additional info.
Definition: ElectronSeed.cc:39
tuple result
Definition: mps_fire.py:311
void loop(const edm::Handle< std::vector< T > > &handle, edm::Handle< reco::PFClusterCollection > &hcalClusters, reco::ElectronSeedCollection &seeds, reco::PreIdCollection &ecalPreIds, reco::PreIdCollection &hcalPreIds, TrackIndxMap &trksToPreIdIndx, edm::Event &, const edm::EventSetup &)
void setTrack(reco::TrackRef trackref)
Definition: PreId.h:31
void fillPreIdRefValueMap(edm::Handle< CollType > tracksHandle, const TrackIndxMap &trksToPreIdIndx, const edm::OrphanHandle< reco::PreIdCollection > &preIdHandle, edm::ValueMap< reco::PreIdRef >::Filler &filler)
bool getData(T &iHolder) const
Definition: EventSetup.h:122
edm::EDGetTokenT< reco::TrackCollection > kfTracks_
T sqrt(T t)
Definition: SSEVec.h:19
edm::Ref< PFClusterCollection > PFClusterRef
persistent reference to PFCluster objects
Definition: PFClusterFwd.h:15
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:150
def move
Definition: eostools.py:511
const edm::EDGetTokenT< EcalRecHitCollection > ebRecHits_
tuple handle
Definition: patZpeak.py:25
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::Ref< PFRecTrackCollection > PFRecTrackRef
persistent reference to PFRecTrack objects
Definition: PFRecTrackFwd.h:15
std::vector< ElectronSeed > ElectronSeedCollection
collection of ElectronSeed objects
const edm::EDGetTokenT< EcalRecHitCollection > eeRecHits_
const edm::EDGetTokenT< double > rho_
edm::EDGetTokenT< reco::PFRecTrackCollection > pfTracks_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool propagateToEcalEntrance(bool first=true)
static void fillDescriptions(edm::ConfigurationDescriptions &)
tuple ecalClusters
Definition: RecoEcal_cff.py:26
void produce(edm::Event &, const edm::EventSetup &) override
static double getDepthCorrection(double energy, bool isBelowPS=false, bool isHadron=false)
Definition: PFCluster.cc:39
ESData get(edm::EventSetup const &eventSetup) const
bool isValid() const
Definition: Trajectory.h:257
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:166
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
bool isValid() const
is this point valid ?
T const * product() const
Definition: Handle.h:70
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void add(std::string const &label, ParameterSetDescription const &psetDescription)
float chiSquared() const
Definition: Trajectory.h:241
TrackingRecHit::ConstRecHitContainer ConstRecHitContainer
Definition: Trajectory.h:41
static std::unique_ptr< lowptgsfeleseed::HeavyObjectCache > initializeGlobalCache(const edm::ParameterSet &conf)
void setTrackProperties(float newchi2, float chi2ratio, float dpt)
Definition: PreId.h:53
unsigned int nHits() const
GlobalVector globalMomentum() const
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > builderToken_
TrajectoryStateOnSurface const & updatedState() const
A PFTrack holds several trajectory points, which basically contain the position and momentum of a tra...
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
reco::TrackRef getBaseRef(edm::Handle< std::vector< reco::Track > > handle, int idx) const
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
std::unique_ptr< TrajectoryFitter > fitterPtr_
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
Global3DVector GlobalVector
Definition: GlobalVector.h:10
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:25
Basic3DVector unit() const