CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GsfElectronAlgo.cc
Go to the documentation of this file.
1 
9 
12 
26 
30 
33 
34 
36 
39 
40 
43 
44 
45 #include <Math/Point3D.h>
46 #include <sstream>
47 #include <algorithm>
48 
49 
50 using namespace edm ;
51 using namespace std ;
52 using namespace reco ;
53 
54 
55 //===================================================================
56 // GsfElectronAlgo::GeneralData
57 //===================================================================
58 
59 // general data and helpers
61  {
62  // constructors
64  ( const InputTagsConfiguration &,
65  const StrategyConfiguration &,
66  const CutsConfiguration & cutsCfg,
67  const CutsConfiguration & cutsCfgPflow,
68  const ElectronHcalHelper::Configuration & hcalCfg,
69  const ElectronHcalHelper::Configuration & hcalCfgPflow,
70  const IsolationConfiguration &,
72  EcalClusterFunctionBaseClass * superClusterErrorFunction,
73  EcalClusterFunctionBaseClass * crackCorrectionFunction ) ;
74  ~GeneralData() ;
75 
76  // configurables
83 
84  // additional configuration and helpers
88  } ;
89 
91  ( const InputTagsConfiguration & inputConfig,
92  const StrategyConfiguration & strategyConfig,
93  const CutsConfiguration & cutsConfig,
94  const CutsConfiguration & cutsConfigPflow,
95  const ElectronHcalHelper::Configuration & hcalConfig,
96  const ElectronHcalHelper::Configuration & hcalConfigPflow,
97  const IsolationConfiguration & isoConfig,
98  const EcalRecHitsConfiguration & recHitsConfig,
99  EcalClusterFunctionBaseClass * superClusterErrorFunc,
100  EcalClusterFunctionBaseClass * crackCorrectionFunc
101  )
102  : inputCfg(inputConfig),
103  strategyCfg(strategyConfig),
104  cutsCfg(cutsConfig),
105  cutsCfgPflow(cutsConfigPflow),
106  isoCfg(isoConfig),
107  recHitsCfg(recHitsConfig),
108  hcalHelper(new ElectronHcalHelper(hcalConfig)),
109  hcalHelperPflow(new ElectronHcalHelper(hcalConfigPflow)),
110  superClusterErrorFunction(superClusterErrorFunc),
111  crackCorrectionFunction(crackCorrectionFunc)
112  {}
113 
115  {
116  delete hcalHelper ;
117  delete hcalHelperPflow ;
118  }
119 
120 //===================================================================
121 // GsfElectronAlgo::EventSetupData
122 //===================================================================
123 
125  {
126  EventSetupData() ;
127  ~EventSetupData() ;
128 
129  unsigned long long cacheIDGeom ;
130  unsigned long long cacheIDTopo ;
131  unsigned long long cacheIDTDGeom ;
132  unsigned long long cacheIDMagField ;
133  //unsigned long long cacheChStatus ;
134  unsigned long long cacheSevLevel ;
135 
140  //edm::ESHandle<EcalChannelStatus> chStatus ;
142 
146 } ;
147 
149  : cacheIDGeom(0), cacheIDTopo(0), cacheIDTDGeom(0), cacheIDMagField(0),/*cacheChStatus(0),*/
150  cacheSevLevel(0), mtsTransform(0), constraintAtVtx(0), mtsMode(new MultiTrajectoryStateMode)
151  {}
152 
154  {
155  delete mtsMode ;
156  delete constraintAtVtx ;
157  delete mtsTransform ;
158  }
159 
160 
161 //===================================================================
162 // GsfElectronAlgo::EventData
163 //===================================================================
164 
166  {
167  // general
171 
172  EventData() ;
173  ~EventData() ;
174 
175  // utilities
176  void retreiveOriginalTrackCollections
177  ( const reco::TrackRef &, const reco::GsfTrackRef & ) ;
178 
179  // input collections
194 
195  // isolation helpers
196  ElectronTkIsolation * tkIsolation03, * tkIsolation04 ;
197  EgammaTowerIsolation * hadDepth1Isolation03, * hadDepth1Isolation04 ;
198  EgammaTowerIsolation * hadDepth2Isolation03, * hadDepth2Isolation04 ;
199  EgammaTowerIsolation * hadDepth1Isolation03Bc, * hadDepth1Isolation04Bc ;
200  EgammaTowerIsolation * hadDepth2Isolation03Bc, * hadDepth2Isolation04Bc ;
203  EgammaRecHitIsolation * ecalBarrelIsol03, * ecalBarrelIsol04 ;
204  EgammaRecHitIsolation * ecalEndcapIsol03, * ecalEndcapIsol04 ;
205 
206  //Isolation Value Maps for PF and EcalDriven electrons
207  typedef std::vector< edm::Handle< edm::ValueMap<double> > > IsolationValueMaps;
210  } ;
211 
213  : event(0), beamspot(0),
214  originalCtfTrackCollectionRetreived(false),
215  originalGsfTrackCollectionRetreived(false),
216  tkIsolation03(0), tkIsolation04(0),
217  hadDepth1Isolation03(0), hadDepth1Isolation04(0),
218  hadDepth2Isolation03(0), hadDepth2Isolation04(0),
219  ecalBarrelHitsMeta(0), ecalEndcapHitsMeta(0),
220  ecalBarrelIsol03(0), ecalBarrelIsol04(0),
221  ecalEndcapIsol03(0), ecalEndcapIsol04(0)
222  {
224  }
225 
227  {
228  delete tkIsolation03 ;
229  delete tkIsolation04 ;
230  delete hadDepth1Isolation03 ;
231  delete hadDepth1Isolation04 ;
232  delete hadDepth2Isolation03 ;
233  delete hadDepth2Isolation04 ;
234  delete ecalBarrelHitsMeta ;
235  delete ecalEndcapHitsMeta ;
236  delete ecalBarrelIsol03 ;
237  delete ecalBarrelIsol04 ;
238  delete ecalEndcapIsol03 ;
239  delete ecalEndcapIsol04 ;
240 
241  GsfElectronPtrCollection::const_iterator it ;
242  for ( it = electrons->begin() ; it != electrons->end() ; it++ )
243  { delete (*it) ; }
244  delete electrons ;
245  }
246 
248  ( const reco::TrackRef & ctfTrack, const reco::GsfTrackRef & gsfTrack )
249  {
250  if ((!originalCtfTrackCollectionRetreived)&&(ctfTrack.isNonnull()))
251  {
252  event->get(ctfTrack.id(),originalCtfTracks) ;
253  originalCtfTrackCollectionRetreived = true ;
254  }
255  if ((!originalGsfTrackCollectionRetreived)&&(gsfTrack.isNonnull()))
256  {
257  event->get(gsfTrack.id(),originalGsfTracks) ;
258  originalGsfTrackCollectionRetreived = true ;
259  }
260  }
261 
262 
263 //===================================================================
264 // GsfElectronAlgo::ElectronData
265 //===================================================================
266 
268  {
269  // Refs to subproducts
276 
277  // constructors
279  ( const reco::GsfElectronCoreRef & core,
280  const reco::BeamSpot & bs ) ;
281  ~ElectronData() ;
282 
283  // utilities
284  void checkCtfTrack( edm::Handle<reco::TrackCollection> currentCtfTracks ) ;
285  void computeCharge( int & charge, reco::GsfElectron::ChargeInfo & info ) ;
286  CaloClusterPtr getEleBasicCluster( const MultiTrajectoryStateTransform * ) ;
287  bool calculateTSOS( const MultiTrajectoryStateTransform *, GsfConstraintAtVertex * ) ;
288  void calculateMode( const MultiTrajectoryStateMode * mtsMode ) ;
289  Candidate::LorentzVector calculateMomentum() ;
290 
291  // TSOS
299 
300  // mode
301  GlobalVector innMom, seedMom, eleMom, sclMom, vtxMom, outMom ;
302  GlobalPoint innPos, seedPos, elePos, sclPos, vtxPos, outPos ;
304  } ;
305 
307  ( const reco::GsfElectronCoreRef & core,
308  const reco::BeamSpot & bs )
309  : coreRef(core),
310  gsfTrackRef(coreRef->gsfTrack()),
311  superClusterRef(coreRef->superCluster()),
312  ctfTrackRef(coreRef->ctfTrack()), shFracInnerHits(coreRef->ctfGsfOverlap()),
313  beamSpot(bs)
314  {}
315 
317  {}
318 
320  {
321  if (!ctfTrackRef.isNull()) return ;
322 
323  // Code below from Puneeth Kalavase
324 
325  shFracInnerHits = 0 ;
326  const TrackCollection * ctfTrackCollection = currentCtfTracks.product() ;
327 
328  // get the Hit Pattern for the gsfTrack
329  const HitPattern & gsfHitPattern = gsfTrackRef->hitPattern() ;
330 
331  unsigned int counter ;
332  TrackCollection::const_iterator ctfTkIter ;
333  for ( ctfTkIter = ctfTrackCollection->begin() , counter = 0 ;
334  ctfTkIter != ctfTrackCollection->end() ; ctfTkIter++, counter++ )
335  {
336 
337  double dEta = gsfTrackRef->eta() - ctfTkIter->eta() ;
338  double dPhi = gsfTrackRef->phi() - ctfTkIter->phi() ;
339  double pi = acos(-1.);
340  if(std::abs(dPhi) > pi) dPhi = 2*pi - std::abs(dPhi) ;
341 
342  // dont want to look at every single track in the event!
343  if (sqrt(dEta*dEta + dPhi*dPhi) > 0.3) continue ;
344 
345  unsigned int shared = 0 ;
346  int gsfHitCounter = 0 ;
347  int numGsfInnerHits = 0 ;
348  int numCtfInnerHits = 0 ;
349 
350  // get the CTF Track Hit Pattern
351  const HitPattern & ctfHitPattern = ctfTkIter->hitPattern() ;
352 
353  trackingRecHit_iterator elHitsIt ;
354  for ( elHitsIt = gsfTrackRef->recHitsBegin() ;
355  elHitsIt != gsfTrackRef->recHitsEnd() ;
356  elHitsIt++, gsfHitCounter++ )
357  {
358  if (!((**elHitsIt).isValid())) //count only valid Hits
359  { continue ; }
360 
361  // look only in the pixels/TIB/TID
362  uint32_t gsfHit = gsfHitPattern.getHitPattern(gsfHitCounter) ;
363  if (!(gsfHitPattern.pixelHitFilter(gsfHit) ||
364  gsfHitPattern.stripTIBHitFilter(gsfHit) ||
365  gsfHitPattern.stripTIDHitFilter(gsfHit) ) )
366  { continue ; }
367 
368  numGsfInnerHits++ ;
369 
370  int ctfHitsCounter = 0 ;
371  numCtfInnerHits = 0 ;
372  trackingRecHit_iterator ctfHitsIt ;
373  for ( ctfHitsIt = ctfTkIter->recHitsBegin() ;
374  ctfHitsIt != ctfTkIter->recHitsEnd() ;
375  ctfHitsIt++, ctfHitsCounter++ )
376  {
377  if(!((**ctfHitsIt).isValid())) //count only valid Hits!
378  { continue ; }
379 
380  uint32_t ctfHit = ctfHitPattern.getHitPattern(ctfHitsCounter);
381  if( !(ctfHitPattern.pixelHitFilter(ctfHit) ||
382  ctfHitPattern.stripTIBHitFilter(ctfHit) ||
383  ctfHitPattern.stripTIDHitFilter(ctfHit) ) )
384  { continue ; }
385 
386  numCtfInnerHits++ ;
387 
388  if( (**elHitsIt).sharesInput(&(**ctfHitsIt),TrackingRecHit::all) )
389  {
390  shared++ ;
391  break ;
392  }
393 
394  } //ctfHits iterator
395 
396  } //gsfHits iterator
397 
398  if ((numGsfInnerHits==0)||(numCtfInnerHits==0))
399  { continue ; }
400 
401  if ( static_cast<float>(shared)/min(numGsfInnerHits,numCtfInnerHits) > shFracInnerHits )
402  {
403  shFracInnerHits = static_cast<float>(shared)/min(numGsfInnerHits, numCtfInnerHits);
404  ctfTrackRef = TrackRef(currentCtfTracks,counter);
405  }
406  } //ctfTrack iterator
407  }
408 
411  {
412  // determine charge from SC
413  GlobalPoint orig, scpos ;
414  ele_convert(beamSpot.position(),orig) ;
415  ele_convert(superClusterRef->position(),scpos) ;
416  GlobalVector scvect(scpos-orig) ;
417  GlobalPoint inntkpos = innTSOS.globalPosition() ;
418  GlobalVector inntkvect = GlobalVector(inntkpos-orig) ;
419  float dPhiInnEle=normalized_phi(scvect.phi()-inntkvect.phi()) ;
420  if(dPhiInnEle>0) info.scPixCharge = -1 ;
421  else info.scPixCharge = 1 ;
422 
423  // flags
424  int chargeGsf = gsfTrackRef->charge() ;
425  info.isGsfScPixConsistent = ((chargeGsf*info.scPixCharge)>0) ;
426  info.isGsfCtfConsistent = (ctfTrackRef.isNonnull()&&((chargeGsf*ctfTrackRef->charge())>0)) ;
428 
429  // default charge
430  if (info.isGsfScPixConsistent||ctfTrackRef.isNull())
431  { charge = info.scPixCharge ; }
432  else
433  { charge = ctfTrackRef->charge() ; }
434  }
435 
437  ( const MultiTrajectoryStateTransform * mtsTransform )
438  {
439  CaloClusterPtr eleRef ;
440  TrajectoryStateOnSurface tempTSOS ;
441  TrajectoryStateOnSurface outTSOS = mtsTransform->outerStateOnSurface(*gsfTrackRef) ;
442  float dphimin = 1.e30 ;
443  for (CaloCluster_iterator bc=superClusterRef->clustersBegin(); bc!=superClusterRef->clustersEnd(); bc++)
444  {
445  GlobalPoint posclu((*bc)->position().x(),(*bc)->position().y(),(*bc)->position().z()) ;
446  tempTSOS = mtsTransform->extrapolatedState(outTSOS,posclu) ;
447  if (!tempTSOS.isValid()) tempTSOS=outTSOS ;
448  GlobalPoint extrap = tempTSOS.globalPosition() ;
449  float dphi = EleRelPointPair(posclu,extrap,beamSpot.position()).dPhi() ;
450  if (std::abs(dphi)<dphimin)
451  {
452  dphimin = std::abs(dphi) ;
453  eleRef = (*bc);
454  eleTSOS = tempTSOS ;
455  }
456  }
457  return eleRef ;
458  }
459 
461  ( const MultiTrajectoryStateTransform * mtsTransform, GsfConstraintAtVertex * constraintAtVtx )
462  {
463  //at innermost point
464  innTSOS = mtsTransform->innerStateOnSurface(*gsfTrackRef);
465  if (!innTSOS.isValid()) return false;
466 
467  //at vertex
468  // innermost state propagation to the beam spot position
469  GlobalPoint bsPos ;
470  ele_convert(beamSpot.position(),bsPos) ;
471  vtxTSOS = mtsTransform->extrapolatedState(innTSOS,bsPos) ;
472  if (!vtxTSOS.isValid()) vtxTSOS=innTSOS;
473 
474  //at seed
475  outTSOS = mtsTransform->outerStateOnSurface(*gsfTrackRef);
476  if (!outTSOS.isValid()) return false;
477 
478  // TrajectoryStateOnSurface seedTSOS
479  seedTSOS = mtsTransform->extrapolatedState(outTSOS,
480  GlobalPoint(superClusterRef->seed()->position().x(),
481  superClusterRef->seed()->position().y(),
482  superClusterRef->seed()->position().z()));
483  if (!seedTSOS.isValid()) seedTSOS=outTSOS;
484 
485  // at scl
486  sclTSOS = mtsTransform->extrapolatedState(innTSOS,GlobalPoint(superClusterRef->x(),superClusterRef->y(),superClusterRef->z()));
487  if (!sclTSOS.isValid()) sclTSOS=outTSOS;
488 
489  // constrained momentum
490  constrainedVtxTSOS = constraintAtVtx->constrainAtBeamSpot(*gsfTrackRef,beamSpot);
491 
492  return true ;
493  }
494 
496  {
497  mtsMode->momentumFromModeCartesian(innTSOS,innMom) ;
498  mtsMode->positionFromModeCartesian(innTSOS,innPos) ;
499  mtsMode->momentumFromModeCartesian(seedTSOS,seedMom) ;
500  mtsMode->positionFromModeCartesian(seedTSOS,seedPos) ;
501  mtsMode->momentumFromModeCartesian(eleTSOS,eleMom) ;
502  mtsMode->positionFromModeCartesian(eleTSOS,elePos) ;
503  mtsMode->momentumFromModeCartesian(sclTSOS,sclMom) ;
504  mtsMode->positionFromModeCartesian(sclTSOS,sclPos) ;
505  mtsMode->momentumFromModeCartesian(vtxTSOS,vtxMom) ;
506  mtsMode->positionFromModeCartesian(vtxTSOS,vtxPos) ;
507  mtsMode->momentumFromModeCartesian(outTSOS,outMom);
508  mtsMode->positionFromModeCartesian(outTSOS,outPos) ;
509  mtsMode->momentumFromModeCartesian(constrainedVtxTSOS,vtxMomWithConstraint);
510  }
511 
513  {
514  double scale = superClusterRef->energy()/vtxMom.mag() ;
516  ( vtxMom.x()*scale,vtxMom.y()*scale,vtxMom.z()*scale,
517  superClusterRef->energy() ) ;
518  }
519 
521  {
522  const reco::CaloCluster & seedCluster = *(theClus->seed()) ;
523  // temporary, till CaloCluster->seed() is made available
524  DetId seedXtalId = seedCluster.hitsAndFractions()[0].first ;
525  int detector = seedXtalId.subdetId() ;
526 
527  const CaloTopology * topology = eventSetupData_->caloTopo.product() ;
529  const EcalRecHitCollection * recHits = 0 ;
530  std::vector<int> recHitFlagsToBeExcluded ;
531  std::vector<int> recHitSeverityToBeExcluded ;
532  const EcalSeverityLevelAlgo * severityLevelAlgo = eventSetupData_->sevLevel.product() ;
533  if (detector==EcalBarrel)
534  {
535  recHits = eventData_->barrelRecHits.product() ;
536  recHitFlagsToBeExcluded = generalData_->recHitsCfg.recHitFlagsToBeExcludedBarrel ;
537  recHitSeverityToBeExcluded = generalData_->recHitsCfg.recHitSeverityToBeExcludedBarrel ;
538  }
539  else
540  {
541  recHits = eventData_->endcapRecHits.product() ;
542  recHitFlagsToBeExcluded = generalData_->recHitsCfg.recHitFlagsToBeExcludedEndcaps ;
543  recHitSeverityToBeExcluded = generalData_->recHitsCfg.recHitSeverityToBeExcludedEndcaps ;
544  }
545 
546  std::vector<float> covariances = EcalClusterTools::covariances(seedCluster,recHits,topology,geometry,recHitFlagsToBeExcluded,recHitSeverityToBeExcluded,severityLevelAlgo) ;
547  std::vector<float> localCovariances = EcalClusterTools::localCovariances(seedCluster,recHits,topology,recHitFlagsToBeExcluded,recHitSeverityToBeExcluded,severityLevelAlgo) ;
548  showerShape.sigmaEtaEta = sqrt(covariances[0]) ;
549  showerShape.sigmaIetaIeta = sqrt(localCovariances[0]) ;
550  if (!edm::isNotFinite(localCovariances[2])) showerShape.sigmaIphiIphi = sqrt(localCovariances[2]) ;
551  showerShape.e1x5 = EcalClusterTools::e1x5(seedCluster,recHits,topology,recHitFlagsToBeExcluded,recHitSeverityToBeExcluded,severityLevelAlgo) ;
552  showerShape.e2x5Max = EcalClusterTools::e2x5Max(seedCluster,recHits,topology,recHitFlagsToBeExcluded,recHitSeverityToBeExcluded,severityLevelAlgo) ;
553  showerShape.e5x5 = EcalClusterTools::e5x5(seedCluster,recHits,topology,recHitFlagsToBeExcluded,recHitSeverityToBeExcluded,severityLevelAlgo) ;
554  showerShape.r9 = EcalClusterTools::e3x3(seedCluster,recHits,topology,recHitFlagsToBeExcluded,recHitSeverityToBeExcluded,severityLevelAlgo)/theClus->rawEnergy() ;
555 
556  if (pflow)
557  {
558  showerShape.hcalDepth1OverEcal = generalData_->hcalHelperPflow->hcalESumDepth1(*theClus)/theClus->energy() ;
559  showerShape.hcalDepth2OverEcal = generalData_->hcalHelperPflow->hcalESumDepth2(*theClus)/theClus->energy() ;
563  }
564  else
565  {
566  showerShape.hcalDepth1OverEcal = generalData_->hcalHelper->hcalESumDepth1(*theClus)/theClus->energy() ;
567  showerShape.hcalDepth2OverEcal = generalData_->hcalHelper->hcalESumDepth2(*theClus)/theClus->energy() ;
571  }
572  }
573 
574 
575 //===================================================================
576 // GsfElectronAlgo
577 //===================================================================
578 
580  ( const InputTagsConfiguration & inputCfg,
581  const StrategyConfiguration & strategyCfg,
582  const CutsConfiguration & cutsCfg,
583  const CutsConfiguration & cutsCfgPflow,
584  const ElectronHcalHelper::Configuration & hcalCfg,
585  const ElectronHcalHelper::Configuration & hcalCfgPflow,
586  const IsolationConfiguration & isoCfg,
587  const EcalRecHitsConfiguration & recHitsCfg,
588  EcalClusterFunctionBaseClass * superClusterErrorFunction,
589  EcalClusterFunctionBaseClass * crackCorrectionFunction
590  )
591  : generalData_(new GeneralData(inputCfg,strategyCfg,cutsCfg,cutsCfgPflow,hcalCfg,hcalCfgPflow,isoCfg,recHitsCfg,superClusterErrorFunction,crackCorrectionFunction)),
594  {}
595 
597  {
598  delete generalData_ ;
599  delete eventSetupData_ ;
600  delete eventData_ ;
601  delete electronData_ ;
602  }
603 
605  {
606  // get EventSetupRecords if needed
607  bool updateField(false);
609  updateField = true;
612  }
613 
614  bool updateGeometry(false);
616  updateGeometry = true;
619  }
620 
621  if ( updateField || updateGeometry ) {
622  delete eventSetupData_->mtsTransform ;
626  }
627 
629  eventSetupData_->cacheIDGeom=es.get<CaloGeometryRecord>().cacheIdentifier();
631  }
632 
634  eventSetupData_->cacheIDTopo=es.get<CaloTopologyRecord>().cacheIdentifier();
636  }
637 
640 
645 
646  //if(eventSetupData_->cacheChStatus!=es.get<EcalChannelStatusRcd>().cacheIdentifier()){
647  // eventSetupData_->cacheChStatus=es.get<EcalChannelStatusRcd>().cacheIdentifier();
648  // es.get<EcalChannelStatusRcd>().get(eventSetupData_->chStatus);
649  //}
650 
652  eventSetupData_->cacheSevLevel = es.get<EcalSeverityLevelAlgoRcd>().cacheIdentifier();
654  }
655  }
656 
658  {
659  GsfElectronPtrCollection::const_iterator it ;
660  for
661  ( it = eventData_->electrons->begin() ;
662  it != eventData_->electrons->end() ;
663  it++ )
664  { outEle.push_back(**it) ; }
665  }
666 
668  {
669  if (eventData_!=0)
670  { throw cms::Exception("GsfElectronAlgo|InternalError")<<"unexpected event data" ; }
671  eventData_ = new EventData ;
672 
673  // init the handles linked to the current event
674  eventData_->event = &event ;
681  event.getByLabel(generalData_->inputCfg.hcalTowersTag,eventData_->towers) ;
682  event.getByLabel(generalData_->inputCfg.pfMVA,eventData_->pfMva) ;
683  event.getByLabel(generalData_->inputCfg.seedsTag,eventData_->seeds) ;
686 
687  // get the beamspot from the Event:
688  edm::Handle<reco::BeamSpot> recoBeamSpotHandle ;
689  event.getByLabel(generalData_->inputCfg.beamSpotTag,recoBeamSpotHandle) ;
690  eventData_->beamspot = recoBeamSpotHandle.product() ;
691 
692  // prepare access to hcal data
695 
696  // Isolation algos
697  float extRadiusSmall=0.3, extRadiusLarge=0.4 ;
698  float intRadiusBarrel=generalData_->isoCfg.intRadiusBarrelTk, intRadiusEndcap=generalData_->isoCfg.intRadiusEndcapTk, stripBarrel=generalData_->isoCfg.stripBarrelTk, stripEndcap=generalData_->isoCfg.stripEndcapTk ;
700  eventData_->tkIsolation03 = new ElectronTkIsolation(extRadiusSmall,intRadiusBarrel,intRadiusEndcap,stripBarrel,stripEndcap,ptMin,maxVtxDist,drb,eventData_->currentCtfTracks.product(),eventData_->beamspot->position()) ;
701  eventData_->tkIsolation04 = new ElectronTkIsolation(extRadiusLarge,intRadiusBarrel,intRadiusEndcap,stripBarrel,stripEndcap,ptMin,maxVtxDist,drb,eventData_->currentCtfTracks.product(),eventData_->beamspot->position()) ;
702 
703  float egHcalIsoConeSizeOutSmall=0.3, egHcalIsoConeSizeOutLarge=0.4;
704  float egHcalIsoConeSizeIn=generalData_->isoCfg.intRadiusHcal,egHcalIsoPtMin=generalData_->isoCfg.etMinHcal;
705  int egHcalDepth1=1, egHcalDepth2=2;
706  eventData_->hadDepth1Isolation03 = new EgammaTowerIsolation(egHcalIsoConeSizeOutSmall,egHcalIsoConeSizeIn,egHcalIsoPtMin,egHcalDepth1,eventData_->towers.product()) ;
707  eventData_->hadDepth2Isolation03 = new EgammaTowerIsolation(egHcalIsoConeSizeOutSmall,egHcalIsoConeSizeIn,egHcalIsoPtMin,egHcalDepth2,eventData_->towers.product()) ;
708  eventData_->hadDepth1Isolation04 = new EgammaTowerIsolation(egHcalIsoConeSizeOutLarge,egHcalIsoConeSizeIn,egHcalIsoPtMin,egHcalDepth1,eventData_->towers.product()) ;
709  eventData_->hadDepth2Isolation04 = new EgammaTowerIsolation(egHcalIsoConeSizeOutLarge,egHcalIsoConeSizeIn,egHcalIsoPtMin,egHcalDepth2,eventData_->towers.product()) ;
710  eventData_->hadDepth1Isolation03Bc = new EgammaTowerIsolation(egHcalIsoConeSizeOutSmall,0.,egHcalIsoPtMin,egHcalDepth1,eventData_->towers.product()) ;
711  eventData_->hadDepth2Isolation03Bc = new EgammaTowerIsolation(egHcalIsoConeSizeOutSmall,0.,egHcalIsoPtMin,egHcalDepth2,eventData_->towers.product()) ;
712  eventData_->hadDepth1Isolation04Bc = new EgammaTowerIsolation(egHcalIsoConeSizeOutLarge,0.,egHcalIsoPtMin,egHcalDepth1,eventData_->towers.product()) ;
713  eventData_->hadDepth2Isolation04Bc = new EgammaTowerIsolation(egHcalIsoConeSizeOutLarge,0.,egHcalIsoPtMin,egHcalDepth2,eventData_->towers.product()) ;
714 
715  float egIsoConeSizeOutSmall=0.3, egIsoConeSizeOutLarge=0.4, egIsoJurassicWidth=generalData_->isoCfg.jurassicWidth;
716  float egIsoPtMinBarrel=generalData_->isoCfg.etMinBarrel,egIsoEMinBarrel=generalData_->isoCfg.eMinBarrel, egIsoConeSizeInBarrel=generalData_->isoCfg.intRadiusEcalBarrel;
717  float egIsoPtMinEndcap=generalData_->isoCfg.etMinEndcaps,egIsoEMinEndcap=generalData_->isoCfg.eMinEndcaps, egIsoConeSizeInEndcap=generalData_->isoCfg.intRadiusEcalEndcaps;
720  eventData_->ecalBarrelIsol03 = new EgammaRecHitIsolation(egIsoConeSizeOutSmall,egIsoConeSizeInBarrel,egIsoJurassicWidth,egIsoPtMinBarrel,egIsoEMinBarrel,eventSetupData_->caloGeom,eventData_->ecalBarrelHitsMeta,eventSetupData_->sevLevel.product(),DetId::Ecal);
721  eventData_->ecalBarrelIsol04 = new EgammaRecHitIsolation(egIsoConeSizeOutLarge,egIsoConeSizeInBarrel,egIsoJurassicWidth,egIsoPtMinBarrel,egIsoEMinBarrel,eventSetupData_->caloGeom,eventData_->ecalBarrelHitsMeta,eventSetupData_->sevLevel.product(),DetId::Ecal);
722  eventData_->ecalEndcapIsol03 = new EgammaRecHitIsolation(egIsoConeSizeOutSmall,egIsoConeSizeInEndcap,egIsoJurassicWidth,egIsoPtMinEndcap,egIsoEMinEndcap,eventSetupData_->caloGeom,eventData_->ecalEndcapHitsMeta,eventSetupData_->sevLevel.product(),DetId::Ecal);
723  eventData_->ecalEndcapIsol04 = new EgammaRecHitIsolation(egIsoConeSizeOutLarge,egIsoConeSizeInEndcap,egIsoJurassicWidth,egIsoPtMinEndcap,egIsoEMinEndcap,eventSetupData_->caloGeom,eventData_->ecalEndcapHitsMeta,eventSetupData_->sevLevel.product(),DetId::Ecal);
740 
741  //Fill in the Isolation Value Maps for PF and EcalDriven electrons
742  std::vector<edm::InputTag> inputTagIsoVals;
744  inputTagIsoVals.push_back(generalData_->inputCfg.pfIsoVals.getParameter<edm::InputTag>("pfChargedHadrons"));
745  inputTagIsoVals.push_back(generalData_->inputCfg.pfIsoVals.getParameter<edm::InputTag>("pfPhotons"));
746  inputTagIsoVals.push_back(generalData_->inputCfg.pfIsoVals.getParameter<edm::InputTag>("pfNeutralHadrons"));
747 
748  eventData_->pfIsolationValues.resize(inputTagIsoVals.size());
749 
750  for (size_t j = 0; j<inputTagIsoVals.size(); ++j) {
751  event.getByLabel(inputTagIsoVals[j], eventData_->pfIsolationValues[j]);
752  }
753 
754  }
755 
757  inputTagIsoVals.clear();
758  inputTagIsoVals.push_back(generalData_->inputCfg.edIsoVals.getParameter<edm::InputTag>("edChargedHadrons"));
759  inputTagIsoVals.push_back(generalData_->inputCfg.edIsoVals.getParameter<edm::InputTag>("edPhotons"));
760  inputTagIsoVals.push_back(generalData_->inputCfg.edIsoVals.getParameter<edm::InputTag>("edNeutralHadrons"));
761 
762  eventData_->edIsolationValues.resize(inputTagIsoVals.size());
763 
764  for (size_t j = 0; j<inputTagIsoVals.size(); ++j) {
765  event.getByLabel(inputTagIsoVals[j], eventData_->edIsolationValues[j]);
766  }
767  }
768  }
769 
771  {
772  if (eventData_==0)
773  { throw cms::Exception("GsfElectronAlgo|InternalError")<<"lacking event data" ; }
774  delete eventData_ ;
775  eventData_ = 0 ;
776  }
777 
779  {
780  LogTrace("GsfElectronAlgo") << "========== " << title << " ==========";
781  LogTrace("GsfElectronAlgo") << "Event: " << eventData_->event->id();
782  LogTrace("GsfElectronAlgo") << "Number of electrons: " << eventData_->electrons->size() ;
783  GsfElectronPtrCollection::const_iterator it ;
784  for ( it = eventData_->electrons->begin(); it != eventData_->electrons->end(); it++ )
785  {
786  LogTrace("GsfElectronAlgo") << "Electron with charge, pt, eta, phi: " << (*it)->charge() << " , "
787  << (*it)->pt() << " , " << (*it)->eta() << " , " << (*it)->phi();
788  }
789  LogTrace("GsfElectronAlgo") << "=================================================";
790  }
791 
793  {
794  if (electronData_!=0)
795  { throw cms::Exception("GsfElectronAlgo|InternalError")<<"unexpected electron data" ; }
796 
797  const GsfElectronCoreCollection * coreCollection = eventData_->coreElectrons.product() ;
798  for ( unsigned int i=0 ; i<coreCollection->size() ; ++i )
799  {
800  // check there is no existing electron with this core
802  bool coreFound = false ;
803  GsfElectronPtrCollection::const_iterator itrEle ;
804  for
805  ( itrEle = eventData_->electrons->begin() ;
806  itrEle != eventData_->electrons->end() ;
807  itrEle++ )
808  {
809  if ((*itrEle)->core()==coreRef)
810  {
811  coreFound = true ;
812  break ;
813  }
814  }
815  if (coreFound) continue ;
816 
817  // check there is a super-cluster
818  if (coreRef->superCluster().isNull()) continue ;
819 
820  // prepare internal structure for electron specific data
821  delete electronData_ ;
822  electronData_ = new ElectronData(coreRef,*eventData_->beamspot) ;
823 
824  // calculate and check Trajectory StatesOnSurface....
826 
827  createElectron() ;
828 
829  } // loop over tracks
830 
831  delete electronData_ ;
832  electronData_ = 0 ;
833  }
834 
836  {
837  const GsfElectronCollection * oldElectrons = eventData_->previousElectrons.product() ;
839  GsfElectronCollection::const_iterator oldElectron ;
840  for
841  ( oldElectron = oldElectrons->begin() ;
842  oldElectron != oldElectrons->end() ;
843  ++oldElectron )
844  {
845  const GsfElectronCoreRef oldCoreRef = oldElectron->core() ;
846  const GsfTrackRef oldElectronGsfTrackRef = oldCoreRef->gsfTrack() ;
847  unsigned int icore ;
848  for ( icore=0 ; icore<newCores->size() ; ++icore )
849  {
850  if (oldElectronGsfTrackRef==(*newCores)[icore].gsfTrack())
851  {
853  eventData_->electrons->push_back(new GsfElectron(*oldElectron,coreRef)) ;
854  break ;
855  }
856  }
857  }
858  }
859 
861  {
862  bool found ;
863  const GsfElectronCollection * edElectrons = eventData_->previousElectrons.product() ;
865  GsfElectronCollection::const_iterator pfElectron, edElectron ;
866  unsigned int edIndex, pfIndex ;
867 
868  GsfElectronPtrCollection::iterator el ;
869  for
870  ( el = eventData_->electrons->begin() ;
871  el != eventData_->electrons->end() ;
872  el++ )
873  {
874 // // MVA
875 // // we check that the value is never inferior to the no-cut value
876 // // we generally use in the configuration file for minMVA.
877 // GsfTrackRef gsfTrackRef = (*el)->gsfTrack() ;
878 // float mva = (*eventData_->pfMva.product())[gsfTrackRef] ;
879 // if (mva<noCutMin) { throw cms::Exception("GsfElectronAlgo|UnexpectedMvaValue")<<"unexpected MVA value: "<<mva ; }
880 //
881 // // Mva Output
882 // GsfElectron::MvaOutput mvaOutput ;
883 // mvaOutput.mva = mva ;
884 // (*el)->setMvaOutput(mvaOutput) ;
885 
886  // Retreive info from pflow electrons
887  found = false ;
888  for
889  ( pfIndex = 0, pfElectron = pfElectrons->begin() ; pfElectron != pfElectrons->end() ; pfIndex++, pfElectron++ )
890  {
891  if (pfElectron->gsfTrack()==(*el)->gsfTrack())
892  {
893  if (found)
894  {
895  edm::LogWarning("GsfElectronProducer")<<"associated pfGsfElectron already found" ;
896  }
897  else
898  {
899  found = true ;
900 
901  // Isolation Values
902  if( (eventData_->pfIsolationValues).size() != 0 )
903  {
905  pfElectronRef(eventData_->pflowElectrons, pfIndex);
907  isoVariables.chargedHadronIso=(*(eventData_->pfIsolationValues)[0])[pfElectronRef];
908  isoVariables.photonIso =(*(eventData_->pfIsolationValues)[1])[pfElectronRef];
909  isoVariables.neutralHadronIso=(*(eventData_->pfIsolationValues)[2])[pfElectronRef];
910  (*el)->setPfIsolationVariables(isoVariables);
911  }
912 
913 // (*el)->setPfIsolationVariables(pfElectron->pfIsolationVariables()) ;
914  (*el)->setMvaInput(pfElectron->mvaInput()) ;
915  (*el)->setMvaOutput(pfElectron->mvaOutput()) ;
916  if ((*el)->ecalDrivenSeed())
917  { (*el)->setP4(GsfElectron::P4_PFLOW_COMBINATION,pfElectron->p4(GsfElectron::P4_PFLOW_COMBINATION),pfElectron->p4Error(GsfElectron::P4_PFLOW_COMBINATION),false) ; }
918  else
919  { (*el)->setP4(GsfElectron::P4_PFLOW_COMBINATION,pfElectron->p4(GsfElectron::P4_PFLOW_COMBINATION),pfElectron->p4Error(GsfElectron::P4_PFLOW_COMBINATION),true) ; }
920  double noCutMin = -999999999. ;
921  if ((*el)->mva()<noCutMin) { throw cms::Exception("GsfElectronAlgo|UnexpectedMvaValue")<<"unexpected MVA value: "<<(*el)->mva() ; }
922  }
923  }
924  }
925 
926  // Isolation Values
927  // Retreive not found info from ed electrons
928  if( (eventData_->edIsolationValues).size() != 0 )
929  {
930  edIndex = 0, edElectron = edElectrons->begin() ;
931  while ((found == false)&&(edElectron != edElectrons->end()))
932  {
933  if (edElectron->gsfTrack()==(*el)->gsfTrack())
934  {
935  found = true ;
936 
937  // CONSTRUCTION D UNE REF dans le handle eventData_->previousElectrons avec l'indice edIndex,
938  // puis recuperation dans la ValueMap ED
939 
941  edElectronRef(eventData_->previousElectrons, edIndex);
943  isoVariables.chargedHadronIso=(*(eventData_->edIsolationValues)[0])[edElectronRef];
944  isoVariables.photonIso =(*(eventData_->edIsolationValues)[1])[edElectronRef];
945  isoVariables.neutralHadronIso=(*(eventData_->edIsolationValues)[2])[edElectronRef];
946  (*el)->setPfIsolationVariables(isoVariables);
947  }
948 
949  edIndex++ ;
950  edElectron++ ;
951  }
952  }
953 
954  // Preselection
956 
957  // Shower Shape of pflow cluster
958  if (!((*el)->pflowSuperCluster().isNull()))
959  {
960  reco::GsfElectron::ShowerShape pflowShowerShape ;
961  calculateShowerShape((*el)->pflowSuperCluster(),true,pflowShowerShape) ;
962  (*el)->setPfShowerShape(pflowShowerShape) ;
963  }
964  else if ((*el)->passingPflowPreselection())
965  { edm::LogError("GsfElectronCoreProducer")<<"Preselected tracker driven GsfTrack with no associated pflow SuperCluster." ; }
966 
967  // PfBrem
968  SuperClusterRef sc = (*el)->pflowSuperCluster() ;
969  if (!(sc.isNull()))
970  {
971 
972  if (sc->clustersSize()>1)
973  {
974  CaloCluster_iterator first = sc->clustersBegin() ;
975  (*el)->setPfSuperClusterFbrem((sc->energy()-(*first)->energy())/sc->energy()) ;
976  }
977  else
978  { (*el)->setPfSuperClusterFbrem(0.) ; }
979  ElectronClassification theClassifier ;
980  theClassifier.refineWithPflow(**el) ;
981  }
982  }
983  }
984 
986  { return (ele->passingCutBasedPreselection()||ele->passingPflowPreselection()) ; }
987 
989  {
991  GsfElectronPtrCollection::iterator eitr = eventData_->electrons->begin() ;
992  while (eitr!=eventData_->electrons->end())
993  {
994  LogTrace("GsfElectronAlgo")<<"========== removed not preselected "<<ei<<"/"<<emax<<"==========" ;
995  if (isPreselected(*eitr))
996  { ++eitr ; ++ei ; }
997  else
998  { delete (*eitr) ; eitr = eventData_->electrons->erase(eitr) ; ++ei ; }
999  }
1000  }
1001 
1003  {
1004  // default value
1005  ele->setPassCutBasedPreselection(false) ;
1006 
1007  // kind of seeding
1008  bool eg = ele->core()->ecalDrivenSeed() ;
1009  bool pf = ele->core()->trackerDrivenSeed() && !ele->core()->ecalDrivenSeed() ;
1010  if (eg&&pf) { throw cms::Exception("GsfElectronAlgo|BothEcalAndPureTrackerDriven")<<"An electron cannot be both egamma and purely pflow" ; }
1011  if ((!eg)&&(!pf)) { throw cms::Exception("GsfElectronAlgo|NeitherEcalNorPureTrackerDriven")<<"An electron cannot be neither egamma nor purely pflow" ; }
1013 
1014  // Et cut
1015  double etaValue = EleRelPoint(ele->superCluster()->position(),bs.position()).eta() ;
1016  double etValue = ele->superCluster()->energy()/cosh(etaValue) ;
1017  LogTrace("GsfElectronAlgo") << "Et : " << etValue ;
1018  if (ele->isEB() && (etValue < cfg->minSCEtBarrel)) return ;
1019  if (ele->isEE() && (etValue < cfg->minSCEtEndcaps)) return ;
1020  LogTrace("GsfElectronAlgo") << "Et criteria are satisfied";
1021 
1022  // E/p cut
1023  double eopValue = ele->eSuperClusterOverP() ;
1024  LogTrace("GsfElectronAlgo") << "E/p : " << eopValue ;
1025  if (ele->isEB() && (eopValue > cfg->maxEOverPBarrel)) return ;
1026  if (ele->isEE() && (eopValue > cfg->maxEOverPEndcaps)) return ;
1027  if (ele->isEB() && (eopValue < cfg->minEOverPBarrel)) return ;
1028  if (ele->isEE() && (eopValue < cfg->minEOverPEndcaps)) return ;
1029  LogTrace("GsfElectronAlgo") << "E/p criteria are satisfied";
1030 
1031  // HoE cuts
1032  LogTrace("GsfElectronAlgo") << "HoE1 : " << ele->hcalDepth1OverEcal() << ", HoE2 : " << ele->hcalDepth2OverEcal();
1033  double had = ele->hcalOverEcal()*ele->superCluster()->energy() ;
1034  const reco::CaloCluster & seedCluster = *(ele->superCluster()->seed()) ;
1035  int detector = seedCluster.hitsAndFractions()[0].first.subdetId() ;
1036  bool HoEveto = false ;
1037  if (detector==EcalBarrel && (had<cfg->maxHBarrel || (had/ele->superCluster()->energy())<cfg->maxHOverEBarrel)) HoEveto=true;
1038  else if (detector==EcalEndcap && (had<cfg->maxHEndcaps || (had/ele->superCluster()->energy())<cfg->maxHOverEEndcaps)) HoEveto=true;
1039  if ( !HoEveto ) return ;
1040  LogTrace("GsfElectronAlgo") << "H/E criteria are satisfied";
1041 
1042  // delta eta criteria
1043  double deta = ele->deltaEtaSuperClusterTrackAtVtx() ;
1044  LogTrace("GsfElectronAlgo") << "delta eta : " << deta ;
1045  if (ele->isEB() && (std::abs(deta) > cfg->maxDeltaEtaBarrel)) return ;
1046  if (ele->isEE() && (std::abs(deta) > cfg->maxDeltaEtaEndcaps)) return ;
1047  LogTrace("GsfElectronAlgo") << "Delta eta criteria are satisfied";
1048 
1049  // delta phi criteria
1050  double dphi = ele->deltaPhiSuperClusterTrackAtVtx();
1051  LogTrace("GsfElectronAlgo") << "delta phi : " << dphi;
1052  if (ele->isEB() && (std::abs(dphi) > cfg->maxDeltaPhiBarrel)) return ;
1053  if (ele->isEE() && (std::abs(dphi) > cfg->maxDeltaPhiEndcaps)) return ;
1054  LogTrace("GsfElectronAlgo") << "Delta phi criteria are satisfied";
1055 
1056  // sigma ieta ieta
1057  LogTrace("GsfElectronAlgo") << "sigma ieta ieta : " << ele->sigmaIetaIeta();
1058  if (ele->isEB() && (ele->sigmaIetaIeta() > cfg->maxSigmaIetaIetaBarrel)) return ;
1059  if (ele->isEE() && (ele->sigmaIetaIeta() > cfg->maxSigmaIetaIetaEndcaps)) return ;
1060  LogTrace("GsfElectronAlgo") << "Sigma ieta ieta criteria are satisfied";
1061 
1062  // fiducial
1063  if (!ele->isEB() && cfg->isBarrel) return ;
1064  if (!ele->isEE() && cfg->isEndcaps) return ;
1065  if (cfg->isFiducial && (ele->isEBEEGap()||ele->isEBEtaGap()||ele->isEBPhiGap()||ele->isEERingGap()||ele->isEEDeeGap())) return ;
1066  LogTrace("GsfElectronAlgo") << "Fiducial flags criteria are satisfied";
1067 
1068  // seed in TEC
1069  edm::RefToBase<TrajectorySeed> seed = ele->gsfTrack()->extra()->seedRef() ;
1070  ElectronSeedRef elseed = seed.castTo<ElectronSeedRef>() ;
1071  if (eg && !generalData_->cutsCfg.seedFromTEC)
1072  {
1073  if (elseed.isNull())
1074  { throw cms::Exception("GsfElectronAlgo|NotElectronSeed")<<"The GsfTrack seed is not an ElectronSeed ?!" ; }
1075  else
1076  { if (elseed->subDet2()==6) return ; }
1077  }
1078 
1079  // transverse impact parameter
1080  if (std::abs(ele->gsfTrack()->dxy(bs.position()))>cfg->maxTIP) return ;
1081  LogTrace("GsfElectronAlgo") << "TIP criterion is satisfied" ;
1082 
1083  LogTrace("GsfElectronAlgo") << "All cut based criteria are satisfied" ;
1084  ele->setPassCutBasedPreselection(true) ;
1085  }
1086 
1088  {
1089  ele->setPassMvaPreselection(false) ;
1090 
1091  if (ele->core()->ecalDrivenSeed())
1092  { if (ele->mvaOutput().mva>=generalData_->cutsCfg.minMVA) ele->setPassMvaPreselection(true) ; }
1093  else
1094  { if (ele->mvaOutput().mva>=generalData_->cutsCfgPflow.minMVA) ele->setPassMvaPreselection(true) ; }
1095 
1096  if (ele->passingMvaPreselection())
1097  { LogTrace("GsfElectronAlgo") << "Main mva criterion is satisfied" ; }
1098 
1100 
1101 // ele->setPassPflowPreselection(false) ;
1102 // if (ele->core()->ecalDrivenSeed())
1103 // {
1104 // if ((ele->mvaOutput().mva>=generalData_->cutsCfg.minMVA) ||
1105 // (ele->mvaOutput().mvaByPassForIsolated>=generalData_->cutsCfg.minMvaByPassForIsolated))
1106 // ele->setPassPflowPreselection(true) ;
1107 // }
1108 // else
1109 // {
1110 // if ((ele->mvaOutput().mva>=generalData_->cutsCfgPflow.minMVA) ||
1111 // (ele->mvaOutput().mvaByPassForIsolated>=generalData_->cutsCfgPflow.minMvaByPassForIsolated))
1112 // ele->setPassPflowPreselection(true) ;
1113 // }
1114 // if (ele->passingPflowPreselection())
1115 // { LogTrace("GsfElectronAlgo") << "Mva criteria are satisfied" ; }
1116  }
1117 
1119  {
1120  // eventually check ctf track
1123 
1124  // charge ID
1125  int eleCharge ;
1126  GsfElectron::ChargeInfo eleChargeInfo ;
1127  electronData_->computeCharge(eleCharge,eleChargeInfo) ;
1128 
1129  // electron basic cluster
1131 
1132  // Seed cluster
1133  const reco::CaloCluster & seedCluster = *(electronData_->superClusterRef->seed()) ;
1134 
1135  // seed Xtal
1136  // temporary, till CaloCluster->seed() is made available
1137  DetId seedXtalId = seedCluster.hitsAndFractions()[0].first ;
1138 
1140 
1141 
1142  //====================================================
1143  // Candidate attributes
1144  //====================================================
1145 
1147 
1148 
1149  //====================================================
1150  // Track-Cluster Matching
1151  //====================================================
1152 
1154  tcMatching.electronCluster = elbcRef ;
1155  tcMatching.eSuperClusterOverP = (electronData_->vtxMom.mag()>0)?(electronData_->superClusterRef->energy()/electronData_->vtxMom.mag()):(-1.) ;
1156  tcMatching.eSeedClusterOverP = (electronData_->vtxMom.mag()>0.)?(seedCluster.energy()/electronData_->vtxMom.mag()):(-1) ;
1157  tcMatching.eSeedClusterOverPout = (electronData_->seedMom.mag()>0.)?(seedCluster.energy()/electronData_->seedMom.mag()):(-1.) ;
1158  tcMatching.eEleClusterOverPout = (electronData_->eleMom.mag()>0.)?(elbcRef->energy()/electronData_->eleMom.mag()):(-1.) ;
1159 
1161  tcMatching.deltaEtaSuperClusterAtVtx = scAtVtx.dEta() ;
1162  tcMatching.deltaPhiSuperClusterAtVtx = scAtVtx.dPhi() ;
1163 
1164  EleRelPointPair seedAtCalo(seedCluster.position(),electronData_->seedPos,eventData_->beamspot->position()) ;
1165  tcMatching.deltaEtaSeedClusterAtCalo = seedAtCalo.dEta() ;
1166  tcMatching.deltaPhiSeedClusterAtCalo = seedAtCalo.dPhi() ;
1167 
1168  EleRelPointPair ecAtCalo(elbcRef->position(),electronData_->elePos,eventData_->beamspot->position()) ;
1169  tcMatching.deltaEtaEleClusterAtCalo = ecAtCalo.dEta() ;
1170  tcMatching.deltaPhiEleClusterAtCalo = ecAtCalo.dPhi() ;
1171 
1172 
1173  //=======================================================
1174  // Track extrapolations
1175  //=======================================================
1176 
1185 
1186 
1187  //=======================================================
1188  // Closest Ctf Track
1189  //=======================================================
1190 
1192  ctfInfo.ctfTrack = electronData_->ctfTrackRef ;
1194 
1195 
1196  //====================================================
1197  // FiducialFlags, using nextToBoundary definition of gaps
1198  //====================================================
1199 
1200  reco::GsfElectron::FiducialFlags fiducialFlags ;
1201  int detector = seedXtalId.subdetId() ;
1202  double feta=std::abs(electronData_->superClusterRef->position().eta()) ;
1203  if (detector==EcalBarrel)
1204  {
1205  fiducialFlags.isEB = true ;
1206  EBDetId ebdetid(seedXtalId);
1207  if (EBDetId::isNextToEtaBoundary(ebdetid))
1208  {
1209  if (ebdetid.ietaAbs()==85)
1210  { fiducialFlags.isEBEEGap = true ; }
1211  else
1212  { fiducialFlags.isEBEtaGap = true ; }
1213  }
1214  if (EBDetId::isNextToPhiBoundary(ebdetid))
1215  { fiducialFlags.isEBPhiGap = true ; }
1216  }
1217  else if (detector==EcalEndcap)
1218  {
1219  fiducialFlags.isEE = true ;
1220  EEDetId eedetid(seedXtalId);
1221  if (EEDetId::isNextToRingBoundary(eedetid))
1222  {
1223  if (std::abs(feta)<2.)
1224  { fiducialFlags.isEBEEGap = true ; }
1225  else
1226  { fiducialFlags.isEERingGap = true ; }
1227  }
1228  if (EEDetId::isNextToDBoundary(eedetid))
1229  { fiducialFlags.isEEDeeGap = true ; }
1230  }
1231  else
1232  { throw cms::Exception("GsfElectronAlgo|UnknownXtalRegion")<<"createElectron(): do not know if it is a barrel or endcap seed cluster !!!!" ; }
1233 
1234 
1235  //====================================================
1236  // ShowerShape
1237  //====================================================
1238 
1239  reco::GsfElectron::ShowerShape showerShape ;
1240  calculateShowerShape(electronData_->superClusterRef,!(electronData_->coreRef->ecalDrivenSeed()),showerShape) ;
1241 
1242 
1243  //====================================================
1244  // ConversionRejection
1245  //====================================================
1246 
1248 
1249  ConversionFinder conversionFinder ;
1250  double BInTesla = eventSetupData_->magField->inTesla(GlobalPoint(0.,0.,0.)).z() ;
1252  if (!ctfTracks.isValid()) { ctfTracks = eventData_->currentCtfTracks ; }
1253 
1254  // values of conversionInfo.flag()
1255  // -9999 : Partner track was not found
1256  // 0 : Partner track found in the CTF collection using
1257  // 1 : Partner track found in the CTF collection using
1258  // 2 : Partner track found in the GSF collection using
1259  // 3 : Partner track found in the GSF collection using the electron's GSF track
1260  ConversionInfo conversionInfo = conversionFinder.getConversionInfo
1261  (*electronData_->coreRef,ctfTracks,eventData_->originalGsfTracks,BInTesla) ;
1262 
1264  conversionVars.flags = conversionInfo.flag() ;
1265  conversionVars.dist = conversionInfo.dist() ;
1266  conversionVars.dcot = conversionInfo.dcot() ;
1267  conversionVars.radius = conversionInfo.radiusOfConversion() ;
1268  if ((conversionVars.flags==0)or(conversionVars.flags==1))
1269  conversionVars.partner = TrackBaseRef(conversionInfo.conversionPartnerCtfTk()) ;
1270  else if ((conversionVars.flags==2)or(conversionVars.flags==3))
1271  conversionVars.partner = TrackBaseRef(conversionInfo.conversionPartnerGsfTk()) ;
1272 
1273 
1274  //====================================================
1275  // Go !
1276  //====================================================
1277 
1278  GsfElectron * ele = new
1279  GsfElectron
1280  ( eleCharge,eleChargeInfo,electronData_->coreRef,
1281  tcMatching, tkExtra, ctfInfo,
1282  fiducialFlags,showerShape,
1283  conversionVars ) ;
1285  ele->setP4(GsfElectron::P4_FROM_SUPER_CLUSTER,momentum,0,true) ;
1286 
1287 
1288  //====================================================
1289  // brems fractions
1290  //====================================================
1291 
1292  if (electronData_->innMom.mag()>0.)
1294 
1295  SuperClusterRef sc = ele->superCluster() ;
1296  if (!(sc.isNull()))
1297  {
1298  CaloClusterPtr cl = ele->electronCluster() ;
1299  if (sc->clustersSize()>1)
1300  { ele->setSuperClusterFbrem( ( sc->energy() - cl->energy() ) / sc->energy() ) ; }
1301  else
1302  { ele->setSuperClusterFbrem(0) ; }
1303  }
1304 
1305 
1306  //====================================================
1307  // classification and corrections
1308  //====================================================
1309 
1310  // classification
1311  ElectronClassification theClassifier ;
1312  theClassifier.classify(*ele) ;
1313 
1314  // ecal energy
1316  if (ele->core()->ecalDrivenSeed())
1317  {
1319  { theEnCorrector.classBasedParameterizationEnergy(*ele,*eventData_->beamspot) ; }
1321  { theEnCorrector.classBasedParameterizationUncertainty(*ele) ; }
1322  }
1323  else
1324  {
1326  { theEnCorrector.simpleParameterizationUncertainty(*ele) ; }
1327  }
1328 
1329  // momentum
1330  if (ele->core()->ecalDrivenSeed())
1331  {
1332  ElectronMomentumCorrector theMomCorrector;
1333  theMomCorrector.correct(*ele,electronData_->vtxTSOS);
1334  }
1335 
1336 
1337  //====================================================
1338  // now isolation variables
1339  //====================================================
1340 
1354  ele->setIsolation03(dr03);
1355  ele->setIsolation04(dr04);
1356 
1357 
1358  //====================================================
1359  // preselection flag
1360  //====================================================
1361 
1363 
1364  LogTrace("GsfElectronAlgo")<<"Constructed new electron with energy "<< ele->p4().e() ;
1365 
1366  eventData_->electrons->push_back(ele) ;
1367  }
1368 
1369 
1370 //=======================================================================================
1371 // Ambiguity solving
1372 //=======================================================================================
1373 
1374 //bool better_electron( const reco::GsfElectron * e1, const reco::GsfElectron * e2 )
1375 // { return (std::abs(e1->eSuperClusterOverP()-1)<std::abs(e2->eSuperClusterOverP()-1)) ; }
1376 
1377 void GsfElectronAlgo::setAmbiguityData( bool ignoreNotPreselected )
1378  {
1379  GsfElectronPtrCollection::iterator e1, e2 ;
1384  else
1385  { throw cms::Exception("GsfElectronAlgo|UnknownAmbiguitySortingStrategy")<<"value of generalData_->strategyCfg.ambSortingStrategy is : "<<generalData_->strategyCfg.ambSortingStrategy ; }
1386 
1387  // init
1388  for
1389  ( e1 = eventData_->electrons->begin() ;
1390  e1 != eventData_->electrons->end() ;
1391  ++e1 )
1392  {
1393  (*e1)->clearAmbiguousGsfTracks() ;
1394  (*e1)->setAmbiguous(false) ;
1395  }
1396 
1397  // get ambiguous from GsfPfRecTracks
1399  {
1400  for
1401  ( e1 = eventData_->electrons->begin() ;
1402  e1 != eventData_->electrons->end() ;
1403  ++e1 )
1404  {
1405  bool found = false ;
1406  const GsfPFRecTrackCollection * gsfPfRecTrackCollection = eventData_->gsfPfRecTracks.product() ;
1407  GsfPFRecTrackCollection::const_iterator gsfPfRecTrack ;
1408  for ( gsfPfRecTrack=gsfPfRecTrackCollection->begin() ;
1409  gsfPfRecTrack!=gsfPfRecTrackCollection->end() ;
1410  ++gsfPfRecTrack )
1411  {
1412  if (gsfPfRecTrack->gsfTrackRef()==(*e1)->gsfTrack())
1413  {
1414  if (found)
1415  {
1416  edm::LogWarning("GsfElectronAlgo")<<"associated gsfPfRecTrack already found" ;
1417  }
1418  else
1419  {
1420  found = true ;
1421  const std::vector<reco::GsfPFRecTrackRef> & duplicates(gsfPfRecTrack->convBremGsfPFRecTrackRef()) ;
1422  std::vector<reco::GsfPFRecTrackRef>::const_iterator duplicate ;
1423  for ( duplicate = duplicates.begin() ; duplicate != duplicates.end() ; duplicate ++ )
1424  { (*e1)->addAmbiguousGsfTrack((*duplicate)->gsfTrackRef()) ; }
1425  }
1426  }
1427  }
1428  }
1429  }
1430  // or search overlapping clusters
1431  else
1432  {
1433  for
1434  ( e1 = eventData_->electrons->begin() ;
1435  e1 != eventData_->electrons->end() ;
1436  ++e1 )
1437  {
1438  if ((*e1)->ambiguous()) continue ;
1439  if ( ignoreNotPreselected && !isPreselected(*e1) ) continue ;
1440 
1441  SuperClusterRef scRef1 = (*e1)->superCluster();
1442  CaloClusterPtr eleClu1 = (*e1)->electronCluster();
1443  LogDebug("GsfElectronAlgo")
1444  << "Blessing electron with E/P " << (*e1)->eSuperClusterOverP()
1445  << ", cluster " << scRef1.get()
1446  << " & track " << (*e1)->gsfTrack().get() ;
1447 
1448  for
1449  ( e2 = e1, ++e2 ;
1450  e2 != eventData_->electrons->end() ;
1451  ++e2 )
1452  {
1453  if ((*e2)->ambiguous()) continue ;
1454  if ( ignoreNotPreselected && !isPreselected(*e2) ) continue ;
1455 
1456  SuperClusterRef scRef2 = (*e2)->superCluster();
1457  CaloClusterPtr eleClu2 = (*e2)->electronCluster();
1458 
1459  // search if same cluster
1460  bool sameCluster = false ;
1462  { sameCluster = (scRef1==scRef2) ; }
1464  {
1465  float eMin = 1. ;
1466  float threshold = eMin*cosh(EleRelPoint(scRef1->position(),eventData_->beamspot->position()).eta()) ;
1467  sameCluster =
1469  (EgAmbiguityTools::sharedEnergy(&(*scRef1->seed()),&(*eleClu2),eventData_->barrelRecHits,eventData_->endcapRecHits)>=threshold) ||
1471  (EgAmbiguityTools::sharedEnergy(&(*scRef1->seed()),&(*scRef2->seed()),eventData_->barrelRecHits,eventData_->endcapRecHits)>=threshold) ) ;
1472  }
1473  else
1474  { throw cms::Exception("GsfElectronAlgo|UnknownAmbiguityClustersOverlapStrategy")<<"value of generalData_->strategyCfg.ambClustersOverlapStrategy is : "<<generalData_->strategyCfg.ambClustersOverlapStrategy ; }
1475 
1476  // main instructions
1477  if (sameCluster)
1478  {
1479  LogDebug("GsfElectronAlgo")
1480  << "Discarding electron with E/P " << (*e2)->eSuperClusterOverP()
1481  << ", cluster " << scRef2.get()
1482  << " and track " << (*e2)->gsfTrack().get() ;
1483  (*e1)->addAmbiguousGsfTrack((*e2)->gsfTrack()) ;
1484  (*e2)->setAmbiguous(true) ;
1485  }
1486  else if ((*e1)->gsfTrack()==(*e2)->gsfTrack())
1487  {
1488  edm::LogWarning("GsfElectronAlgo")
1489  << "Forgetting electron with E/P " << (*e2)->eSuperClusterOverP()
1490  << ", cluster " << scRef2.get()
1491  << " and track " << (*e2)->gsfTrack().get() ;
1492  (*e2)->setAmbiguous(true) ;
1493  }
1494  }
1495  }
1496  }
1497  }
1498 
1500  {
1501  GsfElectronPtrCollection::size_type ei = 1, emax = eventData_->electrons->size() ;
1502  GsfElectronPtrCollection::iterator eitr = eventData_->electrons->begin() ;
1503  while (eitr!=eventData_->electrons->end())
1504  {
1505  LogTrace("GsfElectronAlgo")<<"========== remove ambiguous "<<ei<<"/"<<emax<<"==========" ;
1506  if ((*eitr)->ambiguous())
1507  { delete (*eitr) ; eitr = eventData_->electrons->erase(eitr) ; ++ei ; }
1508  else
1509  { ++eitr ; ++ei ; }
1510  }
1511  }
1512 
1513 
#define LogDebug(id)
TrajectoryStateOnSurface constrainAtBeamSpot(const reco::GsfTrack &, const reco::BeamSpot &) const
(multi)TSOS after including the beamspot
CaloClusterPtr electronCluster() const
Definition: GsfElectron.h:228
ElectronHcalHelper * hcalHelperPflow
edm::Handle< reco::TrackCollection > originalCtfTracks
T getParameter(std::string const &) const
unsigned long long cacheIdentifier() const
edm::Handle< reco::ElectronSeedCollection > seeds
bool empty() const
Definition: ParameterSet.h:219
const MultiTrajectoryStateMode * mtsMode
bool isPreselected(reco::GsfElectron *ele)
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:123
void setTrackFbrem(float fbrem)
Definition: GsfElectron.h:642
int i
Definition: DBlmapReader.cc:9
edm::Handle< edm::ValueMap< float > > pfMva
void setP4(P4Kind kind, const LorentzVector &p4, float p4Error, bool setCandidate)
Definition: GsfElectron.cc:178
GeneralData * generalData_
const CutsConfiguration cutsCfgPflow
static bool isNextToEtaBoundary(EBDetId id)
Definition: EBDetId.cc:125
EgammaTowerIsolation * hadDepth1Isolation04Bc
reco::GsfTrackRef conversionPartnerGsfTk() const
void setPassCutBasedPreselection(bool flag)
Definition: GsfElectron.h:593
bool positionFromModeCartesian(const TrajectoryStateOnSurface tsos, GlobalPoint &position) const
bool isEBEtaGap() const
Definition: GsfElectron.h:335
void readEvent(const edm::Event &)
EgammaTowerIsolation * hadDepth1Isolation03Bc
double radiusOfConversion() const
void clonePreviousElectrons()
const LorentzVector & p4(P4Kind kind) const
Definition: GsfElectron.cc:204
float eSuperClusterOverP() const
Definition: GsfElectron.h:229
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
bool isBetter(const reco::GsfElectron *, const reco::GsfElectron *)
void retreiveOriginalTrackCollections(const reco::TrackRef &, const reco::GsfTrackRef &)
bool isEBEEGap() const
Definition: GsfElectron.h:333
float hcalDepth2OverEcal() const
Definition: GsfElectron.h:389
double getEtSum(const reco::Candidate *emObject) const
const IsolationConfiguration isoCfg
void calculateShowerShape(const reco::SuperClusterRef &, bool pflow, reco::GsfElectron::ShowerShape &)
void beginEvent(edm::Event &)
GeneralData(const InputTagsConfiguration &, const StrategyConfiguration &, const CutsConfiguration &cutsCfg, const CutsConfiguration &cutsCfgPflow, const ElectronHcalHelper::Configuration &hcalCfg, const ElectronHcalHelper::Configuration &hcalCfgPflow, const IsolationConfiguration &, const EcalRecHitsConfiguration &, EcalClusterFunctionBaseClass *superClusterErrorFunction, EcalClusterFunctionBaseClass *crackCorrectionFunction)
TrajectoryStateOnSurface sclTSOS
const EcalRecHitsConfiguration recHitsCfg
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
EventSetupData * eventSetupData_
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
edm::Handle< EcalRecHitCollection > endcapRecHits
double hcalESumDepth2BehindClusters(const std::vector< CaloTowerDetId > &towers)
double dist() const
#define abs(x)
Definition: mlp_lapack.h:159
std::vector< CaloTowerDetId > hcalTowersBehindClusters(const reco::SuperCluster &sc)
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:189
#define min(a, b)
Definition: mlp_lapack.h:161
void checkSetup(const edm::EventSetup &)
bool isEERingGap() const
Definition: GsfElectron.h:339
bool passingCutBasedPreselection() const
Definition: GsfElectron.h:585
bool passingMvaPreselection() const
Definition: GsfElectron.h:601
void computeCharge(int &charge, reco::GsfElectron::ChargeInfo &info)
bool momentumFromModeCartesian(const TrajectoryStateOnSurface tsos, GlobalVector &momentum) const
void checkCtfTrack(edm::Handle< reco::TrackCollection > currentCtfTracks)
T eta() const
double hcalESumDepth1BehindClusters(const std::vector< CaloTowerDetId > &towers)
const InputTagsConfiguration inputCfg
edm::ESHandle< EcalSeverityLevelAlgo > sevLevel
TrajectoryStateOnSurface innTSOS
uint16_t size_type
bool isEEDeeGap() const
Definition: GsfElectron.h:338
double charge(const std::vector< uint8_t > &Ampls)
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
EgammaTowerIsolation * hadDepth1Isolation03
const StrategyConfiguration strategyCfg
bool isEE() const
Definition: GsfElectron.h:331
bool isEB() const
Definition: GsfElectron.h:330
TrajectoryStateOnSurface outerStateOnSurface(const reco::GsfTrack &tk) const
edm::ESHandle< CaloTopology > caloTopo
void doFlagChecks(const std::vector< int > &v)
reco::TrackRef conversionPartnerCtfTk() const
static std::vector< float > covariances(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, const CaloGeometry *geometry, float w0=4.7)
void setSuperClusterFbrem(float fbrem)
Definition: GsfElectron.h:643
static bool stripTIDHitFilter(uint32_t pattern)
Definition: HitPattern.h:439
EgammaRecHitIsolation * ecalBarrelIsol04
TrajectoryStateOnSurface constrainedVtxTSOS
virtual float getValue(const reco::BasicCluster &, const EcalRecHitCollection &) const =0
EgammaTowerIsolation * hadDepth2Isolation03
EgammaTowerIsolation * hadDepth1Isolation04
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
ElectronTkIsolation * tkIsolation03
void setUseNumCrystals(bool b=true)
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:233
void setCorrectedEcalEnergyError(float newEnergyError)
Definition: GsfElectron.cc:158
bool isNull() const
Checks for null.
Definition: Ref.h:247
T mag() const
Definition: PV3DBase.h:67
float sigmaIetaIeta() const
Definition: GsfElectron.h:382
bool isNotFinite(T x)
Definition: isFinite.h:10
static std::vector< float > localCovariances(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, float w0=4.7)
void simpleParameterizationUncertainty(reco::GsfElectron &)
TrajectoryStateOnSurface extrapolatedState(const TrajectoryStateOnSurface tsos, const GlobalPoint &point) const
void setCutBasedPreselectionFlag(reco::GsfElectron *ele, const reco::BeamSpot &)
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
std::vector< GsfPFRecTrack > GsfPFRecTrackCollection
collection of GsfPFRecTrack objects
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
Definition: TrackFwd.h:22
EgammaRecHitIsolation * ecalEndcapIsol03
float sharedEnergy(const reco::CaloCluster *, const reco::CaloCluster *, edm::Handle< EcalRecHitCollection > &barrelRecHits, edm::Handle< EcalRecHitCollection > &endcapRecHits)
EgammaTowerIsolation * hadDepth2Isolation03Bc
RealType normalized_phi(RealType phi)
T sqrt(T t)
Definition: SSEVec.h:48
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:168
GsfConstraintAtVertex * constraintAtVtx
static bool isNextToPhiBoundary(EBDetId id)
Definition: EBDetId.cc:130
edm::Handle< EcalRecHitCollection > barrelRecHits
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:236
std::vector< GsfElectronCore > GsfElectronCoreCollection
void correct(reco::GsfElectron &, TrajectoryStateOnSurface &)
static bool pixelHitFilter(uint32_t pattern)
Definition: HitPattern.h:400
float hcalOverEcal() const
Definition: GsfElectron.h:390
static float e3x3(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
void setPassMvaPreselection(bool flag)
Definition: GsfElectron.h:600
IsolationValueMaps pfIsolationValues
std::vector< CaloTowerDetId > hcalTowersBehindClusters
Definition: GsfElectron.h:366
const MultiTrajectoryStateTransform * mtsTransform
int j
Definition: DBlmapReader.cc:9
static bool isNextToRingBoundary(EEDetId id)
Definition: EEDetId.cc:375
std::list< reco::GsfElectron * > GsfElectronPtrCollection
double hcalESumDepth2(const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=0)
double energy() const
cluster energy
Definition: CaloCluster.h:120
const CutsConfiguration cutsCfg
ElectronHcalHelper * hcalHelper
const reco::BeamSpot * beamspot
edm::ESHandle< MagneticField > magField
GsfElectronPtrCollection * electrons
CaloClusterPtr getEleBasicCluster(const MultiTrajectoryStateTransform *)
static bool isNextToDBoundary(EEDetId id)
Definition: EEDetId.cc:367
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool first
Definition: L1TdeRCT.cc:94
bool isValid() const
Definition: HandleBase.h:76
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
void setIsolation04(const IsolationVariables &dr04)
Definition: GsfElectron.h:463
#define LogTrace(id)
void doSeverityChecks(const EcalRecHitCollection *const recHits, const std::vector< int > &v)
void classify(reco::GsfElectron &)
EgammaTowerIsolation * hadDepth2Isolation04Bc
edm::Handle< reco::GsfElectronCollection > previousElectrons
float hcalDepth1OverEcal() const
Definition: GsfElectron.h:388
std::vector< edm::Handle< edm::ValueMap< double > > > IsolationValueMaps
Float e1
Definition: deltaR.h:22
Definition: DetId.h:20
void classBasedParameterizationEnergy(reco::GsfElectron &, const reco::BeamSpot &bs)
EgammaRecHitIsolation * ecalBarrelIsol03
edm::Handle< reco::GsfElectronCollection > pflowElectrons
EcalRecHitMetaCollection * ecalBarrelHitsMeta
int flag() const
GsfElectronAlgo(const InputTagsConfiguration &, const StrategyConfiguration &, const CutsConfiguration &cutsCfg, const CutsConfiguration &cutsCfgPflow, const ElectronHcalHelper::Configuration &hcalCfg, const ElectronHcalHelper::Configuration &hcalCfgPflow, const IsolationConfiguration &, const EcalRecHitsConfiguration &, EcalClusterFunctionBaseClass *superClusterErrorFunction, EcalClusterFunctionBaseClass *crackCorrectionFunction)
EcalClusterFunctionBaseClass * superClusterErrorFunction
const T & get() const
Definition: EventSetup.h:55
REF castTo() const
cast to a concrete type
Definition: RefToBase.h:241
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:14
void setPflowPreselectionFlag(reco::GsfElectron *ele)
const MvaOutput & mvaOutput() const
Definition: GsfElectron.h:558
T const * product() const
Definition: ESHandle.h:62
const reco::GsfTrackRef gsfTrackRef
void ele_convert(const Type1 &obj1, Type2 &obj2)
T const * product() const
Definition: Handle.h:74
bool calculateTSOS(const MultiTrajectoryStateTransform *, GsfConstraintAtVertex *)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:41
virtual GsfElectronCoreRef core() const
Definition: GsfElectron.cc:8
Float e2
Definition: deltaR.h:23
math::XYZVectorF momentumAtVtxWithConstraint
Definition: GsfElectron.h:266
double getPtTracks(const reco::GsfElectron *) const
TrajectoryStateOnSurface innerStateOnSurface(const reco::GsfTrack &tk) const
TrajectoryStateOnSurface seedTSOS
void refineWithPflow(reco::GsfElectron &)
void setIsolation03(const IsolationVariables &dr03)
Definition: GsfElectron.h:462
ESHandle< TrackerGeometry > geometry
edm::EventID id() const
Definition: EventBase.h:56
edm::Handle< reco::GsfTrackCollection > originalGsfTracks
EgammaTowerIsolation * hadDepth2Isolation04
void setVetoClustered(bool b=true)
SimpleCaloRecHitMetaCollection< EcalRecHitCollection > EcalRecHitMetaCollection
const reco::GsfElectronCoreRef coreRef
bool isEBPhiGap() const
Definition: GsfElectron.h:336
edm::Handle< reco::TrackCollection > currentCtfTracks
static float e2x5Max(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
double getTowerEtSum(const reco::Candidate *cand, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
edm::ESHandle< CaloGeometry > caloGeom
EcalClusterFunctionBaseClass * crackCorrectionFunction
void removeAmbiguousElectrons()
static float e5x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
double hcalESumDepth1(const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=0)
void displayInternalElectrons(const std::string &title) const
void setPassPflowPreselection(bool flag)
Definition: GsfElectron.h:594
EgammaRecHitIsolation * ecalEndcapIsol04
static float e1x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
void removeNotPreselectedElectrons()
const reco::SuperClusterRef superClusterRef
TrajectoryStateOnSurface eleTSOS
const Point & position() const
position
Definition: BeamSpot.h:63
EventData * eventData_
double dcot() const
TrajectoryStateOnSurface outTSOS
ElectronData(const reco::GsfElectronCoreRef &core, const reco::BeamSpot &bs)
void copyElectrons(reco::GsfElectronCollection &)
ProductID id() const
Accessor for product ID.
Definition: Ref.h:256
ElectronTkIsolation * tkIsolation04
double pi
ElectronData * electronData_
edm::ESHandle< TrackerGeometry > trackerHandle
void setAmbiguityData(bool ignoreNotPreselected=true)
IsolationValueMaps edIsolationValues
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:242
uint32_t getHitPattern(int position) const
Definition: HitPattern.cc:144
virtual void init(const edm::EventSetup &es)=0
edm::Handle< reco::GsfElectronCoreCollection > coreElectrons
int ietaAbs() const
get the absolute value of the crystal ieta
Definition: EBDetId.h:50
void classBasedParameterizationUncertainty(reco::GsfElectron &)
edm::Handle< CaloTowerCollection > towers
void calculateMode(const MultiTrajectoryStateMode *mtsMode)
math::PtEtaPhiELorentzVectorF LorentzVector
EcalRecHitMetaCollection * ecalEndcapHitsMeta
Global3DVector GlobalVector
Definition: GlobalVector.h:10
void checkSetup(const edm::EventSetup &)
edm::Handle< reco::GsfPFRecTrackCollection > gsfPfRecTracks
TrajectoryStateOnSurface vtxTSOS
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack
Definition: GsfElectron.h:169
static bool stripTIBHitFilter(uint32_t pattern)
Definition: HitPattern.h:432
Candidate::LorentzVector calculateMomentum()
bool passingPflowPreselection() const
Definition: GsfElectron.h:586
const reco::BeamSpot beamSpot