CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GoodSeedProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: PFTracking
4 // Class: GoodSeedProducer
5 //
6 // Original Author: Michele Pioppi
7 // March 2010. F. Beaudette. Produce PreId information
8 
12 
29 
31 
32 #include <fstream>
33 #include <string>
34 #include "TMath.h"
35 #include "Math/VectorUtil.h"
36 
37 using namespace edm;
38 using namespace std;
39 using namespace reco;
40 
42  pfTransformer_(nullptr),
43  conf_(iConfig),
44  resMapEtaECAL_(nullptr),
45  resMapPhiECAL_(nullptr)
46 {
47  LogInfo("GoodSeedProducer")<<"Electron PreIdentification started ";
48 
49  //now do what ever initialization is needed
50  std::vector<edm::InputTag> tags = iConfig.getParameter< vector < InputTag > >("TkColList");
51  for(unsigned int i=0;i<tags.size();++i) {
52  trajContainers_.push_back(consumes<vector<Trajectory> >(tags[i]));
53  tracksContainers_.push_back(consumes<reco::TrackCollection>(tags[i]));
54  }
55 
56  minPt_=iConfig.getParameter<double>("MinPt");
57  maxPt_=iConfig.getParameter<double>("MaxPt");
58  maxEta_=iConfig.getParameter<double>("MaxEta");
59 
60  HcalIsolWindow_ =iConfig.getParameter<double>("HcalWindow");
61  EcalStripSumE_minClusEnergy_ = iConfig.getParameter<double>("EcalStripSumE_minClusEnergy");
62  EcalStripSumE_deltaEta_ = iConfig.getParameter<double>("EcalStripSumE_deltaEta");
63  EcalStripSumE_deltaPhiOverQ_minValue_ = iConfig.getParameter<double>("EcalStripSumE_deltaPhiOverQ_minValue");
64  EcalStripSumE_deltaPhiOverQ_maxValue_ = iConfig.getParameter<double>("EcalStripSumE_deltaPhiOverQ_maxValue");
65  minEoverP_= iConfig.getParameter<double>("EOverPLead_minValue");
66  maxHoverP_= iConfig.getParameter<double>("HOverPLead_maxValue");
67 
68  pfCLusTagECLabel_=consumes<reco::PFClusterCollection>(iConfig.getParameter<InputTag>("PFEcalClusterLabel"));
69 
70  pfCLusTagHCLabel_=consumes<reco::PFClusterCollection>(iConfig.getParameter<InputTag>("PFHcalClusterLabel"));
71 
72  pfCLusTagPSLabel_=consumes<reco::PFClusterCollection>(iConfig.getParameter<InputTag>("PFPSClusterLabel"));
73 
74  preidgsf_ = iConfig.getParameter<string>("PreGsfLabel");
75  preidckf_ = iConfig.getParameter<string>("PreCkfLabel");
76  preidname_= iConfig.getParameter<string>("PreIdLabel");
77 
78 
79  fitterName_ = iConfig.getParameter<string>("Fitter");
80  smootherName_ = iConfig.getParameter<string>("Smoother");
81 
82 
83  nHitsInSeed_=iConfig.getParameter<int>("NHitsInSeed");
84 
85  clusThreshold_=iConfig.getParameter<double>("ClusterThreshold");
86 
87  minEp_=iConfig.getParameter<double>("MinEOverP");
88  maxEp_=iConfig.getParameter<double>("MaxEOverP");
89 
90  //collection to produce
91  produceCkfseed_ = iConfig.getUntrackedParameter<bool>("ProduceCkfSeed",false);
92 
93  // to disable the electron part (for HI collisions for examples)
94  disablePreId_ = iConfig.getUntrackedParameter<bool>("DisablePreId",false);
95 
96  producePreId_ = iConfig.getUntrackedParameter<bool>("ProducePreId",true);
97  // if no electron, cannot produce the preid
98  if(disablePreId_)
99  producePreId_=false;
100  PtThresholdSavePredId_ = iConfig.getUntrackedParameter<double>("PtThresholdSavePreId",1.);
101 
102  LogDebug("GoodSeedProducer")<<"Seeds for GSF will be produced ";
103 
104  // no disablePreId_ switch here. The collection will be empty if it is true
105  produces<ElectronSeedCollection>(preidgsf_);
106 
107  if(produceCkfseed_){
108  LogDebug("GoodSeedProducer")<<"Seeds for CKF will be produced ";
109  produces<TrajectorySeedCollection>(preidckf_);
110  }
111 
112  if(producePreId_){
113  LogDebug("GoodSeedProducer")<<"PreId debugging information will be produced ";
114 
115  produces<PreIdCollection>(preidname_);
116  if(tracksContainers_.size()==1) // do not make a value map if more than one input track collection
118  }
119 
120  useQuality_ = iConfig.getParameter<bool>("UseQuality");
121  trackQuality_=TrackBase::qualityByName(iConfig.getParameter<std::string>("TrackQuality"));
122 
123  useTmva_= iConfig.getUntrackedParameter<bool>("UseTMVA",false);
124 
125  Min_dr_ = iConfig.getParameter<double>("Min_dr");
126 }
127 
128 
129 //
130 // member functions
131 //
132 
133 // ------------ method called to produce the data ------------
134 void
136 {
137 
138  LogDebug("GoodSeedProducer")<<"START event: "<<iEvent.id().event()
139  <<" in run "<<iEvent.id().run();
140  //Create empty output collections
141  auto_ptr<ElectronSeedCollection> output_preid(new ElectronSeedCollection);
142  auto_ptr<TrajectorySeedCollection> output_nopre(new TrajectorySeedCollection);
143  auto_ptr<PreIdCollection> output_preidinfo(new PreIdCollection);
144  auto_ptr<edm::ValueMap<reco::PreIdRef> > preIdMap_p(new edm::ValueMap<reco::PreIdRef>);
145  edm::ValueMap<reco::PreIdRef>::Filler mapFiller(*preIdMap_p);
146 
147  //Tracking Tools
148  if(!disablePreId_)
149  {
152  iSetup.get<TrajectoryFitter::Record>().get(fitterName_, aFitter);
153  iSetup.get<TrajectoryFitter::Record>().get(smootherName_, aSmoother);
154  smoother_.reset(aSmoother->clone());
155  fitter_ = aFitter->clone();
157  edm::ESHandle<TransientTrackingRecHitBuilder> theTrackerRecHitBuilder;
158  try {
159  std::string theTrackerRecHitBuilderName("WithAngleAndTemplate"); // FIXME FIXME
160  iSetup.get<TransientRecHitRecord>().get(theTrackerRecHitBuilderName,theTrackerRecHitBuilder);
161  theTrackerRecHitBuilder.product();
162  } catch(...) {
163  std::string theTrackerRecHitBuilderName("hltESPTTRHBWithTrackAngle"); // FIXME FIXME
164  iSetup.get<TransientRecHitRecord>().get(theTrackerRecHitBuilderName,theTrackerRecHitBuilder);
165  theTrackerRecHitBuilder.product();
166  }
167  hitCloner = static_cast<TkTransientTrackingRecHitBuilder const *>(theTrackerRecHitBuilder.product())->cloner();
168  fitter_->setHitCloner(&hitCloner);
169  smoother_->setHitCloner(&hitCloner);
170  }
171 
172  // clear temporary maps
173  refMap_.clear();
174 
175  //Handle input collections
176  //ECAL clusters
177  Handle<PFClusterCollection> theECPfClustCollection;
178  iEvent.getByToken(pfCLusTagECLabel_,theECPfClustCollection);
179 
180 
181  vector<PFCluster const *> basClus;
182  for ( auto const & klus : *theECPfClustCollection.product() ) {
183  if(klus.correctedEnergy()>clusThreshold_) basClus.push_back(&klus);
184  }
185 
186  //HCAL clusters
187  Handle<PFClusterCollection> theHCPfClustCollection;
188  iEvent.getByToken(pfCLusTagHCLabel_,theHCPfClustCollection);
189 
190  //PS clusters
191  Handle<PFClusterCollection> thePSPfClustCollection;
192  iEvent.getByToken(pfCLusTagPSLabel_,thePSPfClustCollection);
193 
194  //Vector of track collections
195  for (unsigned int istr=0; istr<tracksContainers_.size();++istr){
196 
197  //Track collection
198  Handle<TrackCollection> tkRefCollection;
199  iEvent.getByToken(tracksContainers_[istr], tkRefCollection);
200  const TrackCollection& Tk=*(tkRefCollection.product());
201 
202  //Trajectory collection
203  Handle<vector<Trajectory> > tjCollection;
204  iEvent.getByToken(trajContainers_[istr], tjCollection);
205  auto const & Tj=*(tjCollection.product());
206 
207  LogDebug("GoodSeedProducer")<<"Number of tracks in collection "
208  <<tracksContainers_[istr] <<" to be analyzed "
209  <<Tj.size();
210 
211  //loop over the track collection
212  for(unsigned int i=0;i<Tk.size();++i){
213  if (useQuality_ &&
214  (!(Tk[i].quality(trackQuality_)))) continue;
215 
216  reco::PreId myPreId;
217  bool GoodPreId=false;
218 
219  TrackRef trackRef(tkRefCollection, i);
220  // TrajectorySeed Seed=Tj[i].seed();
221  math::XYZVectorF tkmom(Tk[i].momentum());
222  auto tketa= tkmom.eta();
223  auto tkpt = std::sqrt(tkmom.perp2());
224  auto const & Seed=(*trackRef->seedRef());
225  if(!disablePreId_)
226  {
227  int ipteta=getBin(Tk[i].eta(),Tk[i].pt());
228  int ibin=ipteta*9;
229 
230  float oPTOB=1.f/Tj[i].lastMeasurement().updatedState().globalMomentum().mag();
231  // float chikfred=Tk[i].normalizedChi2();
232  float nchi=Tk[i].normalizedChi2();
233 
234  int nhitpi=Tj[i].foundHits();
235  float EP=0;
236 
237  // set track info
238  myPreId.setTrack(trackRef);
239  //CLUSTERS - TRACK matching
240 
241  auto pfmass= 0.0005;
242  auto pfoutenergy=sqrt((pfmass*pfmass)+Tk[i].outerMomentum().Mag2());
243 
244  XYZTLorentzVector mom =XYZTLorentzVector(Tk[i].outerMomentum().x(),
245  Tk[i].outerMomentum().y(),
246  Tk[i].outerMomentum().z(),
247  pfoutenergy);
248  XYZTLorentzVector pos = XYZTLorentzVector(Tk[i].outerPosition().x(),
249  Tk[i].outerPosition().y(),
250  Tk[i].outerPosition().z(),
251  0.);
252 
253  BaseParticlePropagator theOutParticle( RawParticle(mom,pos),
254  0,0,B_.z());
255  theOutParticle.setCharge(Tk[i].charge());
256 
257  theOutParticle.propagateToEcalEntrance(false);
258 
259 
260 
261  float toteta=1000.f;
262  float totphi=1000.f;
263  float dr=1000.f;
264  float EE=0.f;
265  float feta=0.f;
266  GlobalPoint ElecTrkEcalPos(0,0,0);
267 
268  PFClusterRef clusterRef;
269  math::XYZPoint meanShowerSaved;
270  if(theOutParticle.getSuccess()!=0){
271  ElecTrkEcalPos=GlobalPoint(theOutParticle.vertex().x(),
272  theOutParticle.vertex().y(),
273  theOutParticle.vertex().z()
274  );
275 
276  constexpr float psLim = 2.50746495928f; // std::sinh(1.65f);
277  bool isBelowPS= (ElecTrkEcalPos.z()*ElecTrkEcalPos.z()) > (psLim*psLim)*ElecTrkEcalPos.perp2();
278  // bool isBelowPS=(std::abs(ElecTrkEcalPos.eta())>1.65f);
279 
280  unsigned clusCounter=0;
281  float max_ee = 0;
282  for(auto aClus : basClus) {
283 
284  float tmp_ep=float(aClus->correctedEnergy())*oPTOB;
285  if ((tmp_ep<minEp_)|(tmp_ep>maxEp_)) { ++clusCounter; continue;}
286 
287  double ecalShowerDepth
288  = PFCluster::getDepthCorrection(aClus->correctedEnergy(),
289  isBelowPS,
290  false);
291  auto mom = theOutParticle.momentum().Vect();
292  auto meanShower = ElecTrkEcalPos +
293  GlobalVector(mom.x(),mom.y(),mom.z()).unit()*ecalShowerDepth;
294 
295  float etarec=meanShower.eta();
296  float phirec=meanShower.phi();
297 
298 
299  float tmp_phi=std::abs(aClus->positionREP().phi()-phirec);
300  if (tmp_phi>float(TMath::Pi())) tmp_phi-= float(TMath::TwoPi());
301 
302  float tmp_dr=std::sqrt(std::pow(tmp_phi,2.f)+
303  std::pow(aClus->positionREP().eta()-etarec,2.f));
304 
305  if (tmp_dr<dr){
306  dr=tmp_dr;
307  if(dr < Min_dr_){ // find the most closest and energetic ECAL cluster
308  if(aClus->correctedEnergy() > max_ee){
309 
310  toteta=aClus->positionREP().eta()-etarec;
311  totphi=tmp_phi;
312  EP=tmp_ep;
313  EE=aClus->correctedEnergy();
314  feta= aClus->positionREP().eta();
315  clusterRef = PFClusterRef(theECPfClustCollection,clusCounter);
316  meanShowerSaved = meanShower;
317 
318  }
319  }
320  }
321  ++clusCounter;
322  }
323  }
324  float trk_ecalDeta_ = fabs(toteta);
325  float trk_ecalDphi_ = fabs(totphi);
326 
327  //Resolution maps
328  auto ecaletares
329  = resMapEtaECAL_->GetBinContent(resMapEtaECAL_->FindBin(feta,EE));
330  auto ecalphires
331  = resMapPhiECAL_->GetBinContent(resMapPhiECAL_->FindBin(feta,EE));
332 
333  //geomatrical compatibility
334  float chieta=(toteta!=1000.f)? toteta/ecaletares : toteta;
335  float chiphi=(totphi!=1000.f)? totphi/ecalphires : totphi;
336  float chichi= sqrt(chieta*chieta + chiphi*chiphi);
337 
338  //Matching criteria
339  float eta_cut = thr[ibin+0];
340  float phi_cut = thr[ibin+1];
341  float ep_cutmin=thr[ibin+2];
342  bool GoodMatching= ((trk_ecalDeta_<eta_cut) && (trk_ecalDphi_<phi_cut) && (EP>ep_cutmin) && (nhitpi>10));
343 
344  bool EcalMatching=GoodMatching;
345 
346  if (tkpt>maxPt_) GoodMatching=true;
347  if (tkpt<minPt_) GoodMatching=false;
348 
349 
350 
351  math::XYZPoint myPoint(ElecTrkEcalPos.x(),ElecTrkEcalPos.y(),ElecTrkEcalPos.z());
352  myPreId.setECALMatchingProperties(clusterRef,myPoint,meanShowerSaved,std::abs(toteta),std::abs(totphi),chieta,
353  chiphi,chichi,EP);
354  myPreId.setECALMatching(EcalMatching);
355 
356 
357  bool GoodRange= ((std::abs(tketa)<maxEta_) &
358  (tkpt>minPt_));
359  //KF FILTERING FOR UNMATCHED EVENTS
360  int hit1max=int(thr[ibin+3]);
361  float chiredmin=thr[ibin+4];
362  bool GoodKFFiltering =
363  ((nchi>chiredmin) | (nhitpi<hit1max));
364 
365 
366  myPreId.setTrackFiltering(GoodKFFiltering);
367 
368  bool GoodTkId= false;
369 
370  if((!GoodMatching) &&(GoodKFFiltering) &&(GoodRange)){
371  chired=1000;
372  chiRatio=1000;
373  dpt=0;
374  nhit=nhitpi;
375  chikfred = nchi;
376  trk_ecalDeta = trk_ecalDeta_;
377  trk_ecalDphi = trk_ecalDphi_;
378 
380  Trajectory::ConstRecHitContainer && hits=Tj[i].recHits();
381  for (int ih=hits.size()-1; ih>=0; ih--) tmp.push_back(hits[ih]);
382  Trajectory && FitTjs= fitter_->fitOne(Seed,tmp,Tj[i].lastMeasurement().updatedState());
383 
384  if(FitTjs.isValid()){
385  Trajectory && SmooTjs= smoother_->trajectory(FitTjs);
386  if(SmooTjs.isValid()){
387 
388  //Track refitted with electron hypothesis
389 
390  float pt_out=SmooTjs.firstMeasurement().
391  updatedState().globalMomentum().perp();
392  float pt_in=SmooTjs.lastMeasurement().
393  updatedState().globalMomentum().perp();
394  dpt=(pt_in>0) ? fabs(pt_out-pt_in)/pt_in : 0.;
395  // the following is simply the number of degrees of freedom
396  chiRatio=SmooTjs.chiSquared()/Tj[i].chiSquared();
398 
399  }
400  }
401 
402 
403  //TMVA Analysis
404  if(useTmva_){
405 
406  eta=tketa;
407  pt=tkpt;
408  eP=EP;
409 
410  float Ytmva=reader[ipteta]->EvaluateMVA( method_ );
411 
412  float BDTcut=thr[ibin+5];
413  if ( Ytmva>BDTcut) GoodTkId=true;
414  myPreId.setMVA(GoodTkId,Ytmva);
416  }else{
417 
418  float chiratiocut=thr[ibin+6];
419  float gschicut=thr[ibin+7];
420  float gsptmin=thr[ibin+8];
421 
422  GoodTkId=((dpt>gsptmin)&(chired<gschicut)&(chiRatio<chiratiocut));
423 
424  }
425  }
426 
427  GoodPreId= GoodTkId | GoodMatching;
428 
429  myPreId.setFinalDecision(GoodPreId);
430 
431  if(GoodPreId)
432  LogDebug("GoodSeedProducer")<<"Track (pt= "<<Tk[i].pt()<<
433  "GeV/c, eta= "<<Tk[i].eta() <<
434  ") preidentified for agreement between track and ECAL cluster";
435  if(GoodPreId &&(!GoodMatching))
436  LogDebug("GoodSeedProducer")<<"Track (pt= "<<Tk[i].pt()<<
437  "GeV/c, eta= "<<Tk[i].eta() <<
438  ") preidentified only for track properties";
439 
440  } // end of !disablePreId_
441 
442  if (GoodPreId){
443  //NEW SEED with n hits
444  ElectronSeed NewSeed(Seed);
445  NewSeed.setCtfTrack(trackRef);
446  output_preid->push_back(NewSeed);
447  }else{
448  if (produceCkfseed_){
449  output_nopre->push_back(Seed);
450  }
451  }
452  if(producePreId_ && myPreId.pt()>PtThresholdSavePredId_)
453  {
454  // save the index of the PreId object as to be able to create a Ref later
455  refMap_[trackRef] = output_preidinfo->size();
456  output_preidinfo->push_back(myPreId);
457  }
458  } //end loop on track collection
459  } //end loop on the vector of track collections
460 
461  // no disablePreId_ switch, it is simpler to have an empty collection rather than no collection
462  iEvent.put(output_preid,preidgsf_);
463  if (produceCkfseed_)
464  iEvent.put(output_nopre,preidckf_);
465  if(producePreId_)
466  {
467  const edm::OrphanHandle<reco::PreIdCollection> preIdRefProd = iEvent.put(output_preidinfo,preidname_);
468  // now make the Value Map, but only if one input collection
469  if(tracksContainers_.size()==1)
470  {
471  Handle<TrackCollection> tkRefCollection ;
472  iEvent.getByToken(tracksContainers_[0],tkRefCollection);
473  fillPreIdRefValueMap(tkRefCollection,preIdRefProd,mapFiller);
474  mapFiller.fill();
475  iEvent.put(preIdMap_p,preidname_);
476  }
477  }
478  // clear temporary maps
479  refMap_.clear();
480 }
481 // ------------ method called once each job just before starting event loop ------------
482 void
484  const EventSetup& es)
485 {
486  //Magnetic Field
487  ESHandle<MagneticField> magneticField;
488  es.get<IdealMagneticFieldRecord>().get(magneticField);
489  B_=magneticField->inTesla(GlobalPoint(0,0,0));
490 
491  pfTransformer_.reset( new PFTrackTransformer(B_) );
492  pfTransformer_->OnlyProp();
493 
494  //Resolution maps
495  FileInPath ecalEtaMap(conf_.getParameter<string>("EtaMap"));
496  FileInPath ecalPhiMap(conf_.getParameter<string>("PhiMap"));
497  resMapEtaECAL_.reset( new PFResolutionMap("ECAL_eta",ecalEtaMap.fullPath().c_str()) );
498  resMapPhiECAL_.reset( new PFResolutionMap("ECAL_phi",ecalPhiMap.fullPath().c_str()) );
499 
500  if(useTmva_){
501  method_ = conf_.getParameter<string>("TMVAMethod");
502  FileInPath Weigths1(conf_.getParameter<string>("Weights1"));
503  FileInPath Weigths2(conf_.getParameter<string>("Weights2"));
504  FileInPath Weigths3(conf_.getParameter<string>("Weights3"));
505  FileInPath Weigths4(conf_.getParameter<string>("Weights4"));
506  FileInPath Weigths5(conf_.getParameter<string>("Weights5"));
507  FileInPath Weigths6(conf_.getParameter<string>("Weights6"));
508  FileInPath Weigths7(conf_.getParameter<string>("Weights7"));
509  FileInPath Weigths8(conf_.getParameter<string>("Weights8"));
510  FileInPath Weigths9(conf_.getParameter<string>("Weights9"));
511 
512  for(UInt_t j = 0; j < 9; ++j){
513  reader[j].reset( new TMVA::Reader("!Color:Silent"));
514 
515  reader[j]->AddVariable("NHits", &nhit);
516  reader[j]->AddVariable("NormChi", &chikfred);
517  reader[j]->AddVariable("dPtGSF", &dpt);
518  reader[j]->AddVariable("EoP", &eP);
519  reader[j]->AddVariable("ChiRatio", &chiRatio);
520  reader[j]->AddVariable("RedChi", &chired);
521  reader[j]->AddVariable("EcalDEta", &trk_ecalDeta);
522  reader[j]->AddVariable("EcalDPhi", &trk_ecalDphi);
523  reader[j]->AddVariable("pt", &pt);
524  reader[j]->AddVariable("eta", &eta);
525 
526  if(j==0) reader[j]->BookMVA(method_, Weigths1.fullPath().c_str());
527  if(j==1) reader[j]->BookMVA(method_, Weigths2.fullPath().c_str());
528  if(j==2) reader[j]->BookMVA(method_, Weigths3.fullPath().c_str());
529  if(j==3) reader[j]->BookMVA(method_, Weigths4.fullPath().c_str());
530  if(j==4) reader[j]->BookMVA(method_, Weigths5.fullPath().c_str());
531  if(j==5) reader[j]->BookMVA(method_, Weigths6.fullPath().c_str());
532  if(j==6) reader[j]->BookMVA(method_, Weigths7.fullPath().c_str());
533  if(j==7) reader[j]->BookMVA(method_, Weigths8.fullPath().c_str());
534  if(j==8) reader[j]->BookMVA(method_, Weigths9.fullPath().c_str());
535  }
536  }
537  //read threshold
538  FileInPath parFile(conf_.getParameter<string>("ThresholdFile"));
539  ifstream ifs(parFile.fullPath().c_str());
540  for (int iy=0;iy<81;++iy) ifs >> thr[iy];
541 }
542 
543 int
545  int ie=0;
546  int ip=0;
547  if (fabs(eta)<0.8) ie=0;
548  else{ if (fabs(eta)<1.479) ie=1;
549  else ie=2;
550  }
551  if (pt<6) ip=0;
552  else { if (pt<12) ip=1;
553  else ip=2;
554  }
555  int iep= ie*3+ip;
556  LogDebug("GoodSeedProducer")<<"Track pt ="<<pt<<" eta="<<eta<<" bin="<<iep;
557  return iep;
558 }
559 
561  const edm::OrphanHandle<reco::PreIdCollection>& preidhandle,
563 {
564  std::vector<reco::PreIdRef> values;
565 
566  unsigned ntracks=tracks->size();
567  for(unsigned itrack=0;itrack<ntracks;++itrack)
568  {
569  reco::TrackRef theTrackRef(tracks,itrack);
570  std::map<reco::TrackRef,unsigned>::const_iterator itcheck=refMap_.find(theTrackRef);
571  if(itcheck==refMap_.end())
572  {
573  // the track has been early discarded
574  values.push_back(reco::PreIdRef());
575  }
576  else
577  {
578  edm::Ref<reco::PreIdCollection> preIdRef(preidhandle,itcheck->second);
579  values.push_back(preIdRef);
580  // std::cout << " Checking Refs " << (theTrackRef==preIdRef->trackRef()) << std::endl;
581  }
582  }
583  filler.insert(tracks,values.begin(),values.end());
584 }
585 
#define LogDebug(id)
int nHitsInSeed_
Number of hits in the seed;.
RunNumber_t run() const
Definition: EventID.h:39
const double TwoPi
const double Pi
void setCharge(float q)
set the MEASURED charge
Definition: RawParticle.cc:139
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:41
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
void setECALMatchingProperties(PFClusterRef clusterRef, const math::XYZPoint &ecalpos, const math::XYZPoint &meanShower, float deta, float dphi, float chieta, float chiphi, float chi2, float eop)
Definition: PreId.h:38
std::vector< reco::PreId > PreIdCollection
Definition: PreIdFwd.h:6
std::string preidckf_
Name of the Seed(Ckf) Collection.
edm::EDGetTokenT< reco::PFClusterCollection > pfCLusTagPSLabel_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
std::array< std::unique_ptr< TMVA::Reader >, 9 > reader
READER FOR TMVA.
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
float eP
VARIABLES NEEDED FOR TMVA.
std::unique_ptr< TrajectorySmoother > smoother_
Smoother.
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:52
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::unique_ptr< PFResolutionMap > resMapEtaECAL_
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:13
T y() const
Definition: PV3DBase.h:63
double EcalStripSumE_minClusEnergy_
float thr[150]
vector of thresholds for different bins of eta and pt
T perp2() const
Definition: PV3DBase.h:71
T eta() const
#define nullptr
#define constexpr
float float float z
TkClonerImpl hitCloner
void setCtfTrack(const CtfTrackRef &)
Set additional info.
Definition: ElectronSeed.cc:64
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
void setTrack(reco::TrackRef trackref)
Definition: PreId.h:34
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
int getBin(float, float)
Find the bin in pt and eta.
int iEvent
Definition: GenABIO.cc:230
std::unique_ptr< TrajectoryFitter > fitter_
Fitter.
edm::ParameterSet conf_
void setMVA(bool accepted, float mva, unsigned n=0)
Definition: PreId.h:72
std::string method_
TMVA method.
double EcalStripSumE_deltaEta_
double EcalStripSumE_deltaPhiOverQ_minValue_
std::vector< TrajectorySeed > TrajectorySeedCollection
double EcalStripSumE_deltaPhiOverQ_maxValue_
void setTrackFiltering(bool accepted, unsigned n=0)
Definition: PreId.h:68
virtual void produce(edm::Event &, const edm::EventSetup &) override
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
string unit
Definition: csvLumiCalc.py:46
T sqrt(T t)
Definition: SSEVec.h:48
edm::Ref< PFClusterCollection > PFClusterRef
persistent reference to PFCluster objects
Definition: PFClusterFwd.h:15
math::XYZVector B_
B field.
std::string preidname_
Name of the preid Collection (FB)
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:181
T z() const
Definition: PV3DBase.h:64
TypeLabelItem const & produces()
declare what type of product will make and with which optional label
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
bool useQuality_
TRACK QUALITY.
void fillPreIdRefValueMap(edm::Handle< reco::TrackCollection > tkhandle, const edm::OrphanHandle< reco::PreIdCollection > &, edm::ValueMap< reco::PreIdRef >::Filler &filler)
double f[11][100]
double minPt_
Minimum transverse momentum and maximum pseudorapidity.
std::string fitterName_
std::vector< ElectronSeed > ElectronSeedCollection
collection of ElectronSeed objects
bool disablePreId_
switch to disable the pre-id
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float > > XYZVectorF
spatial vector with cartesian internal representation
Definition: Vector3D.h:17
virtual void beginRun(const edm::Run &run, const edm::EventSetup &) override
reco::TrackBase::TrackQuality trackQuality_
double clusThreshold_
Cut on the energy of the clusters.
TrackingRecHit::ConstRecHitContainer ConstRecHitContainer
Definition: Trajectory.h:47
tuple tags
Definition: o2o.py:248
bool produceCkfseed_
Produce the Seed for Ckf tracks?
bool isValid() const
Definition: Trajectory.h:269
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:194
float pt() const
Definition: PreId.h:92
T const * product() const
Definition: Handle.h:81
bool useTmva_
USE OF TMVA.
tuple tracks
Definition: testEve_cfg.py:39
std::unique_ptr< PFResolutionMap > resMapPhiECAL_
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
float chiSquared() const
Definition: Trajectory.h:252
std::vector< edm::EDGetTokenT< reco::TrackCollection > > tracksContainers_
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
void setTrackProperties(float newchi2, float chi2ratio, float dpt)
Definition: PreId.h:50
edm::EventID id() const
Definition: EventBase.h:56
void setECALMatching(bool accepted, unsigned n=0)
Definition: PreId.h:60
std::map< reco::TrackRef, unsigned > refMap_
Map used to create the TrackRef, PreIdRef value map.
bool producePreId_
Produce the pre-id debugging collection.
std::unique_ptr< PFTrackTransformer > pfTransformer_
PFTrackTransformer.
GoodSeedProducer(const edm::ParameterSet &)
std::string smootherName_
edm::EDGetTokenT< reco::PFClusterCollection > pfCLusTagHCLabel_
std::string fullPath() const
Definition: FileInPath.cc:165
Definition: DDAxes.h:10
Resolution Map (resolution as a function of eta and E)
T x() const
Definition: PV3DBase.h:62
std::string preidgsf_
Name of the Seed(Gsf) Collection.
edm::EDGetTokenT< reco::PFClusterCollection > pfCLusTagECLabel_
double minEp_
Min and MAx allowed values forEoverP.
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
std::vector< edm::EDGetTokenT< std::vector< Trajectory > > > trajContainers_
Definition: Run.h:41
double PtThresholdSavePredId_
Threshold to save Pre Idinfo.
Global3DVector GlobalVector
Definition: GlobalVector.h:10
void setFinalDecision(bool accepted, unsigned n=0)
Definition: PreId.h:56
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:15