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