CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFElectronTranslator.cc
Go to the documentation of this file.
20 
21 
24  = iConfig.getParameter<edm::InputTag>("PFCandidate");
26  = iConfig.getParameter<edm::InputTag>("PFCandidateElectron");
28  = iConfig.getParameter<edm::InputTag>("GSFTracks");
29 
30  edm::ParameterSet isoVals = iConfig.getParameter<edm::ParameterSet> ("isolationValues");
31  inputTagIsoVals_.push_back(isoVals.getParameter<edm::InputTag>("pfChargedHadrons"));
32  inputTagIsoVals_.push_back(isoVals.getParameter<edm::InputTag>("pfPhotons"));
33  inputTagIsoVals_.push_back(isoVals.getParameter<edm::InputTag>("pfNeutralHadrons"));
34 
35  PFBasicClusterCollection_ = iConfig.getParameter<std::string>("PFBasicClusters");
36  PFPreshowerClusterCollection_ = iConfig.getParameter<std::string>("PFPreshowerClusters");
37  PFSuperClusterCollection_ = iConfig.getParameter<std::string>("PFSuperClusters");
38  GsfElectronCoreCollection_ = iConfig.getParameter<std::string>("PFGsfElectronCore");
39  GsfElectronCollection_ = iConfig.getParameter<std::string>("PFGsfElectron");
40 
41  PFMVAValueMap_ = iConfig.getParameter<std::string>("ElectronMVA");
42  PFSCValueMap_ = iConfig.getParameter<std::string>("ElectronSC");
43  MVACut_ = (iConfig.getParameter<edm::ParameterSet>("MVACutBlock")).getParameter<double>("MVACut");
44  checkStatusFlag_ = iConfig.getParameter<bool>("CheckStatusFlag");
45 
46  if (iConfig.exists("emptyIsOk")) emptyIsOk_ = iConfig.getParameter<bool>("emptyIsOk");
47  else emptyIsOk_=false;
48 
49  produces<reco::BasicClusterCollection>(PFBasicClusterCollection_);
50  produces<reco::PreshowerClusterCollection>(PFPreshowerClusterCollection_);
51  produces<reco::SuperClusterCollection>(PFSuperClusterCollection_);
52  produces<reco::GsfElectronCoreCollection>(GsfElectronCoreCollection_);
53  produces<reco::GsfElectronCollection>(GsfElectronCollection_);
54  produces<edm::ValueMap<float> >(PFMVAValueMap_);
55  produces<edm::ValueMap<reco::SuperClusterRef> >(PFSCValueMap_);
56 }
57 
59 
61 
63  const edm::EventSetup& iSetup) {
64 
65  std::auto_ptr<reco::GsfElectronCoreCollection>
66  gsfElectronCores_p(new reco::GsfElectronCoreCollection);
67 
68  std::auto_ptr<reco::GsfElectronCollection>
69  gsfElectrons_p(new reco::GsfElectronCollection);
70 
71  std::auto_ptr<reco::SuperClusterCollection>
72  superClusters_p(new reco::SuperClusterCollection);
73 
74  std::auto_ptr<reco::BasicClusterCollection>
75  basicClusters_p(new reco::BasicClusterCollection);
76 
77  std::auto_ptr<reco::PreshowerClusterCollection>
78  psClusters_p(new reco::PreshowerClusterCollection);
79 
80  std::auto_ptr<edm::ValueMap<float> > mvaMap_p(new edm::ValueMap<float>());
81  edm::ValueMap<float>::Filler mvaFiller(*mvaMap_p);
82 
83  std::auto_ptr<edm::ValueMap<reco::SuperClusterRef> >
86 
87 
89  bool status=fetchCandidateCollection(pfCandidates,
91  iEvent );
92 
93  IsolationValueMaps isolationValues(inputTagIsoVals_.size());
94  for (size_t j = 0; j<inputTagIsoVals_.size(); ++j) {
95  iEvent.getByLabel(inputTagIsoVals_[j], isolationValues[j]);
96  }
97 
98 
99  // clear the vectors
100  GsfTrackRef_.clear();
101  CandidatePtr_.clear();
102  ambiguousGsfTracks_.clear();
103  kfTrackRef_.clear();
104  basicClusters_.clear();
105  pfClusters_.clear();
106  preshowerClusters_.clear();
107  superClusters_.clear();
108  basicClusterPtr_.clear();
109  preshowerClusterPtr_.clear();
110  gsfPFCandidateIndex_.clear();
111  gsfElectronCoreRefs_.clear();
112  scMap_.clear();
113 
114 
115  // loop on the candidates
116  //CC@@
117  // we need first to create AND put the SuperCluster,
118  // basic clusters and presh clusters collection
119  // in order to get a working Handle
120  unsigned ncand=(status)?pfCandidates->size():0;
121  unsigned iGSF=0;
122  for( unsigned i=0; i<ncand; ++i ) {
123 
124  const reco::PFCandidate& cand = (*pfCandidates)[i];
125  if(cand.particleId()!=reco::PFCandidate::e) continue;
126  if(cand.gsfTrackRef().isNull()) continue;
127  // Note that -1 will still cut some total garbage candidates
128  // Fill the MVA map
129  if(cand.mva_e_pi()<MVACut_) continue;
130 
131  // Check the status flag
133  continue;
134  }
135 
136  GsfTrackRef_.push_back(cand.gsfTrackRef());
137  kfTrackRef_.push_back(cand.trackRef());
138  gsfPFCandidateIndex_.push_back(i);
139 
140  reco::PFCandidatePtr ptrToPFElectron(pfCandidates,i);
141  //CandidatePtr_.push_back(ptrToPFElectron->sourceCandidatePtr(0));
142  CandidatePtr_.push_back(ptrToPFElectron);
143 
145  pfClusters_.push_back(std::vector<const reco::PFCluster *>());
147  ambiguousGsfTracks_.push_back(std::vector<reco::GsfTrackRef>());
148 
149  for(unsigned iele=0; iele<cand.elementsInBlocks().size(); ++iele) {
150  // first get the block
151  reco::PFBlockRef blockRef = cand.elementsInBlocks()[iele].first;
152  //
153  unsigned elementIndex = cand.elementsInBlocks()[iele].second;
154  // check it actually exists
155  if(blockRef.isNull()) continue;
156 
157  // then get the elements of the block
158  const edm::OwnVector< reco::PFBlockElement >& elements = (*blockRef).elements();
159 
160  const reco::PFBlockElement & pfbe (elements[elementIndex]);
161  // The first ECAL element should be the cluster associated to the GSF; defined as the seed
162  if(pfbe.type()==reco::PFBlockElement::ECAL)
163  {
164  // const reco::PFCandidate * coCandidate = &cand;
165  // the Brem photons are saved as daughter PFCandidate; this
166  // is convenient to access the corrected energy
167  // std::cout << " Found candidate " << correspondingDaughterCandidate(coCandidate,pfbe) << " " << coCandidate << std::endl;
169  }
170  if(pfbe.type()==reco::PFBlockElement::PS1)
171  {
173  }
174  if(pfbe.type()==reco::PFBlockElement::PS2)
175  {
177  }
178  if(pfbe.type()==reco::PFBlockElement::GSF)
179  {
181  }
182 
183  } // loop on the elements
184 
185  // save the basic clusters
186  basicClusters_p->insert(basicClusters_p->end(),basicClusters_[iGSF].begin(), basicClusters_[iGSF].end());
187  // save the preshower clusters
188  psClusters_p->insert(psClusters_p->end(),preshowerClusters_[iGSF].begin(),preshowerClusters_[iGSF].end());
189 
190  ++iGSF;
191  } // loop on PFCandidates
192 
193 
194  //Save the basic clusters and get an handle as to be able to create valid Refs (thanks to Claude)
195  // std::cout << " Number of basic clusters " << basicClusters_p->size() << std::endl;
197  iEvent.put(basicClusters_p,PFBasicClusterCollection_);
198 
199  //preshower clusters
201  iEvent.put(psClusters_p,PFPreshowerClusterCollection_);
202 
203  // now that the Basic clusters are in the event, the Ref can be created
204  createBasicClusterPtrs(bcRefProd);
205  // now that the preshower clusters are in the event, the Ref can be created
206  createPreshowerClusterPtrs(psRefProd);
207 
208  // and now the Super cluster can be created with valid references
209  if(status) createSuperClusters(*pfCandidates,*superClusters_p);
210 
211  // Let's put the super clusters in the event
212  const edm::OrphanHandle<reco::SuperClusterCollection> scRefProd = iEvent.put(superClusters_p,PFSuperClusterCollection_);
213  // create the super cluster Ref
214  createSuperClusterGsfMapRefs(scRefProd);
215 
216  // Now create the GsfElectronCoers
217  createGsfElectronCores(*gsfElectronCores_p);
218  // Put them in the as to get to be able to build a Ref
219  const edm::OrphanHandle<reco::GsfElectronCoreCollection> gsfElectronCoreRefProd =
220  iEvent.put(gsfElectronCores_p,GsfElectronCoreCollection_);
221 
222  // now create the Refs
223  createGsfElectronCoreRefs(gsfElectronCoreRefProd);
224 
225  // now make the GsfElectron
226  createGsfElectrons(*pfCandidates,isolationValues,*gsfElectrons_p);
227  iEvent.put(gsfElectrons_p,GsfElectronCollection_);
228 
229  fillMVAValueMap(iEvent,mvaFiller);
230  mvaFiller.fill();
231 
232  fillSCRefValueMap(iEvent,scRefFiller);
233  scRefFiller.fill();
234 
235  // MVA map
236  iEvent.put(mvaMap_p,PFMVAValueMap_);
237  // Gsf-SC map
238  iEvent.put(scMap_p,PFSCValueMap_);
239 
240 
241 
242 }
243 
244 
245 
247  const edm::InputTag& tag,
248  const edm::Event& iEvent) const {
249  bool found = iEvent.getByLabel(tag, c);
250 
251  if(!found && !emptyIsOk_)
252  {
253  std::ostringstream err;
254  err<<" cannot get PFCandidates: "
255  <<tag<<std::endl;
256  edm::LogError("PFElectronTranslator")<<err.str();
257  }
258  return found;
259 
260 }
261 
263  const edm::InputTag& tag,
264  const edm::Event& iEvent) const {
265  bool found = iEvent.getByLabel(tag, c);
266 
267  if(!found ) {
268  std::ostringstream err;
269  err<<" cannot get GSFTracks: "
270  <<tag<<std::endl;
271  edm::LogError("PFElectronTranslator")<<err.str();
272  throw cms::Exception( "MissingProduct", err.str());
273  }
274 }
275 
276 // The basic cluster is a copy of the PFCluster -> the energy is not corrected
277 // It should be possible to get the corrected energy (including the associated PS energy)
278 // from the PFCandidate daugthers ; Needs some work
280  reco::BasicClusterCollection & basicClusters,
281  std::vector<const reco::PFCluster *> & pfClusters,
282  const reco::PFCandidate & coCandidate) const
283 {
284  reco::PFClusterRef myPFClusterRef= PFBE.clusterRef();
285  if(myPFClusterRef.isNull()) return;
286 
287  const reco::PFCluster & myPFCluster (*myPFClusterRef);
288  pfClusters.push_back(&myPFCluster);
289 // std::cout << " Creating BC " << myPFCluster.energy() << " " << coCandidate.ecalEnergy() <<" "<< coCandidate.rawEcalEnergy() <<std::endl;
290 // std::cout << " # hits " << myPFCluster.hitsAndFractions().size() << std::endl;
291 
292 // basicClusters.push_back(reco::CaloCluster(myPFCluster.energy(),
293  basicClusters.push_back(reco::CaloCluster(
294  // myPFCluster.energy(),
295  coCandidate.rawEcalEnergy(),
296  myPFCluster.position(),
297  myPFCluster.caloID(),
298  myPFCluster.hitsAndFractions(),
299  myPFCluster.algo(),
300  myPFCluster.seed()));
301 }
302 
303 
305 {
306  reco::PFClusterRef myPFClusterRef= PFBE.clusterRef();
307  preshowerClusters.push_back(reco::PreshowerCluster(myPFClusterRef->energy(),myPFClusterRef->position(),
308  myPFClusterRef->hitsAndFractions(),plane));
309 }
310 
312 {
313  unsigned size=GsfTrackRef_.size();
314  unsigned basicClusterCounter=0;
315  basicClusterPtr_.resize(size);
316 
317  for(unsigned iGSF=0;iGSF<size;++iGSF) // loop on tracks
318  {
319  unsigned nbc=basicClusters_[iGSF].size();
320  for(unsigned ibc=0;ibc<nbc;++ibc) // loop on basic clusters
321  {
322  // std::cout << "Track "<< iGSF << " ref " << basicClusterCounter << std::endl;
323  reco::CaloClusterPtr bcPtr(basicClustersHandle,basicClusterCounter);
324  basicClusterPtr_[iGSF].push_back(bcPtr);
325  ++basicClusterCounter;
326  }
327  }
328 }
329 
331 {
332  unsigned size=GsfTrackRef_.size();
333  unsigned psClusterCounter=0;
334  preshowerClusterPtr_.resize(size);
335 
336  for(unsigned iGSF=0;iGSF<size;++iGSF) // loop on tracks
337  {
338  unsigned nbc=preshowerClusters_[iGSF].size();
339  for(unsigned ibc=0;ibc<nbc;++ibc) // loop on basic clusters
340  {
341  // std::cout << "Track "<< iGSF << " ref " << basicClusterCounter << std::endl;
342  reco::CaloClusterPtr psPtr(preshowerClustersHandle,psClusterCounter);
343  preshowerClusterPtr_[iGSF].push_back(psPtr);
344  ++psClusterCounter;
345  }
346  }
347 }
348 
350 {
351  unsigned size=GsfTrackRef_.size();
352 
353  for(unsigned iGSF=0;iGSF<size;++iGSF) // loop on tracks
354  {
355  edm::Ref<reco::SuperClusterCollection> scRef(superClustersHandle,iGSF);
356  scMap_[GsfTrackRef_[iGSF]]=scRef;
357  }
358 }
359 
360 
362 {
363  gsfMvaMap_.clear();
365  bool status=fetchCandidateCollection(pfCandidates,
367  iEvent );
368 
369  unsigned ncand=(status)?pfCandidates->size():0;
370  for( unsigned i=0; i<ncand; ++i ) {
371 
372  const reco::PFCandidate& cand = (*pfCandidates)[i];
373  if(cand.particleId()!=reco::PFCandidate::e) continue;
374  if(cand.gsfTrackRef().isNull()) continue;
375  // Fill the MVA map
376  gsfMvaMap_[cand.gsfTrackRef()]=cand.mva_e_pi();
377  }
378 
380  fetchGsfCollection(gsfTracks,
382  iEvent);
383  unsigned ngsf=gsfTracks->size();
384  std::vector<float> values;
385  for(unsigned igsf=0;igsf<ngsf;++igsf)
386  {
387  reco::GsfTrackRef theTrackRef(gsfTracks, igsf);
388  std::map<reco::GsfTrackRef,float>::const_iterator itcheck=gsfMvaMap_.find(theTrackRef);
389  if(itcheck==gsfMvaMap_.end())
390  {
391  // edm::LogWarning("PFElectronTranslator") << "MVA Map, missing GSF track ref " << std::endl;
392  values.push_back(-99.);
393  // std::cout << " Push_back -99. " << std::endl;
394  }
395  else
396  {
397  // std::cout << " Value " << itcheck->second << std::endl;
398  values.push_back(itcheck->second);
399  }
400  }
401  filler.insert(gsfTracks,values.begin(),values.end());
402 }
403 
404 
407 {
409  fetchGsfCollection(gsfTracks,
411  iEvent);
412  unsigned ngsf=gsfTracks->size();
413  std::vector<reco::SuperClusterRef> values;
414  for(unsigned igsf=0;igsf<ngsf;++igsf)
415  {
416  reco::GsfTrackRef theTrackRef(gsfTracks, igsf);
417  std::map<reco::GsfTrackRef,reco::SuperClusterRef>::const_iterator itcheck=scMap_.find(theTrackRef);
418  if(itcheck==scMap_.end())
419  {
420  // edm::LogWarning("PFElectronTranslator") << "SCRef Map, missing GSF track ref" << std::endl;
421  values.push_back(reco::SuperClusterRef());
422  }
423  else
424  {
425  values.push_back(itcheck->second);
426  }
427  }
428  filler.insert(gsfTracks,values.begin(),values.end());
429 }
430 
431 
433  reco::SuperClusterCollection &superClusters) const
434 {
435  unsigned nGSF=GsfTrackRef_.size();
436  for(unsigned iGSF=0;iGSF<nGSF;++iGSF)
437  {
438 
439  // Computes energy position a la e/gamma
440  double sclusterE=0;
441  double posX=0.;
442  double posY=0.;
443  double posZ=0.;
444 
445  unsigned nbasics=basicClusters_[iGSF].size();
446  for(unsigned ibc=0;ibc<nbasics;++ibc)
447  {
448  double e = basicClusters_[iGSF][ibc].energy();
449  sclusterE += e;
450  posX += e * basicClusters_[iGSF][ibc].position().X();
451  posY += e * basicClusters_[iGSF][ibc].position().Y();
452  posZ += e * basicClusters_[iGSF][ibc].position().Z();
453  }
454  posX /=sclusterE;
455  posY /=sclusterE;
456  posZ /=sclusterE;
457 
458  if(pfCand[gsfPFCandidateIndex_[iGSF]].gsfTrackRef()!=GsfTrackRef_[iGSF])
459  {
460  edm::LogError("PFElectronTranslator") << " Major problem in PFElectron Translator" << std::endl;
461  }
462 
463  // compute the width
464  PFClusterWidthAlgo pfwidth(pfClusters_[iGSF]);
465 
466  double correctedEnergy=pfCand[gsfPFCandidateIndex_[iGSF]].ecalEnergy();
467  reco::SuperCluster mySuperCluster(correctedEnergy,math::XYZPoint(posX,posY,posZ));
468  // protection against empty basic cluster collection ; the value is -2 in this case
469  if(nbasics)
470  {
471 // std::cout << "SuperCluster creation; energy " << pfCand[gsfPFCandidateIndex_[iGSF]].ecalEnergy();
472 // std::cout << " " << pfCand[gsfPFCandidateIndex_[iGSF]].rawEcalEnergy() << std::endl;
473 // std::cout << "Seed energy from basic " << basicClusters_[iGSF][0].energy() << std::endl;
474  mySuperCluster.setSeed(basicClusterPtr_[iGSF][0]);
475  }
476  else
477  {
478  // std::cout << "SuperCluster creation ; seed energy " << 0 << std::endl;
479 // std::cout << "SuperCluster creation ; energy " << pfCand[gsfPFCandidateIndex_[iGSF]].ecalEnergy();
480 // std::cout << " " << pfCand[gsfPFCandidateIndex_[iGSF]].rawEcalEnergy() << std::endl;
481 // std::cout << " No seed found " << 0 << std::endl;
482 // std::cout << " MVA " << pfCand[gsfPFCandidateIndex_[iGSF]].mva_e_pi() << std::endl;
483  mySuperCluster.setSeed(reco::CaloClusterPtr());
484  }
485  // the seed should be the first basic cluster
486 
487  for(unsigned ibc=0;ibc<nbasics;++ibc)
488  {
489  mySuperCluster.addCluster(basicClusterPtr_[iGSF][ibc]);
490  // std::cout <<"Adding Ref to SC " << basicClusterPtr_[iGSF][ibc].index() << std::endl;
491  const std::vector< std::pair<DetId, float> > & v1 = basicClusters_[iGSF][ibc].hitsAndFractions();
492  // std::cout << " Number of cells " << v1.size() << std::endl;
493  for( std::vector< std::pair<DetId, float> >::const_iterator diIt = v1.begin();
494  diIt != v1.end();
495  ++diIt ) {
496  // std::cout << " Adding DetId " << (diIt->first).rawId() << " " << diIt->second << std::endl;
497  mySuperCluster.addHitAndFraction(diIt->first,diIt->second);
498  } // loop over rechits
499  }
500 
501  unsigned nps=preshowerClusterPtr_[iGSF].size();
502  for(unsigned ips=0;ips<nps;++ips)
503  {
504  mySuperCluster.addPreshowerCluster(preshowerClusterPtr_[iGSF][ips]);
505  }
506 
507 
508  // Set the preshower energy
509  mySuperCluster.setPreshowerEnergy(pfCand[gsfPFCandidateIndex_[iGSF]].pS1Energy()+
510  pfCand[gsfPFCandidateIndex_[iGSF]].pS2Energy());
511 
512  // Set the cluster width
513  mySuperCluster.setEtaWidth(pfwidth.pflowEtaWidth());
514  mySuperCluster.setPhiWidth(pfwidth.pflowPhiWidth());
515  // Force the computation of rawEnergy_ of the reco::SuperCluster
516  mySuperCluster.rawEnergy();
517  superClusters.push_back(mySuperCluster);
518  }
519 }
520 
521 
523 {
524  unsigned refindex=pfbe.index();
525  // std::cout << " N daughters " << cand.numberOfDaughters() << std::endl;
526  reco::PFCandidate::const_iterator myDaughterCandidate=cand.begin();
528 
529  for(;myDaughterCandidate!=itend;++myDaughterCandidate)
530  {
531  const reco::PFCandidate * myPFCandidate = (const reco::PFCandidate*)&*myDaughterCandidate;
532  if(myPFCandidate->elementsInBlocks().size()!=1)
533  {
534  // std::cout << " Daughter with " << myPFCandidate.elementsInBlocks().size()<< " element in block " << std::endl;
535  return cand;
536  }
537  if(myPFCandidate->elementsInBlocks()[0].second==refindex)
538  {
539  // std::cout << " Found it " << cand << std::endl;
540  return *myPFCandidate;
541  }
542  }
543  return cand;
544 }
545 
547  unsigned nGSF=GsfTrackRef_.size();
548  for(unsigned iGSF=0;iGSF<nGSF;++iGSF)
549  {
550  reco::GsfElectronCore myElectronCore(GsfTrackRef_[iGSF]);
551  myElectronCore.setCtfTrack(kfTrackRef_[iGSF],-1.);
552  std::map<reco::GsfTrackRef,reco::SuperClusterRef>::const_iterator
553  itcheck=scMap_.find(GsfTrackRef_[iGSF]);
554  if(itcheck!=scMap_.end())
555  myElectronCore.setPflowSuperCluster(itcheck->second);
556  gsfElectronCores.push_back(myElectronCore);
557  }
558 }
559 
561  unsigned size=GsfTrackRef_.size();
562 
563  for(unsigned iGSF=0;iGSF<size;++iGSF) // loop on tracks
564  {
565  edm::Ref<reco::GsfElectronCoreCollection> elecCoreRef(gsfElectronCoreHandle,iGSF);
566  gsfElectronCoreRefs_.push_back(elecCoreRef);
567  }
568 }
569 
570 void PFElectronTranslator::getAmbiguousGsfTracks(const reco::PFBlockElement & PFBE, std::vector<reco::GsfTrackRef>& tracks) const {
571  const reco::PFBlockElementGsfTrack * GsfEl = dynamic_cast<const reco::PFBlockElementGsfTrack*>(&PFBE);
572  if(GsfEl==0) return;
573  const std::vector<reco::GsfPFRecTrackRef>& ambPFRecTracks(GsfEl->GsftrackRefPF()->convBremGsfPFRecTrackRef());
574  unsigned ntracks=ambPFRecTracks.size();
575  for(unsigned it=0;it<ntracks;++it) {
576  tracks.push_back(ambPFRecTracks[it]->gsfTrackRef());
577  }
578 }
579 
580 
582  const IsolationValueMaps& isolationValues,
583  reco::GsfElectronCollection &gsfelectrons) {
584  unsigned size=GsfTrackRef_.size();
585 
586  for(unsigned iGSF=0;iGSF<size;++iGSF) // loop on tracks
587  {
588  const reco::PFCandidate& pfCandidate(pfcand[gsfPFCandidateIndex_[iGSF]]);
589  // Electron
590  reco::GsfElectron myElectron(gsfElectronCoreRefs_[iGSF]);
591  // Warning set p4 error !
592  myElectron.setP4(reco::GsfElectron::P4_PFLOW_COMBINATION, pfCandidate.p4(),pfCandidate.deltaP(), true);
593 
594  // MVA inputs
595  reco::GsfElectron::MvaInput myMvaInput;
596  myMvaInput.earlyBrem = pfCandidate.electronExtraRef()->mvaVariable(reco::PFCandidateElectronExtra::MVA_FirstBrem);
597  myMvaInput.lateBrem = pfCandidate.electronExtraRef()->mvaVariable(reco::PFCandidateElectronExtra::MVA_LateBrem);
599  myMvaInput.sigmaEtaEta = pfCandidate.electronExtraRef()->sigmaEtaEta();
600  myMvaInput.hadEnergy = pfCandidate.electronExtraRef()->hadEnergy();
601 
602  // Mustache
603  reco::Mustache myMustache;
604  myMustache.MustacheID(*(myElectron. pflowSuperCluster()), myMvaInput.nClusterOutsideMustache, myMvaInput.etOutsideMustache );
605 
606  myElectron.setMvaInput(myMvaInput);
607 
608  // MVA output
609  reco::GsfElectron::MvaOutput myMvaOutput;
610  myMvaOutput.status = pfCandidate.electronExtraRef()->electronStatus();
611  myMvaOutput.mva = pfCandidate.mva_e_pi();
612  myElectron.setMvaOutput(myMvaOutput);
613 
614  // ambiguous tracks
615  unsigned ntracks=ambiguousGsfTracks_[iGSF].size();
616  for(unsigned it=0;it<ntracks;++it) {
617  myElectron.addAmbiguousGsfTrack(ambiguousGsfTracks_[iGSF][it]);
618  }
619 
620  // isolation
622  myPFIso.chargedHadronIso=(*isolationValues[0])[CandidatePtr_[iGSF]];
623  myPFIso.photonIso=(*isolationValues[1])[CandidatePtr_[iGSF]];
624  myPFIso.neutralHadronIso=(*isolationValues[2])[CandidatePtr_[iGSF]];
625  myElectron.setPfIsolationVariables(myPFIso);
626 
627  gsfelectrons.push_back(myElectron);
628  }
629 
630 }
631 
632 
std::vector< std::vector< const reco::PFCluster * > > pfClusters_
T getParameter(std::string const &) const
std::string PFPreshowerClusterCollection_
Abstract base class for a PFBlock element (track, cluster...)
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:123
void setCtfTrack(const TrackRef &closestCtfTrack, float ctfGsfOverlap)
int i
Definition: DBlmapReader.cc:9
void setP4(P4Kind kind, const LorentzVector &p4, float p4Error, bool setCandidate)
Definition: GsfElectron.cc:178
bool fetchCandidateCollection(edm::Handle< reco::PFCandidateCollection > &c, const edm::InputTag &tag, const edm::Event &iEvent) const
double rawEcalEnergy() const
return corrected Ecal energy
Definition: PFCandidate.h:192
void addHitAndFraction(DetId id, float fraction)
Definition: CaloCluster.h:182
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:42
void createGsfElectronCoreRefs(const edm::OrphanHandle< reco::GsfElectronCoreCollection > &gsfElectronCoreHandle)
std::map< reco::GsfTrackRef, float > gsfMvaMap_
virtual const_iterator end() const
last daughter const_iterator
std::vector< edm::Handle< edm::ValueMap< double > > > IsolationValueMaps
Type type() const
std::vector< reco::CaloClusterPtrVector > basicClusterPtr_
std::vector< reco::GsfElectronCoreRef > gsfElectronCoreRefs_
double pflowPhiWidth() const
void setMvaInput(const MvaInput &mi)
Definition: GsfElectron.h:563
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:53
void createBasicClusterPtrs(const edm::OrphanHandle< reco::BasicClusterCollection > &basicClustersHandle)
bool exists(std::string const &parameterName) const
checks if a parameter exists
list elements
Definition: asciidump.py:414
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:189
void setSeed(const CaloClusterPtr &r)
list of used xtals by DetId // now inherited by CaloCluster
Definition: SuperCluster.h:83
std::string GsfElectronCollection_
void setPfIsolationVariables(const PflowIsolationVariables &iso)
Definition: GsfElectron.h:562
void setPhiWidth(double pw)
Definition: SuperCluster.h:58
void setMvaOutput(const MvaOutput &mo)
Definition: GsfElectron.h:564
double pflowEtaWidth() const
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
void fillSCRefValueMap(edm::Event &iEvent, edm::ValueMap< reco::SuperClusterRef >::Filler &filler) const
const ElementsInBlocks & elementsInBlocks() const
Definition: PFCandidate.h:342
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
reco::TrackRef trackRef() const
Definition: PFCandidate.cc:339
AlgoId algo() const
algorithm identifier
Definition: CaloCluster.h:169
void setPflowSuperCluster(const SuperClusterRef &scl)
void setEtaWidth(double ew)
Definition: SuperCluster.h:59
std::vector< reco::GsfTrackRef > GsfTrackRef_
int iEvent
Definition: GenABIO.cc:243
bool isNull() const
Checks for null.
Definition: Ref.h:247
void fillMVAValueMap(edm::Event &iEvent, edm::ValueMap< float >::Filler &filler)
const CaloID & caloID() const
Definition: CaloCluster.h:180
const reco::PFCandidate & correspondingDaughterCandidate(const reco::PFCandidate &cand, const reco::PFBlockElement &pfbe) const
unsigned index() const
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
std::vector< GsfElectronCore > GsfElectronCoreCollection
std::vector< reco::PreshowerClusterCollection > preshowerClusters_
virtual const_iterator begin() const
first daughter const_iterator
virtual PFClusterRef clusterRef() const
void createSuperClusterGsfMapRefs(const edm::OrphanHandle< reco::SuperClusterCollection > &superClustersHandle)
int j
Definition: DBlmapReader.cc:9
std::vector< PreshowerCluster > PreshowerClusterCollection
collection of PreshowerCluster objects
virtual void produce(edm::Event &, const edm::EventSetup &)
std::vector< int > gsfPFCandidateIndex_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
edm::InputTag inputTagPFCandidateElectrons_
std::vector< reco::CandidatePtr > CandidatePtr_
edm::InputTag inputTagPFCandidates_
std::vector< std::vector< reco::GsfTrackRef > > ambiguousGsfTracks_
std::map< reco::GsfTrackRef, reco::SuperClusterRef > scMap_
edm::InputTag inputTagGSFTracks_
float mva_e_pi() const
mva for electron-pion discrimination
Definition: PFCandidate.h:274
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
double rawEnergy() const
raw uncorrected energy (sum of energies of component BasicClusters)
Definition: SuperCluster.h:47
reco::PFCandidateElectronExtraRef electronExtraRef() const
return a reference to the electron extra
Definition: PFCandidate.cc:489
void MustacheID(CaloClusterPtrVector &clusters, int &nclusters, float &EoutsideMustache)
Definition: Mustache.cc:17
DetId seed() const
return DetId of seed
Definition: CaloCluster.h:199
void fetchGsfCollection(edm::Handle< reco::GsfTrackCollection > &c, const edm::InputTag &tag, const edm::Event &iEvent) const
std::string PFBasicClusterCollection_
void createBasicCluster(const reco::PFBlockElement &, reco::BasicClusterCollection &basicClusters, std::vector< const reco::PFCluster * > &, const reco::PFCandidate &coCandidate) const
std::vector< reco::SuperClusterCollection > superClusters_
tuple tracks
Definition: testEve_cfg.py:39
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
std::vector< reco::CaloClusterPtrVector > preshowerClusterPtr_
void createSuperClusters(const reco::PFCandidateCollection &, reco::SuperClusterCollection &superClusters) const
void addPreshowerCluster(const CaloClusterPtr &r)
add reference to constituent BasicCluster
Definition: SuperCluster.h:92
void getAmbiguousGsfTracks(const reco::PFBlockElement &PFBE, std::vector< reco::GsfTrackRef > &) const
std::string GsfElectronCoreCollection_
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
std::vector< edm::InputTag > inputTagIsoVals_
void addCluster(const CaloClusterPtr &r)
add reference to constituent BasicCluster
Definition: SuperCluster.h:86
std::vector< reco::BasicClusterCollection > basicClusters_
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:33
std::vector< reco::TrackRef > kfTrackRef_
void createPreshowerCluster(const reco::PFBlockElement &PFBE, reco::PreshowerClusterCollection &preshowerClusters, unsigned plane) const
PFElectronTranslator(const edm::ParameterSet &)
reco::GsfTrackRef gsfTrackRef() const
Definition: PFCandidate.cc:376
GsfPFRecTrackRef GsftrackRefPF() const
std::string PFSuperClusterCollection_
void createGsfElectronCores(reco::GsfElectronCoreCollection &) const
tuple status
Definition: ntuplemaker.py:245
virtual ParticleType particleId() const
Definition: PFCandidate.h:324
void createGsfElectrons(const reco::PFCandidateCollection &, const IsolationValueMaps &isolationValues, reco::GsfElectronCollection &)
void addAmbiguousGsfTrack(const reco::GsfTrackRef &t)
Definition: GsfElectron.h:597
void createPreshowerClusterPtrs(const edm::OrphanHandle< reco::PreshowerClusterCollection > &preshowerClustersHandle)
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
virtual void beginRun(edm::Run &run, const edm::EventSetup &c)
tuple size
Write out results.
double deltaP() const
uncertainty on 3-momentum
Definition: PFCandidate.h:260
Definition: Run.h:33
void setPreshowerEnergy(double preshowerEnergy)
Definition: SuperCluster.h:57