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  Algo = 0;
527  break;
528  case TrackBase::iter2:
529  Algo = 1;
530  break;
531  case TrackBase::iter3:
532  Algo = 2;
533  break;
534  case TrackBase::iter4:
535  Algo = 3;
536  break;
537  case TrackBase::iter5:
538  Algo = 4;
539  break;
540  default:
541  Algo = 5;
542  break;
543  }
544  if ( Algo >= 4 ) {
545  isFithStep = true;
546  }
547 
548  return isFithStep;
549 }
550 // -- method to apply gsf electron selection to EcalDriven seeds
551 bool
553  if (&(*gsftk.seedRef())==0) return false;
554  ElectronSeedRef ElSeedRef=gsftk.extra()->seedRef().castTo<ElectronSeedRef>();
555 
556  bool passCut = false;
557  if (ElSeedRef->ctfTrack().isNull()){
558  if(ElSeedRef->caloCluster().isNull()) return passCut;
559  SuperClusterRef scRef = ElSeedRef->caloCluster().castTo<SuperClusterRef>();
560  //do this just to know if exist a SC?
561  if(scRef.isNonnull()) {
562  float caloEne = scRef->energy();
563  float feta = fabs(scRef->eta()-gsftk.etaMode());
564  float fphi = fabs(scRef->phi()-gsftk.phiMode());
565  if (fphi>TMath::Pi()) fphi-= TMath::TwoPi();
566  if(caloEne > SCEne_ && feta < detaGsfSC_ && fabs(fphi) < dphiGsfSC_)
567  passCut = true;
568  }
569  }
570  else {
571  // get all the gsf found by tracker driven
572  passCut = true;
573  }
574  return passCut;
575 }
576 bool
577 PFElecTkProducer::resolveGsfTracks(const vector<reco::GsfPFRecTrack> & GsfPFVec,
578  unsigned int ngsf,
579  vector<unsigned int> &secondaries,
580  const reco::PFClusterCollection & theEClus) {
581  bool debugCleaning = debugGsfCleaning_;
582  bool n_keepGsf = true;
583 
584  reco::GsfTrackRef nGsfTrack = GsfPFVec[ngsf].gsfTrackRef();
585 
586  if (&(*nGsfTrack->seedRef())==0) return false;
587  ElectronSeedRef nElSeedRef=nGsfTrack->extra()->seedRef().castTo<ElectronSeedRef>();
588 
589 
591  GlobalVector ninnMom;
592  float nPin = nGsfTrack->pMode();
593  if(inTSOS.isValid()){
594  mtsMode_->momentumFromModeCartesian(inTSOS,ninnMom);
595  nPin = ninnMom.mag();
596  }
597 
598  float neta = nGsfTrack->innerMomentum().eta();
599  float nphi = nGsfTrack->innerMomentum().phi();
600 
601 
602 
603 
604  if(debugCleaning)
605  cout << " PFElecTkProducer:: considering track " << nGsfTrack->pt()
606  << " eta,phi " << nGsfTrack->eta() << ", " << nGsfTrack->phi() << endl;
607 
608 
609  for (unsigned int igsf=0; igsf< GsfPFVec.size();igsf++) {
610  if(igsf != ngsf ) {
611  reco::GsfTrackRef iGsfTrack = GsfPFVec[igsf].gsfTrackRef();
612 
613  if(debugCleaning)
614  cout << " PFElecTkProducer:: and comparing with track " << iGsfTrack->pt()
615  << " eta,phi " << iGsfTrack->eta() << ", " << iGsfTrack->phi() << endl;
616 
617  float ieta = iGsfTrack->innerMomentum().eta();
618  float iphi = iGsfTrack->innerMomentum().phi();
619  float feta = fabs(neta - ieta);
620  float fphi = fabs(nphi - iphi);
621  if (fphi>TMath::Pi()) fphi-= TMath::TwoPi();
622 
623 
624  // apply a superloose preselection only to avoid un-useful cpu time: hard-coded for this reason
625  if(feta < 0.5 && fabs(fphi) < 1.0) {
626  if(debugCleaning)
627  cout << " Entering angular superloose preselection " << endl;
628 
630  GlobalVector i_innMom;
631  float iPin = iGsfTrack->pMode();
632  if(i_inTSOS.isValid()){
633  mtsMode_->momentumFromModeCartesian(i_inTSOS,i_innMom);
634  iPin = i_innMom.mag();
635  }
636 
637  if (&(*iGsfTrack->seedRef())==0) continue;
638  ElectronSeedRef iElSeedRef=iGsfTrack->extra()->seedRef().castTo<ElectronSeedRef>();
639 
640  float SCEnergy = -1.;
641  // Check if two tracks match the same SC
642  bool areBothGsfEcalDriven = false;;
643  bool isSameSC = isSameEgSC(nElSeedRef,iElSeedRef,areBothGsfEcalDriven,SCEnergy);
644 
645  // CASE1 both GsfTracks ecalDriven and match the same SC
646  if(areBothGsfEcalDriven ) {
647  if(isSameSC) {
648  float nEP = SCEnergy/nPin;
649  float iEP = SCEnergy/iPin;
650  if(debugCleaning)
651  cout << " Entering SAME supercluster case "
652  << " nEP " << nEP
653  << " iEP " << iEP << endl;
654 
655 
656 
657  // if same SC take the closest or if same
658  // distance the best E/p
659 
660  // Innermost using LostHits technology
661  bool isSameLayer = false;
662  bool iGsfInnermostWithLostHits =
663  isInnerMostWithLostHits(nGsfTrack,iGsfTrack,isSameLayer);
664 
665 
666  if(debugCleaning)
667  cout << " iGsf is InnerMostWithLostHits " << iGsfInnermostWithLostHits
668  << " isSameLayer " << isSameLayer << endl;
669 
670  if (iGsfInnermostWithLostHits) {
671  n_keepGsf = false;
672  return n_keepGsf;
673  }
674  else if(isSameLayer){
675  if(fabs(iEP-1) < fabs(nEP-1)) {
676  n_keepGsf = false;
677  return n_keepGsf;
678  }
679  else{
680  secondaries.push_back(igsf);
681  }
682  }
683  else {
684  // save secondaries gsf track (put selection)
685  secondaries.push_back(igsf);
686  }
687  } // end same SC case
688  }
689  else {
690  // enter in the condition where at least one track is trackerDriven
691  float minBremDphi = minTangDist(GsfPFVec[ngsf],GsfPFVec[igsf]);
692  float nETot = 0.;
693  float iETot = 0.;
694  bool isBothGsfTrackerDriven = false;
695  bool nEcalDriven = false;
696  bool iEcalDriven = false;
697  bool isSameScEgPf = isSharingEcalEnergyWithEgSC(GsfPFVec[ngsf],
698  GsfPFVec[igsf],
699  nElSeedRef,
700  iElSeedRef,
701  theEClus,
702  isBothGsfTrackerDriven,
703  nEcalDriven,
704  iEcalDriven,
705  nETot,
706  iETot);
707 
708  // check if the first hit of iGsfTrack < nGsfTrack
709  bool isSameLayer = false;
710  bool iGsfInnermostWithLostHits =
711  isInnerMostWithLostHits(nGsfTrack,iGsfTrack,isSameLayer);
712 
713  if(isSameScEgPf) {
714  // CASE 2 : One Gsf has reference to a SC and the other one not or both not
715 
716  if(debugCleaning) {
717  cout << " Sharing ECAL energy passed "
718  << " nEtot " << nETot
719  << " iEtot " << iETot << endl;
720  if(isBothGsfTrackerDriven)
721  cout << " Both Track are trackerDriven " << endl;
722  }
723 
724  // Innermost using LostHits technology
725  if (iGsfInnermostWithLostHits) {
726  n_keepGsf = false;
727  return n_keepGsf;
728  }
729  else if(isSameLayer){
730  // Thirt Case: One Gsf has reference to a SC and the other one not or both not
731  // gsf tracks starts from the same layer
732  // check number of sharing modules (at least 50%)
733  // check number of sharing hits (at least 2)
734  // check charge flip inner/outer
735 
736 
737  // they share energy
738  if(isBothGsfTrackerDriven == false) {
739  // if at least one Gsf track is EcalDriven choose that one.
740  if(iEcalDriven) {
741  n_keepGsf = false;
742  return n_keepGsf;
743  }
744  else {
745  secondaries.push_back(igsf);
746  }
747  }
748  else {
749  // if both tracks are tracker driven choose that one with the best E/p
750  // with ETot = max(En,Ei)
751 
752  float ETot = -1;
753  if(nETot != iETot) {
754  if(nETot > iETot)
755  ETot = nETot;
756  else
757  ETot = iETot;
758  }
759  else {
760  ETot = nETot;
761  }
762  float nEP = ETot/nPin;
763  float iEP = ETot/iPin;
764 
765 
766  if(debugCleaning)
767  cout << " nETot " << nETot
768  << " iETot " << iETot
769  << " ETot " << ETot << endl
770  << " nPin " << nPin
771  << " iPin " << iPin
772  << " nEP " << nEP
773  << " iEP " << iEP << endl;
774 
775 
776  if(fabs(iEP-1) < fabs(nEP-1)) {
777  n_keepGsf = false;
778  return n_keepGsf;
779  }
780  else{
781  secondaries.push_back(igsf);
782  }
783  }
784  }
785  else {
786  secondaries.push_back(igsf);
787  }
788  }
789  else if(feta < detaCutGsfClean_ && minBremDphi < dphiCutGsfClean_) {
790  // very close tracks
791  bool secPushedBack = false;
792  if(nEcalDriven == false && nETot == 0.) {
793  n_keepGsf = false;
794  return n_keepGsf;
795  }
796  else if(iEcalDriven == false && iETot == 0.) {
797  secondaries.push_back(igsf);
798  secPushedBack = true;
799  }
800  if(debugCleaning)
801  cout << " Close Tracks "
802  << " feta " << feta << " fabs(fphi) " << fabs(fphi)
803  << " minBremDphi " << minBremDphi
804  << " nETot " << nETot
805  << " iETot " << iETot
806  << " nLostHits " << nGsfTrack->trackerExpectedHitsInner().numberOfLostHits()
807  << " iLostHits " << iGsfTrack->trackerExpectedHitsInner().numberOfLostHits() << endl;
808 
809  // apply selection only if one track has lost hits
811  if (iGsfInnermostWithLostHits) {
812  n_keepGsf = false;
813  return n_keepGsf;
814  }
815  else if(isSameLayer == false) {
816  if(secPushedBack == false)
817  secondaries.push_back(igsf);
818  }
819  }
820  }
821  else if(feta < 0.1 && minBremDphi < 0.2){
822  // failed all the conditions, discard only tracker driven tracks
823  // with no PFClusters linked.
824  if(debugCleaning)
825  cout << " Close Tracks and failed all the conditions "
826  << " feta " << feta << " fabs(fphi) " << fabs(fphi)
827  << " minBremDphi " << minBremDphi
828  << " nETot " << nETot
829  << " iETot " << iETot
830  << " nLostHits " << nGsfTrack->trackerExpectedHitsInner().numberOfLostHits()
831  << " iLostHits " << iGsfTrack->trackerExpectedHitsInner().numberOfLostHits() << endl;
832 
833  if(nEcalDriven == false && nETot == 0.) {
834  n_keepGsf = false;
835  return n_keepGsf;
836  }
837  // Here I do not push back the secondary because considered fakes...
838  }
839  }
840  }
841  }
842  }
843 
844  return n_keepGsf;
845 }
846 float
848  const reco::GsfPFRecTrack secGsf) {
849 
850  float minDeta = 1000.;
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 secEta = atSecECAL.positionREP().Eta();
865  float secPhi = atSecECAL.positionREP().Phi();
866 
867  unsigned int sbrem = 0;
868  for(unsigned ipbrem = 0; ipbrem < primPFBrem.size(); ipbrem++) {
869  if(primPFBrem[ipbrem].indTrajPoint() == 99) continue;
870  const reco::PFTrajectoryPoint& atPrimECAL
871  = primPFBrem[ipbrem].extrapolatedPoint( reco::PFTrajectoryPoint::ECALEntrance );
872  if( ! atPrimECAL.isValid() ) continue;
873  sbrem++;
874  if(sbrem <= 3) {
875  float primEta = atPrimECAL.positionREP().Eta();
876  float primPhi = atPrimECAL.positionREP().Phi();
877 
878  float deta = fabs(primEta - secEta);
879  float dphi = fabs(primPhi - secPhi);
880  if (dphi>TMath::Pi()) dphi-= TMath::TwoPi();
881  if(fabs(dphi) < minDphi) {
882  minDeta = deta;
883  minDphi = fabs(dphi);
884  }
885  }
886  }
887 
888 
889  cbrem++;
890  if(cbrem == 3)
891  break;
892  }
893  return minDphi;
894 }
895 bool
897  const reco::ElectronSeedRef& iSeedRef,
898  bool& bothGsfEcalDriven,
899  float& SCEnergy) {
900 
901  bool isSameSC = false;
902 
903  if(nSeedRef->caloCluster().isNonnull() && iSeedRef->caloCluster().isNonnull()) {
904  SuperClusterRef nscRef = nSeedRef->caloCluster().castTo<SuperClusterRef>();
905  SuperClusterRef iscRef = iSeedRef->caloCluster().castTo<SuperClusterRef>();
906 
907  if(nscRef.isNonnull() && iscRef.isNonnull()) {
908  bothGsfEcalDriven = true;
909  if(nscRef == iscRef) {
910  isSameSC = true;
911  // retrieve the supercluster energy
912  SCEnergy = nscRef->energy();
913  }
914  }
915  }
916  return isSameSC;
917 }
918 bool
920  const reco::GsfPFRecTrack& iGsfPFRecTrack,
921  const reco::ElectronSeedRef& nSeedRef,
922  const reco::ElectronSeedRef& iSeedRef,
923  const reco::PFClusterCollection& theEClus,
924  bool& bothGsfTrackerDriven,
925  bool& nEcalDriven,
926  bool& iEcalDriven,
927  float& nEnergy,
928  float& iEnergy) {
929 
930  bool isSharingEnergy = false;
931 
932  //which is EcalDriven?
933  bool oneEcalDriven = true;
934  SuperClusterRef scRef;
935  GsfPFRecTrack gsfPfTrack;
936 
937  if(nSeedRef->caloCluster().isNonnull()) {
938  scRef = nSeedRef->caloCluster().castTo<SuperClusterRef>();
939  nEnergy = scRef->energy();
940  nEcalDriven = true;
941  gsfPfTrack = iGsfPFRecTrack;
942  }
943  else if(iSeedRef->caloCluster().isNonnull()){
944  scRef = iSeedRef->caloCluster().castTo<SuperClusterRef>();
945  iEnergy = scRef->energy();
946  iEcalDriven = true;
947  gsfPfTrack = nGsfPFRecTrack;
948  }
949  else{
950  oneEcalDriven = false;
951  }
952 
953  if(oneEcalDriven) {
954  //run a basic reconstruction for the particle flow
955 
956  vector<PFCluster> vecPFClusters;
957  vecPFClusters.clear();
958 
959  for (PFClusterCollection::const_iterator clus = theEClus.begin();
960  clus != theEClus.end();
961  clus++ ) {
962  PFCluster clust = *clus;
963  clust.calculatePositionREP();
964 
965  float deta = fabs(scRef->position().eta() - clust.position().eta());
966  float dphi = fabs(scRef->position().phi() - clust.position().phi());
967  if (dphi>TMath::Pi()) dphi-= TMath::TwoPi();
968 
969  // Angle preselection between the supercluster and pfclusters
970  // this is needed just to save some cpu-time for this is hard-coded
971  if(deta < 0.5 && fabs(dphi) < 1.0) {
972  bool foundLink = false;
973  double distGsf = LinkByRecHit::testTrackAndClusterByRecHit(gsfPfTrack , clust );
974  // check if it touch the GsfTrack
975  if(distGsf > 0.) {
976  if(nEcalDriven)
977  iEnergy += clust.energy();
978  else
979  nEnergy += clust.energy();
980  vecPFClusters.push_back(clust);
981  foundLink = true;
982  }
983  // check if it touch the Brem-tangents
984  if(foundLink == false) {
985  vector<PFBrem> primPFBrem = gsfPfTrack.PFRecBrem();
986  for(unsigned ipbrem = 0; ipbrem < primPFBrem.size(); ipbrem++) {
987  if(primPFBrem[ipbrem].indTrajPoint() == 99) continue;
988  reco::PFRecTrack pfBremTrack = primPFBrem[ipbrem];
989  double dist = LinkByRecHit::testTrackAndClusterByRecHit(pfBremTrack , clust, true );
990  if(dist > 0.) {
991  if(nEcalDriven)
992  iEnergy += clust.energy();
993  else
994  nEnergy += clust.energy();
995  vecPFClusters.push_back(clust);
996  foundLink = true;
997  }
998  }
999  }
1000  } // END if anble preselection
1001  } // PFClusters Loop
1002  if(vecPFClusters.size() > 0 ) {
1003  for(unsigned int pf = 0; pf < vecPFClusters.size(); pf++) {
1004  bool isCommon = ClusterClusterMapping::overlap(vecPFClusters[pf],*scRef);
1005  if(isCommon) {
1006  isSharingEnergy = true;
1007  }
1008  break;
1009  }
1010  }
1011  }
1012  else {
1013  // both tracks are trackerDriven, try ECAL energy matching also in this case.
1014 
1015  bothGsfTrackerDriven = true;
1016  vector<PFCluster> nPFCluster;
1017  vector<PFCluster> iPFCluster;
1018 
1019  nPFCluster.clear();
1020  iPFCluster.clear();
1021 
1022  for (PFClusterCollection::const_iterator clus = theEClus.begin();
1023  clus != theEClus.end();
1024  clus++ ) {
1025  PFCluster clust = *clus;
1026  clust.calculatePositionREP();
1027 
1028  float ndeta = fabs(nGsfPFRecTrack.gsfTrackRef()->eta() - clust.position().eta());
1029  float ndphi = fabs(nGsfPFRecTrack.gsfTrackRef()->phi() - clust.position().phi());
1030  if (ndphi>TMath::Pi()) ndphi-= TMath::TwoPi();
1031  // Apply loose preselection with the track
1032  // just to save cpu time, for this hard-coded
1033  if(ndeta < 0.5 && fabs(ndphi) < 1.0) {
1034  bool foundNLink = false;
1035 
1036  double distGsf = LinkByRecHit::testTrackAndClusterByRecHit(nGsfPFRecTrack , clust );
1037  if(distGsf > 0.) {
1038  nPFCluster.push_back(clust);
1039  nEnergy += clust.energy();
1040  foundNLink = true;
1041  }
1042  if(foundNLink == false) {
1043  vector<PFBrem> primPFBrem = nGsfPFRecTrack.PFRecBrem();
1044  for(unsigned ipbrem = 0; ipbrem < primPFBrem.size(); ipbrem++) {
1045  if(primPFBrem[ipbrem].indTrajPoint() == 99) continue;
1046  reco::PFRecTrack pfBremTrack = primPFBrem[ipbrem];
1047  if(foundNLink == false) {
1048  double dist = LinkByRecHit::testTrackAndClusterByRecHit(pfBremTrack , clust, true );
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 = LinkByRecHit::testTrackAndClusterByRecHit(iGsfPFRecTrack , clust );
1067  if(dist > 0.) {
1068  iPFCluster.push_back(clust);
1069  iEnergy += clust.energy();
1070  foundILink = true;
1071  }
1072  if(foundILink == false) {
1073  vector<PFBrem> primPFBrem = iGsfPFRecTrack.PFRecBrem();
1074  for(unsigned ipbrem = 0; ipbrem < primPFBrem.size(); ipbrem++) {
1075  if(primPFBrem[ipbrem].indTrajPoint() == 99) continue;
1076  reco::PFRecTrack pfBremTrack = primPFBrem[ipbrem];
1077  if(foundILink == false) {
1078  double dist = LinkByRecHit::testTrackAndClusterByRecHit(pfBremTrack , clust, true );
1079  if(dist > 0.) {
1080  iPFCluster.push_back(clust);
1081  iEnergy += clust.energy();
1082  foundILink = true;
1083  }
1084  }
1085  }
1086  }
1087  }
1088  }
1089 
1090 
1091  if(nPFCluster.size() > 0 && iPFCluster.size() > 0) {
1092  for(unsigned int npf = 0; npf < nPFCluster.size(); npf++) {
1093  for(unsigned int ipf = 0; ipf < iPFCluster.size(); ipf++) {
1094  bool isCommon = ClusterClusterMapping::overlap(nPFCluster[npf],iPFCluster[ipf]);
1095  if(isCommon) {
1096  isSharingEnergy = true;
1097  break;
1098  }
1099  }
1100  if(isSharingEnergy)
1101  break;
1102  }
1103  }
1104  }
1105 
1106  return isSharingEnergy;
1107 }
1109  const reco::GsfTrackRef& iGsfTrack,
1110  bool& sameLayer) {
1111 
1112  // copied by the class RecoEgamma/EgammaElectronAlgos/src/EgAmbiguityTools.cc
1113  // obsolete but the code is kept: now using lost hits method
1114 
1115  reco::HitPattern gsfHitPattern1 = nGsfTrack->hitPattern();
1116  reco::HitPattern gsfHitPattern2 = iGsfTrack->hitPattern();
1117 
1118  // retrieve first valid hit
1119  int gsfHitCounter1 = 0 ;
1120  trackingRecHit_iterator elHitsIt1 ;
1121  for
1122  ( elHitsIt1 = nGsfTrack->recHitsBegin() ;
1123  elHitsIt1 != nGsfTrack->recHitsEnd() ;
1124  elHitsIt1++, gsfHitCounter1++ )
1125  { if (((**elHitsIt1).isValid())) break ; }
1126 
1127  int gsfHitCounter2 = 0 ;
1128  trackingRecHit_iterator elHitsIt2 ;
1129  for
1130  ( elHitsIt2 = iGsfTrack->recHitsBegin() ;
1131  elHitsIt2 != iGsfTrack->recHitsEnd() ;
1132  elHitsIt2++, gsfHitCounter2++ )
1133  { if (((**elHitsIt2).isValid())) break ; }
1134 
1135  uint32_t gsfHit1 = gsfHitPattern1.getHitPattern(gsfHitCounter1) ;
1136  uint32_t gsfHit2 = gsfHitPattern2.getHitPattern(gsfHitCounter2) ;
1137 
1138 
1139  if (gsfHitPattern1.getSubStructure(gsfHit1)!=gsfHitPattern2.getSubStructure(gsfHit2))
1140  {
1141  return (gsfHitPattern2.getSubStructure(gsfHit2)<gsfHitPattern1.getSubStructure(gsfHit1));
1142  }
1143  else if (gsfHitPattern1.getLayer(gsfHit1)!=gsfHitPattern2.getLayer(gsfHit2))
1144  {
1145  return (gsfHitPattern2.getLayer(gsfHit2)<gsfHitPattern1.getLayer(gsfHit1));
1146  }
1147  else
1148  {
1149  sameLayer = true;
1150  return false;
1151  }
1152 }
1154  const reco::GsfTrackRef& iGsfTrack,
1155  bool& sameLayer) {
1156 
1157  // define closest using the lost hits on the expectedhitsineer
1158  unsigned int nLostHits = nGsfTrack->trackerExpectedHitsInner().numberOfLostHits();
1159  unsigned int iLostHits = iGsfTrack->trackerExpectedHitsInner().numberOfLostHits();
1160 
1161  if (nLostHits!=iLostHits) {
1162  return (nLostHits > iLostHits);
1163  }
1164  else {
1165  sameLayer = true;
1166  return false;
1167  }
1168 }
1169 
1170 
1171 
1172 // ------------ method called once each job just before starting event loop ------------
1173 void
1175  const EventSetup& iSetup)
1176 {
1177  ESHandle<MagneticField> magneticField;
1178  iSetup.get<IdealMagneticFieldRecord>().get(magneticField);
1179 
1181  iSetup.get<TrackerDigiGeometryRecord>().get(tracker);
1182 
1183 
1184  mtsTransform_ = MultiTrajectoryStateTransform(tracker.product(),magneticField.product());
1185 
1186 
1187  pfTransformer_= new PFTrackTransformer(math::XYZVector(magneticField->inTesla(GlobalPoint(0,0,0))));
1188 
1189 
1191  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", builder);
1192  TransientTrackBuilder thebuilder = *(builder.product());
1193 
1194 
1195  if(useConvBremFinder_) {
1196  FILE * fileConvBremID = fopen(path_mvaWeightFileConvBrem_.c_str(), "r");
1197  if (fileConvBremID) {
1198  fclose(fileConvBremID);
1199  }
1200  else {
1201  string err = "PFElecTkProducer: cannot open weight file '";
1203  err += "'";
1204  throw invalid_argument( err );
1205  }
1206  }
1208 
1209 }
1210 
1211 // ------------ method called once each job just after ending the event loop ------------
1212 void
1214  delete pfTransformer_;
1215 }
1216 
1217 //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)
uint32_t getSubStructure(uint32_t pattern) const
Definition: HitPattern.cc:133
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.
uint32_t getLayer(uint32_t pattern) const
Definition: HitPattern.cc:219
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:249
PFElecTkProducer(const edm::ParameterSet &)
Constructor.
int iEvent
Definition: GenABIO.cc:243
edm::InputTag pfEcalClusters_
bool isNull() const
Checks for null.
Definition: Ref.h:246
T mag() const
Definition: PV3DBase.h:61
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:84
const reco::GsfTrackRef & gsfTrackRef() const
Definition: GsfPFRecTrack.h:39
recHitContainer::const_iterator const_iterator
T sqrt(T t)
Definition: SSEVec.h:28
std::vector< GsfTrack > GsfTrackCollection
collection of GsfTracks
Definition: GsfTrackFwd.h:9
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
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
float minTangDist(const reco::GsfPFRecTrack primGsf, const reco::GsfPFRecTrack secGsf)
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:41
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:86
static double testTrackAndClusterByRecHit(const reco::PFRecTrack &track, const reco::PFCluster &cluster, bool isBrem=false, bool debug=false)
Definition: LinkByRecHit.cc:10
std::vector< PFRecTrack > PFRecTrackCollection
collection of PFRecTrack objects
Definition: PFRecTrackFwd.h:9
Definition: fakeMenu.h:4
Definition: Run.h:32
MultiTrajectoryStateTransform mtsTransform_
bool isInnerMost(const reco::GsfTrackRef &nGsfTrack, const reco::GsfTrackRef &iGsfTrack, bool &sameLayer)