CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFElecTkProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: PFTracking
4 // Class: PFElecTkProducer
5 //
6 // Original Author: Michele Pioppi
7 // Created: Tue Jan 23 15:26:39 CET 2007
8 
9 
10 
11 // system include files
12 #include <memory>
13 
14 // user include files
36 
37 #include "TMath.h"
38 using namespace std;
39 using namespace edm;
40 using namespace reco;
42  conf_(iConfig)
43 {
44 
45 
46  gsfTrackLabel_ = consumes<reco::GsfTrackCollection>(iConfig.getParameter<InputTag>
47  ("GsfTrackModuleLabel"));
48 
49  pfTrackLabel_ = consumes<reco::PFRecTrackCollection>(iConfig.getParameter<InputTag>
50  ("PFRecTrackLabel"));
51 
52  primVtxLabel_ = consumes<reco::VertexCollection>(iConfig.getParameter<InputTag>
53  ("PrimaryVertexLabel"));
54 
55  pfEcalClusters_ = consumes<reco::PFClusterCollection>(iConfig.getParameter<InputTag>
56  ("PFEcalClusters"));
57 
58  pfNuclear_ = consumes<reco::PFDisplacedTrackerVertexCollection>(iConfig.getParameter<InputTag>
59  ("PFNuclear"));
60 
61  pfConv_ = consumes<reco::PFConversionCollection>(iConfig.getParameter<InputTag>
62  ("PFConversions"));
63 
64  pfV0_ = consumes<reco::PFV0Collection>(iConfig.getParameter<InputTag>
65  ("PFV0"));
66 
67  useNuclear_ = iConfig.getParameter<bool>("useNuclear");
68  useConversions_ = iConfig.getParameter<bool>("useConversions");
69  useV0_ = iConfig.getParameter<bool>("useV0");
70  debugGsfCleaning_ = iConfig.getParameter<bool>("debugGsfCleaning");
71 
72  produces<GsfPFRecTrackCollection>();
73  produces<GsfPFRecTrackCollection>( "Secondary" ).setBranchAlias( "secondary" );
74 
75 
76  trajinev_ = iConfig.getParameter<bool>("TrajInEvents");
77  modemomentum_ = iConfig.getParameter<bool>("ModeMomentum");
78  applySel_ = iConfig.getParameter<bool>("applyEGSelection");
79  applyGsfClean_ = iConfig.getParameter<bool>("applyGsfTrackCleaning");
80  applyAngularGsfClean_ = iConfig.getParameter<bool>("applyAlsoGsfAngularCleaning");
81  detaCutGsfClean_ = iConfig.getParameter<double>("maxDEtaGsfAngularCleaning");
82  dphiCutGsfClean_ = iConfig.getParameter<double>("maxDPhiBremTangGsfAngularCleaning");
83  useFifthStepForTrackDriven_ = iConfig.getParameter<bool>("useFifthStepForTrackerDrivenGsf");
84  useFifthStepForEcalDriven_ = iConfig.getParameter<bool>("useFifthStepForEcalDrivenGsf");
85  maxPtConvReco_ = iConfig.getParameter<double>("MaxConvBremRecoPT");
86  detaGsfSC_ = iConfig.getParameter<double>("MinDEtaGsfSC");
87  dphiGsfSC_ = iConfig.getParameter<double>("MinDPhiGsfSC");
88  SCEne_ = iConfig.getParameter<double>("MinSCEnergy");
89 
90  // set parameter for convBremFinder
91  useConvBremFinder_ = iConfig.getParameter<bool>("useConvBremFinder");
92 
93  mvaConvBremFinderIDBarrelLowPt_ = iConfig.getParameter<double>("pf_convBremFinderID_mvaCutBarrelLowPt");
94  mvaConvBremFinderIDBarrelHighPt_ = iConfig.getParameter<double>("pf_convBremFinderID_mvaCutBarrelHighPt");
95  mvaConvBremFinderIDEndcapsLowPt_ = iConfig.getParameter<double>("pf_convBremFinderID_mvaCutEndcapsLowPt");
96  mvaConvBremFinderIDEndcapsHighPt_ = iConfig.getParameter<double>("pf_convBremFinderID_mvaCutEndcapsHighPt");
97 
98 }
99 
100 
102 { }
103 
104 
105 //
106 // member functions
107 //
108 
109 // ------------ method called to produce the data ------------
110 void
112 {
113 
114 
115  //create the empty collections
116  auto_ptr< GsfPFRecTrackCollection >
117  gsfPFRecTrackCollection(new GsfPFRecTrackCollection);
118 
119 
120  auto_ptr< GsfPFRecTrackCollection >
121  gsfPFRecTrackCollectionSecondary(new GsfPFRecTrackCollection);
122 
123  //read collections of tracks
124  Handle<GsfTrackCollection> gsftrackscoll;
125  iEvent.getByToken(gsfTrackLabel_,gsftrackscoll);
126 
127  //read collections of trajectories
129 
130  //read pfrectrack collection
131  Handle<PFRecTrackCollection> thePfRecTrackCollection;
132  iEvent.getByToken(pfTrackLabel_,thePfRecTrackCollection);
133  const PFRecTrackCollection& PfRTkColl = *(thePfRecTrackCollection.product());
134 
135  // PFClusters
136  Handle<PFClusterCollection> theECPfClustCollection;
137  iEvent.getByToken(pfEcalClusters_,theECPfClustCollection);
138  const PFClusterCollection& theEcalClusters = *(theECPfClustCollection.product());
139 
140  //Primary Vertexes
141  Handle<reco::VertexCollection> thePrimaryVertexColl;
142  iEvent.getByToken(primVtxLabel_,thePrimaryVertexColl);
143 
144  // Displaced Vertex
146  if( useNuclear_ )
147  iEvent.getByToken(pfNuclear_, pfNuclears);
148 
149  // Conversions
151  if( useConversions_ )
152  iEvent.getByToken(pfConv_,pfConversions);
153 
154  // V0
156  if( useV0_ )
157  iEvent.getByToken(pfV0_, pfV0);
158 
159 
160 
161 
162  GsfTrackCollection gsftracks = *(gsftrackscoll.product());
163  vector<Trajectory> tjvec(0);
164  if (trajinev_){
165  iEvent.getByToken(gsfTrackLabel_,TrajectoryCollection);
166 
167  tjvec= *(TrajectoryCollection.product());
168  }
169 
170 
171  vector<reco::GsfPFRecTrack> selGsfPFRecTracks;
172  vector<reco::GsfPFRecTrack> primaryGsfPFRecTracks;
173  std::map<unsigned int, std::vector<reco::GsfPFRecTrack> > GsfPFMap;
174 
175 
176  for (unsigned int igsf=0; igsf<gsftracks.size();igsf++) {
177 
178  GsfTrackRef trackRef(gsftrackscoll, igsf);
179 
180  int kf_ind=FindPfRef(PfRTkColl,gsftracks[igsf],false);
181 
182  if (kf_ind>=0) {
183 
184  PFRecTrackRef kf_ref(thePfRecTrackCollection,
185  kf_ind);
186 
187  // remove fifth step tracks
188  if( useFifthStepForEcalDriven_ == false
189  || useFifthStepForTrackDriven_ == false) {
190 
191  bool isFifthStepTrack = PFTrackAlgoTools::isFifthStep(kf_ref->trackRef()->algo());
192  bool isEcalDriven = true;
193  bool isTrackerDriven = true;
194 
195  if (&(*trackRef->seedRef())==0) {
196  isEcalDriven = false;
197  isTrackerDriven = false;
198  }
199  else {
200  auto const& SeedFromRef= dynamic_cast<ElectronSeed const&>(*(trackRef->extra()->seedRef()) );
201  if(SeedFromRef.caloCluster().isNull())
202  isEcalDriven = false;
203  if(SeedFromRef.ctfTrack().isNull())
204  isTrackerDriven = false;
205  }
206  //note: the same track could be both ecalDriven and trackerDriven
207  if(isFifthStepTrack &&
208  isEcalDriven &&
209  isTrackerDriven == false &&
210  useFifthStepForEcalDriven_ == false) {
211  continue;
212  }
213 
214  if(isFifthStepTrack &&
215  isTrackerDriven &&
216  isEcalDriven == false &&
217  useFifthStepForTrackDriven_ == false) {
218  continue;
219  }
220 
221  if(isFifthStepTrack &&
222  isTrackerDriven &&
223  isEcalDriven &&
224  useFifthStepForTrackDriven_ == false &&
225  useFifthStepForEcalDriven_ == false) {
226  continue;
227  }
228  }
229 
230  pftrack_=GsfPFRecTrack( gsftracks[igsf].charge(),
232  igsf, trackRef,
233  kf_ref);
234  } else {
235  PFRecTrackRef dummyRef;
236  pftrack_=GsfPFRecTrack( gsftracks[igsf].charge(),
238  igsf, trackRef,
239  dummyRef);
240  }
241 
242 
243  bool validgsfbrem = false;
244  if(trajinev_) {
245  validgsfbrem = pfTransformer_->addPointsAndBrems(pftrack_,
246  gsftracks[igsf],
247  tjvec[igsf],
248  modemomentum_);
249  } else {
250  validgsfbrem = pfTransformer_->addPointsAndBrems(pftrack_,
251  gsftracks[igsf],
252  mtsTransform_);
253  }
254 
255  bool passSel = true;
256  if(applySel_)
257  passSel = applySelection(gsftracks[igsf]);
258 
259  if(validgsfbrem && passSel)
260  selGsfPFRecTracks.push_back(pftrack_);
261  }
262 
263 
264  unsigned int count_primary = 0;
265  if(selGsfPFRecTracks.size() > 0) {
266  for(unsigned int ipfgsf=0; ipfgsf<selGsfPFRecTracks.size();ipfgsf++) {
267 
268  vector<unsigned int> secondaries(0);
269  secondaries.clear();
270  bool keepGsf = true;
271 
272  if(applyGsfClean_) {
273  keepGsf = resolveGsfTracks(selGsfPFRecTracks,ipfgsf,secondaries,theEcalClusters);
274  }
275 
276  //is primary?
277  if(keepGsf == true) {
278 
279  // Find kf tracks from converted brem photons
280  if(convBremFinder_->foundConvBremPFRecTrack(thePfRecTrackCollection,thePrimaryVertexColl,
281  pfNuclears,pfConversions,pfV0,
282  globalCache(),
284  theEcalClusters,selGsfPFRecTracks[ipfgsf])) {
285  const vector<PFRecTrackRef>& convBremPFRecTracks(convBremFinder_->getConvBremPFRecTracks());
286  for(unsigned int ii = 0; ii<convBremPFRecTracks.size(); ii++) {
287  selGsfPFRecTracks[ipfgsf].addConvBremPFRecTrackRef(convBremPFRecTracks[ii]);
288  }
289  }
290 
291  // save primaries gsf tracks
292  // gsfPFRecTrackCollection->push_back(selGsfPFRecTracks[ipfgsf]);
293  primaryGsfPFRecTracks.push_back(selGsfPFRecTracks[ipfgsf]);
294 
295 
296  // NOTE:: THE TRACKID IS USED TO LINK THE PRIMARY GSF TRACK. THIS NEEDS
297  // TO BE CHANGED AS SOON AS IT IS POSSIBLE TO CHANGE DATAFORMATS
298  // A MODIFICATION HERE IMPLIES A MODIFICATION IN PFBLOCKALGO.CC/H
299  unsigned int primGsfIndex = selGsfPFRecTracks[ipfgsf].trackId();
300  vector<reco::GsfPFRecTrack> trueGsfPFRecTracks;
301  if(secondaries.size() > 0) {
302  // loop on secondaries gsf tracks (from converted brems)
303  for(unsigned int isecpfgsf=0; isecpfgsf<secondaries.size();isecpfgsf++) {
304 
305  PFRecTrackRef refsecKF = selGsfPFRecTracks[(secondaries[isecpfgsf])].kfPFRecTrackRef();
306 
307  unsigned int secGsfIndex = selGsfPFRecTracks[(secondaries[isecpfgsf])].trackId();
308  GsfTrackRef secGsfRef = selGsfPFRecTracks[(secondaries[isecpfgsf])].gsfTrackRef();
309 
310  if(refsecKF.isNonnull()) {
311  // NOTE::IT SAVED THE TRACKID OF THE PRIMARY!!! THIS IS USED IN PFBLOCKALGO.CC/H
312  secpftrack_= GsfPFRecTrack( gsftracks[secGsfIndex].charge(),
314  primGsfIndex, secGsfRef,
315  refsecKF);
316  }
317  else{
318  PFRecTrackRef dummyRef;
319  // NOTE::IT SAVED THE TRACKID OF THE PRIMARY!!! THIS IS USED IN PFBLOCKALGO.CC/H
320  secpftrack_= GsfPFRecTrack( gsftracks[secGsfIndex].charge(),
322  primGsfIndex, secGsfRef,
323  dummyRef);
324  }
325 
326  bool validgsfbrem = false;
327  if(trajinev_) {
328  validgsfbrem = pfTransformer_->addPointsAndBrems(secpftrack_,
329  gsftracks[secGsfIndex],
330  tjvec[secGsfIndex],
331  modemomentum_);
332  } else {
333  validgsfbrem = pfTransformer_->addPointsAndBrems(secpftrack_,
334  gsftracks[secGsfIndex],
335  mtsTransform_);
336  }
337 
338  if(validgsfbrem) {
339  gsfPFRecTrackCollectionSecondary->push_back(secpftrack_);
340  trueGsfPFRecTracks.push_back(secpftrack_);
341  }
342  }
343  }
344  GsfPFMap.insert(pair<unsigned int,std::vector<reco::GsfPFRecTrack> >(count_primary,trueGsfPFRecTracks));
345  trueGsfPFRecTracks.clear();
346  count_primary++;
347  }
348  }
349  }
350 
351 
352  const edm::OrphanHandle<GsfPFRecTrackCollection> gsfPfRefProd =
353  iEvent.put(gsfPFRecTrackCollectionSecondary,"Secondary");
354 
355 
356  //now the secondary GsfPFRecTracks are in the event, the Ref can be created
357  createGsfPFRecTrackRef(gsfPfRefProd,primaryGsfPFRecTracks,GsfPFMap);
358 
359  for(unsigned int iGSF = 0; iGSF<primaryGsfPFRecTracks.size();iGSF++){
360  gsfPFRecTrackCollection->push_back(primaryGsfPFRecTracks[iGSF]);
361  }
362  iEvent.put(gsfPFRecTrackCollection);
363 
364  selGsfPFRecTracks.clear();
365  GsfPFMap.clear();
366  primaryGsfPFRecTracks.clear();
367 }
368 
369 // create the secondary GsfPFRecTracks Ref
370 void
372  std::vector<reco::GsfPFRecTrack>& gsfPFRecTrackPrimary,
373  const std::map<unsigned int, std::vector<reco::GsfPFRecTrack> >& MapPrimSec) {
374  unsigned int cgsf=0;
375  unsigned int csecgsf=0;
376  for (std::map<unsigned int, std::vector<reco::GsfPFRecTrack> >::const_iterator igsf = MapPrimSec.begin();
377  igsf != MapPrimSec.end(); igsf++,cgsf++) {
378  vector<reco::GsfPFRecTrack> SecGsfPF = igsf->second;
379  for (unsigned int iSecGsf=0; iSecGsf < SecGsfPF.size(); iSecGsf++) {
380  edm::Ref<reco::GsfPFRecTrackCollection> refgprt(gsfPfHandle,csecgsf);
381  gsfPFRecTrackPrimary[cgsf].addConvBremGsfPFRecTrackRef(refgprt);
382  ++csecgsf;
383  }
384  }
385 
386  return;
387 }
388 // ------------- method for find the corresponding kf pfrectrack ---------------------
389 int
391  const reco::GsfTrack& gsftk,
392  bool otherColl){
393 
394 
395  if (&(*gsftk.seedRef())==0) return -1;
396  auto const & ElSeedFromRef=dynamic_cast<ElectronSeed const&>( *(gsftk.extra()->seedRef()) );
397  //CASE 1 ELECTRONSEED DOES NOT HAVE A REF TO THE CKFTRACK
398  if (ElSeedFromRef.ctfTrack().isNull()){
399  reco::PFRecTrackCollection::const_iterator pft=PfRTkColl.begin();
400  reco::PFRecTrackCollection::const_iterator pftend=PfRTkColl.end();
401  unsigned int i_pf=0;
402  int ibest=-1;
403  unsigned int ish_max=0;
404  float dr_min=1000;
405  //SEARCH THE PFRECTRACK THAT SHARES HITS WITH THE ELECTRON SEED
406  // Here the cpu time can be improved.
407  for(;pft!=pftend;++pft){
408  unsigned int ish=0;
409 
410  float dph= fabs(pft->trackRef()->phi()-gsftk.phi());
411  if (dph>TMath::Pi()) dph-= TMath::TwoPi();
412  float det=fabs(pft->trackRef()->eta()-gsftk.eta());
413  float dr =sqrt(dph*dph+det*det);
414 
416  pft->trackRef()->recHitsBegin();
417  trackingRecHit_iterator hhit_end=
418  pft->trackRef()->recHitsEnd();
419 
420 
421 
422  for(;hhit!=hhit_end;++hhit){
423  if (!(*hhit)->isValid()) continue;
425  gsftk.seedRef()->recHits().first;
427  gsftk.seedRef()->recHits().second;
428  for(;hit!=hit_end;++hit){
429  if (!(hit->isValid())) continue;
430  if((*hhit)->sharesInput(&*(hit),TrackingRecHit::all)) ish++;
431  // if((hit->geographicalId()==(*hhit)->geographicalId())&&
432  // (((*hhit)->localPosition()-hit->localPosition()).mag()<0.01)) ish++;
433  }
434 
435  }
436 
437 
438  if ((ish>ish_max)||
439  ((ish==ish_max)&&(dr<dr_min))){
440  ish_max=ish;
441  dr_min=dr;
442  ibest=i_pf;
443  }
444 
445 
446 
447  i_pf++;
448  }
449  if (ibest<0) return -1;
450 
451  if((ish_max==0) || (dr_min>0.05))return -1;
452  if(otherColl && (ish_max==0)) return -1;
453  return ibest;
454  }
455  else{
456  //ELECTRON SEED HAS A REFERENCE
457 
458  reco::PFRecTrackCollection::const_iterator pft=PfRTkColl.begin();
459  reco::PFRecTrackCollection::const_iterator pftend=PfRTkColl.end();
460  unsigned int i_pf=0;
461 
462  for(;pft!=pftend;++pft){
463  //REF COMPARISON
464  if (pft->trackRef()==ElSeedFromRef.ctfTrack()){
465  return i_pf;
466  }
467  i_pf++;
468  }
469  }
470  return -1;
471 }
472 
473 // -- method to apply gsf electron selection to EcalDriven seeds
474 bool
476  if (&(*gsftk.seedRef())==0) return false;
477  auto const& ElSeedFromRef=dynamic_cast<ElectronSeed const&>( *(gsftk.extra()->seedRef()) );
478 
479  bool passCut = false;
480  if (ElSeedFromRef.ctfTrack().isNull()){
481  if(ElSeedFromRef.caloCluster().isNull()) return passCut;
482  auto const* scRef = dynamic_cast<SuperCluster const*>(ElSeedFromRef.caloCluster().get());
483  //do this just to know if exist a SC?
484  if(scRef) {
485  float caloEne = scRef->energy();
486  float feta = fabs(scRef->eta()-gsftk.etaMode());
487  float fphi = fabs(scRef->phi()-gsftk.phiMode());
488  if (fphi>TMath::Pi()) fphi-= TMath::TwoPi();
489  if(caloEne > SCEne_ && feta < detaGsfSC_ && fabs(fphi) < dphiGsfSC_)
490  passCut = true;
491  }
492  }
493  else {
494  // get all the gsf found by tracker driven
495  passCut = true;
496  }
497  return passCut;
498 }
499 bool
500 PFElecTkProducer::resolveGsfTracks(const vector<reco::GsfPFRecTrack> & GsfPFVec,
501  unsigned int ngsf,
502  vector<unsigned int> &secondaries,
503  const reco::PFClusterCollection & theEClus) {
504  bool debugCleaning = debugGsfCleaning_;
505  bool n_keepGsf = true;
506 
507  reco::GsfTrackRef nGsfTrack = GsfPFVec[ngsf].gsfTrackRef();
508 
509  if (&(*nGsfTrack->seedRef())==0) return false;
510  auto const& nElSeedFromRef=dynamic_cast<ElectronSeed const&>( *(nGsfTrack->extra()->seedRef()) );
511 
512 
514  GlobalVector ninnMom;
515  float nPin = nGsfTrack->pMode();
516  if(inTSOS.isValid()){
517  mtsMode_->momentumFromModeCartesian(inTSOS,ninnMom);
518  nPin = ninnMom.mag();
519  }
520 
521  float neta = nGsfTrack->innerMomentum().eta();
522  float nphi = nGsfTrack->innerMomentum().phi();
523 
524 
525 
526 
527  if(debugCleaning)
528  cout << " PFElecTkProducer:: considering track " << nGsfTrack->pt()
529  << " eta,phi " << nGsfTrack->eta() << ", " << nGsfTrack->phi() << endl;
530 
531 
532  for (unsigned int igsf=0; igsf< GsfPFVec.size();igsf++) {
533  if(igsf != ngsf ) {
534  reco::GsfTrackRef iGsfTrack = GsfPFVec[igsf].gsfTrackRef();
535 
536  if(debugCleaning)
537  cout << " PFElecTkProducer:: and comparing with track " << iGsfTrack->pt()
538  << " eta,phi " << iGsfTrack->eta() << ", " << iGsfTrack->phi() << endl;
539 
540  float ieta = iGsfTrack->innerMomentum().eta();
541  float iphi = iGsfTrack->innerMomentum().phi();
542  float feta = fabs(neta - ieta);
543  float fphi = fabs(nphi - iphi);
544  if (fphi>TMath::Pi()) fphi-= TMath::TwoPi();
545 
546 
547  // apply a superloose preselection only to avoid un-useful cpu time: hard-coded for this reason
548  if(feta < 0.5 && fabs(fphi) < 1.0) {
549  if(debugCleaning)
550  cout << " Entering angular superloose preselection " << endl;
551 
553  GlobalVector i_innMom;
554  float iPin = iGsfTrack->pMode();
555  if(i_inTSOS.isValid()){
556  mtsMode_->momentumFromModeCartesian(i_inTSOS,i_innMom);
557  iPin = i_innMom.mag();
558  }
559 
560  if (&(*iGsfTrack->seedRef())==0) continue;
561  auto const& iElSeedFromRef=dynamic_cast<ElectronSeed const&>( *(iGsfTrack->extra()->seedRef()) );
562 
563  float SCEnergy = -1.;
564  // Check if two tracks match the same SC
565  bool areBothGsfEcalDriven = false;;
566  bool isSameSC = isSameEgSC(nElSeedFromRef,iElSeedFromRef,areBothGsfEcalDriven,SCEnergy);
567 
568  // CASE1 both GsfTracks ecalDriven and match the same SC
569  if(areBothGsfEcalDriven ) {
570  if(isSameSC) {
571  float nEP = SCEnergy/nPin;
572  float iEP = SCEnergy/iPin;
573  if(debugCleaning)
574  cout << " Entering SAME supercluster case "
575  << " nEP " << nEP
576  << " iEP " << iEP << endl;
577 
578 
579 
580  // if same SC take the closest or if same
581  // distance the best E/p
582 
583  // Innermost using LostHits technology
584  bool isSameLayer = false;
585  bool iGsfInnermostWithLostHits =
586  isInnerMostWithLostHits(nGsfTrack,iGsfTrack,isSameLayer);
587 
588 
589  if(debugCleaning)
590  cout << " iGsf is InnerMostWithLostHits " << iGsfInnermostWithLostHits
591  << " isSameLayer " << isSameLayer << endl;
592 
593  if (iGsfInnermostWithLostHits) {
594  n_keepGsf = false;
595  return n_keepGsf;
596  }
597  else if(isSameLayer){
598  if(fabs(iEP-1) < fabs(nEP-1)) {
599  n_keepGsf = false;
600  return n_keepGsf;
601  }
602  else{
603  secondaries.push_back(igsf);
604  }
605  }
606  else {
607  // save secondaries gsf track (put selection)
608  secondaries.push_back(igsf);
609  }
610  } // end same SC case
611  }
612  else {
613  // enter in the condition where at least one track is trackerDriven
614  float minBremDphi = minTangDist(GsfPFVec[ngsf],GsfPFVec[igsf]);
615  float nETot = 0.;
616  float iETot = 0.;
617  bool isBothGsfTrackerDriven = false;
618  bool nEcalDriven = false;
619  bool iEcalDriven = false;
620  bool isSameScEgPf = isSharingEcalEnergyWithEgSC(GsfPFVec[ngsf],
621  GsfPFVec[igsf],
622  nElSeedFromRef,
623  iElSeedFromRef,
624  theEClus,
625  isBothGsfTrackerDriven,
626  nEcalDriven,
627  iEcalDriven,
628  nETot,
629  iETot);
630 
631  // check if the first hit of iGsfTrack < nGsfTrack
632  bool isSameLayer = false;
633  bool iGsfInnermostWithLostHits =
634  isInnerMostWithLostHits(nGsfTrack,iGsfTrack,isSameLayer);
635 
636  if(isSameScEgPf) {
637  // CASE 2 : One Gsf has reference to a SC and the other one not or both not
638 
639  if(debugCleaning) {
640  cout << " Sharing ECAL energy passed "
641  << " nEtot " << nETot
642  << " iEtot " << iETot << endl;
643  if(isBothGsfTrackerDriven)
644  cout << " Both Track are trackerDriven " << endl;
645  }
646 
647  // Innermost using LostHits technology
648  if (iGsfInnermostWithLostHits) {
649  n_keepGsf = false;
650  return n_keepGsf;
651  }
652  else if(isSameLayer){
653  // Thirt Case: One Gsf has reference to a SC and the other one not or both not
654  // gsf tracks starts from the same layer
655  // check number of sharing modules (at least 50%)
656  // check number of sharing hits (at least 2)
657  // check charge flip inner/outer
658 
659 
660  // they share energy
661  if(isBothGsfTrackerDriven == false) {
662  // if at least one Gsf track is EcalDriven choose that one.
663  if(iEcalDriven) {
664  n_keepGsf = false;
665  return n_keepGsf;
666  }
667  else {
668  secondaries.push_back(igsf);
669  }
670  }
671  else {
672  // if both tracks are tracker driven choose that one with the best E/p
673  // with ETot = max(En,Ei)
674 
675  float ETot = -1;
676  if(nETot != iETot) {
677  if(nETot > iETot)
678  ETot = nETot;
679  else
680  ETot = iETot;
681  }
682  else {
683  ETot = nETot;
684  }
685  float nEP = ETot/nPin;
686  float iEP = ETot/iPin;
687 
688 
689  if(debugCleaning)
690  cout << " nETot " << nETot
691  << " iETot " << iETot
692  << " ETot " << ETot << endl
693  << " nPin " << nPin
694  << " iPin " << iPin
695  << " nEP " << nEP
696  << " iEP " << iEP << endl;
697 
698 
699  if(fabs(iEP-1) < fabs(nEP-1)) {
700  n_keepGsf = false;
701  return n_keepGsf;
702  }
703  else{
704  secondaries.push_back(igsf);
705  }
706  }
707  }
708  else {
709  secondaries.push_back(igsf);
710  }
711  }
712  else if(feta < detaCutGsfClean_ && minBremDphi < dphiCutGsfClean_) {
713  // very close tracks
714  bool secPushedBack = false;
715  if(nEcalDriven == false && nETot == 0.) {
716  n_keepGsf = false;
717  return n_keepGsf;
718  }
719  else if(iEcalDriven == false && iETot == 0.) {
720  secondaries.push_back(igsf);
721  secPushedBack = true;
722  }
723  if(debugCleaning)
724  cout << " Close Tracks "
725  << " feta " << feta << " fabs(fphi) " << fabs(fphi)
726  << " minBremDphi " << minBremDphi
727  << " nETot " << nETot
728  << " iETot " << iETot
729  << " nLostHits " << nGsfTrack->hitPattern().numberOfLostHits(HitPattern::MISSING_INNER_HITS)
730  << " iLostHits " << iGsfTrack->hitPattern().numberOfLostHits(HitPattern::MISSING_INNER_HITS) << endl;
731 
732  // apply selection only if one track has lost hits
734  if (iGsfInnermostWithLostHits) {
735  n_keepGsf = false;
736  return n_keepGsf;
737  }
738  else if(isSameLayer == false) {
739  if(secPushedBack == false)
740  secondaries.push_back(igsf);
741  }
742  }
743  }
744  else if(feta < 0.1 && minBremDphi < 0.2){
745  // failed all the conditions, discard only tracker driven tracks
746  // with no PFClusters linked.
747  if(debugCleaning)
748  cout << " Close Tracks and failed all the conditions "
749  << " feta " << feta << " fabs(fphi) " << fabs(fphi)
750  << " minBremDphi " << minBremDphi
751  << " nETot " << nETot
752  << " iETot " << iETot
753  << " nLostHits " << nGsfTrack->hitPattern().numberOfLostHits(HitPattern::MISSING_INNER_HITS)
754  << " iLostHits " << iGsfTrack->hitPattern().numberOfLostHits(HitPattern::MISSING_INNER_HITS) << endl;
755 
756  if(nEcalDriven == false && nETot == 0.) {
757  n_keepGsf = false;
758  return n_keepGsf;
759  }
760  // Here I do not push back the secondary because considered fakes...
761  }
762  }
763  }
764  }
765  }
766 
767  return n_keepGsf;
768 }
769 float
771  const reco::GsfPFRecTrack& secGsf) {
772 
773  float minDphi = 1000.;
774 
775 
776  std::vector<reco::PFBrem> primPFBrem = primGsf.PFRecBrem();
777  std::vector<reco::PFBrem> secPFBrem = secGsf.PFRecBrem();
778 
779 
780  unsigned int cbrem = 0;
781  for (unsigned isbrem = 0; isbrem < secPFBrem.size(); isbrem++) {
782  if(secPFBrem[isbrem].indTrajPoint() == 99) continue;
783  const reco::PFTrajectoryPoint& atSecECAL
784  = secPFBrem[isbrem].extrapolatedPoint( reco::PFTrajectoryPoint::ECALEntrance );
785  if( ! atSecECAL.isValid() ) continue;
786  float secPhi = atSecECAL.positionREP().Phi();
787 
788  unsigned int sbrem = 0;
789  for(unsigned ipbrem = 0; ipbrem < primPFBrem.size(); ipbrem++) {
790  if(primPFBrem[ipbrem].indTrajPoint() == 99) continue;
791  const reco::PFTrajectoryPoint& atPrimECAL
792  = primPFBrem[ipbrem].extrapolatedPoint( reco::PFTrajectoryPoint::ECALEntrance );
793  if( ! atPrimECAL.isValid() ) continue;
794  sbrem++;
795  if(sbrem <= 3) {
796  float primPhi = atPrimECAL.positionREP().Phi();
797 
798  float dphi = fabs(primPhi - secPhi);
799  if (dphi>TMath::Pi()) dphi-= TMath::TwoPi();
800  if(fabs(dphi) < minDphi) {
801  minDphi = fabs(dphi);
802  }
803  }
804  }
805 
806 
807  cbrem++;
808  if(cbrem == 3)
809  break;
810  }
811  return minDphi;
812 }
813 bool
815  const reco::ElectronSeed& iSeed,
816  bool& bothGsfEcalDriven,
817  float& SCEnergy) {
818 
819  bool isSameSC = false;
820 
821  if(nSeed.caloCluster().isNonnull() && iSeed.caloCluster().isNonnull()) {
822  auto const* nscRef = dynamic_cast<SuperCluster const*>(nSeed.caloCluster().get());
823  auto const* iscRef = dynamic_cast<SuperCluster const*>(iSeed.caloCluster().get());
824 
825  if(nscRef && iscRef) {
826  bothGsfEcalDriven = true;
827  if(nscRef == iscRef) {
828  isSameSC = true;
829  // retrieve the supercluster energy
830  SCEnergy = nscRef->energy();
831  }
832  }
833  }
834  return isSameSC;
835 }
836 bool
838  const reco::GsfPFRecTrack& iGsfPFRecTrack,
839  const reco::ElectronSeed& nSeed,
840  const reco::ElectronSeed& iSeed,
841  const reco::PFClusterCollection& theEClus,
842  bool& bothGsfTrackerDriven,
843  bool& nEcalDriven,
844  bool& iEcalDriven,
845  float& nEnergy,
846  float& iEnergy) {
847 
848  bool isSharingEnergy = false;
849 
850  //which is EcalDriven?
851  bool oneEcalDriven = true;
852  SuperCluster const* scRef = nullptr;
853  GsfPFRecTrack gsfPfTrack;
854 
855  if(nSeed.caloCluster().isNonnull()) {
856  scRef = dynamic_cast<SuperCluster const*>(nSeed.caloCluster().get());
857  assert(scRef);
858  nEnergy = scRef->energy();
859  nEcalDriven = true;
860  gsfPfTrack = iGsfPFRecTrack;
861  }
862  else if(iSeed.caloCluster().isNonnull()){
863  scRef = dynamic_cast<SuperCluster const*>(iSeed.caloCluster().get());
864  assert(scRef);
865  iEnergy = scRef->energy();
866  iEcalDriven = true;
867  gsfPfTrack = nGsfPFRecTrack;
868  }
869  else{
870  oneEcalDriven = false;
871  }
872 
873  if(oneEcalDriven) {
874  //run a basic reconstruction for the particle flow
875 
876  vector<PFCluster> vecPFClusters;
877  vecPFClusters.clear();
878 
879  for (PFClusterCollection::const_iterator clus = theEClus.begin();
880  clus != theEClus.end();
881  clus++ ) {
882  PFCluster clust = *clus;
883  clust.calculatePositionREP();
884 
885  float deta = fabs(scRef->position().eta() - clust.position().eta());
886  float dphi = fabs(scRef->position().phi() - clust.position().phi());
887  if (dphi>TMath::Pi()) dphi-= TMath::TwoPi();
888 
889  // Angle preselection between the supercluster and pfclusters
890  // this is needed just to save some cpu-time for this is hard-coded
891  if(deta < 0.5 && fabs(dphi) < 1.0) {
892  bool foundLink = false;
893  double distGsf = gsfPfTrack.extrapolatedPoint( reco::PFTrajectoryPoint::ECALShowerMax ).isValid() ?
894  LinkByRecHit::testTrackAndClusterByRecHit(gsfPfTrack , clust ) : -1.;
895  // check if it touch the GsfTrack
896  if(distGsf > 0.) {
897  if(nEcalDriven)
898  iEnergy += clust.energy();
899  else
900  nEnergy += clust.energy();
901  vecPFClusters.push_back(clust);
902  foundLink = true;
903  }
904  // check if it touch the Brem-tangents
905  if(foundLink == false) {
906  vector<PFBrem> primPFBrem = gsfPfTrack.PFRecBrem();
907  for(unsigned ipbrem = 0; ipbrem < primPFBrem.size(); ipbrem++) {
908  if(primPFBrem[ipbrem].indTrajPoint() == 99) continue;
909  const reco::PFRecTrack& pfBremTrack = primPFBrem[ipbrem];
910  double dist = pfBremTrack.extrapolatedPoint( reco::PFTrajectoryPoint::ECALShowerMax ).isValid() ?
911  LinkByRecHit::testTrackAndClusterByRecHit(pfBremTrack , clust, true ) : -1.;
912  if(dist > 0.) {
913  if(nEcalDriven)
914  iEnergy += clust.energy();
915  else
916  nEnergy += clust.energy();
917  vecPFClusters.push_back(clust);
918  foundLink = true;
919  }
920  }
921  }
922  } // END if anble preselection
923  } // PFClusters Loop
924  if(vecPFClusters.size() > 0 ) {
925  for(unsigned int pf = 0; pf < vecPFClusters.size(); pf++) {
926  bool isCommon = ClusterClusterMapping::overlap(vecPFClusters[pf],*scRef);
927  if(isCommon) {
928  isSharingEnergy = true;
929  }
930  break;
931  }
932  }
933  }
934  else {
935  // both tracks are trackerDriven, try ECAL energy matching also in this case.
936 
937  bothGsfTrackerDriven = true;
938  vector<PFCluster> nPFCluster;
939  vector<PFCluster> iPFCluster;
940 
941  nPFCluster.clear();
942  iPFCluster.clear();
943 
944  for (PFClusterCollection::const_iterator clus = theEClus.begin();
945  clus != theEClus.end();
946  clus++ ) {
947  PFCluster clust = *clus;
948  clust.calculatePositionREP();
949 
950  float ndeta = fabs(nGsfPFRecTrack.gsfTrackRef()->eta() - clust.position().eta());
951  float ndphi = fabs(nGsfPFRecTrack.gsfTrackRef()->phi() - clust.position().phi());
952  if (ndphi>TMath::Pi()) ndphi-= TMath::TwoPi();
953  // Apply loose preselection with the track
954  // just to save cpu time, for this hard-coded
955  if(ndeta < 0.5 && fabs(ndphi) < 1.0) {
956  bool foundNLink = false;
957 
958  double distGsf = nGsfPFRecTrack.extrapolatedPoint( reco::PFTrajectoryPoint::ECALShowerMax ).isValid() ?
959  LinkByRecHit::testTrackAndClusterByRecHit(nGsfPFRecTrack , clust ) : -1.;
960  if(distGsf > 0.) {
961  nPFCluster.push_back(clust);
962  nEnergy += clust.energy();
963  foundNLink = true;
964  }
965  if(foundNLink == false) {
966  const vector<PFBrem>& primPFBrem = nGsfPFRecTrack.PFRecBrem();
967  for(unsigned ipbrem = 0; ipbrem < primPFBrem.size(); ipbrem++) {
968  if(primPFBrem[ipbrem].indTrajPoint() == 99) continue;
969  const reco::PFRecTrack& pfBremTrack = primPFBrem[ipbrem];
970  if(foundNLink == false) {
971  double dist = pfBremTrack.extrapolatedPoint( reco::PFTrajectoryPoint::ECALShowerMax ).isValid() ?
972  LinkByRecHit::testTrackAndClusterByRecHit(pfBremTrack , clust, true ) : -1.;
973  if(dist > 0.) {
974  nPFCluster.push_back(clust);
975  nEnergy += clust.energy();
976  foundNLink = true;
977  }
978  }
979  }
980  }
981  }
982 
983  float ideta = fabs(iGsfPFRecTrack.gsfTrackRef()->eta() - clust.position().eta());
984  float idphi = fabs(iGsfPFRecTrack.gsfTrackRef()->phi() - clust.position().phi());
985  if (idphi>TMath::Pi()) idphi-= TMath::TwoPi();
986  // Apply loose preselection with the track
987  // just to save cpu time, for this hard-coded
988  if(ideta < 0.5 && fabs(idphi) < 1.0) {
989  bool foundILink = false;
990  double dist = iGsfPFRecTrack.extrapolatedPoint( reco::PFTrajectoryPoint::ECALShowerMax ).isValid() ?
991  LinkByRecHit::testTrackAndClusterByRecHit(iGsfPFRecTrack , clust ) : -1.;
992  if(dist > 0.) {
993  iPFCluster.push_back(clust);
994  iEnergy += clust.energy();
995  foundILink = true;
996  }
997  if(foundILink == false) {
998  vector<PFBrem> primPFBrem = iGsfPFRecTrack.PFRecBrem();
999  for(unsigned ipbrem = 0; ipbrem < primPFBrem.size(); ipbrem++) {
1000  if(primPFBrem[ipbrem].indTrajPoint() == 99) continue;
1001  const reco::PFRecTrack& pfBremTrack = primPFBrem[ipbrem];
1002  if(foundILink == false) {
1003  double dist = LinkByRecHit::testTrackAndClusterByRecHit(pfBremTrack , clust, true );
1004  if(dist > 0.) {
1005  iPFCluster.push_back(clust);
1006  iEnergy += clust.energy();
1007  foundILink = true;
1008  }
1009  }
1010  }
1011  }
1012  }
1013  }
1014 
1015 
1016  if(nPFCluster.size() > 0 && iPFCluster.size() > 0) {
1017  for(unsigned int npf = 0; npf < nPFCluster.size(); npf++) {
1018  for(unsigned int ipf = 0; ipf < iPFCluster.size(); ipf++) {
1019  bool isCommon = ClusterClusterMapping::overlap(nPFCluster[npf],iPFCluster[ipf]);
1020  if(isCommon) {
1021  isSharingEnergy = true;
1022  break;
1023  }
1024  }
1025  if(isSharingEnergy)
1026  break;
1027  }
1028  }
1029  }
1030 
1031  return isSharingEnergy;
1032 }
1034  const reco::GsfTrackRef& iGsfTrack,
1035  bool& sameLayer) {
1036 
1037  // copied by the class RecoEgamma/EgammaElectronAlgos/src/EgAmbiguityTools.cc
1038  // obsolete but the code is kept: now using lost hits method
1039 
1040  const reco::HitPattern &gsfHitPattern1 = nGsfTrack->hitPattern();
1041  const reco::HitPattern &gsfHitPattern2 = iGsfTrack->hitPattern();
1042 
1043  // retrieve first valid hit
1044  int gsfHitCounter1 = 0 ;
1045  trackingRecHit_iterator elHitsIt1 ;
1046  for
1047  ( elHitsIt1 = nGsfTrack->recHitsBegin() ;
1048  elHitsIt1 != nGsfTrack->recHitsEnd() ;
1049  elHitsIt1++, gsfHitCounter1++ )
1050  { if (((**elHitsIt1).isValid())) break ; }
1051 
1052  int gsfHitCounter2 = 0 ;
1053  trackingRecHit_iterator elHitsIt2 ;
1054  for
1055  ( elHitsIt2 = iGsfTrack->recHitsBegin() ;
1056  elHitsIt2 != iGsfTrack->recHitsEnd() ;
1057  elHitsIt2++, gsfHitCounter2++ )
1058  { if (((**elHitsIt2).isValid())) break ; }
1059 
1060  uint32_t gsfHit1 = gsfHitPattern1.getHitPattern(HitPattern::TRACK_HITS, gsfHitCounter1) ;
1061  uint32_t gsfHit2 = gsfHitPattern2.getHitPattern(HitPattern::TRACK_HITS, gsfHitCounter2) ;
1062 
1063 
1064  if (gsfHitPattern1.getSubStructure(gsfHit1)!=gsfHitPattern2.getSubStructure(gsfHit2))
1065  {
1066  return (gsfHitPattern2.getSubStructure(gsfHit2)<gsfHitPattern1.getSubStructure(gsfHit1));
1067  }
1068  else if (gsfHitPattern1.getLayer(gsfHit1)!=gsfHitPattern2.getLayer(gsfHit2))
1069  {
1070  return (gsfHitPattern2.getLayer(gsfHit2)<gsfHitPattern1.getLayer(gsfHit1));
1071  }
1072  else
1073  {
1074  sameLayer = true;
1075  return false;
1076  }
1077 }
1079  const reco::GsfTrackRef& iGsfTrack,
1080  bool& sameLayer) {
1081 
1082  // define closest using the lost hits on the expectedhitsineer
1083  unsigned int nLostHits = nGsfTrack->hitPattern().numberOfLostHits(HitPattern::MISSING_INNER_HITS);
1084  unsigned int iLostHits = iGsfTrack->hitPattern().numberOfLostHits(HitPattern::MISSING_INNER_HITS);
1085 
1086  if (nLostHits!=iLostHits) {
1087  return (nLostHits > iLostHits);
1088  }
1089  else {
1090  sameLayer = true;
1091  return false;
1092  }
1093 }
1094 
1095 
1096 
1097 // ------------ method called once each job just before starting event loop ------------
1098 void
1100  const EventSetup& iSetup)
1101 {
1103  iSetup.get<IdealMagneticFieldRecord>().get(magneticField);
1104 
1106  iSetup.get<TrackerDigiGeometryRecord>().get(tracker);
1107 
1108  mtsTransform_ = MultiTrajectoryStateTransform(tracker.product(),magneticField.product());
1109 
1110  pfTransformer_.reset( new PFTrackTransformer(math::XYZVector(magneticField->inTesla(GlobalPoint(0,0,0)))) );
1111 
1113  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", builder);
1114  TransientTrackBuilder thebuilder = *(builder.product());
1115 
1116  convBremFinder_.reset( new ConvBremPFTrackFinder(thebuilder,
1121 
1122 }
1123 
1124 // ------------ method called once each job just after ending the event loop ------------
1125 void
1127  const EventSetup& iSetup) {
1128  pfTransformer_.reset();
1129  convBremFinder_.reset();
1130 }
1131 
1132 //define this as a plug-in
const REPPoint & positionREP() const
trajectory position in (rho, eta, phi) base
bool trajinev_
Trajectory of GSfTracks in the event?
const double TwoPi
const double Pi
value_type const * get() const
Definition: RefToBase.h:234
T getParameter(std::string const &) const
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:126
reconstructed track used as an input to particle flow
Definition: PFRecTrack.h:22
edm::EDGetTokenT< reco::PFRecTrackCollection > pfTrackLabel_
static uint32_t getLayer(uint16_t pattern)
Definition: HitPattern.h:700
static bool overlap(const reco::CaloCluster &sc1, const reco::CaloCluster &sc, float minfrac=0.01, bool debug=false)
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
edm::EDGetTokenT< reco::GsfTrackCollection > gsfTrackLabel_
void createGsfPFRecTrackRef(const edm::OrphanHandle< reco::GsfPFRecTrackCollection > &gsfPfHandle, std::vector< reco::GsfPFRecTrack > &gsfPFRecTrackPrimary, const std::map< unsigned int, std::vector< reco::GsfPFRecTrack > > &MapPrimSec)
tuple pfV0
Definition: pfV0_cfi.py:3
const TrackExtraRef & extra() const
reference to &quot;extra&quot; object
Definition: Track.h:189
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:47
double mvaConvBremFinderIDEndcapsLowPt_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
assert(m_qm.get())
const std::vector< reco::PFBrem > & PFRecBrem() const
Definition: GsfPFRecTrack.h:51
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:640
bool applySelection(const reco::GsfTrack &)
bool isNonnull() const
Checks for non-null.
Definition: RefToBase.h:337
~PFElecTkProducer()
Destructor.
bool momentumFromModeCartesian(const TrajectoryStateOnSurface tsos, GlobalVector &momentum) const
reco::GsfPFRecTrack secpftrack_
int ii
Definition: cuy.py:588
std::unique_ptr< ConvBremPFTrackFinder > convBremFinder_
edm::EDGetTokenT< reco::VertexCollection > primVtxLabel_
const MultiTrajectoryStateMode * mtsMode_
double mvaConvBremFinderIDBarrelLowPt_
CaloClusterRef caloCluster() const
Definition: ElectronSeed.h:70
int iEvent
Definition: GenABIO.cc:230
T mag() const
Definition: PV3DBase.h:67
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:646
std::vector< GsfPFRecTrack > GsfPFRecTrackCollection
collection of GsfPFRecTrack objects
void calculatePositionREP()
computes posrep_ once and for all
Definition: PFCluster.h:96
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
edm::EDGetTokenT< reco::PFV0Collection > pfV0_
const reco::GsfTrackRef & gsfTrackRef() const
Definition: GsfPFRecTrack.h:39
recHitContainer::const_iterator const_iterator
T sqrt(T t)
Definition: SSEVec.h:18
std::vector< GsfTrack > GsfTrackCollection
collection of GsfTracks
Definition: GsfTrackFwd.h:9
double energy() const
cluster energy
Definition: CaloCluster.h:121
edm::EDGetTokenT< reco::PFDisplacedTrackerVertexCollection > pfNuclear_
const reco::PFTrajectoryPoint & extrapolatedPoint(unsigned layerid) const
Definition: PFTrack.cc:76
bool isSameEgSC(const reco::ElectronSeed &nSeed, const reco::ElectronSeed &iSeed, bool &bothGsfEcalDriven, float &SCEnergy)
static uint32_t getSubStructure(uint16_t pattern)
Definition: HitPattern.h:691
double energy() const
cluster energy
Definition: PFCluster.h:82
bool isInnerMostWithLostHits(const reco::GsfTrackRef &nGsfTrack, const reco::GsfTrackRef &iGsfTrack, bool &sameLayer)
PFElecTkProducer(const edm::ParameterSet &, const convbremhelpers::HeavyObjectCache *)
Constructor.
virtual void endRun(const edm::Run &, const edm::EventSetup &) override
int FindPfRef(const reco::PFRecTrackCollection &PfRTkColl, const reco::GsfTrack &, bool)
edm::RefToBase< TrajectorySeed > seedRef() const
Definition: Track.h:213
bool resolveGsfTracks(const std::vector< reco::GsfPFRecTrack > &GsfPFVec, unsigned int ngsf, std::vector< unsigned int > &secondaries, const reco::PFClusterCollection &theEClus)
bool isValid() const
is this point valid ?
T const * product() const
Definition: Handle.h:81
bool isFifthStep(const reco::TrackBase::TrackAlgorithm &)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
range recHits() const
string const
Definition: compareJSON.py:14
double mvaConvBremFinderIDBarrelHighPt_
double mvaConvBremFinderIDEndcapsHighPt_
edm::EDGetTokenT< reco::PFConversionCollection > pfConv_
std::vector< Trajectory > TrajectoryCollection
TrajectoryStateOnSurface innerStateOnSurface(const reco::GsfTrack &tk) const
virtual void beginRun(const edm::Run &, const edm::EventSetup &) override
double etaMode() const
pseudorapidity of momentum vector from mode
Definition: GsfTrack.h:59
reco::GsfPFRecTrack pftrack_
virtual void produce(edm::Event &, const edm::EventSetup &) override
Produce the PFRecTrack collection.
double phiMode() const
azimuthal angle of momentum vector from mode
Definition: GsfTrack.h:57
bool useConvBremFinder_
Conv Brem Finder.
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
Definition: PFClusterFwd.h:9
tuple cout
Definition: gather_cfg.py:145
A PFTrack holds several trajectory points, which basically contain the position and momentum of a tra...
std::unique_ptr< PFTrackTransformer > pfTransformer_
PFTrackTransformer.
uint16_t getHitPattern(HitCategory category, int position) const
Definition: HitPattern.h:515
static double testTrackAndClusterByRecHit(const reco::PFRecTrack &track, const reco::PFCluster &cluster, bool isBrem=false, bool debug=false)
Definition: LinkByRecHit.cc:18
float minTangDist(const reco::GsfPFRecTrack &primGsf, const reco::GsfPFRecTrack &secGsf)
std::vector< PFRecTrack > PFRecTrackCollection
collection of PFRecTrack objects
Definition: PFRecTrackFwd.h:9
edm::EDGetTokenT< reco::PFClusterCollection > pfEcalClusters_
bool isSharingEcalEnergyWithEgSC(const reco::GsfPFRecTrack &nGsfPFRecTrack, const reco::GsfPFRecTrack &iGsfPFRecTrack, const reco::ElectronSeed &nSeed, const reco::ElectronSeed &iSeed, const reco::PFClusterCollection &theEClus, bool &bothGsfTrackerDriven, bool &nEcalDriven, bool &iEcalDriven, float &nEnergy, float &iEnergy)
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
Definition: Run.h:43
MultiTrajectoryStateTransform mtsTransform_
bool isInnerMost(const reco::GsfTrackRef &nGsfTrack, const reco::GsfTrackRef &iGsfTrack, bool &sameLayer)