CMS 3D CMS Logo

GEDPhotonProducer.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <vector>
3 #include <memory>
4 
5 // Framework
9 
11 
16 
17 
29 
31 
34 
37 
40 
45 
46 namespace {
47  inline double ptFast( const double energy,
48  const math::XYZPoint& position,
49  const math::XYZPoint& origin ) {
50  const auto v = position - origin;
51  return energy*std::sqrt(v.perp2()/v.mag2());
52  }
53 }
54 
56 
57  conf_(config)
58 {
59 
60  // use configuration file to setup input/output collection names
61  //
62  photonProducer_ = conf_.getParameter<edm::InputTag>("photonProducer");
63  reconstructionStep_ = conf_.getParameter<std::string>("reconstructionStep");
64 
65  if ( reconstructionStep_ == "final" ) {
67  consumes<reco::PhotonCollection>(photonProducer_);
68  pfCandidates_ =
69  consumes<reco::PFCandidateCollection>(conf_.getParameter<edm::InputTag>("pfCandidates"));
70 
72  consumes<edm::ValueMap<float>>(conf_.getParameter<edm::InputTag>("chargedHadronIsolation"));
74  consumes<edm::ValueMap<float>>(conf_.getParameter<edm::InputTag>("neutralHadronIsolation"));
76  consumes<edm::ValueMap<float>>(conf_.getParameter<edm::InputTag>("photonIsolation"));
77 
78  } else {
79 
81  consumes<reco::PhotonCoreCollection>(photonProducer_);
82 
83  }
84 
85  auto pfEg = conf_.getParameter<edm::InputTag>("pfEgammaCandidates");
86  if (not pfEg.label().empty())
88  consumes<reco::PFCandidateCollection>(pfEg);
90  consumes<EcalRecHitCollection>(conf_.getParameter<edm::InputTag>("barrelEcalHits"));
92  consumes<EcalRecHitCollection>(conf_.getParameter<edm::InputTag>("endcapEcalHits"));
94  consumes<EcalRecHitCollection>(conf_.getParameter<edm::InputTag>("preshowerHits"));
96  consumes<reco::VertexCollection>(conf_.getParameter<edm::InputTag>("primaryVertexProducer"));
97 
98  auto hcTow = conf_.getParameter<edm::InputTag>("hcalTowers");
99  if (not hcTow.label().empty())
100  hcalTowers_ =
101  consumes<CaloTowerCollection>(hcTow);
102  //
103  photonCollection_ = conf_.getParameter<std::string>("outputPhotonCollection");
104  hOverEConeSize_ = conf_.getParameter<double>("hOverEConeSize");
105  highEt_ = conf_.getParameter<double>("highEt");
106  // R9 value to decide converted/unconverted
107  minR9Barrel_ = conf_.getParameter<double>("minR9Barrel");
108  minR9Endcap_ = conf_.getParameter<double>("minR9Endcap");
109  usePrimaryVertex_ = conf_.getParameter<bool>("usePrimaryVertex");
110  runMIPTagger_ = conf_.getParameter<bool>("runMIPTagger");
111 
112  candidateP4type_ = config.getParameter<std::string>("candidateP4type") ;
113  valueMapPFCandPhoton_ = config.getParameter<std::string>("valueMapPhotons");
114 
115 
117  config.getParameter<edm::ParameterSet>("posCalcParameters");
118  posCalculator_ = PositionCalc(posCalcParameters);
119 
120 
121  //AA
122  //Flags and Severities to be excluded from photon calculations
123  const std::vector<std::string> flagnamesEB =
124  config.getParameter<std::vector<std::string> >("RecHitFlagToBeExcludedEB");
125 
126  const std::vector<std::string> flagnamesEE =
127  config.getParameter<std::vector<std::string> >("RecHitFlagToBeExcludedEE");
128 
129  flagsexclEB_=
130  StringToEnumValue<EcalRecHit::Flags>(flagnamesEB);
131 
132  flagsexclEE_=
133  StringToEnumValue<EcalRecHit::Flags>(flagnamesEE);
134 
135  const std::vector<std::string> severitynamesEB =
136  config.getParameter<std::vector<std::string> >("RecHitSeverityToBeExcludedEB");
137 
139  StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEB);
140 
141  const std::vector<std::string> severitynamesEE =
142  config.getParameter<std::vector<std::string> >("RecHitSeverityToBeExcludedEE");
143 
145  StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEE);
146 
149  if( conf_.existsAs<edm::ParameterSet>("regressionConfig") ) {
150  auto sumes = consumesCollector();
151  thePhotonEnergyCorrector_->gedRegression()->setConsumes(sumes);
152  }
153 
154  //AA
155 
156  //
157 
158  // Parameters for the position calculation:
159  // std::map<std::string,double> providedParameters;
160  // providedParameters.insert(std::make_pair("LogWeighted",conf_.getParameter<bool>("posCalc_logweight")));
161  //providedParameters.insert(std::make_pair("T0_barl",conf_.getParameter<double>("posCalc_t0_barl")));
162  //providedParameters.insert(std::make_pair("T0_endc",conf_.getParameter<double>("posCalc_t0_endc")));
163  //providedParameters.insert(std::make_pair("T0_endcPresh",conf_.getParameter<double>("posCalc_t0_endcPresh")));
164  //providedParameters.insert(std::make_pair("W0",conf_.getParameter<double>("posCalc_w0")));
165  //providedParameters.insert(std::make_pair("X0",conf_.getParameter<double>("posCalc_x0")));
166  //posCalculator_ = PositionCalc(providedParameters);
167  // cut values for pre-selection
168  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("minSCEtBarrel"));
169  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("maxHoverEBarrel"));
170  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("ecalRecHitSumEtOffsetBarrel"));
171  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("ecalRecHitSumEtSlopeBarrel"));
172  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("hcalTowerSumEtOffsetBarrel"));
173  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("hcalTowerSumEtSlopeBarrel"));
174  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("nTrackSolidConeBarrel"));
175  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("nTrackHollowConeBarrel"));
176  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("trackPtSumSolidConeBarrel"));
177  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("trackPtSumHollowConeBarrel"));
178  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("sigmaIetaIetaCutBarrel"));
179  //
180  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("minSCEtEndcap"));
181  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("maxHoverEEndcap"));
182  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("ecalRecHitSumEtOffsetEndcap"));
183  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("ecalRecHitSumEtSlopeEndcap"));
184  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("hcalTowerSumEtOffsetEndcap"));
185  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("hcalTowerSumEtSlopeEndcap"));
186  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("nTrackSolidConeEndcap"));
187  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("nTrackHollowConeEndcap"));
188  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("trackPtSumSolidConeEndcap"));
189  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("trackPtSumHollowConeEndcap"));
190  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("sigmaIetaIetaCutEndcap"));
191  //
192 
193  //moved from beginRun to here, I dont see how this could cause harm as its just reading in the exactly same parameters each run
194  if ( reconstructionStep_ != "final"){
197  thePhotonIsolationCalculator_->setup(isolationSumsCalculatorSet, flagsexclEB_, flagsexclEE_, severitiesexclEB_, severitiesexclEE_,consumesCollector());
201 
202  }else{
205  }
206  // Register the product
207  produces< reco::PhotonCollection >(photonCollection_);
209  produces< edm::ValueMap<reco::PhotonRef> > (valueMapPFCandPhoton_);
210 
211 
212 }
213 
215 {
219  //delete energyCorrectionF;
220 }
221 
222 
223 
224 void GEDPhotonProducer::beginRun (edm::Run const& r, edm::EventSetup const & theEventSetup) {
225 
226  if ( reconstructionStep_ != "final" ) {
227  thePhotonEnergyCorrector_ -> init(theEventSetup);
228  }
229 
230 }
231 
232 void GEDPhotonProducer::endRun (edm::Run const& r, edm::EventSetup const & theEventSetup) {
233 }
234 
235 
236 void GEDPhotonProducer::produce(edm::Event& theEvent, const edm::EventSetup& theEventSetup) {
237 
238  using namespace edm;
239  // nEvt_++;
240 
242  auto outputPhotonCollection_p = std::make_unique<reco::PhotonCollection>();
243  edm::ValueMap<reco::PhotonRef> pfEGCandToPhotonMap;
244 
245 
246  // Get the PhotonCore collection
247  bool validPhotonCoreHandle=false;
248  Handle<reco::PhotonCoreCollection> photonCoreHandle;
249  bool validPhotonHandle= false;
250  Handle<reco::PhotonCollection> photonHandle;
251  //value maps for isolation
252  edm::Handle<edm::ValueMap<float> > phoChargedIsolationMap_CITK;
253  edm::Handle<edm::ValueMap<float> > phoNeutralHadronIsolationMap_CITK;
254  edm::Handle<edm::ValueMap<float> > phoPhotonIsolationMap_CITK;
255 
256  if ( reconstructionStep_ == "final" ) {
257  theEvent.getByToken(photonProducerT_,photonHandle);
258  //get isolation objects
259  theEvent.getByToken(phoChargedIsolationToken_CITK,phoChargedIsolationMap_CITK);
260  theEvent.getByToken(phoNeutralHadronIsolationToken_CITK,phoNeutralHadronIsolationMap_CITK);
261  theEvent.getByToken(phoPhotonIsolationToken_CITK,phoPhotonIsolationMap_CITK);
262  if ( photonHandle.isValid()) {
263  validPhotonHandle=true;
264  } else {
265  throw cms::Exception("GEDPhotonProducer") << "Error! Can't get the product " << photonProducer_.label() << "\n";
266  }
267  } else {
268 
269  theEvent.getByToken(photonCoreProducerT_,photonCoreHandle);
270  if (photonCoreHandle.isValid()) {
271  validPhotonCoreHandle=true;
272  } else {
273  throw cms::Exception("GEDPhotonProducer")
274  << "Error! Can't get the photonCoreProducer" << photonProducer_.label() << "\n";
275  }
276  }
277 
278  // Get EcalRecHits
279  bool validEcalRecHits=true;
280  Handle<EcalRecHitCollection> barrelHitHandle;
281  const EcalRecHitCollection dummyEB;
282  theEvent.getByToken(barrelEcalHits_, barrelHitHandle);
283  if (!barrelHitHandle.isValid()) {
284  throw cms::Exception("GEDPhotonProducer")
285  << "Error! Can't get the barrelEcalHits";
286  }
287  const EcalRecHitCollection& barrelRecHits(validEcalRecHits ? *(barrelHitHandle.product()) : dummyEB);
288 
289  Handle<EcalRecHitCollection> endcapHitHandle;
290  theEvent.getByToken(endcapEcalHits_, endcapHitHandle);
291  const EcalRecHitCollection dummyEE;
292  if (!endcapHitHandle.isValid()) {
293  throw cms::Exception("GEDPhotonProducer")
294  << "Error! Can't get the endcapEcalHits";
295  }
296  const EcalRecHitCollection& endcapRecHits(validEcalRecHits ? *(endcapHitHandle.product()) : dummyEE);
297 
298  bool validPreshowerRecHits=true;
299  Handle<EcalRecHitCollection> preshowerHitHandle;
300  theEvent.getByToken(preshowerHits_, preshowerHitHandle);
301  EcalRecHitCollection preshowerRecHits;
302  if (!preshowerHitHandle.isValid()) {
303  throw cms::Exception("GEDPhotonProducer")
304  << "Error! Can't get the preshowerEcalHits";
305  }
306  if( validPreshowerRecHits ) preshowerRecHits = *(preshowerHitHandle.product());
307 
308 
309 
310  Handle<reco::PFCandidateCollection> pfEGCandidateHandle;
311  // Get the PF refined cluster collection
313  theEvent.getByToken(pfEgammaCandidates_,pfEGCandidateHandle);
314  if (!pfEGCandidateHandle.isValid()) {
315  throw cms::Exception("GEDPhotonProducer")
316  << "Error! Can't get the pfEgammaCandidates";
317  }
318  }
319 
320  Handle<reco::PFCandidateCollection> pfCandidateHandle;
321 
322  if ( reconstructionStep_ == "final" ) {
323  // Get the PF candidates collection
324  theEvent.getByToken(pfCandidates_,pfCandidateHandle);
325  if (!pfCandidateHandle.isValid()) {
326  throw cms::Exception("GEDPhotonProducer")
327  << "Error! Can't get the pfCandidates";
328  }
329  }
330 
331  //AA
332  //Get the severity level object
334  theEventSetup.get<EcalSeverityLevelAlgoRcd>().get(sevLv);
335  //
336 
337 
338 // get Hcal towers collection
339  Handle<CaloTowerCollection> hcalTowersHandle;
340  if (not hcalTowers_.isUninitialized()){
341  theEvent.getByToken(hcalTowers_, hcalTowersHandle);
342  }
343 
344  // get the geometry from the event setup:
345  theEventSetup.get<CaloGeometryRecord>().get(theCaloGeom_);
346 
347  //
348  // update energy correction function
349  // energyCorrectionF->init(theEventSetup);
350 
351  edm::ESHandle<CaloTopology> pTopology;
352  theEventSetup.get<CaloTopologyRecord>().get(theCaloTopo_);
354 
355  // Get the primary event vertex
356  Handle<reco::VertexCollection> vertexHandle;
357  const reco::VertexCollection dummyVC;
358  bool validVertex=true;
359  if ( usePrimaryVertex_ ) {
360  theEvent.getByToken(vertexProducer_, vertexHandle);
361  if (!vertexHandle.isValid()) {
362  throw cms::Exception("GEDPhotonProducer")
363  << "Error! Can't get the product primary Vertex Collection";
364  }
365  }
366  const reco::VertexCollection& vertexCollection(usePrimaryVertex_ && validVertex ? *(vertexHandle.product()) : dummyVC);
367 
368  // math::XYZPoint vtx(0.,0.,0.);
369  //if (vertexCollection.size()>0) vtx = vertexCollection.begin()->position();
370 
371  // get the regression calculator ready
372  thePhotonEnergyCorrector_->init(theEventSetup);
374  thePhotonEnergyCorrector_->gedRegression()->setEvent(theEvent);
375  thePhotonEnergyCorrector_->gedRegression()->setEventContent(theEventSetup);
376  }
377 
378 
379  int iSC=0; // index in photon collection
380  // Loop over barrel and endcap SC collections and fill the photon collection
381  if ( validPhotonCoreHandle)
382  fillPhotonCollection(theEvent,
383  theEventSetup,
384  photonCoreHandle,
385  topology,
386  &barrelRecHits,
387  &endcapRecHits,
388  &preshowerRecHits,
389  hcalTowersHandle,
390  //vtx,
391  vertexCollection,
392  outputPhotonCollection,
393  iSC);
394 
395  iSC=0;
396  if ( validPhotonHandle && reconstructionStep_ == "final" )
397  fillPhotonCollection(theEvent,
398  theEventSetup,
399  photonHandle,
400  pfCandidateHandle,
401  pfEGCandidateHandle,
402  pfEGCandToPhotonMap,
403  vertexHandle,
404  outputPhotonCollection,
405  iSC,
406  phoChargedIsolationMap_CITK,
407  phoNeutralHadronIsolationMap_CITK,
408  phoPhotonIsolationMap_CITK);
409 
410 
411 
412  // put the product in the event
413  edm::LogInfo("GEDPhotonProducer") << " Put in the event " << iSC << " Photon Candidates \n";
414  outputPhotonCollection_p->assign(outputPhotonCollection.begin(),outputPhotonCollection.end());
415  const edm::OrphanHandle<reco::PhotonCollection> photonOrphHandle = theEvent.put(std::move(outputPhotonCollection_p), photonCollection_);
416 
417 
418  if ( reconstructionStep_ != "final" && not pfEgammaCandidates_.isUninitialized()) {
420  auto pfEGCandToPhotonMap_p = std::make_unique<edm::ValueMap<reco::PhotonRef>>();
421  edm::ValueMap<reco::PhotonRef>::Filler filler(*pfEGCandToPhotonMap_p);
422  unsigned nObj = pfEGCandidateHandle->size();
423  std::vector<reco::PhotonRef> values(nObj);
425  for(unsigned int lCand=0; lCand < nObj; lCand++) {
426  reco::PFCandidateRef pfCandRef (reco::PFCandidateRef(pfEGCandidateHandle,lCand));
427  reco::SuperClusterRef pfScRef = pfCandRef -> superClusterRef();
428 
429  for(unsigned int lSC=0; lSC < photonOrphHandle->size(); lSC++) {
430  reco::PhotonRef photonRef(reco::PhotonRef(photonOrphHandle, lSC));
431  reco::SuperClusterRef scRef=photonRef->superCluster();
432  if ( pfScRef != scRef ) continue;
433  values[lCand] = photonRef;
434  }
435  }
436 
437 
438  filler.insert(pfEGCandidateHandle,values.begin(),values.end());
439  filler.fill();
440  theEvent.put(std::move(pfEGCandToPhotonMap_p),valueMapPFCandPhoton_);
441 
442 
443  }
444 
445 
446 
447 
448 
449 
450 }
451 
453  edm::EventSetup const & es,
454  const edm::Handle<reco::PhotonCoreCollection> & photonCoreHandle,
455  const CaloTopology* topology,
456  const EcalRecHitCollection* ecalBarrelHits,
457  const EcalRecHitCollection* ecalEndcapHits,
459  const edm::Handle<CaloTowerCollection> & hcalTowersHandle,
462 
463 
466  std::vector<double> preselCutValues;
467  std::vector<int> flags_, severitiesexcl_;
468 
469  for(unsigned int lSC=0; lSC < photonCoreHandle->size(); lSC++) {
470 
471  reco::PhotonCoreRef coreRef(reco::PhotonCoreRef(photonCoreHandle, lSC));
472  reco::SuperClusterRef parentSCRef = coreRef->parentSuperCluster();
473  reco::SuperClusterRef scRef=coreRef->superCluster();
474 
475 
476 
477  // const reco::SuperCluster* pClus=&(*scRef);
478  iSC++;
479 
480  int thedet = scRef->seed()->hitsAndFractions()[0].first.det();
481  int subdet = scRef->seed()->hitsAndFractions()[0].first.subdetId();
482  if (subdet==EcalBarrel) {
483  preselCutValues = preselCutValuesBarrel_;
484  hits = ecalBarrelHits;
485  flags_ = flagsexclEB_;
486  severitiesexcl_ = severitiesexclEB_;
487  } else if (subdet==EcalEndcap) {
488  preselCutValues = preselCutValuesEndcap_;
489  hits = ecalEndcapHits;
490  flags_ = flagsexclEE_;
491  severitiesexcl_ = severitiesexclEE_;
492  } else if ( thedet == DetId::Forward ) {
493  preselCutValues = preselCutValuesEndcap_;
494  hits = nullptr;
495  flags_ = flagsexclEE_;
496  severitiesexcl_ = severitiesexclEE_;
497  } else {
498  edm::LogWarning("")<<"GEDPhotonProducer: do not know if it is a barrel or endcap SuperCluster" << thedet << ' ' << subdet;
499  }
500 
501 
502 
503 
504  // SC energy preselection
505  if (parentSCRef.isNonnull() &&
506  ptFast(parentSCRef->energy(),parentSCRef->position(),math::XYZPoint(0,0,0)) <= preselCutValues[0] ) continue;
507  // calculate HoE
508 
509  double HoE1,HoE2;
510  HoE1=HoE2=0.;
511 
512  std::vector<CaloTowerDetId> TowersBehindClus;
513  float hcalDepth1OverEcalBc,hcalDepth2OverEcalBc;
514  hcalDepth1OverEcalBc=hcalDepth2OverEcalBc=0.f;
515 
516  if (not hcalTowers_.isUninitialized()) {
517  const CaloTowerCollection* hcalTowersColl = hcalTowersHandle.product();
518  EgammaTowerIsolation towerIso1(hOverEConeSize_,0.,0.,1,hcalTowersColl) ;
519  EgammaTowerIsolation towerIso2(hOverEConeSize_,0.,0.,2,hcalTowersColl) ;
520  HoE1=towerIso1.getTowerESum(&(*scRef))/scRef->energy();
521  HoE2=towerIso2.getTowerESum(&(*scRef))/scRef->energy();
522 
523  EgammaHadTower towerIsoBehindClus(es);
524  towerIsoBehindClus.setTowerCollection(hcalTowersHandle.product());
525  TowersBehindClus = towerIsoBehindClus.towersOf(*scRef);
526  hcalDepth1OverEcalBc = towerIsoBehindClus.getDepth1HcalESum(TowersBehindClus)/scRef->energy();
527  hcalDepth2OverEcalBc = towerIsoBehindClus.getDepth2HcalESum(TowersBehindClus)/scRef->energy();
528  }
529 
530  // std::cout << " GEDPhotonProducer calculation of HoE with towers in a cone " << HoE1 << " " << HoE2 << std::endl;
531  //std::cout << " GEDPhotonProducer calcualtion of HoE with towers behind the BCs " << hcalDepth1OverEcalBc << " " << hcalDepth2OverEcalBc << std::endl;
532 
533  float maxXtal = ( hits != nullptr ? EcalClusterTools::eMax( *(scRef->seed()), &(*hits) ) : 0.f );
534  //AA
535  //Change these to consider severity level of hits
536  float e1x5 = ( hits != nullptr ? EcalClusterTools::e1x5( *(scRef->seed()), &(*hits), &(*topology)) : 0.f );
537  float e2x5 = ( hits != nullptr ? EcalClusterTools::e2x5Max( *(scRef->seed()), &(*hits), &(*topology)) : 0.f );
538  float e3x3 = ( hits != nullptr ? EcalClusterTools::e3x3( *(scRef->seed()), &(*hits), &(*topology)) : 0.f );
539  float e5x5 = ( hits != nullptr ? EcalClusterTools::e5x5( *(scRef->seed()), &(*hits), &(*topology)) : 0.f );
540  std::vector<float> cov = ( hits != nullptr ? EcalClusterTools::covariances( *(scRef->seed()), &(*hits), &(*topology), geometry) : std::vector<float>( {0.f,0.f,0.f} ) );
541  std::vector<float> locCov = ( hits != nullptr ? EcalClusterTools::localCovariances( *(scRef->seed()), &(*hits), &(*topology)) : std::vector<float>( {0.f,0.f,0.f} ) );
542 
543  float sigmaEtaEta = sqrt(cov[0]);
544  float sigmaIetaIeta = sqrt(locCov[0]);
545 
546  float full5x5_maxXtal = ( hits != nullptr ? noZS::EcalClusterTools::eMax( *(scRef->seed()), &(*hits) ) : 0.f );
547  //AA
548  //Change these to consider severity level of hits
549  float full5x5_e1x5 = ( hits != nullptr ? noZS::EcalClusterTools::e1x5( *(scRef->seed()), &(*hits), &(*topology)) : 0.f );
550  float full5x5_e2x5 = ( hits != nullptr ? noZS::EcalClusterTools::e2x5Max( *(scRef->seed()), &(*hits), &(*topology)) : 0.f );
551  float full5x5_e3x3 = ( hits != nullptr ? noZS::EcalClusterTools::e3x3( *(scRef->seed()), &(*hits), &(*topology)) : 0.f );
552  float full5x5_e5x5 = ( hits != nullptr ? noZS::EcalClusterTools::e5x5( *(scRef->seed()), &(*hits), &(*topology)) : 0.f );
553  std::vector<float> full5x5_cov = ( hits != nullptr ? noZS::EcalClusterTools::covariances( *(scRef->seed()), &(*hits), &(*topology), geometry) : std::vector<float>( {0.f,0.f,0.f} ) );
554  std::vector<float> full5x5_locCov = ( hits != nullptr ? noZS::EcalClusterTools::localCovariances( *(scRef->seed()), &(*hits), &(*topology)) : std::vector<float>( {0.f,0.f,0.f} ) );
555 
556  float full5x5_sigmaEtaEta = sqrt(full5x5_cov[0]);
557  float full5x5_sigmaIetaIeta = sqrt(full5x5_locCov[0]);
558 
559  // compute position of ECAL shower
560  math::XYZPoint caloPosition = scRef->position();
561 
562 
564  double photonEnergy=1.;
565  math::XYZPoint vtx(0.,0.,0.);
566  if (vertexCollection.size()>0) vtx = vertexCollection.begin()->position();
567  // compute momentum vector of photon from primary vertex and cluster position
568  math::XYZVector direction = caloPosition - vtx;
569  //math::XYZVector momentum = direction.unit() * photonEnergy ;
570  math::XYZVector momentum = direction.unit() ;
571 
572  // Create dummy candidate with unit momentum and zero energy to allow setting of all variables. The energy is set for last.
573  math::XYZTLorentzVectorD p4(momentum.x(), momentum.y(), momentum.z(), photonEnergy );
574  reco::Photon newCandidate(p4, caloPosition, coreRef, vtx);
575 
576  //std::cout << " standard p4 before " << newCandidate.p4() << " energy " << newCandidate.energy() << std::endl;
577  //std::cout << " type " <<newCandidate.getCandidateP4type() << " standard p4 after " << newCandidate.p4() << " energy " << newCandidate.energy() << std::endl;
578 
579  // Calculate fiducial flags and isolation variable. Blocked are filled from the isolationCalculator
580  reco::Photon::FiducialFlags fiducialFlags;
581  reco::Photon::IsolationVariables isolVarR03, isolVarR04;
582  if( thedet != DetId::Forward && thedet != DetId::Hcal) {
583  thePhotonIsolationCalculator_->calculate( &newCandidate,evt,es,fiducialFlags,isolVarR04, isolVarR03);
584  }
585  newCandidate.setFiducialVolumeFlags( fiducialFlags );
586  newCandidate.setIsolationVariables(isolVarR04, isolVarR03 );
587 
588 
590  reco::Photon::ShowerShape showerShape;
591  showerShape.e1x5= e1x5;
592  showerShape.e2x5= e2x5;
593  showerShape.e3x3= e3x3;
594  showerShape.e5x5= e5x5;
595  showerShape.maxEnergyXtal = maxXtal;
596  showerShape.sigmaEtaEta = sigmaEtaEta;
597  showerShape.sigmaIetaIeta = sigmaIetaIeta;
598  showerShape.hcalDepth1OverEcal = HoE1;
599  showerShape.hcalDepth2OverEcal = HoE2;
600  showerShape.hcalDepth1OverEcalBc = hcalDepth1OverEcalBc;
601  showerShape.hcalDepth2OverEcalBc = hcalDepth2OverEcalBc;
602  showerShape.hcalTowersBehindClusters = TowersBehindClus;
604  const float spp = (!edm::isFinite(locCov[2]) ? 0. : sqrt(locCov[2]));
605  const float sep = locCov[1];
606  showerShape.sigmaIetaIphi = sep;
607  showerShape.sigmaIphiIphi = spp;
608  showerShape.e2nd = ( hits != nullptr ? EcalClusterTools::e2nd(*(scRef->seed()),&(*hits)) : 0.f );
609  showerShape.eTop = ( hits != nullptr ? EcalClusterTools::eTop(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
610  showerShape.eLeft = ( hits != nullptr ? EcalClusterTools::eLeft(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
611  showerShape.eRight = ( hits != nullptr ? EcalClusterTools::eRight(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
612  showerShape.eBottom = ( hits != nullptr ? EcalClusterTools::eBottom(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
613  showerShape.e1x3 = ( hits != nullptr ? EcalClusterTools::e1x3(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
614  showerShape.e2x2 = ( hits != nullptr ? EcalClusterTools::e2x2(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
615  showerShape.e2x5Max = ( hits != nullptr ? EcalClusterTools::e2x5Max(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
616  showerShape.e2x5Left = ( hits != nullptr ? EcalClusterTools::e2x5Left(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
617  showerShape.e2x5Right = ( hits != nullptr ? EcalClusterTools::e2x5Right(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
618  showerShape.e2x5Top = ( hits != nullptr ? EcalClusterTools::e2x5Top(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
619  showerShape.e2x5Bottom = ( hits != nullptr ? EcalClusterTools::e2x5Bottom(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
620  // fill preshower shapes
622  const float sigmaRR = toolsforES.eseffsirir( *scRef );
623  showerShape.effSigmaRR = sigmaRR;
624  newCandidate.setShowerShapeVariables ( showerShape );
625 
626  reco::Photon::SaturationInfo saturationInfo;
627  const reco::CaloCluster& seedCluster = *(scRef->seed()) ;
628  DetId seedXtalId = seedCluster.seed();
629  int nSaturatedXtals = 0;
630  bool isSeedSaturated = false;
631  if (hits != nullptr) {
632  const auto hitsAndFractions = scRef->hitsAndFractions();
633  for (auto&& hitFractionPair : hitsAndFractions) {
634  auto&& ecalRecHit = hits->find(hitFractionPair.first);
635  if (ecalRecHit == hits->end()) continue;
636  if (ecalRecHit->checkFlag(EcalRecHit::Flags::kSaturated)) {
637  nSaturatedXtals++;
638  if (seedXtalId == ecalRecHit->detid())
639  isSeedSaturated = true;
640  }
641  }
642  }
643  saturationInfo.nSaturatedXtals = nSaturatedXtals;
644  saturationInfo.isSeedSaturated = isSeedSaturated;
645  newCandidate.setSaturationInfo(saturationInfo);
646 
648  reco::Photon::ShowerShape full5x5_showerShape;
649  full5x5_showerShape.e1x5= full5x5_e1x5;
650  full5x5_showerShape.e2x5= full5x5_e2x5;
651  full5x5_showerShape.e3x3= full5x5_e3x3;
652  full5x5_showerShape.e5x5= full5x5_e5x5;
653  full5x5_showerShape.maxEnergyXtal = full5x5_maxXtal;
654  full5x5_showerShape.sigmaEtaEta = full5x5_sigmaEtaEta;
655  full5x5_showerShape.sigmaIetaIeta = full5x5_sigmaIetaIeta;
657  const float full5x5_spp = (!edm::isFinite(full5x5_locCov[2]) ? 0. : sqrt(full5x5_locCov[2]));
658  const float full5x5_sep = full5x5_locCov[1];
659  full5x5_showerShape.sigmaIetaIphi = full5x5_sep;
660  full5x5_showerShape.sigmaIphiIphi = full5x5_spp;
661  full5x5_showerShape.e2nd = ( hits != nullptr ? noZS::EcalClusterTools::e2nd(*(scRef->seed()),&(*hits)) : 0.f );
662  full5x5_showerShape.eTop = ( hits != nullptr ? noZS::EcalClusterTools::eTop(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
663  full5x5_showerShape.eLeft = ( hits != nullptr ? noZS::EcalClusterTools::eLeft(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
664  full5x5_showerShape.eRight = ( hits != nullptr ? noZS::EcalClusterTools::eRight(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
665  full5x5_showerShape.eBottom = ( hits != nullptr ? noZS::EcalClusterTools::eBottom(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
666  full5x5_showerShape.e1x3 = ( hits != nullptr ? noZS::EcalClusterTools::e1x3(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
667  full5x5_showerShape.e2x2 = ( hits != nullptr ? noZS::EcalClusterTools::e2x2(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
668  full5x5_showerShape.e2x5Max = ( hits != nullptr ? noZS::EcalClusterTools::e2x5Max(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
669  full5x5_showerShape.e2x5Left = ( hits != nullptr ? noZS::EcalClusterTools::e2x5Left(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
670  full5x5_showerShape.e2x5Right = ( hits != nullptr ? noZS::EcalClusterTools::e2x5Right(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
671  full5x5_showerShape.e2x5Top = ( hits != nullptr ? noZS::EcalClusterTools::e2x5Top(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
672  full5x5_showerShape.e2x5Bottom = ( hits != nullptr ? noZS::EcalClusterTools::e2x5Bottom(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
673  // fill preshower shapes
674  full5x5_showerShape.effSigmaRR = sigmaRR;
675  newCandidate.full5x5_setShowerShapeVariables ( full5x5_showerShape );
676 
677 
678 
681  // Photon candidate takes by default (set in photons_cfi.py)
682  // a 4-momentum derived from the ecal photon-specific corrections.
683  if( thedet != DetId::Forward && thedet != DetId::Hcal) {
684  thePhotonEnergyCorrector_->calculate(evt, newCandidate, subdet, vertexCollection, es);
685  if ( candidateP4type_ == "fromEcalEnergy") {
686  newCandidate.setP4( newCandidate.p4(reco::Photon::ecal_photons) );
687  newCandidate.setCandidateP4type(reco::Photon::ecal_photons);
688  } else if ( candidateP4type_ == "fromRegression1") {
689  newCandidate.setP4( newCandidate.p4(reco::Photon::regression1) );
690  newCandidate.setCandidateP4type(reco::Photon::regression1);
691  } else if ( candidateP4type_ == "fromRegression2") {
692  newCandidate.setP4( newCandidate.p4(reco::Photon::regression2) );
693  newCandidate.setCandidateP4type(reco::Photon::regression2);
694  } else if ( candidateP4type_ == "fromRefinedSCRegression" ) {
695  newCandidate.setP4( newCandidate.p4(reco::Photon::regression2) );
696  newCandidate.setCandidateP4type(reco::Photon::regression2);
697  }
698  }
699 
700  // std::cout << " final p4 " << newCandidate.p4() << " energy " << newCandidate.energy() << std::endl;
701 
702 
703  // std::cout << " GEDPhotonProducer from candidate HoE with towers in a cone " << newCandidate.hadronicOverEm() << " " << newCandidate.hadronicDepth1OverEm() << " " << newCandidate.hadronicDepth2OverEm() << std::endl;
704  // std::cout << " GEDPhotonProducer from candidate of HoE with towers behind the BCs " << newCandidate.hadTowOverEm() << " " << newCandidate.hadTowDepth1OverEm() << " " << newCandidate.hadTowDepth2OverEm() << std::endl;
705 
706 
707  // fill MIP Vairables for Halo: Block for MIP are filled from PhotonMIPHaloTagger
709  if(subdet==EcalBarrel && runMIPTagger_ )
710  {
711 
712  thePhotonMIPHaloTagger_-> MIPcalculate( &newCandidate,evt,es,mipVar);
713  newCandidate.setMIPVariables(mipVar);
714  }
715 
716 
717 
719  bool isLooseEM=true;
720  if ( newCandidate.pt() < highEt_) {
721  if ( newCandidate.hadronicOverEm() >= preselCutValues[1] ) isLooseEM=false;
722  if ( newCandidate.ecalRecHitSumEtConeDR04() > preselCutValues[2]+ preselCutValues[3]*newCandidate.pt() ) isLooseEM=false;
723  if ( newCandidate.hcalTowerSumEtConeDR04() > preselCutValues[4]+ preselCutValues[5]*newCandidate.pt() ) isLooseEM=false;
724  if ( newCandidate.nTrkSolidConeDR04() > int(preselCutValues[6]) ) isLooseEM=false;
725  if ( newCandidate.nTrkHollowConeDR04() > int(preselCutValues[7]) ) isLooseEM=false;
726  if ( newCandidate.trkSumPtSolidConeDR04() > preselCutValues[8] ) isLooseEM=false;
727  if ( newCandidate.trkSumPtHollowConeDR04() > preselCutValues[9] ) isLooseEM=false;
728  if ( newCandidate.sigmaIetaIeta() > preselCutValues[10] ) isLooseEM=false;
729  }
730 
731 
732 
733  if ( isLooseEM)
734  outputPhotonCollection.push_back(newCandidate);
735 
736 
737  }
738 }
739 
740 
741 
742 
744  edm::EventSetup const & es,
745  const edm::Handle<reco::PhotonCollection> & photonHandle,
746  const edm::Handle<reco::PFCandidateCollection> pfCandidateHandle,
747  const edm::Handle<reco::PFCandidateCollection> pfEGCandidateHandle,
748  edm::ValueMap<reco::PhotonRef> pfEGCandToPhotonMap,
750  reco::PhotonCollection & outputPhotonCollection, int& iSC, const edm::Handle<edm::ValueMap<float>>& chargedHadrons_, const edm::Handle<edm::ValueMap<float>>& neutralHadrons_, const edm::Handle<edm::ValueMap<float>>& photons_) {
751 
752 
753 
754  std::vector<double> preselCutValues;
755 
756 
757  for(unsigned int lSC=0; lSC < photonHandle->size(); lSC++) {
758  reco::PhotonRef phoRef(reco::PhotonRef(photonHandle, lSC));
759  reco::SuperClusterRef parentSCRef = phoRef->parentSuperCluster();
760  reco::SuperClusterRef scRef=phoRef->superCluster();
761  int thedet = scRef->seed()->hitsAndFractions()[0].first.det();
762  int subdet = scRef->seed()->hitsAndFractions()[0].first.subdetId();
763  if (subdet==EcalBarrel) {
764  preselCutValues = preselCutValuesBarrel_;
765  } else if (subdet==EcalEndcap) {
766  preselCutValues = preselCutValuesEndcap_;
767  } else if ( thedet == DetId::Forward || thedet == DetId::Hcal) {
768  preselCutValues = preselCutValuesEndcap_;
769  } else {
770  edm::LogWarning("")<<"GEDPhotonProducer: do not know if it is a barrel or endcap SuperCluster" << thedet << ' ' << subdet;
771  }
772 
773 
774 
775  // SC energy preselection
776  if (parentSCRef.isNonnull() &&
777  ptFast(parentSCRef->energy(),parentSCRef->position(),math::XYZPoint(0,0,0)) <= preselCutValues[0] ) continue;
778  reco::Photon newCandidate(*phoRef);
779  iSC++;
780 
781 
782  // Calculate the PF isolation and ID - for the time being there is no calculation. Only the setting
785 
786  //get the pointer for the photon object
787  edm::Ptr<reco::Photon> photonPtr(photonHandle, lSC);
788 
789  pfIso.chargedHadronIso = (*chargedHadrons_)[photonPtr] ;
790  pfIso.neutralHadronIso = (*neutralHadrons_)[photonPtr];
791  pfIso.photonIso = (*photons_)[photonPtr];
792  newCandidate.setPflowIsolationVariables(pfIso);
793  newCandidate.setPflowIDVariables(pfID);
794 
795 
796  // do the regression
797  thePhotonEnergyCorrector_->calculate(evt, newCandidate, subdet, *vertexHandle, es);
798  if ( candidateP4type_ == "fromEcalEnergy") {
799  newCandidate.setP4( newCandidate.p4(reco::Photon::ecal_photons) );
801  } else if ( candidateP4type_ == "fromRegression1") {
802  newCandidate.setP4( newCandidate.p4(reco::Photon::regression1) );
804  } else if ( candidateP4type_ == "fromRegression2") {
805  newCandidate.setP4( newCandidate.p4(reco::Photon::regression2) );
807  } else if ( candidateP4type_ == "fromRefinedSCRegression" ) {
808  newCandidate.setP4( newCandidate.p4(reco::Photon::regression2) );
810  }
811 
812  // std::cout << " GEDPhotonProducer pf based isolation chargedHadron " << newCandidate.chargedHadronIso() << " neutralHadron " << newCandidate.neutralHadronIso() << " Photon " << newCandidate.photonIso() << std::endl;
813  //std::cout << " GEDPhotonProducer from candidate HoE with towers in a cone " << newCandidate.hadronicOverEm() << " " << newCandidate.hadronicDepth1OverEm() << " " << newCandidate.hadronicDepth2OverEm() << std::endl;
814  //std::cout << " GEDPhotonProducer from candidate of HoE with towers behind the BCs " << newCandidate.hadTowOverEm() << " " << newCandidate.hadTowDepth1OverEm() << " " << newCandidate.hadTowDepth2OverEm() << std::endl;
815  //std::cout << " standard p4 before " << newCandidate.p4() << " energy " << newCandidate.energy() << std::endl;
816  //std::cout << " type " <<newCandidate.getCandidateP4type() << " standard p4 after " << newCandidate.p4() << " energy " << newCandidate.energy() << std::endl;
817  //std::cout << " final p4 " << newCandidate.p4() << " energy " << newCandidate.energy() << std::endl;
818 
819  outputPhotonCollection.push_back(newCandidate);
820 
821  }
822 
823 }
edm::InputTag photonProducer_
void setPflowIsolationVariables(const PflowIsolationVariables &pfisol)
Set Particle Flow Isolation variables.
Definition: Photon.h:497
T getParameter(std::string const &) const
PhotonEnergyCorrector * thePhotonEnergyCorrector_
PhotonMIPHaloTagger * thePhotonMIPHaloTagger_
virtual void beginRun(edm::Run const &r, edm::EventSetup const &es) override final
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
void calculate(const reco::Photon *, const edm::Event &, const edm::EventSetup &es, reco::Photon::FiducialFlags &phofid, reco::Photon::IsolationVariables &phoisolR03, reco::Photon::IsolationVariables &phoisolR04) const
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
edm::EDGetTokenT< reco::PFCandidateCollection > pfCandidates_
edm::ESHandle< CaloGeometry > theCaloGeom_
static float e2x5Bottom(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
std::vector< CaloTowerDetId > hcalTowersBehindClusters
Definition: Photon.h:152
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
void setCandidateP4type(const P4type type)
Definition: Photon.h:302
static std::vector< float > covariances(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, const CaloGeometry *geometry, float w0=4.7)
edm::EDGetTokenT< CaloTowerCollection > hcalTowers_
CaloTopology const * topology(0)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
static float eMax(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
virtual void produce(edm::Event &evt, const edm::EventSetup &es) override
int init
Definition: HydjetWrapper.h:67
edm::EDGetTokenT< edm::ValueMap< float > > phoPhotonIsolationToken_CITK
std::vector< int > flagsexclEB_
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
Definition: config.py:1
edm::EDGetTokenT< EcalRecHitCollection > endcapEcalHits_
#define nullptr
std::string reconstructionStep_
PhotonIsolationCalculator * thePhotonIsolationCalculator_
std::vector< int > severitiesexclEE_
std::unique_ptr< ModifyObjectValueBase > & gedRegression()
double ptFast(const double energy, const math::XYZPoint &position, const math::XYZPoint &origin)
std::string photonCollection_
static float e2x5Top(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
bool isFinite(T x)
virtual void endRun(edm::Run const &, edm::EventSetup const &) override final
edm::ESHandle< CaloTopology > theCaloTopo_
void setTowerCollection(const CaloTowerCollection *towercollection)
edm::EDGetTokenT< EcalRecHitCollection > barrelEcalHits_
PositionCalc posCalculator_
double getDepth1HcalESum(const reco::SuperCluster &sc) const
static float e2x2(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
T sqrt(T t)
Definition: SSEVec.h:18
double p4[4]
Definition: TauolaWrapper.h:92
void setup(const edm::ParameterSet &conf, std::vector< int > const &flagsEB_, std::vector< int > const &flagsEE_, std::vector< int > const &severitiesEB_, std::vector< int > const &severitiesEE_, edm::ConsumesCollector &&iC)
void setPflowIDVariables(const PflowIDVariables &pfid)
Definition: Photon.h:520
static float e2nd(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
TypeLabelItem const & produces()
declare what type of product will make and with which optional label
std::vector< int > flagsexclEE_
edm::EDGetTokenT< reco::PhotonCoreCollection > photonCoreProducerT_
static float e2x5Max(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
edm::EDGetTokenT< edm::ValueMap< float > > phoChargedIsolationToken_CITK
double f[11][100]
static float eBottom(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
static float e2x5Right(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
void init(const edm::EventSetup &theEventSetup)
void setup(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC)
bool isValid() const
Definition: HandleBase.h:74
double getTowerESum(const reco::Candidate *cand, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
edm::EDGetTokenT< reco::PFCandidateCollection > pfEgammaCandidates_
std::vector< int > severitiesexclEB_
const_iterator end() const
static float eTop(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
Definition: DetId.h:18
void calculate(edm::Event &evt, reco::Photon &, int subdet, const reco::VertexCollection &vtxcol, const edm::EventSetup &iSetup)
DetId seed() const
return DetId of seed
Definition: CaloCluster.h:205
GEDPhotonProducer(const edm::ParameterSet &ps)
T const * product() const
Definition: Handle.h:81
std::vector< double > preselCutValuesBarrel_
edm::EDGetTokenT< reco::PhotonCollection > photonProducerT_
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
const T & get() const
Definition: EventSetup.h:56
std::vector< double > preselCutValuesEndcap_
static float e2x5Left(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
const LorentzVector & p4(P4type type) const
std::string candidateP4type_
void fillPhotonCollection(edm::Event &evt, edm::EventSetup const &es, const edm::Handle< reco::PhotonCoreCollection > &photonCoreHandle, const CaloTopology *topology, const EcalRecHitCollection *ecalBarrelHits, const EcalRecHitCollection *ecalEndcapHits, const EcalRecHitCollection *preshowerHits, const edm::Handle< CaloTowerCollection > &hcalTowersHandle, const reco::VertexCollection &pvVertices, reco::PhotonCollection &outputCollection, int &iSC)
std::string const & label() const
Definition: InputTag.h:36
std::vector< CaloTowerDetId > towersOf(const reco::SuperCluster &sc) const
edm::EDGetTokenT< edm::ValueMap< float > > phoNeutralHadronIsolationToken_CITK
double getDepth2HcalESum(const reco::SuperCluster &sc) const
ESHandle< TrackerGeometry > geometry
iterator find(key_type k)
HLT enums.
static int position[264][3]
Definition: ReadPGInfo.cc:509
edm::ParameterSet conf_
static float eRight(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
bool isUninitialized() const
Definition: EDGetToken.h:73
static float e3x3(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
static float e1x3(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
edm::EDGetTokenT< reco::VertexCollection > vertexProducer_
T const * product() const
Definition: ESHandle.h:86
static float eLeft(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
static std::vector< float > localCovariances(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, float w0=4.7)
edm::EDGetTokenT< EcalRecHitCollection > preshowerHits_
static float e1x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
def move(src, dest)
Definition: eostools.py:510
Definition: Run.h:42
void setP4(P4type type, const LorentzVector &p4, float p4Error, bool setToRecoCandidate)
std::string valueMapPFCandPhoton_
static float e5x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)