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 
46 
47 namespace {
48  inline double ptFast( const double energy,
49  const math::XYZPoint& position,
50  const math::XYZPoint& origin ) {
51  const auto v = position - origin;
52  return energy*std::sqrt(v.perp2()/v.mag2());
53  }
54 }
55 
57  flags_(0)
58 {
59  if(step=="final") flags_ = kFinal;
60  else if(step=="oot") flags_ = kOOT;
61  else if(step=="ootfinal") flags_ = (kOOT|kFinal);
62  else if(step=="tmp") flags_ = 0;
63  else{
64  throw cms::Exception("InvalidConfig") <<" reconstructStep "<<step<<" is invalid, the options are: tmp, final,oot or ootfinal"<<std::endl;
65  }
66 }
67 
69  recoStep_(config.getParameter<std::string>("reconstructionStep")),
70  conf_(config)
71 {
72 
73  // use configuration file to setup input/output collection names
74  //
75  photonProducer_ = conf_.getParameter<edm::InputTag>("photonProducer");
76 
77  if ( recoStep_.isFinal() ) {
79  consumes<reco::PhotonCollection>(photonProducer_);
80  pfCandidates_ =
81  consumes<reco::PFCandidateCollection>(conf_.getParameter<edm::InputTag>("pfCandidates"));
82 
84  consumes<edm::ValueMap<float>>(conf_.getParameter<edm::InputTag>("chargedHadronIsolation"));
86  consumes<edm::ValueMap<float>>(conf_.getParameter<edm::InputTag>("neutralHadronIsolation"));
88  consumes<edm::ValueMap<float>>(conf_.getParameter<edm::InputTag>("photonIsolation"));
89  //OOT photons in legacy 80X re-miniAOD do not have PF cluster embeded into the reco object
90  //to preserve 80X behaviour
91  if(conf_.exists("pfECALClusIsolation")){
93  consumes<edm::ValueMap<float>>(conf_.getParameter<edm::InputTag>("pfECALClusIsolation"));
94  }
95  if(conf_.exists("pfHCALClusIsolation")){
97  consumes<edm::ValueMap<float>>(conf_.getParameter<edm::InputTag>("pfHCALClusIsolation"));
98  }
99  } else {
100 
102  consumes<reco::PhotonCoreCollection>(photonProducer_);
103 
104  }
105 
106  auto pfEg = conf_.getParameter<edm::InputTag>("pfEgammaCandidates");
107  if (not pfEg.label().empty())
109  consumes<reco::PFCandidateCollection>(pfEg);
110  barrelEcalHits_ =
111  consumes<EcalRecHitCollection>(conf_.getParameter<edm::InputTag>("barrelEcalHits"));
112  endcapEcalHits_ =
113  consumes<EcalRecHitCollection>(conf_.getParameter<edm::InputTag>("endcapEcalHits"));
114  preshowerHits_ =
115  consumes<EcalRecHitCollection>(conf_.getParameter<edm::InputTag>("preshowerHits"));
116  vertexProducer_ =
117  consumes<reco::VertexCollection>(conf_.getParameter<edm::InputTag>("primaryVertexProducer"));
118 
119  auto hcTow = conf_.getParameter<edm::InputTag>("hcalTowers");
120  if (not hcTow.label().empty())
121  hcalTowers_ =
122  consumes<CaloTowerCollection>(hcTow);
123  //
124  photonCollection_ = conf_.getParameter<std::string>("outputPhotonCollection");
125  hOverEConeSize_ = conf_.getParameter<double>("hOverEConeSize");
126  highEt_ = conf_.getParameter<double>("highEt");
127  // R9 value to decide converted/unconverted
128  minR9Barrel_ = conf_.getParameter<double>("minR9Barrel");
129  minR9Endcap_ = conf_.getParameter<double>("minR9Endcap");
130  usePrimaryVertex_ = conf_.getParameter<bool>("usePrimaryVertex");
131  runMIPTagger_ = conf_.getParameter<bool>("runMIPTagger");
132 
133  candidateP4type_ = config.getParameter<std::string>("candidateP4type") ;
134  valueMapPFCandPhoton_ = config.getParameter<std::string>("valueMapPhotons");
135 
136 
138  config.getParameter<edm::ParameterSet>("posCalcParameters");
139  posCalculator_ = PositionCalc(posCalcParameters);
140 
141 
142  //AA
143  //Flags and Severities to be excluded from photon calculations
144  const std::vector<std::string> flagnamesEB =
145  config.getParameter<std::vector<std::string> >("RecHitFlagToBeExcludedEB");
146 
147  const std::vector<std::string> flagnamesEE =
148  config.getParameter<std::vector<std::string> >("RecHitFlagToBeExcludedEE");
149 
150  flagsexclEB_=
151  StringToEnumValue<EcalRecHit::Flags>(flagnamesEB);
152 
153  flagsexclEE_=
154  StringToEnumValue<EcalRecHit::Flags>(flagnamesEE);
155 
156  const std::vector<std::string> severitynamesEB =
157  config.getParameter<std::vector<std::string> >("RecHitSeverityToBeExcludedEB");
158 
160  StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEB);
161 
162  const std::vector<std::string> severitynamesEE =
163  config.getParameter<std::vector<std::string> >("RecHitSeverityToBeExcludedEE");
164 
166  StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEE);
167 
169  new PhotonEnergyCorrector(conf_, consumesCollector());
170  if( conf_.existsAs<edm::ParameterSet>("regressionConfig") ) {
171  auto sumes = consumesCollector();
172  thePhotonEnergyCorrector_->gedRegression()->setConsumes(sumes);
173  }
174 
175  //AA
176 
177  //
178 
179  // Parameters for the position calculation:
180  // std::map<std::string,double> providedParameters;
181  // providedParameters.insert(std::make_pair("LogWeighted",conf_.getParameter<bool>("posCalc_logweight")));
182  //providedParameters.insert(std::make_pair("T0_barl",conf_.getParameter<double>("posCalc_t0_barl")));
183  //providedParameters.insert(std::make_pair("T0_endc",conf_.getParameter<double>("posCalc_t0_endc")));
184  //providedParameters.insert(std::make_pair("T0_endcPresh",conf_.getParameter<double>("posCalc_t0_endcPresh")));
185  //providedParameters.insert(std::make_pair("W0",conf_.getParameter<double>("posCalc_w0")));
186  //providedParameters.insert(std::make_pair("X0",conf_.getParameter<double>("posCalc_x0")));
187  //posCalculator_ = PositionCalc(providedParameters);
188  // cut values for pre-selection
189  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("minSCEtBarrel"));
190  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("maxHoverEBarrel"));
191  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("ecalRecHitSumEtOffsetBarrel"));
192  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("ecalRecHitSumEtSlopeBarrel"));
193  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("hcalTowerSumEtOffsetBarrel"));
194  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("hcalTowerSumEtSlopeBarrel"));
195  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("nTrackSolidConeBarrel"));
196  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("nTrackHollowConeBarrel"));
197  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("trackPtSumSolidConeBarrel"));
198  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("trackPtSumHollowConeBarrel"));
199  preselCutValuesBarrel_.push_back(conf_.getParameter<double>("sigmaIetaIetaCutBarrel"));
200  //
201  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("minSCEtEndcap"));
202  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("maxHoverEEndcap"));
203  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("ecalRecHitSumEtOffsetEndcap"));
204  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("ecalRecHitSumEtSlopeEndcap"));
205  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("hcalTowerSumEtOffsetEndcap"));
206  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("hcalTowerSumEtSlopeEndcap"));
207  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("nTrackSolidConeEndcap"));
208  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("nTrackHollowConeEndcap"));
209  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("trackPtSumSolidConeEndcap"));
210  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("trackPtSumHollowConeEndcap"));
211  preselCutValuesEndcap_.push_back(conf_.getParameter<double>("sigmaIetaIetaCutEndcap"));
212  //
213 
214  //moved from beginRun to here, I dont see how this could cause harm as its just reading in the exactly same parameters each run
215  if ( !recoStep_.isFinal()){
218  thePhotonIsolationCalculator_->setup(isolationSumsCalculatorSet, flagsexclEB_, flagsexclEE_, severitiesexclEB_, severitiesexclEE_,consumesCollector());
221  thePhotonMIPHaloTagger_->setup(mipVariableSet,consumesCollector());
222 
223  }else{
225  thePhotonMIPHaloTagger_=nullptr;
226  }
227 
228  checkHcalStatus_ = conf_.getParameter<bool>("checkHcalStatus");
229 
230  // Register the product
231  produces< reco::PhotonCollection >(photonCollection_);
233  produces< edm::ValueMap<reco::PhotonRef> > (valueMapPFCandPhoton_);
234 
235 
236 }
237 
239 {
243  //delete energyCorrectionF;
244 }
245 
246 
247 
248 void GEDPhotonProducer::beginRun (edm::Run const& r, edm::EventSetup const & theEventSetup) {
249 
250  if ( !recoStep_.isFinal() ) {
251  thePhotonEnergyCorrector_ -> init(theEventSetup);
252  }
253 
254 }
255 
256 void GEDPhotonProducer::endRun (edm::Run const& r, edm::EventSetup const & theEventSetup) {
257 }
258 
259 
260 void GEDPhotonProducer::produce(edm::Event& theEvent, const edm::EventSetup& theEventSetup) {
261 
262  using namespace edm;
263  // nEvt_++;
264 
266  auto outputPhotonCollection_p = std::make_unique<reco::PhotonCollection>();
267  edm::ValueMap<reco::PhotonRef> pfEGCandToPhotonMap;
268 
269 
270  // Get the PhotonCore collection
271  bool validPhotonCoreHandle=false;
272  Handle<reco::PhotonCoreCollection> photonCoreHandle;
273  bool validPhotonHandle= false;
274  Handle<reco::PhotonCollection> photonHandle;
275  //value maps for isolation
276  edm::Handle<edm::ValueMap<float> > phoChargedIsolationMapCITK;
277  edm::Handle<edm::ValueMap<float> > phoNeutralHadronIsolationMapCITK;
278  edm::Handle<edm::ValueMap<float> > phoPhotonIsolationMapCITK;
279  edm::Handle<edm::ValueMap<float> > phoPFECALClusIsolationMap;
280  edm::Handle<edm::ValueMap<float> > phoPFHCALClusIsolationMap;
281 
282  if ( recoStep_.isFinal() ) {
283  theEvent.getByToken(photonProducerT_,photonHandle);
284  //get isolation objects
285  theEvent.getByToken(phoChargedIsolationTokenCITK_,phoChargedIsolationMapCITK);
286  theEvent.getByToken(phoNeutralHadronIsolationTokenCITK_,phoNeutralHadronIsolationMapCITK);
287  theEvent.getByToken(phoPhotonIsolationTokenCITK_,phoPhotonIsolationMapCITK);
288  //OOT photons in legacy 80X re-miniAOD workflow dont have cluster isolation embed in them
290  theEvent.getByToken(phoPFECALClusIsolationToken_,phoPFECALClusIsolationMap);
291  }
293  theEvent.getByToken(phoPFHCALClusIsolationToken_,phoPFHCALClusIsolationMap);
294  }
295 
296  if ( photonHandle.isValid()) {
297  validPhotonHandle=true;
298  } else {
299  throw cms::Exception("GEDPhotonProducer") << "Error! Can't get the product " << photonProducer_.label() << "\n";
300  }
301  } else {
302 
303  theEvent.getByToken(photonCoreProducerT_,photonCoreHandle);
304  if (photonCoreHandle.isValid()) {
305  validPhotonCoreHandle=true;
306  } else {
307  throw cms::Exception("GEDPhotonProducer")
308  << "Error! Can't get the photonCoreProducer " << photonProducer_.label() << "\n";
309  }
310  }
311 
312  // Get EcalRecHits
313  bool validEcalRecHits=true;
314  Handle<EcalRecHitCollection> barrelHitHandle;
315  const EcalRecHitCollection dummyEB;
316  theEvent.getByToken(barrelEcalHits_, barrelHitHandle);
317  if (!barrelHitHandle.isValid()) {
318  throw cms::Exception("GEDPhotonProducer")
319  << "Error! Can't get the barrelEcalHits";
320  }
321  const EcalRecHitCollection& barrelRecHits(validEcalRecHits ? *(barrelHitHandle.product()) : dummyEB);
322 
323  Handle<EcalRecHitCollection> endcapHitHandle;
324  theEvent.getByToken(endcapEcalHits_, endcapHitHandle);
325  const EcalRecHitCollection dummyEE;
326  if (!endcapHitHandle.isValid()) {
327  throw cms::Exception("GEDPhotonProducer")
328  << "Error! Can't get the endcapEcalHits";
329  }
330  const EcalRecHitCollection& endcapRecHits(validEcalRecHits ? *(endcapHitHandle.product()) : dummyEE);
331 
332  bool validPreshowerRecHits=true;
333  Handle<EcalRecHitCollection> preshowerHitHandle;
334  theEvent.getByToken(preshowerHits_, preshowerHitHandle);
335  EcalRecHitCollection preshowerRecHits;
336  if (!preshowerHitHandle.isValid()) {
337  throw cms::Exception("GEDPhotonProducer")
338  << "Error! Can't get the preshowerEcalHits";
339  }
340  if( validPreshowerRecHits ) preshowerRecHits = *(preshowerHitHandle.product());
341 
342 
343 
344  Handle<reco::PFCandidateCollection> pfEGCandidateHandle;
345  // Get the PF refined cluster collection
347  theEvent.getByToken(pfEgammaCandidates_,pfEGCandidateHandle);
348  if (!pfEGCandidateHandle.isValid()) {
349  throw cms::Exception("GEDPhotonProducer")
350  << "Error! Can't get the pfEgammaCandidates";
351  }
352  }
353 
354  Handle<reco::PFCandidateCollection> pfCandidateHandle;
355 
356  if ( recoStep_.isFinal() ) {
357  // Get the PF candidates collection
358  theEvent.getByToken(pfCandidates_,pfCandidateHandle);
359  //OOT photons have no PF candidates so its not an error in this case
360  if (!pfCandidateHandle.isValid() && !recoStep_.isOOT()) {
361  throw cms::Exception("GEDPhotonProducer")
362  << "Error! Can't get the pfCandidates";
363  }
364  }
365 
366  //AA
367  //Get the severity level object
369  theEventSetup.get<EcalSeverityLevelAlgoRcd>().get(sevLv);
370  //
371 
372 
373 // get Hcal towers collection
374  Handle<CaloTowerCollection> hcalTowersHandle;
375  if (not hcalTowers_.isUninitialized()){
376  theEvent.getByToken(hcalTowers_, hcalTowersHandle);
377  }
378 
379  // get the geometry from the event setup:
380  theEventSetup.get<CaloGeometryRecord>().get(theCaloGeom_);
381 
382  //
383  // update energy correction function
384  // energyCorrectionF->init(theEventSetup);
385 
386  edm::ESHandle<CaloTopology> pTopology;
387  theEventSetup.get<CaloTopologyRecord>().get(theCaloTopo_);
389 
390  // Get the primary event vertex
391  Handle<reco::VertexCollection> vertexHandle;
392  const reco::VertexCollection dummyVC;
393  bool validVertex=true;
394  if ( usePrimaryVertex_ ) {
395  theEvent.getByToken(vertexProducer_, vertexHandle);
396  if (!vertexHandle.isValid()) {
397  throw cms::Exception("GEDPhotonProducer")
398  << "Error! Can't get the product primary Vertex Collection";
399  }
400  }
401  const reco::VertexCollection& vertexCollection(usePrimaryVertex_ && validVertex ? *(vertexHandle.product()) : dummyVC);
402 
403  // math::XYZPoint vtx(0.,0.,0.);
404  //if (vertexCollection.size()>0) vtx = vertexCollection.begin()->position();
405 
406  // get the regression calculator ready
407  thePhotonEnergyCorrector_->init(theEventSetup);
409  thePhotonEnergyCorrector_->gedRegression()->setEvent(theEvent);
410  thePhotonEnergyCorrector_->gedRegression()->setEventContent(theEventSetup);
411  }
412 
413 
414  int iSC=0; // index in photon collection
415  // Loop over barrel and endcap SC collections and fill the photon collection
416  if ( validPhotonCoreHandle)
417  fillPhotonCollection(theEvent,
418  theEventSetup,
419  photonCoreHandle,
420  topology,
421  &barrelRecHits,
422  &endcapRecHits,
423  &preshowerRecHits,
424  hcalTowersHandle,
425  //vtx,
426  vertexCollection,
427  outputPhotonCollection,
428  iSC);
429 
430  iSC=0;
431  if ( validPhotonHandle && recoStep_.isFinal() )
432  fillPhotonCollection(theEvent,
433  theEventSetup,
434  photonHandle,
435  pfCandidateHandle,
436  pfEGCandidateHandle,
437  pfEGCandToPhotonMap,
438  vertexHandle,
439  outputPhotonCollection,
440  iSC,
441  phoChargedIsolationMapCITK,
442  phoNeutralHadronIsolationMapCITK,
443  phoPhotonIsolationMapCITK,
444  phoPFECALClusIsolationMap,
445  phoPFHCALClusIsolationMap);
446 
447 
448 
449  // put the product in the event
450  edm::LogInfo("GEDPhotonProducer") << " Put in the event " << iSC << " Photon Candidates \n";
451  outputPhotonCollection_p->assign(outputPhotonCollection.begin(),outputPhotonCollection.end());
452  const edm::OrphanHandle<reco::PhotonCollection> photonOrphHandle = theEvent.put(std::move(outputPhotonCollection_p), photonCollection_);
453 
454 
457  auto pfEGCandToPhotonMap_p = std::make_unique<edm::ValueMap<reco::PhotonRef>>();
458  edm::ValueMap<reco::PhotonRef>::Filler filler(*pfEGCandToPhotonMap_p);
459  unsigned nObj = pfEGCandidateHandle->size();
460  std::vector<reco::PhotonRef> values(nObj);
462  for(unsigned int lCand=0; lCand < nObj; lCand++) {
463  reco::PFCandidateRef pfCandRef (reco::PFCandidateRef(pfEGCandidateHandle,lCand));
464  reco::SuperClusterRef pfScRef = pfCandRef -> superClusterRef();
465 
466  for(unsigned int lSC=0; lSC < photonOrphHandle->size(); lSC++) {
467  reco::PhotonRef photonRef(reco::PhotonRef(photonOrphHandle, lSC));
468  reco::SuperClusterRef scRef=photonRef->superCluster();
469  if ( pfScRef != scRef ) continue;
470  values[lCand] = photonRef;
471  }
472  }
473 
474 
475  filler.insert(pfEGCandidateHandle,values.begin(),values.end());
476  filler.fill();
477  theEvent.put(std::move(pfEGCandToPhotonMap_p),valueMapPFCandPhoton_);
478 
479 
480  }
481 
482 
483 
484 
485 
486 
487 }
488 
490  edm::EventSetup const & es,
491  const edm::Handle<reco::PhotonCoreCollection> & photonCoreHandle,
492  const CaloTopology* topology,
493  const EcalRecHitCollection* ecalBarrelHits,
494  const EcalRecHitCollection* ecalEndcapHits,
496  const edm::Handle<CaloTowerCollection> & hcalTowersHandle,
499 
500 
503  std::vector<double> preselCutValues;
504  std::vector<int> flags_, severitiesexcl_;
505 
506  for(unsigned int lSC=0; lSC < photonCoreHandle->size(); lSC++) {
507 
508  reco::PhotonCoreRef coreRef(reco::PhotonCoreRef(photonCoreHandle, lSC));
509  reco::SuperClusterRef parentSCRef = coreRef->parentSuperCluster();
510  reco::SuperClusterRef scRef=coreRef->superCluster();
511 
512 
513 
514  // const reco::SuperCluster* pClus=&(*scRef);
515  iSC++;
516 
517  DetId::Detector thedet = scRef->seed()->hitsAndFractions()[0].first.det();
518  int subdet = scRef->seed()->hitsAndFractions()[0].first.subdetId();
519  if (subdet==EcalBarrel) {
520  preselCutValues = preselCutValuesBarrel_;
521  hits = ecalBarrelHits;
522  flags_ = flagsexclEB_;
523  severitiesexcl_ = severitiesexclEB_;
524  } else if (subdet==EcalEndcap) {
525  preselCutValues = preselCutValuesEndcap_;
526  hits = ecalEndcapHits;
527  flags_ = flagsexclEE_;
528  severitiesexcl_ = severitiesexclEE_;
529  } else if ( EcalTools::isHGCalDet(thedet) ) {
530  preselCutValues = preselCutValuesEndcap_;
531  hits = nullptr;
532  flags_ = flagsexclEE_;
533  severitiesexcl_ = severitiesexclEE_;
534  } else {
535  edm::LogWarning("")<<"GEDPhotonProducer: do not know if it is a barrel or endcap SuperCluster: " << thedet << ' ' << subdet;
536  }
537 
538 
539 
540 
541  // SC energy preselection
542  if (parentSCRef.isNonnull() &&
543  ptFast(parentSCRef->energy(),parentSCRef->position(),math::XYZPoint(0,0,0)) <= preselCutValues[0] ) continue;
544  // calculate HoE
545 
546  double HoE1,HoE2;
547  HoE1=HoE2=0.;
548 
549  std::vector<CaloTowerDetId> TowersBehindClus;
550  float hcalDepth1OverEcalBc,hcalDepth2OverEcalBc;
551  hcalDepth1OverEcalBc=hcalDepth2OverEcalBc=0.f;
552  bool invalidHcal = false;
553 
554  if (not hcalTowers_.isUninitialized()) {
555  const CaloTowerCollection* hcalTowersColl = hcalTowersHandle.product();
556  EgammaTowerIsolation towerIso1(hOverEConeSize_,0.,0.,1,hcalTowersColl) ;
557  EgammaTowerIsolation towerIso2(hOverEConeSize_,0.,0.,2,hcalTowersColl) ;
558  HoE1=towerIso1.getTowerESum(&(*scRef))/scRef->energy();
559  HoE2=towerIso2.getTowerESum(&(*scRef))/scRef->energy();
560 
561  EgammaHadTower towerIsoBehindClus(es);
562  towerIsoBehindClus.setTowerCollection(hcalTowersHandle.product());
563  TowersBehindClus = towerIsoBehindClus.towersOf(*scRef);
564  hcalDepth1OverEcalBc = towerIsoBehindClus.getDepth1HcalESum(TowersBehindClus)/scRef->energy();
565  hcalDepth2OverEcalBc = towerIsoBehindClus.getDepth2HcalESum(TowersBehindClus)/scRef->energy();
566 
567  if (checkHcalStatus_ && hcalDepth1OverEcalBc == 0 && hcalDepth2OverEcalBc == 0) {
568  invalidHcal = !towerIsoBehindClus.hasActiveHcal(TowersBehindClus);
569  }
570  }
571 
572  // std::cout << " GEDPhotonProducer calculation of HoE with towers in a cone " << HoE1 << " " << HoE2 << std::endl;
573  //std::cout << " GEDPhotonProducer calcualtion of HoE with towers behind the BCs " << hcalDepth1OverEcalBc << " " << hcalDepth2OverEcalBc << std::endl;
574 
575  float maxXtal = ( hits != nullptr ? EcalClusterTools::eMax( *(scRef->seed()), &(*hits) ) : 0.f );
576  //AA
577  //Change these to consider severity level of hits
578  float e1x5 = ( hits != nullptr ? EcalClusterTools::e1x5( *(scRef->seed()), &(*hits), &(*topology)) : 0.f );
579  float e2x5 = ( hits != nullptr ? EcalClusterTools::e2x5Max( *(scRef->seed()), &(*hits), &(*topology)) : 0.f );
580  float e3x3 = ( hits != nullptr ? EcalClusterTools::e3x3( *(scRef->seed()), &(*hits), &(*topology)) : 0.f );
581  float e5x5 = ( hits != nullptr ? EcalClusterTools::e5x5( *(scRef->seed()), &(*hits), &(*topology)) : 0.f );
582  std::vector<float> cov = ( hits != nullptr ? EcalClusterTools::covariances( *(scRef->seed()), &(*hits), &(*topology), geometry) : std::vector<float>( {0.f,0.f,0.f} ) );
583  std::vector<float> locCov = ( hits != nullptr ? EcalClusterTools::localCovariances( *(scRef->seed()), &(*hits), &(*topology)) : std::vector<float>( {0.f,0.f,0.f} ) );
584 
585  float sigmaEtaEta = sqrt(cov[0]);
586  float sigmaIetaIeta = sqrt(locCov[0]);
587 
588  float full5x5_maxXtal = ( hits != nullptr ? noZS::EcalClusterTools::eMax( *(scRef->seed()), &(*hits) ) : 0.f );
589  //AA
590  //Change these to consider severity level of hits
591  float full5x5_e1x5 = ( hits != nullptr ? noZS::EcalClusterTools::e1x5( *(scRef->seed()), &(*hits), &(*topology)) : 0.f );
592  float full5x5_e2x5 = ( hits != nullptr ? noZS::EcalClusterTools::e2x5Max( *(scRef->seed()), &(*hits), &(*topology)) : 0.f );
593  float full5x5_e3x3 = ( hits != nullptr ? noZS::EcalClusterTools::e3x3( *(scRef->seed()), &(*hits), &(*topology)) : 0.f );
594  float full5x5_e5x5 = ( hits != nullptr ? noZS::EcalClusterTools::e5x5( *(scRef->seed()), &(*hits), &(*topology)) : 0.f );
595  std::vector<float> full5x5_cov = ( hits != nullptr ? noZS::EcalClusterTools::covariances( *(scRef->seed()), &(*hits), &(*topology), geometry) : std::vector<float>( {0.f,0.f,0.f} ) );
596  std::vector<float> full5x5_locCov = ( hits != nullptr ? noZS::EcalClusterTools::localCovariances( *(scRef->seed()), &(*hits), &(*topology)) : std::vector<float>( {0.f,0.f,0.f} ) );
597 
598  float full5x5_sigmaEtaEta = sqrt(full5x5_cov[0]);
599  float full5x5_sigmaIetaIeta = sqrt(full5x5_locCov[0]);
600 
601  // compute position of ECAL shower
602  math::XYZPoint caloPosition = scRef->position();
603 
604 
606  double photonEnergy=1.;
607  math::XYZPoint vtx(0.,0.,0.);
608  if (!vertexCollection.empty()) vtx = vertexCollection.begin()->position();
609  // compute momentum vector of photon from primary vertex and cluster position
610  math::XYZVector direction = caloPosition - vtx;
611  //math::XYZVector momentum = direction.unit() * photonEnergy ;
612  math::XYZVector momentum = direction.unit() ;
613 
614  // Create dummy candidate with unit momentum and zero energy to allow setting of all variables. The energy is set for last.
615  math::XYZTLorentzVectorD p4(momentum.x(), momentum.y(), momentum.z(), photonEnergy );
616  reco::Photon newCandidate(p4, caloPosition, coreRef, vtx);
617 
618  //std::cout << " standard p4 before " << newCandidate.p4() << " energy " << newCandidate.energy() << std::endl;
619  //std::cout << " type " <<newCandidate.getCandidateP4type() << " standard p4 after " << newCandidate.p4() << " energy " << newCandidate.energy() << std::endl;
620 
621  // Calculate fiducial flags and isolation variable. Blocked are filled from the isolationCalculator
622  reco::Photon::FiducialFlags fiducialFlags;
623  reco::Photon::IsolationVariables isolVarR03, isolVarR04;
624  if( !EcalTools::isHGCalDet(thedet) ) {
625  thePhotonIsolationCalculator_->calculate( &newCandidate,evt,es,fiducialFlags,isolVarR04, isolVarR03);
626  }
627  newCandidate.setFiducialVolumeFlags( fiducialFlags );
628  newCandidate.setIsolationVariables(isolVarR04, isolVarR03 );
629 
630 
632  reco::Photon::ShowerShape showerShape;
633  showerShape.e1x5= e1x5;
634  showerShape.e2x5= e2x5;
635  showerShape.e3x3= e3x3;
636  showerShape.e5x5= e5x5;
637  showerShape.maxEnergyXtal = maxXtal;
638  showerShape.sigmaEtaEta = sigmaEtaEta;
639  showerShape.sigmaIetaIeta = sigmaIetaIeta;
640  showerShape.hcalDepth1OverEcal = HoE1;
641  showerShape.hcalDepth2OverEcal = HoE2;
642  showerShape.hcalDepth1OverEcalBc = hcalDepth1OverEcalBc;
643  showerShape.hcalDepth2OverEcalBc = hcalDepth2OverEcalBc;
644  showerShape.hcalTowersBehindClusters = TowersBehindClus;
645  showerShape.invalidHcal = invalidHcal;
647  const float spp = (!edm::isFinite(locCov[2]) ? 0. : sqrt(locCov[2]));
648  const float sep = locCov[1];
649  showerShape.sigmaIetaIphi = sep;
650  showerShape.sigmaIphiIphi = spp;
651  showerShape.e2nd = ( hits != nullptr ? EcalClusterTools::e2nd(*(scRef->seed()),&(*hits)) : 0.f );
652  showerShape.eTop = ( hits != nullptr ? EcalClusterTools::eTop(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
653  showerShape.eLeft = ( hits != nullptr ? EcalClusterTools::eLeft(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
654  showerShape.eRight = ( hits != nullptr ? EcalClusterTools::eRight(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
655  showerShape.eBottom = ( hits != nullptr ? EcalClusterTools::eBottom(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
656  showerShape.e1x3 = ( hits != nullptr ? EcalClusterTools::e1x3(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
657  showerShape.e2x2 = ( hits != nullptr ? EcalClusterTools::e2x2(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
658  showerShape.e2x5Max = ( hits != nullptr ? EcalClusterTools::e2x5Max(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
659  showerShape.e2x5Left = ( hits != nullptr ? EcalClusterTools::e2x5Left(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
660  showerShape.e2x5Right = ( hits != nullptr ? EcalClusterTools::e2x5Right(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
661  showerShape.e2x5Top = ( hits != nullptr ? EcalClusterTools::e2x5Top(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
662  showerShape.e2x5Bottom = ( hits != nullptr ? EcalClusterTools::e2x5Bottom(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
663  // fill preshower shapes
665  const float sigmaRR = toolsforES.eseffsirir( *scRef );
666  showerShape.effSigmaRR = sigmaRR;
667  newCandidate.setShowerShapeVariables ( showerShape );
668 
669  reco::Photon::SaturationInfo saturationInfo;
670  const reco::CaloCluster& seedCluster = *(scRef->seed()) ;
671  DetId seedXtalId = seedCluster.seed();
672  int nSaturatedXtals = 0;
673  bool isSeedSaturated = false;
674  if (hits != nullptr) {
675  const auto hitsAndFractions = scRef->hitsAndFractions();
676  for (auto&& hitFractionPair : hitsAndFractions) {
677  auto&& ecalRecHit = hits->find(hitFractionPair.first);
678  if (ecalRecHit == hits->end()) continue;
679  if (ecalRecHit->checkFlag(EcalRecHit::Flags::kSaturated)) {
680  nSaturatedXtals++;
681  if (seedXtalId == ecalRecHit->detid())
682  isSeedSaturated = true;
683  }
684  }
685  }
686  saturationInfo.nSaturatedXtals = nSaturatedXtals;
687  saturationInfo.isSeedSaturated = isSeedSaturated;
688  newCandidate.setSaturationInfo(saturationInfo);
689 
691  reco::Photon::ShowerShape full5x5_showerShape;
692  full5x5_showerShape.e1x5= full5x5_e1x5;
693  full5x5_showerShape.e2x5= full5x5_e2x5;
694  full5x5_showerShape.e3x3= full5x5_e3x3;
695  full5x5_showerShape.e5x5= full5x5_e5x5;
696  full5x5_showerShape.maxEnergyXtal = full5x5_maxXtal;
697  full5x5_showerShape.sigmaEtaEta = full5x5_sigmaEtaEta;
698  full5x5_showerShape.sigmaIetaIeta = full5x5_sigmaIetaIeta;
700  const float full5x5_spp = (!edm::isFinite(full5x5_locCov[2]) ? 0. : sqrt(full5x5_locCov[2]));
701  const float full5x5_sep = full5x5_locCov[1];
702  full5x5_showerShape.sigmaIetaIphi = full5x5_sep;
703  full5x5_showerShape.sigmaIphiIphi = full5x5_spp;
704  full5x5_showerShape.e2nd = ( hits != nullptr ? noZS::EcalClusterTools::e2nd(*(scRef->seed()),&(*hits)) : 0.f );
705  full5x5_showerShape.eTop = ( hits != nullptr ? noZS::EcalClusterTools::eTop(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
706  full5x5_showerShape.eLeft = ( hits != nullptr ? noZS::EcalClusterTools::eLeft(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
707  full5x5_showerShape.eRight = ( hits != nullptr ? noZS::EcalClusterTools::eRight(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
708  full5x5_showerShape.eBottom = ( hits != nullptr ? noZS::EcalClusterTools::eBottom(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
709  full5x5_showerShape.e1x3 = ( hits != nullptr ? noZS::EcalClusterTools::e1x3(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
710  full5x5_showerShape.e2x2 = ( hits != nullptr ? noZS::EcalClusterTools::e2x2(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
711  full5x5_showerShape.e2x5Max = ( hits != nullptr ? noZS::EcalClusterTools::e2x5Max(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
712  full5x5_showerShape.e2x5Left = ( hits != nullptr ? noZS::EcalClusterTools::e2x5Left(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
713  full5x5_showerShape.e2x5Right = ( hits != nullptr ? noZS::EcalClusterTools::e2x5Right(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
714  full5x5_showerShape.e2x5Top = ( hits != nullptr ? noZS::EcalClusterTools::e2x5Top(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
715  full5x5_showerShape.e2x5Bottom = ( hits != nullptr ? noZS::EcalClusterTools::e2x5Bottom(*(scRef->seed()), &(*hits), &(*topology)) : 0.f );
716  // fill preshower shapes
717  full5x5_showerShape.effSigmaRR = sigmaRR;
718  newCandidate.full5x5_setShowerShapeVariables ( full5x5_showerShape );
719 
720 
721 
724  // Photon candidate takes by default (set in photons_cfi.py)
725  // a 4-momentum derived from the ecal photon-specific corrections.
726  if( !EcalTools::isHGCalDet(thedet) ) {
727  thePhotonEnergyCorrector_->calculate(evt, newCandidate, subdet, vertexCollection, es);
728  if ( candidateP4type_ == "fromEcalEnergy") {
729  newCandidate.setP4( newCandidate.p4(reco::Photon::ecal_photons) );
730  newCandidate.setCandidateP4type(reco::Photon::ecal_photons);
731  } else if ( candidateP4type_ == "fromRegression1") {
732  newCandidate.setP4( newCandidate.p4(reco::Photon::regression1) );
733  newCandidate.setCandidateP4type(reco::Photon::regression1);
734  } else if ( candidateP4type_ == "fromRegression2") {
735  newCandidate.setP4( newCandidate.p4(reco::Photon::regression2) );
736  newCandidate.setCandidateP4type(reco::Photon::regression2);
737  } else if ( candidateP4type_ == "fromRefinedSCRegression" ) {
738  newCandidate.setP4( newCandidate.p4(reco::Photon::regression2) );
739  newCandidate.setCandidateP4type(reco::Photon::regression2);
740  }
741  } else {
742  math::XYZVector gamma_momentum = direction.unit() * scRef->energy();
743  math::XYZTLorentzVectorD p4(gamma_momentum.x(),
744  gamma_momentum.y(),
745  gamma_momentum.z(),
746  scRef->energy());
747  newCandidate.setP4(p4);
748  newCandidate.setCandidateP4type(reco::Photon::ecal_photons);
749  // Make it an EE photon
750  reco::Photon::FiducialFlags fiducialFlags;
751  fiducialFlags.isEE = true;
752  newCandidate.setFiducialVolumeFlags(fiducialFlags);
753  }
754 
755  // std::cout << " final p4 " << newCandidate.p4() << " energy " << newCandidate.energy() << std::endl;
756 
757 
758  // std::cout << " GEDPhotonProducer from candidate HoE with towers in a cone " << newCandidate.hadronicOverEm() << " " << newCandidate.hadronicDepth1OverEm() << " " << newCandidate.hadronicDepth2OverEm() << std::endl;
759  // std::cout << " GEDPhotonProducer from candidate of HoE with towers behind the BCs " << newCandidate.hadTowOverEm() << " " << newCandidate.hadTowDepth1OverEm() << " " << newCandidate.hadTowDepth2OverEm() << std::endl;
760 
761 
762  // fill MIP Vairables for Halo: Block for MIP are filled from PhotonMIPHaloTagger
764  if(subdet==EcalBarrel && runMIPTagger_ )
765  {
766 
767  thePhotonMIPHaloTagger_-> MIPcalculate( &newCandidate,evt,es,mipVar);
768  newCandidate.setMIPVariables(mipVar);
769  }
770 
771 
772 
774  bool isLooseEM=true;
775  if ( newCandidate.pt() < highEt_) {
776  if ( newCandidate.hadronicOverEm() >= preselCutValues[1] ) isLooseEM=false;
777  if ( newCandidate.ecalRecHitSumEtConeDR04() > preselCutValues[2]+ preselCutValues[3]*newCandidate.pt() ) isLooseEM=false;
778  if ( newCandidate.hcalTowerSumEtConeDR04() > preselCutValues[4]+ preselCutValues[5]*newCandidate.pt() ) isLooseEM=false;
779  if ( newCandidate.nTrkSolidConeDR04() > int(preselCutValues[6]) ) isLooseEM=false;
780  if ( newCandidate.nTrkHollowConeDR04() > int(preselCutValues[7]) ) isLooseEM=false;
781  if ( newCandidate.trkSumPtSolidConeDR04() > preselCutValues[8] ) isLooseEM=false;
782  if ( newCandidate.trkSumPtHollowConeDR04() > preselCutValues[9] ) isLooseEM=false;
783  if ( newCandidate.sigmaIetaIeta() > preselCutValues[10] ) isLooseEM=false;
784  }
785 
786 
787 
788  if ( isLooseEM)
789  outputPhotonCollection.push_back(newCandidate);
790 
791 
792  }
793 }
794 
795 
796 
797 
799  edm::EventSetup const & es,
800  const edm::Handle<reco::PhotonCollection> & photonHandle,
801  const edm::Handle<reco::PFCandidateCollection> pfCandidateHandle,
802  const edm::Handle<reco::PFCandidateCollection> pfEGCandidateHandle,
803  edm::ValueMap<reco::PhotonRef> pfEGCandToPhotonMap,
806  const edm::Handle<edm::ValueMap<float>>& chargedHadrons,
807  const edm::Handle<edm::ValueMap<float>>& neutralHadrons,
809  const edm::Handle<edm::ValueMap<float>>& pfEcalClusters,
810  const edm::Handle<edm::ValueMap<float>>& pfHcalClusters){
811 
812 
813 
814  std::vector<double> preselCutValues;
815 
816 
817  for(unsigned int lSC=0; lSC < photonHandle->size(); lSC++) {
818  reco::PhotonRef phoRef(reco::PhotonRef(photonHandle, lSC));
819  reco::SuperClusterRef parentSCRef = phoRef->parentSuperCluster();
820  reco::SuperClusterRef scRef=phoRef->superCluster();
821  DetId::Detector thedet = scRef->seed()->hitsAndFractions()[0].first.det();
822  int subdet = scRef->seed()->hitsAndFractions()[0].first.subdetId();
823  if (subdet==EcalBarrel) {
824  preselCutValues = preselCutValuesBarrel_;
825  } else if (subdet==EcalEndcap) {
826  preselCutValues = preselCutValuesEndcap_;
827  } else if (EcalTools::isHGCalDet(thedet)) {
828  preselCutValues = preselCutValuesEndcap_;
829  } else {
830  edm::LogWarning("")<<"GEDPhotonProducer: do not know if it is a barrel or endcap SuperCluster" << thedet << ' ' << subdet;
831  }
832 
833 
834 
835  // SC energy preselection
836  if (parentSCRef.isNonnull() &&
837  ptFast(parentSCRef->energy(),parentSCRef->position(),math::XYZPoint(0,0,0)) <= preselCutValues[0] ) continue;
838  reco::Photon newCandidate(*phoRef);
839  iSC++;
840 
841 
842  // Calculate the PF isolation and ID - for the time being there is no calculation. Only the setting
845 
846  //get the pointer for the photon object
847  edm::Ptr<reco::Photon> photonPtr(photonHandle, lSC);
848 
849  if(!recoStep_.isOOT()){ //out of time photons do not have PF info so skip in this case
850  pfIso.chargedHadronIso = (*chargedHadrons)[photonPtr] ;
851  pfIso.neutralHadronIso = (*neutralHadrons)[photonPtr];
852  pfIso.photonIso = (*photons)[photonPtr];
853  }
854 
855  //OOT photons in legacy 80X reminiAOD workflow dont have pf cluster isolation embeded into them at this stage
857  pfIso.sumEcalClusterEt = (*pfEcalClusters)[photonPtr];
858  }else pfIso.sumEcalClusterEt = 0.;
859 
861  pfIso.sumHcalClusterEt = (*pfHcalClusters)[photonPtr];
862  }else pfIso.sumHcalClusterEt = 0.;
863 
864  newCandidate.setPflowIsolationVariables(pfIso);
865  newCandidate.setPflowIDVariables(pfID);
866 
867  // do the regression
868  thePhotonEnergyCorrector_->calculate(evt, newCandidate, subdet, *vertexHandle, es);
869  if ( candidateP4type_ == "fromEcalEnergy") {
870  newCandidate.setP4( newCandidate.p4(reco::Photon::ecal_photons) );
872  } else if ( candidateP4type_ == "fromRegression1") {
873  newCandidate.setP4( newCandidate.p4(reco::Photon::regression1) );
875  } else if ( candidateP4type_ == "fromRegression2") {
876  newCandidate.setP4( newCandidate.p4(reco::Photon::regression2) );
878  } else if ( candidateP4type_ == "fromRefinedSCRegression" ) {
879  newCandidate.setP4( newCandidate.p4(reco::Photon::regression2) );
881  }
882 
883  // std::cout << " GEDPhotonProducer pf based isolation chargedHadron " << newCandidate.chargedHadronIso() << " neutralHadron " << newCandidate.neutralHadronIso() << " Photon " << newCandidate.photonIso() << std::endl;
884  //std::cout << " GEDPhotonProducer from candidate HoE with towers in a cone " << newCandidate.hadronicOverEm() << " " << newCandidate.hadronicDepth1OverEm() << " " << newCandidate.hadronicDepth2OverEm() << std::endl;
885  //std::cout << " GEDPhotonProducer from candidate of HoE with towers behind the BCs " << newCandidate.hadTowOverEm() << " " << newCandidate.hadTowDepth1OverEm() << " " << newCandidate.hadTowDepth2OverEm() << std::endl;
886  //std::cout << " standard p4 before " << newCandidate.p4() << " energy " << newCandidate.energy() << std::endl;
887  //std::cout << " type " <<newCandidate.getCandidateP4type() << " standard p4 after " << newCandidate.p4() << " energy " << newCandidate.energy() << std::endl;
888  //std::cout << " final p4 " << newCandidate.p4() << " energy " << newCandidate.energy() << std::endl;
889 
890  outputPhotonCollection.push_back(newCandidate);
891 
892  }
893 
894 }
edm::EDGetTokenT< edm::ValueMap< float > > phoNeutralHadronIsolationTokenCITK_
edm::InputTag photonProducer_
void setPflowIsolationVariables(const PflowIsolationVariables &pfisol)
Set Particle Flow Isolation variables.
Definition: Photon.h:510
T getParameter(std::string const &) const
static bool isHGCalDet(DetId::Detector thedet)
identify HGCal cells
Definition: EcalTools.h:54
PhotonEnergyCorrector * thePhotonEnergyCorrector_
PhotonMIPHaloTagger * thePhotonMIPHaloTagger_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
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:253
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:185
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:308
void beginRun(edm::Run const &r, edm::EventSetup const &es) final
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:579
static float eMax(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
void produce(edm::Event &evt, const edm::EventSetup &es) override
~GEDPhotonProducer() override
int init
Definition: HydjetWrapper.h:67
RecoStepInfo recoStep_
bool exists(std::string const &parameterName) const
checks if a parameter exists
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
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_
bool hasActiveHcal(const reco::SuperCluster &sc) const
static float e2x5Top(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
bool isFinite(T x)
RecoStepInfo(const std::string &recoStep)
edm::EDGetTokenT< edm::ValueMap< float > > phoPhotonIsolationTokenCITK_
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)
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:533
static float e2nd(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
std::vector< int > flagsexclEE_
edm::EDGetTokenT< reco::PhotonCoreCollection > photonCoreProducerT_
static float e2x5Max(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
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)
edm::EDGetTokenT< edm::ValueMap< float > > phoPFHCALClusIsolationToken_
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:207
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
edm::EDGetTokenT< edm::ValueMap< float > > phoChargedIsolationTokenCITK_
Detector
Definition: DetId.h:26
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
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)
void endRun(edm::Run const &, edm::EventSetup const &) final
std::string const & label() const
Definition: InputTag.h:36
std::vector< CaloTowerDetId > towersOf(const reco::SuperCluster &sc) const
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
T get() const
Definition: EventSetup.h:68
edm::EDGetTokenT< edm::ValueMap< float > > phoPFECALClusIsolationToken_
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)
step
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:84
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:511
Definition: Run.h:44
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)