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