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