CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFEGammaProducer.cc
Go to the documentation of this file.
2 
3 
19 
21 #include <sstream>
22 
23 #include "TFile.h"
24 
25 //#define PFLOW_DEBUG
26 
27 #ifdef PFLOW_DEBUG
28 #define docast(x,y) dynamic_cast<x>(y)
29 #define LOGVERB(x) edm::LogVerbatim(x)
30 #define LOGWARN(x) edm::LogWarning(x)
31 #define LOGERR(x) edm::LogError(x)
32 #define LOGDRESSED(x) edm::LogInfo(x)
33 #else
34 #define docast(x,y) reinterpret_cast<x>(y)
35 #define LOGVERB(x) LogTrace(x)
36 #define LOGWARN(x) edm::LogWarning(x)
37 #define LOGERR(x) edm::LogError(x)
38 #define LOGDRESSED(x) LogDebug(x)
39 #endif
40 
41 namespace {
42  typedef std::list< reco::PFBlockRef >::iterator IBR;
43 }
44 
47  primaryVertex_(reco::Vertex()),
48  ebeeClustersCollection_("EBEEClusters"),
49  esClustersCollection_("ESClusters") {
50 
51  PFEGammaAlgo::PFEGConfigInfo algo_config;
52 
54  = consumes<reco::PFBlockCollection>(iConfig.getParameter<edm::InputTag>("blocks"));
55 
56  eetopsSrc_ = consumes<reco::PFCluster::EEtoPSAssociation>(iConfig.getParameter<edm::InputTag>("EEtoPS_source"));
57 
58  algo_config.useReg
59  = iConfig.getParameter<bool>("usePhotonReg");
60 
62  = iConfig.getParameter<bool>("useVerticesForNeutral");
63 
65  = iConfig.getParameter<bool>("useRegressionFromDB");
66 
67 
68  std::vector<double> calibPFSCEle_Fbrem_barrel;
69  std::vector<double> calibPFSCEle_Fbrem_endcap;
70  std::vector<double> calibPFSCEle_barrel;
71  std::vector<double> calibPFSCEle_endcap;
72  algo_config.usePFSCEleCalib = iConfig.getParameter<bool>("usePFSCEleCalib");
73  calibPFSCEle_Fbrem_barrel = iConfig.getParameter<std::vector<double> >("calibPFSCEle_Fbrem_barrel");
74  calibPFSCEle_Fbrem_endcap = iConfig.getParameter<std::vector<double> >("calibPFSCEle_Fbrem_endcap");
75  calibPFSCEle_barrel = iConfig.getParameter<std::vector<double> >("calibPFSCEle_barrel");
76  calibPFSCEle_endcap = iConfig.getParameter<std::vector<double> >("calibPFSCEle_endcap");
77  std::shared_ptr<PFSCEnergyCalibration>
78  thePFSCEnergyCalibration ( new PFSCEnergyCalibration(calibPFSCEle_Fbrem_barrel,calibPFSCEle_Fbrem_endcap,
79  calibPFSCEle_barrel,calibPFSCEle_endcap ));
80 
81  algo_config.useEGammaSupercluster =
82  iConfig.getParameter<bool>("useEGammaSupercluster");
84  iConfig.getParameter<bool>("produceEGCandsWithNoSuperCluster");
85  algo_config.sumEtEcalIsoForEgammaSC_barrel =
86  iConfig.getParameter<double>("sumEtEcalIsoForEgammaSC_barrel");
87  algo_config.sumEtEcalIsoForEgammaSC_endcap =
88  iConfig.getParameter<double>("sumEtEcalIsoForEgammaSC_endcap");
89  algo_config.coneEcalIsoForEgammaSC =
90  iConfig.getParameter<double>("coneEcalIsoForEgammaSC");
91  algo_config.sumPtTrackIsoForEgammaSC_barrel =
92  iConfig.getParameter<double>("sumPtTrackIsoForEgammaSC_barrel");
93  algo_config.sumPtTrackIsoForEgammaSC_endcap =
94  iConfig.getParameter<double>("sumPtTrackIsoForEgammaSC_endcap");
95  algo_config.coneTrackIsoForEgammaSC =
96  iConfig.getParameter<double>("coneTrackIsoForEgammaSC");
97  algo_config.nTrackIsoForEgammaSC =
98  iConfig.getParameter<unsigned int>("nTrackIsoForEgammaSC");
99 
100 
101  // register products
102  produces<reco::PFCandidateCollection>();
103  produces<reco::PFCandidateEGammaExtraCollection>();
104  produces<reco::SuperClusterCollection>();
105  produces<reco::CaloClusterCollection>(ebeeClustersCollection_);
106  produces<reco::CaloClusterCollection>(esClustersCollection_);
107  produces<reco::ConversionCollection>();
108 
109  //PFElectrons Configuration
110  algo_config.mvaEleCut
111  = iConfig.getParameter<double>("pf_electron_mvaCut");
112 
113 
114  algo_config. mvaWeightFileEleID
115  = iConfig.getParameter<edm::FileInPath>("pf_electronID_mvaWeightFile").fullPath();
116 
117  algo_config.applyCrackCorrections
118  = iConfig.getParameter<bool>("pf_electronID_crackCorrection");
119 
120  //PFPhoton Configuration
121 
122  std::string path_mvaWeightFileConvID;
123  std::string mvaWeightFileConvID;
124  std::string path_mvaWeightFileGCorr;
125  std::string path_mvaWeightFileLCorr;
126  std::string path_X0_Map;
127  std::string path_mvaWeightFileRes;
128 
129  algo_config.mvaweightfile =
130  iConfig.getParameter<edm::FileInPath>("pf_convID_mvaWeightFile").fullPath();
131  algo_config.mvaConvCut = iConfig.getParameter<double>("pf_conv_mvaCut");
132  algo_config.sumPtTrackIsoForPhoton =
133  iConfig.getParameter<double>("sumPtTrackIsoForPhoton");
134  algo_config.sumPtTrackIsoSlopeForPhoton =
135  iConfig.getParameter<double>("sumPtTrackIsoSlopeForPhoton");
136 
137  algo_config.X0_Map = iConfig.getParameter<std::string>("X0_Map");
138  algo_config.X0_Map =
139  edm::FileInPath( algo_config.X0_Map.c_str() ).fullPath();
140 
141  if(!useRegressionFromDB_) {
142  std::string mvaWeightFileLCorr=iConfig.getParameter<std::string>("pf_locC_mvaWeightFile");
143  path_mvaWeightFileLCorr = edm::FileInPath( mvaWeightFileLCorr.c_str() ).fullPath();
144  std::string mvaWeightFileGCorr=iConfig.getParameter<std::string>("pf_GlobC_mvaWeightFile");
145  path_mvaWeightFileGCorr = edm::FileInPath( mvaWeightFileGCorr.c_str() ).fullPath();
146  std::string mvaWeightFileRes=iConfig.getParameter<std::string>("pf_Res_mvaWeightFile");
147  path_mvaWeightFileRes=edm::FileInPath(mvaWeightFileRes.c_str()).fullPath();
148 
149  TFile *fgbr = new TFile(path_mvaWeightFileGCorr.c_str(),"READ");
150  ReaderGC_ =(const GBRForest*)fgbr->Get("GBRForest");
151  TFile *fgbr2 = new TFile(path_mvaWeightFileLCorr.c_str(),"READ");
152  ReaderLC_ = (const GBRForest*)fgbr2->Get("GBRForest");
153  TFile *fgbr3 = new TFile(path_mvaWeightFileRes.c_str(),"READ");
154  ReaderRes_ = (const GBRForest*)fgbr3->Get("GBRForest");
155  LogDebug("PFEGammaProducer")<<"Will set regressions from binary files " <<std::endl;
156  }
157 
159  = iConfig.getParameter<edm::ParameterSet>("iCfgCandConnector");
160 
161 
162  // fToRead = iConfig.getUntrackedParameter<std::vector<std::string> >("toRead");
163 
165  = iConfig.getParameter<bool>("useCalibrationsFromDB");
166 
167  std::shared_ptr<PFEnergyCalibration> calibration(new PFEnergyCalibration());
168 
169  int algoType
170  = iConfig.getParameter<unsigned>("algoType");
171 
172  switch(algoType) {
173  case 0:
174  //pfAlgo_.reset( new PFAlgo);
175  break;
176  default:
177  assert(0);
178  }
179 
180  //PFEGamma
181  setPFEGParameters(algo_config);
182 
183  //MIKE: Vertex Parameters
184  vertices_ = consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertexCollection"));
185 
186  verbose_ =
187  iConfig.getUntrackedParameter<bool>("verbose",false);
188 
189 // bool debug_ =
190 // iConfig.getUntrackedParameter<bool>("debug",false);
191 
192 }
193 
194 
195 
197 
198 void
200  const edm::EventSetup & es)
201 {
202 
203  /* // kept for historical reasons
204  if(useRegressionFromDB_) {
205 
206  edm::ESHandle<GBRForest> readerPFLCEB;
207  edm::ESHandle<GBRForest> readerPFLCEE;
208  edm::ESHandle<GBRForest> readerPFGCEB;
209  edm::ESHandle<GBRForest> readerPFGCEEHR9;
210  edm::ESHandle<GBRForest> readerPFGCEELR9;
211  edm::ESHandle<GBRForest> readerPFRes;
212  es.get<GBRWrapperRcd>().get("PFLCorrectionBar",readerPFLCEB);
213  ReaderLCEB_=readerPFLCEB.product();
214  es.get<GBRWrapperRcd>().get("PFLCorrectionEnd",readerPFLCEE);
215  ReaderLCEE_=readerPFLCEE.product();
216  es.get<GBRWrapperRcd>().get("PFGCorrectionBar",readerPFGCEB);
217  ReaderGCBarrel_=readerPFGCEB.product();
218  es.get<GBRWrapperRcd>().get("PFGCorrectionEndHighR9",readerPFGCEEHR9);
219  ReaderGCEndCapHighr9_=readerPFGCEEHR9.product();
220  es.get<GBRWrapperRcd>().get("PFGCorrectionEndLowR9",readerPFGCEELR9);
221  ReaderGCEndCapLowr9_=readerPFGCEELR9.product();
222  es.get<GBRWrapperRcd>().get("PFEcalResolution",readerPFRes);
223  ReaderEcalRes_=readerPFRes.product();
224 
225 
226  LogDebug("PFEGammaProducer")<<"setting regressions from DB "<<std::endl;
227 
228  }
229  */
230 
231  //pfAlgo_->setPFPhotonRegWeights(ReaderLC_, ReaderGC_, ReaderRes_);
232 
233 }
234 
235 
236 void
238  const edm::EventSetup& iSetup) {
239 
240  LOGDRESSED("PFEGammaProducer")
241  <<"START event: "
242  <<iEvent.id().event()
243  <<" in run "<<iEvent.id().run()<<std::endl;
244 
245 
246  // reset output collection
250 
251  // Get the EE-PS associations
253  iEvent.getByToken(eetopsSrc_,eetops);
254  pfeg_->setEEtoPSAssociation(eetops);
255 
256  // Get The vertices from the event
257  // and assign dynamic vertex parameters
259  bool gotVertices = iEvent.getByToken(vertices_,vertices);
260  if(!gotVertices) {
261  std::ostringstream err;
262  err<<"Cannot find vertices for this event.Continuing Without them ";
263  edm::LogError("PFEGammaProducer")<<err.str()<<std::endl;
264  }
265 
266  //Assign the PFAlgo Parameters
268 
269  // get the collection of blocks
270 
272 
273  LOGDRESSED("PFEGammaProducer")<<"getting blocks"<<std::endl;
274  bool found = iEvent.getByToken( inputTagBlocks_, blocks );
275 
276  if(!found ) {
277 
278  std::ostringstream err;
279  err<<"cannot find blocks: (tag index)"
280  << std::hex<< inputTagBlocks_.index() << std::dec;
281  edm::LogError("PFEGammaProducer")<<err.str()<<std::endl;
282 
283  throw cms::Exception( "MissingProduct", err.str());
284  }
285 
286  LOGDRESSED("PFEGammaProducer")
287  <<"EGPFlow is starting..."<<std::endl;
288 
289 #ifdef PFLOW_DEBUG
290  assert( blocks.isValid() && "edm::Handle to blocks was null!");
291  std::ostringstream str;
292  //str<<(*pfAlgo_)<<std::endl;
293  // cout << (*pfAlgo_) << std::endl;
294  LOGDRESSED("PFEGammaProducer") <<str.str()<<std::endl;
295 #endif
296 
297  // sort elements in three lists:
298  std::list< reco::PFBlockRef > hcalBlockRefs;
299  std::list< reco::PFBlockRef > ecalBlockRefs;
300  std::list< reco::PFBlockRef > hoBlockRefs;
301  std::list< reco::PFBlockRef > otherBlockRefs;
302 
303  for( unsigned i=0; i<blocks->size(); ++i ) {
304  // reco::PFBlockRef blockref( blockh,i );
305  //reco::PFBlockRef blockref = createBlockRef( *blocks, i);
306  reco::PFBlockRef blockref(blocks, i);
307 
309  elements = blockref->elements();
310 
311  LOGDRESSED("PFEGammaProducer")
312  << "Found " << elements.size()
313  << " PFBlockElements in block: " << i << std::endl;
314 
315  bool singleEcalOrHcal = false;
316  if( elements.size() == 1 ){
317  switch( elements[0].type() ) {
319  edm::LogError("PFEGammaProducer")
320  << "PFBLOCKALGO BUG!!!! Found a SuperCluster in a block by itself!";
324  ecalBlockRefs.push_back( blockref );
325  singleEcalOrHcal = true;
326  break;
330  hcalBlockRefs.push_back( blockref );
331  singleEcalOrHcal = true;
332  break;
334  // Single HO elements are likely to be noise. Not considered for now.
335  hoBlockRefs.push_back( blockref );
336  singleEcalOrHcal = true;
337  break;
338  default:
339  break;
340  }
341  }
342 
343  if(!singleEcalOrHcal) {
344  otherBlockRefs.push_back( blockref );
345  }
346  }//loop blocks
347 
348  // loop on blocks that are not single ecal, single ps1, single ps2 , or
349  // single hcal and produce unbiased collection of EGamma Candidates
350 
351  //printf("loop over blocks\n");
352  unsigned nblcks = 0;
353 
354  // this auto is a const reco::PFBlockRef&
355  for( const auto& blockref : otherBlockRefs ) {
356  ++nblcks;
357  // this auto is a: const edm::OwnVector< reco::PFBlockElement >&
358  const auto& elements = blockref->elements();
359  // make a copy of the link data, which will be edited.
360  //PFBlock::LinkData linkData = block.linkData();
361 
362  // keep track of the elements which are still active.
363  std::vector<bool> active( elements.size(), true );
364 
365  pfeg_->RunPFEG(globalCache(),blockref,active);
366 
367  if( pfeg_->getCandidates().size() ) {
368  LOGDRESSED("PFEGammaProducer")
369  << "Block with " << elements.size()
370  << " elements produced "
371  << pfeg_->getCandidates().size()
372  << " e-g candidates!" << std::endl;
373  }
374 
375  const size_t egsize = egCandidates_->size();
376  egCandidates_->resize(egsize + pfeg_->getCandidates().size());
377  reco::PFCandidateCollection::iterator eginsertfrom =
378  egCandidates_->begin() + egsize;
379  std::move(pfeg_->getCandidates().begin(),
380  pfeg_->getCandidates().end(),
381  eginsertfrom);
382 
383  const size_t egxsize = egExtra_->size();
384  egExtra_->resize(egxsize + pfeg_->getEGExtra().size());
385  reco::PFCandidateEGammaExtraCollection::iterator egxinsertfrom =
386  egExtra_->begin() + egxsize;
387  std::move(pfeg_->getEGExtra().begin(),
388  pfeg_->getEGExtra().end(),
389  egxinsertfrom);
390 
391  const size_t rscsize = sClusters_->size();
392  sClusters_->resize(rscsize + pfeg_->getRefinedSCs().size());
393  reco::SuperClusterCollection::iterator rscinsertfrom =
394  sClusters_->begin() + rscsize;
395  std::move(pfeg_->getRefinedSCs().begin(),
396  pfeg_->getRefinedSCs().end(),
397  rscinsertfrom);
398  }
399 
400  LOGDRESSED("PFEGammaProducer")
401  << "Running PFEGammaAlgo on all blocks produced = "
402  << egCandidates_->size() << " e-g candidates!"
403  << std::endl;
404 
407 
410 
411  //set the correct references to refined SC and EG extra using the refprods
412  for (unsigned int i=0; i < egCandidates_->size(); ++i) {
413  reco::PFCandidate &cand = egCandidates_->at(i);
415 
416  reco::PFCandidateEGammaExtraRef extraref(egXtraProd,i);
417  reco::SuperClusterRef refinedSCRef(sClusterProd,i);
418 
419  xtra.setSuperClusterRef(refinedSCRef);
420  cand.setSuperClusterRef(refinedSCRef);
421  cand.setPFEGammaExtraRef(extraref);
422  }
423 
424  //build collections of output CaloClusters from the used PFClusters
425  std::auto_ptr<reco::CaloClusterCollection> caloClustersEBEE(new reco::CaloClusterCollection);
426  std::auto_ptr<reco::CaloClusterCollection> caloClustersES(new reco::CaloClusterCollection);
427 
428  std::map<edm::Ptr<reco::CaloCluster>, unsigned int> pfClusterMapEBEE; //maps of pfclusters to caloclusters
429  std::map<edm::Ptr<reco::CaloCluster>, unsigned int> pfClusterMapES;
430 
431  for( const auto& sc : *sClusters_ ) {
432  for (reco::CaloCluster_iterator pfclus = sc.clustersBegin(); pfclus!=sc.clustersEnd(); ++pfclus) {
433  if (!pfClusterMapEBEE.count(*pfclus)) {
434  reco::CaloCluster caloclus(**pfclus);
435  caloClustersEBEE->push_back(caloclus);
436  pfClusterMapEBEE[*pfclus] = caloClustersEBEE->size() - 1;
437  }
438  else {
439  throw cms::Exception("PFEgammaProducer::produce")
440  << "Found an EB/EE pfcluster matched to more than one supercluster!"
441  << std::dec << std::endl;
442  }
443  }
444  for (reco::CaloCluster_iterator pfclus = sc.preshowerClustersBegin(); pfclus!=sc.preshowerClustersEnd(); ++pfclus) {
445  if (!pfClusterMapES.count(*pfclus)) {
446  reco::CaloCluster caloclus(**pfclus);
447  caloClustersES->push_back(caloclus);
448  pfClusterMapES[*pfclus] = caloClustersES->size() - 1;
449  }
450  else {
451  throw cms::Exception("PFEgammaProducer::produce")
452  << "Found an ES pfcluster matched to more than one supercluster!"
453  << std::dec << std::endl;
454  }
455  }
456  }
457 
458  //put calocluster output collections in event and get orphan handles to create ptrs
459  const edm::OrphanHandle<reco::CaloClusterCollection> &caloClusHandleEBEE = iEvent.put(caloClustersEBEE,ebeeClustersCollection_);
460  const edm::OrphanHandle<reco::CaloClusterCollection> &caloClusHandleES = iEvent.put(caloClustersES,esClustersCollection_);
461 
462  //relink superclusters to output caloclusters
463  for( auto& sc : *sClusters_ ) {
464  edm::Ptr<reco::CaloCluster> seedptr(caloClusHandleEBEE,pfClusterMapEBEE[sc.seed()]);
465  sc.setSeed(seedptr);
466 
468  for (reco::CaloCluster_iterator pfclus = sc.clustersBegin(); pfclus!=sc.clustersEnd(); ++pfclus) {
469  edm::Ptr<reco::CaloCluster> clusptr(caloClusHandleEBEE,pfClusterMapEBEE[*pfclus]);
470  clusters.push_back(clusptr);
471  }
472  sc.setClusters(clusters);
473 
474  reco::CaloClusterPtrVector psclusters;
475  for (reco::CaloCluster_iterator pfclus = sc.preshowerClustersBegin(); pfclus!=sc.preshowerClustersEnd(); ++pfclus) {
476  edm::Ptr<reco::CaloCluster> clusptr(caloClusHandleES,pfClusterMapES[*pfclus]);
477  psclusters.push_back(clusptr);
478  }
479  sc.setPreshowerClusters(psclusters);
480  }
481 
482  //create and fill references to single leg conversions
486 
487  // release our demonspawn into the wild to cause havoc
488  iEvent.put(sClusters_);
489  iEvent.put(egExtra_);
490  iEvent.put(singleLegConv_);
491  iEvent.put(egCandidates_);
492 }
493 
494 //PFEGammaAlgo: a new method added to set the parameters for electron and photon reconstruction.
495 void
497 
498  FILE * fileEleID = fopen(cfg.mvaWeightFileEleID.c_str(), "r");
499  if (fileEleID) {
500  fclose(fileEleID);
501  }
502  else {
503  std::string err = "PFAlgo: cannot open weight file '";
504  err += cfg.mvaWeightFileEleID;
505  err += "'";
506  throw std::invalid_argument( err );
507  }
508 
509  //for MVA pass PV if there is one in the collection otherwise pass a dummy
510  if(!useVerticesForNeutral_) { // create a dummy PV
512  e(0, 0) = 0.0015 * 0.0015;
513  e(1, 1) = 0.0015 * 0.0015;
514  e(2, 2) = 15. * 15.;
515  reco::Vertex::Point p(0, 0, 0);
516  primaryVertex_ = reco::Vertex(p, e, 0, 0, 0);
517  }
518  // pv=&dummy;
519  //if(! usePFPhotons_) return;
520  FILE * filePhotonConvID = fopen(cfg.mvaweightfile.c_str(), "r");
521  if (filePhotonConvID) {
522  fclose(filePhotonConvID);
523  }
524  else {
525  std::string err = "PFAlgo: cannot open weight file '";
526  err += cfg.mvaweightfile;
527  err += "'";
528  throw std::invalid_argument( err );
529  }
530  cfg.primaryVtx = &primaryVertex_;
531  pfeg_.reset(new PFEGammaAlgo(cfg));
532 }
533 
534 /*
535 void PFAlgo::setPFPhotonRegWeights(
536  const GBRForest *LCorrForest,
537  const GBRForest *GCorrForest,
538  const GBRForest *ResForest
539  ) {
540  if(usePFPhotons_)
541  pfpho_->setGBRForest(LCorrForest, GCorrForest, ResForest);
542 }
543 */
544 
545 void
549 
550  //Set the vertices for muon cleaning
551 // pfmu_->setInputsForCleaning(primaryVertices);
552 
553 
554  //Now find the primary vertex!
555  //bool primaryVertexFound = false;
556  int nVtx=primaryVertices->size();
557  pfeg_->setnPU(nVtx);
558 // if(usePFPhotons_){
559 // pfpho_->setnPU(nVtx);
560 // }
561  primaryVertex_ = primaryVertices->front();
562  for (unsigned short i=0 ;i<primaryVertices->size();++i)
563  {
564  if(primaryVertices->at(i).isValid()&&(!primaryVertices->at(i).isFake()))
565  {
566  primaryVertex_ = primaryVertices->at(i);
567  //primaryVertexFound = true;
568  break;
569  }
570  }
571 
572  pfeg_->setPhotonPrimaryVtx(primaryVertex_ );
573 
574 }
575 
577 
579  for (auto &extra : extras){
580  for (const auto &tkrefmva : extra.singleLegConvTrackRefMva()) {
581  const reco::Track &trk = *tkrefmva.first;
582 
583  const reco::Vertex convVtx(trk.innerPosition(), error);
584  std::vector<reco::TrackRef> OneLegConvVector;
585  OneLegConvVector.push_back(tkrefmva.first);
586  std::vector< float > OneLegMvaVector;
587  OneLegMvaVector.push_back(tkrefmva.second);
588  std::vector<reco::CaloClusterPtr> dummymatchingBC;
590  scPtrVec.push_back(edm::refToPtr(extra.superClusterRef()));
591 
592  std::vector<math::XYZPointF>trackPositionAtEcalVec;
593  std::vector<math::XYZPointF>innPointVec;
594  std::vector<math::XYZVectorF>trackPinVec;
595  std::vector<math::XYZVectorF>trackPoutVec;
596  math::XYZPointF trackPositionAtEcal(trk.outerPosition().X(), trk.outerPosition().Y(), trk.outerPosition().Z());
597  trackPositionAtEcalVec.push_back(trackPositionAtEcal);
598 
599  math::XYZPointF innPoint(trk.innerPosition().X(), trk.innerPosition().Y(), trk.innerPosition().Z());
600  innPointVec.push_back(innPoint);
601 
602  math::XYZVectorF trackPin(trk.innerMomentum().X(), trk.innerMomentum().Y(), trk.innerMomentum().Z());
603  trackPinVec.push_back(trackPin);
604 
605  math::XYZVectorF trackPout(trk.outerMomentum().X(), trk.outerMomentum().Y(), trk.outerMomentum().Z());
606  trackPoutVec.push_back( trackPout );
607 
608  float DCA = trk.d0() ;
609  float mvaval = tkrefmva.second;
610  reco::Conversion singleLegConvCandidate(scPtrVec,
611  OneLegConvVector,
612  trackPositionAtEcalVec,
613  convVtx,
614  dummymatchingBC,
615  DCA,
616  innPointVec,
617  trackPinVec,
618  trackPoutVec,
619  mvaval,
621  singleLegConvCandidate.setOneLegMVA(OneLegMvaVector);
622  oneLegConversions.push_back(singleLegConvCandidate);
623 
624  reco::ConversionRef convref(convProd,oneLegConversions.size()-1);
625  extra.addSingleLegConversionRef(convref);
626 
627  }
628 
629  }
630 
631 }
632 
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:39
type
Definition: HCALResponse.h:21
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 createSingleLegConversions(reco::PFCandidateEGammaExtraCollection &extras, reco::ConversionCollection &oneLegConversions, const edm::RefProd< reco::ConversionCollection > &convProd)
const GBRForest * ReaderRes_
tuple cfg
Definition: looper.py:259
void setSuperClusterRef(reco::SuperClusterRef sc)
set reference to the corresponding supercluster
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
Definition: RefToPtr.h:18
double d0() const
dxy parameter in perigee convention (d0 = -dxy)
Definition: TrackBase.h:560
edm::EDGetTokenT< reco::VertexCollection > vertices_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:141
assert(m_qm.get())
unsigned int index() const
Definition: EDGetToken.h:70
size_type size() const
Definition: OwnVector.h:254
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:43
list elements
Definition: asciidump.py:414
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
ErrorD< N >::type type
Definition: Error.h:39
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
Definition: Point3D.h:10
const reco::Vertex * primaryVtx
Definition: PFEGammaAlgo.h:126
const math::XYZPoint & outerPosition() const
position of the outermost hit
Definition: Track.h:65
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
Definition: ConversionFwd.h:9
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:55
int iEvent
Definition: GenABIO.cc:230
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
void setPFVertexParameters(bool useVertex, const reco::VertexCollection *primaryVertices)
std::vector< reco::PFCandidateEGammaExtra > PFCandidateEGammaExtraCollection
collection of PFCandidateEGammaExtras
reco::Vertex primaryVertex_
std::auto_ptr< reco::PFCandidateEGammaExtraCollection > egExtra_
std::vector< CaloCluster > CaloClusterCollection
collection of CaloCluster objects
math::XYZPoint Point
point in the space
Definition: Vertex.h:39
std::string ebeeClustersCollection_
std::string esClustersCollection_
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float > > XYZVectorF
spatial vector with cartesian internal representation
Definition: Vector3D.h:17
void setPFEGParameters(PFEGammaAlgo::PFEGConfigInfo &)
virtual void beginRun(const edm::Run &, const edm::EventSetup &) override
std::auto_ptr< reco::PFCandidateCollection > egCandidates_
bool verbose_
verbose ?
edm::EDGetTokenT< reco::PFCluster::EEtoPSAssociation > eetopsSrc_
RefProd< PROD > getRefBeforePut()
Definition: Event.h:135
const GBRForest * ReaderLC_
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
std::list< reco::PFBlockRef >::iterator IBR
Definition: PFAlgo.cc:54
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
Definition: Track.h:70
T const * product() const
Definition: Handle.h:81
list blocks
Definition: gather_cfg.py:90
std::unique_ptr< PFEGammaAlgo > pfeg_
the unfiltered electron collection
const GBRForest * ReaderGC_
edm::EDGetTokenT< reco::PFBlockCollection > inputTagBlocks_
edm::EventID id() const
Definition: EventBase.h:60
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
void setOneLegMVA(const std::vector< float > &mva)
set the MVS output from PF for one leg conversions
Definition: Conversion.h:171
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
Definition: Track.h:60
#define LOGDRESSED(x)
void setPFEGammaExtraRef(const reco::PFCandidateEGammaExtraRef &ref)
set the PF EGamma Extra Ref
Definition: PFCandidate.cc:641
void setSuperClusterRef(const reco::SuperClusterRef &scRef)
Definition: PFCandidate.cc:620
PFEGammaProducer(const edm::ParameterSet &, const pfEGHelpers::HeavyObjectCache *)
virtual void produce(edm::Event &, const edm::EventSetup &) override
std::auto_ptr< reco::ConversionCollection > singleLegConv_
Definition: Run.h:41
std::auto_ptr< reco::SuperClusterCollection > sClusters_