CMS 3D CMS Logo

PATPhotonProducer.cc
Go to the documentation of this file.
1 //
2 //
3 
9 
15 
18 
22 
24 
25 #include "TVector2.h"
27 
28 
29 #include <memory>
30 
31 using namespace pat;
32 
34  isolator_(iConfig.exists("userIsolation") ? iConfig.getParameter<edm::ParameterSet>("userIsolation") : edm::ParameterSet(), consumesCollector(), false) ,
35  useUserData_(iConfig.exists("userData"))
36 {
37  // initialize the configurables
38  photonToken_ = consumes<edm::View<reco::Photon> >(iConfig.getParameter<edm::InputTag>("photonSource"));
39  electronToken_ = consumes<reco::GsfElectronCollection>(iConfig.getParameter<edm::InputTag>("electronSource"));
40 hConversionsToken_ = consumes<reco::ConversionCollection>(iConfig.getParameter<edm::InputTag>("conversionSource"));
41  beamLineToken_ = consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamLineSrc"));
42  embedSuperCluster_ = iConfig.getParameter<bool>("embedSuperCluster");
43  embedSeedCluster_ = iConfig.getParameter<bool>( "embedSeedCluster" );
44  embedBasicClusters_ = iConfig.getParameter<bool>( "embedBasicClusters" );
45  embedPreshowerClusters_ = iConfig.getParameter<bool>( "embedPreshowerClusters" );
46  embedRecHits_ = iConfig.getParameter<bool>( "embedRecHits" );
47  reducedBarrelRecHitCollection_ = iConfig.getParameter<edm::InputTag>("reducedBarrelRecHitCollection");
48  reducedBarrelRecHitCollectionToken_ = mayConsume<EcalRecHitCollection>(reducedBarrelRecHitCollection_);
49  reducedEndcapRecHitCollection_ = iConfig.getParameter<edm::InputTag>("reducedEndcapRecHitCollection");
50  reducedEndcapRecHitCollectionToken_ = mayConsume<EcalRecHitCollection>(reducedEndcapRecHitCollection_);
51  // MC matching configurables
52  addGenMatch_ = iConfig.getParameter<bool>( "addGenMatch" );
53  if (addGenMatch_) {
54  embedGenMatch_ = iConfig.getParameter<bool>( "embedGenMatch" );
55  if (iConfig.existsAs<edm::InputTag>("genParticleMatch")) {
57  }
58  else {
59  genMatchTokens_ = edm::vector_transform(iConfig.getParameter<std::vector<edm::InputTag> >( "genParticleMatch" ), [this](edm::InputTag const & tag){return consumes<edm::Association<reco::GenParticleCollection> >(tag);});
60  }
61  }
62  // Efficiency configurables
63  addEfficiencies_ = iConfig.getParameter<bool>("addEfficiencies");
64  if (addEfficiencies_) {
66  }
67  // PFCluster Isolation maps
68  addPFClusterIso_ = iConfig.getParameter<bool>("addPFClusterIso");
69  addPuppiIsolation_ = iConfig.getParameter<bool>("addPuppiIsolation");
70  if (addPuppiIsolation_){
71  PUPPIIsolation_charged_hadrons_ = consumes<edm::ValueMap<float> >(iConfig.getParameter<edm::InputTag>("puppiIsolationChargedHadrons"));
72  PUPPIIsolation_neutral_hadrons_ = consumes<edm::ValueMap<float> >(iConfig.getParameter<edm::InputTag>("puppiIsolationNeutralHadrons"));
73  PUPPIIsolation_photons_ = consumes<edm::ValueMap<float> >(iConfig.getParameter<edm::InputTag>("puppiIsolationPhotons"));
74  }
75  ecalPFClusterIsoT_ = consumes<edm::ValueMap<float> >(iConfig.getParameter<edm::InputTag>("ecalPFClusterIsoMap"));
76  hcalPFClusterIsoT_ = consumes<edm::ValueMap<float> >(iConfig.getParameter<edm::InputTag>("hcalPFClusterIsoMap"));
77  // photon ID configurables
78  addPhotonID_ = iConfig.getParameter<bool>( "addPhotonID" );
79  if (addPhotonID_) {
80  // it might be a single photon ID
81  if (iConfig.existsAs<edm::InputTag>("photonIDSource")) {
82  photIDSrcs_.push_back(NameTag("", iConfig.getParameter<edm::InputTag>("photonIDSource")));
83  }
84  // or there might be many of them
85  if (iConfig.existsAs<edm::ParameterSet>("photonIDSources")) {
86  // please don't configure me twice
87  if (!photIDSrcs_.empty()){
88  throw cms::Exception("Configuration") << "PATPhotonProducer: you can't specify both 'photonIDSource' and 'photonIDSources'\n";
89  }
90  // read the different photon ID names
91  edm::ParameterSet idps = iConfig.getParameter<edm::ParameterSet>("photonIDSources");
92  std::vector<std::string> names = idps.getParameterNamesForType<edm::InputTag>();
93  for (std::vector<std::string>::const_iterator it = names.begin(), ed = names.end(); it != ed; ++it) {
94  photIDSrcs_.push_back(NameTag(*it, idps.getParameter<edm::InputTag>(*it)));
95  }
96  }
97  // but in any case at least once
98  if (photIDSrcs_.empty()) throw cms::Exception("Configuration") <<
99  "PATPhotonProducer: id addPhotonID is true, you must specify either:\n" <<
100  "\tInputTag photonIDSource = <someTag>\n" << "or\n" <<
101  "\tPSet photonIDSources = { \n" <<
102  "\t\tInputTag <someName> = <someTag> // as many as you want \n " <<
103  "\t}\n";
104  }
105  photIDTokens_ = edm::vector_transform(photIDSrcs_, [this](NameTag const & tag){return mayConsume<edm::ValueMap<Bool_t> >(tag.second);});
106  // Resolution configurables
107  addResolutions_ = iConfig.getParameter<bool>("addResolutions");
108  if (addResolutions_) {
110  }
111  // Check to see if the user wants to add user data
112  if ( useUserData_ ) {
114  }
115  // produces vector of photons
116  produces<std::vector<Photon> >();
117 
118  // read isoDeposit labels, for direct embedding
119  readIsolationLabels(iConfig, "isoDeposits", isoDepositLabels_, isoDepositTokens_);
120  // read isolation value labels, for direct embedding
122 
123 }
124 
126 }
127 
129 {
130  // switch off embedding (in unschedules mode)
131  if (iEvent.isRealData()){
132  addGenMatch_ = false;
133  embedGenMatch_ = false;
134  }
135 
136  edm::ESHandle<CaloTopology> theCaloTopology;
137  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
138  ecalTopology_ = & (*theCaloTopology);
139 
140  edm::ESHandle<CaloGeometry> theCaloGeometry;
141  iSetup.get<CaloGeometryRecord>().get(theCaloGeometry);
142  ecalGeometry_ = & (*theCaloGeometry);
143 
144  // Get the vector of Photon's from the event
146  iEvent.getByToken(photonToken_, photons);
147 
148  // for conversion veto selection
150  iEvent.getByToken(hConversionsToken_, hConversions);
151 
152  // Get the collection of electrons from the event
154  iEvent.getByToken(electronToken_, hElectrons);
155 
156  // Get the beamspot
157  edm::Handle<reco::BeamSpot> beamSpotHandle;
158  iEvent.getByToken(beamLineToken_, beamSpotHandle);
159 
161 
162  // prepare the MC matching
163  std::vector<edm::Handle<edm::Association<reco::GenParticleCollection> > >genMatches(genMatchTokens_.size());
164  if (addGenMatch_) {
165  for (size_t j = 0, nd = genMatchTokens_.size(); j < nd; ++j) {
166  iEvent.getByToken(genMatchTokens_[j], genMatches[j]);
167  }
168  }
169 
170  if (isolator_.enabled()) isolator_.beginEvent(iEvent,iSetup);
171 
173  if (resolutionLoader_.enabled()) resolutionLoader_.newEvent(iEvent, iSetup);
174 
176  for (size_t j = 0, nd = isoDepositTokens_.size(); j < nd; ++j) {
177  iEvent.getByToken(isoDepositTokens_[j], deposits[j]);
178  }
179 
181  for (size_t j = 0; j<isolationValueTokens_.size(); ++j) {
183  }
184 
185 
186  // prepare ID extraction
187  std::vector<edm::Handle<edm::ValueMap<Bool_t> > > idhandles;
188  std::vector<pat::Photon::IdPair> ids;
189  if (addPhotonID_) {
190  idhandles.resize(photIDSrcs_.size());
191  ids.resize(photIDSrcs_.size());
192  for (size_t i = 0; i < photIDSrcs_.size(); ++i) {
193  iEvent.getByToken(photIDTokens_[i], idhandles[i]);
194  ids[i].first = photIDSrcs_[i].first;
195  }
196  }
197 
198  //value maps for puppi isolation
199  edm::Handle<edm::ValueMap<float>> PUPPIIsolation_charged_hadrons;
200  edm::Handle<edm::ValueMap<float>> PUPPIIsolation_neutral_hadrons;
201  edm::Handle<edm::ValueMap<float>> PUPPIIsolation_photons;
202  if (addPuppiIsolation_){
203  iEvent.getByToken(PUPPIIsolation_charged_hadrons_, PUPPIIsolation_charged_hadrons);
204  iEvent.getByToken(PUPPIIsolation_neutral_hadrons_, PUPPIIsolation_neutral_hadrons);
205  iEvent.getByToken(PUPPIIsolation_photons_, PUPPIIsolation_photons);
206  }
207 
208  // loop over photons
209  std::vector<Photon> * PATPhotons = new std::vector<Photon>();
210  for (edm::View<reco::Photon>::const_iterator itPhoton = photons->begin(); itPhoton != photons->end(); itPhoton++) {
211  // construct the Photon from the ref -> save ref to original object
212  unsigned int idx = itPhoton - photons->begin();
213  edm::RefToBase<reco::Photon> photonRef = photons->refAt(idx);
214  edm::Ptr<reco::Photon> photonPtr = photons->ptrAt(idx);
215  Photon aPhoton(photonRef);
216  auto phoPtr = photons -> ptrAt(idx);
217  if (embedSuperCluster_) aPhoton.embedSuperCluster();
218  if (embedSeedCluster_) aPhoton.embedSeedCluster();
221 
222  std::vector<DetId> selectedCells;
223  bool barrel = itPhoton->isEB();
224  //loop over sub clusters
225  if (embedBasicClusters_) {
226  for (reco::CaloCluster_iterator clusIt = itPhoton->superCluster()->clustersBegin(); clusIt!=itPhoton->superCluster()->clustersEnd(); ++clusIt) {
227  //get seed (max energy xtal)
228  DetId seed = lazyTools.getMaximum(**clusIt).first;
229  //get all xtals in 5x5 window around the seed
230  std::vector<DetId> dets5x5 = (barrel) ? ecalTopology_->getSubdetectorTopology(DetId::Ecal,EcalBarrel)->getWindow(seed,5,5):
232  selectedCells.insert(selectedCells.end(), dets5x5.begin(), dets5x5.end());
233 
234  //get all xtals belonging to cluster
235  for (const std::pair<DetId, float> &hit : (*clusIt)->hitsAndFractions()) {
236  selectedCells.push_back(hit.first);
237  }
238  }
239  }
240 
241  //remove duplicates
242  std::sort(selectedCells.begin(),selectedCells.end());
243  std::unique(selectedCells.begin(),selectedCells.end());
244 
245  // Retrieve the corresponding RecHits
246 
247 
248  edm::Handle< EcalRecHitCollection > recHitsEBHandle;
249  iEvent.getByToken(reducedBarrelRecHitCollectionToken_,recHitsEBHandle);
250  edm::Handle< EcalRecHitCollection > recHitsEEHandle;
251  iEvent.getByToken(reducedEndcapRecHitCollectionToken_,recHitsEEHandle);
252 
253 
254  //orginal code would throw an exception via the handle not being valid but now it'll just have a null pointer error
255  //should have little effect, if its not barrel or endcap, something very bad has happened elsewhere anyways
256  const EcalRecHitCollection *recHits = nullptr;
257  if(photonRef->superCluster()->seed()->hitsAndFractions().at(0).first.subdetId()==EcalBarrel ) recHits = recHitsEBHandle.product();
258  else if( photonRef->superCluster()->seed()->hitsAndFractions().at(0).first.subdetId()==EcalEndcap ) recHits = recHitsEEHandle.product();
259 
260 
261  EcalRecHitCollection selectedRecHits;
262 
263 
264  unsigned nSelectedCells = selectedCells.size();
265  for (unsigned icell = 0 ; icell < nSelectedCells ; ++icell) {
266  EcalRecHitCollection::const_iterator it = recHits->find( selectedCells[icell] );
267  if ( it != recHits->end() ) {
268  selectedRecHits.push_back(*it);
269  }
270  }
271  selectedRecHits.sort();
272  if (embedRecHits_) aPhoton.embedRecHits(& selectedRecHits);
273 
274  // store the match to the generated final state muons
275  if (addGenMatch_) {
276  for(size_t i = 0, n = genMatches.size(); i < n; ++i) {
277  reco::GenParticleRef genPhoton = (*genMatches[i])[photonRef];
278  aPhoton.addGenParticleRef(genPhoton);
279  }
280  if (embedGenMatch_) aPhoton.embedGenParticle();
281  }
282 
283  if (efficiencyLoader_.enabled()) {
284  efficiencyLoader_.setEfficiencies( aPhoton, photonRef );
285  }
286 
287  if (resolutionLoader_.enabled()) {
289  }
290 
291  // here comes the extra functionality
292  if (isolator_.enabled()) {
293  isolator_.fill(*photons, idx, isolatorTmpStorage_);
294  typedef pat::helper::MultiIsolator::IsolationValuePairs IsolationValuePairs;
295  // better to loop backwards, so the vector is resized less times
296  for (IsolationValuePairs::const_reverse_iterator it = isolatorTmpStorage_.rbegin(), ed = isolatorTmpStorage_.rend(); it != ed; ++it) {
297  aPhoton.setIsolation(it->first, it->second);
298  }
299  }
300 
301  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
302  aPhoton.setIsoDeposit(isoDepositLabels_[j].first, (*deposits[j])[photonRef]);
303  }
304 
305  for (size_t j = 0; j<isolationValues.size(); ++j) {
306  aPhoton.setIsolation(isolationValueLabels_[j].first,(*isolationValues[j])[photonRef]);
307  }
308 
309  // add photon ID info
310  if (addPhotonID_) {
311  for (size_t i = 0; i < photIDSrcs_.size(); ++i) {
312  ids[i].second = (*idhandles[i])[photonRef];
313  }
314  aPhoton.setPhotonIDs(ids);
315  }
316 
317  if ( useUserData_ ) {
318  userDataHelper_.add( aPhoton, iEvent, iSetup );
319  }
320 
321 
322  // set conversion veto selection
323  bool passelectronveto = false;
324  if( hConversions.isValid()){
325  // this is recommended method
326  passelectronveto = !ConversionTools::hasMatchedPromptElectron(photonRef->superCluster(), hElectrons, hConversions, beamSpotHandle->position());
327  }
328  aPhoton.setPassElectronVeto( passelectronveto );
329 
330 
331  // set electron veto using pixel seed (not recommended but many analysis groups are still using since it is powerful method to remove electrons)
332  aPhoton.setHasPixelSeed( photonRef->hasPixelSeed() );
333 
334  // set seed energy
335  aPhoton.setSeedEnergy( photonRef->superCluster()->seed()->energy() );
336 
337  EcalRegressionData ecalRegData;
338  ecalRegData.fill(*(photonRef->superCluster()),
339  recHitsEBHandle.product(),recHitsEEHandle.product(),
341 
342 
343  // set input variables for regression energy correction
344  aPhoton.setEMax( ecalRegData.eMax() );
345  aPhoton.setE2nd( ecalRegData.e2nd() );
346  aPhoton.setE3x3( ecalRegData.e3x3() );
347  aPhoton.setETop( ecalRegData.eTop() );
348  aPhoton.setEBottom( ecalRegData.eBottom() );
349  aPhoton.setELeft( ecalRegData.eLeft() );
350  aPhoton.setERight( ecalRegData.eRight() );
351  aPhoton.setSee( ecalRegData.sigmaIEtaIEta() );
352  aPhoton.setSep( ecalRegData.sigmaIEtaIPhi()*ecalRegData.sigmaIEtaIEta()*ecalRegData.sigmaIPhiIPhi() ); //there is a conflict on what sigmaIEtaIPhi actually is, regression and ID have it differently, this may change in later releases
353  aPhoton.setSpp( ecalRegData.sigmaIPhiIPhi() );
354 
355  aPhoton.setMaxDR( ecalRegData.maxSubClusDR() );
356  aPhoton.setMaxDRDPhi( ecalRegData.maxSubClusDRDPhi() );
357  aPhoton.setMaxDRDEta( ecalRegData.maxSubClusDRDEta() );
358  aPhoton.setMaxDRRawEnergy( ecalRegData.maxSubClusDRRawEnergy() );
368 
369  aPhoton.setCryPhi( ecalRegData.seedCrysPhiOrY() );
370  aPhoton.setCryEta( ecalRegData.seedCrysEtaOrX() );
371  aPhoton.setIEta( ecalRegData.seedCrysIEtaOrIX() );
372  aPhoton.setIPhi( ecalRegData.seedCrysIPhiOrIY() );
373  if (addPuppiIsolation_)aPhoton.setIsolationPUPPI((*PUPPIIsolation_charged_hadrons)[phoPtr], (*PUPPIIsolation_neutral_hadrons)[phoPtr], (*PUPPIIsolation_photons)[phoPtr]);
374  else aPhoton.setIsolationPUPPI(-999., -999.,-999.);
375 
376  // Get PFCluster Isolation
377  if (addPFClusterIso_) {
378  edm::Handle<edm::ValueMap<float> > ecalPFClusterIsoMapH;
379  iEvent.getByToken(ecalPFClusterIsoT_, ecalPFClusterIsoMapH);
380  edm::Handle<edm::ValueMap<float> > hcalPFClusterIsoMapH;
381  iEvent.getByToken(hcalPFClusterIsoT_, hcalPFClusterIsoMapH);
382  aPhoton.setEcalPFClusterIso((*ecalPFClusterIsoMapH)[photonRef]);
383  aPhoton.setHcalPFClusterIso((*hcalPFClusterIsoMapH)[photonRef]);
384  } else {
385  aPhoton.setEcalPFClusterIso(-999.);
386  aPhoton.setHcalPFClusterIso(-999.);
387  }
388 
389  // add the Photon to the vector of Photons
390  PATPhotons->push_back(aPhoton);
391  }
392 
393  // sort Photons in ET
394  std::sort(PATPhotons->begin(), PATPhotons->end(), eTComparator_);
395 
396  // put genEvt object in Event
397  std::unique_ptr<std::vector<Photon> > myPhotons(PATPhotons);
398  iEvent.put(std::move(myPhotons));
400 
401 }
402 
403 // ParameterSet description for module
405 {
407  iDesc.setComment("PAT photon producer module");
408 
409  // input source
410  iDesc.add<edm::InputTag>("photonSource", edm::InputTag("no default"))->setComment("input collection");
411  iDesc.add<edm::InputTag>("electronSource", edm::InputTag("no default"))->setComment("input collection");
412  iDesc.add<edm::InputTag>("conversionSource", edm::InputTag("allConversions"))->setComment("input collection");
413 
414  iDesc.add<edm::InputTag>("reducedBarrelRecHitCollection", edm::InputTag("reducedEcalRecHitsEB"));
415  iDesc.add<edm::InputTag>("reducedEndcapRecHitCollection", edm::InputTag("reducedEcalRecHitsEE"));
416 
417  iDesc.ifValue(edm::ParameterDescription<bool>("addPFClusterIso", false, true),
418  true >> (edm::ParameterDescription<edm::InputTag>("ecalPFClusterIsoMap", edm::InputTag("photonEcalPFClusterIsolationProducer"), true) and
419  edm::ParameterDescription<edm::InputTag>("hcalPFClusterIsoMap", edm::InputTag("photonHcalPFClusterIsolationProducer"),true)) or
420  false >> (edm::ParameterDescription<edm::InputTag>("ecalPFClusterIsoMap", edm::InputTag(""), true) and
421  edm::ParameterDescription<edm::InputTag>("hcalPFClusterIsoMap", edm::InputTag(""),true)));
422 
423  iDesc.ifValue(edm::ParameterDescription<bool>("addPuppiIsolation", false, true),
424  true >> (edm::ParameterDescription<edm::InputTag>("puppiIsolationChargedHadrons", edm::InputTag("egmPhotonPUPPIIsolation","h+-DR030-"), true) and
425  edm::ParameterDescription<edm::InputTag>("puppiIsolationNeutralHadrons", edm::InputTag("egmPhotonPUPPIIsolation","h0-DR030-"), true) and
426  edm::ParameterDescription<edm::InputTag>("puppiIsolationPhotons", edm::InputTag("egmPhotonPUPPIIsolation","gamma-DR030-"), true)) or
427  false >> edm::EmptyGroupDescription());
428 
429  iDesc.add<bool>("embedSuperCluster", true)->setComment("embed external super cluster");
430  iDesc.add<bool>("embedSeedCluster", true)->setComment("embed external seed cluster");
431  iDesc.add<bool>("embedBasicClusters", true)->setComment("embed external basic clusters");
432  iDesc.add<bool>("embedPreshowerClusters", true)->setComment("embed external preshower clusters");
433  iDesc.add<bool>("embedRecHits", true)->setComment("embed external RecHits");
434 
435  // MC matching configurables
436  iDesc.add<bool>("addGenMatch", true)->setComment("add MC matching");
437  iDesc.add<bool>("embedGenMatch", false)->setComment("embed MC matched MC information");
438  std::vector<edm::InputTag> emptySourceVector;
439  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("genParticleMatch", edm::InputTag(), true) xor
440  edm::ParameterDescription<std::vector<edm::InputTag> >("genParticleMatch", emptySourceVector, true)
441  )->setComment("input with MC match information");
442 
444 
445  // photon ID configurables
446  iDesc.add<bool>("addPhotonID",true)->setComment("add photon ID variables");
447  edm::ParameterSetDescription photonIDSourcesPSet;
448  photonIDSourcesPSet.setAllowAnything();
449  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("photonIDSource", edm::InputTag(), true) xor
450  edm::ParameterDescription<edm::ParameterSetDescription>("photonIDSources", photonIDSourcesPSet, true)
451  )->setComment("input with photon ID variables");
452 
453  // IsoDeposit configurables
454  edm::ParameterSetDescription isoDepositsPSet;
455  isoDepositsPSet.addOptional<edm::InputTag>("tracker");
456  isoDepositsPSet.addOptional<edm::InputTag>("ecal");
457  isoDepositsPSet.addOptional<edm::InputTag>("hcal");
458  isoDepositsPSet.addOptional<edm::InputTag>("pfAllParticles");
459  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedHadrons");
460  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedAll");
461  isoDepositsPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
462  isoDepositsPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
463  isoDepositsPSet.addOptional<edm::InputTag>("pfPhotons");
464  isoDepositsPSet.addOptional<std::vector<edm::InputTag> >("user");
465  iDesc.addOptional("isoDeposits", isoDepositsPSet);
466 
467  // isolation values configurables
468  edm::ParameterSetDescription isolationValuesPSet;
469  isolationValuesPSet.addOptional<edm::InputTag>("tracker");
470  isolationValuesPSet.addOptional<edm::InputTag>("ecal");
471  isolationValuesPSet.addOptional<edm::InputTag>("hcal");
472  isolationValuesPSet.addOptional<edm::InputTag>("pfAllParticles");
473  isolationValuesPSet.addOptional<edm::InputTag>("pfChargedHadrons");
474  isolationValuesPSet.addOptional<edm::InputTag>("pfChargedAll");
475  isolationValuesPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
476  isolationValuesPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
477  isolationValuesPSet.addOptional<edm::InputTag>("pfPhotons");
478  isolationValuesPSet.addOptional<std::vector<edm::InputTag> >("user");
479  iDesc.addOptional("isolationValues", isolationValuesPSet);
480 
481  // Efficiency configurables
482  edm::ParameterSetDescription efficienciesPSet;
483  efficienciesPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
484  iDesc.add("efficiencies", efficienciesPSet);
485  iDesc.add<bool>("addEfficiencies", false);
486 
487  // Check to see if the user wants to add user data
488  edm::ParameterSetDescription userDataPSet;
490  iDesc.addOptional("userData", userDataPSet);
491 
492  edm::ParameterSetDescription isolationPSet;
493  isolationPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
494  iDesc.add("userIsolation", isolationPSet);
495 
496  iDesc.addNode( edm::ParameterDescription<edm::InputTag>("beamLineSrc", edm::InputTag(), true)
497  )->setComment("input with high level selection");
498 
499  descriptions.add("PATPhotonProducer", iDesc);
500 
501 }
502 
504 
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
float sigmaIPhiIPhi() const
T getParameter(std::string const &) const
void setSpp(float s)
Definition: Photon.h:271
void setComment(std::string const &value)
Assists in assimilating all pat::UserData into pat objects.
void newEvent(const edm::Event &event)
To be called for each new event, reads in the ValueMaps for efficiencies.
const std::vector< float > & subClusRawEnergy() const
void setIEta(float i)
Definition: Photon.h:313
pat::PATUserDataHelper< pat::Photon > userDataHelper_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
float maxSubClusDRRawEnergy() const
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
float maxSubClusDRDEta() const
Definition: Photon.py:1
edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollectionToken_
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
void setSubClusDPhi3(float s)
Definition: Photon.h:296
static const HistoName names[]
reco::SuperClusterRef superCluster() const
Ref to SuperCluster.
std::pair< std::string, edm::InputTag > NameTag
void setE2nd(float e)
Definition: Photon.h:256
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
void setAllowAnything()
allow any parameter label/value pairs
void setSee(float s)
Definition: Photon.h:269
std::vector< edm::Handle< edm::ValueMap< double > > > IsolationValueMaps
std::vector< edm::EDGetTokenT< edm::ValueMap< Bool_t > > > photIDTokens_
void fill(const reco::SuperCluster &superClus, const EcalRecHitCollection *ebRecHits, const EcalRecHitCollection *eeRecHits, const CaloGeometry *geom, const CaloTopology *topology, const reco::VertexCollection *vertices)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void setMaxDRRawEnergy(float m)
Definition: Photon.h:282
edm::EDGetTokenT< reco::BeamSpot > beamLineToken_
void embedSeedCluster()
method to store the electron&#39;s seedcluster internally
static bool hasMatchedPromptElectron(const reco::SuperClusterRef &sc, const edm::Handle< reco::GsfElectronCollection > &eleCol, const edm::Handle< reco::ConversionCollection > &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0)
edm::EDGetTokenT< edm::View< reco::Photon > > photonToken_
std::vector< EcalRecHit >::const_iterator const_iterator
void setSubClusDPhi2(float s)
Definition: Photon.h:294
float eLeft() const
edm::EDGetTokenT< edm::ValueMap< float > > ecalPFClusterIsoT_
void push_back(T const &t)
float seedCrysPhiOrY() const
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
std::vector< edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > > genMatchTokens_
void embedRecHits(const EcalRecHitCollection *rechits)
method to store the RecHits internally - can be called from the PATElectronProducer ...
void setIsolationPUPPI(float chargedhadrons_, float neutralhadrons_, float photons_)
Sets PUPPI isolation.
Definition: Photon.h:200
pat::helper::KinResolutionsLoader resolutionLoader_
float sigmaIEtaIEta() const
edm::EDGetTokenT< edm::ValueMap< float > > hcalPFClusterIsoT_
GreaterByEt< Photon > eTComparator_
const CaloGeometry * ecalGeometry_
float sigmaIEtaIPhi() const
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
void setIPhi(float i)
Definition: Photon.h:311
void setResolutions(pat::PATObject< T > &obj) const
Sets the efficiencies for this object, using the reference to the original objects.
bool isRealData() const
Definition: EventBase.h:62
edm::InputTag reducedEndcapRecHitCollection_
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: HeavyIon.h:7
static void fillDescription(edm::ParameterSetDescription &iDesc)
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:194
bool enabled() const
True if it has a non null configuration.
Definition: MultiIsolator.h:50
IsolationLabels isoDepositLabels_
void setIsolation(IsolationKeys key, float value)
Definition: Photon.h:179
void setComment(std::string const &value)
pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_
void setELeft(float e)
Definition: Photon.h:264
void setIsoDeposit(IsolationKeys key, const IsoDeposit &dep)
Sets the IsoDeposit associated with some key; if it is already existent, it is overwritten.
Definition: Photon.h:227
int iEvent
Definition: GenABIO.cc:230
void setEMax(float e)
Definition: Photon.h:254
void beginEvent(const edm::Event &event, const edm::EventSetup &eventSetup)
const CaloTopology * ecalTopology_
void setERight(float e)
Definition: Photon.h:266
float seedCrysIPhiOrIY() const
IsolationLabels isolationValueLabels_
void setMaxDRDEta(float m)
Definition: Photon.h:280
std::vector< edm::EDGetTokenT< edm::ValueMap< IsoDeposit > > > isoDepositTokens_
void embedGenParticle()
Definition: PATObject.h:694
pat::helper::EfficiencyLoader efficiencyLoader_
void newEvent(const edm::Event &event, const edm::EventSetup &setup)
To be called for each new event, reads in the EventSetup object.
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
float maxSubClusDR() const
def unique(seq, keepstr=True)
Definition: tier0.py:24
void setPhotonIDs(const std::vector< IdPair > &ids)
Definition: Photon.h:110
ParameterDescriptionNode * ifValue(ParameterDescription< T > const &switchParameter, std::unique_ptr< ParameterDescriptionCases< T > > cases)
float seedCrysIEtaOrIX() const
void embedBasicClusters()
method to store the electron&#39;s basic clusters
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_photons_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void setPassElectronVeto(bool flag)
Definition: Photon.h:244
void setETop(float e)
Definition: Photon.h:260
float maxSubClusDRDPhi() const
void setSeedEnergy(float e)
Definition: Photon.h:251
void setSubClusDPhi1(float s)
Definition: Photon.h:292
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< NameTag > photIDSrcs_
bool isValid() const
Definition: HandleBase.h:74
void setSubClusDEta1(float s)
Definition: Photon.h:299
std::vector< edm::Handle< edm::ValueMap< IsoDeposit > > > IsoDepositMaps
pat::helper::MultiIsolator isolator_
float seedCrysEtaOrX() const
void embedPreshowerClusters()
method to store the electron&#39;s preshower clusters
void setCryEta(float c)
Definition: Photon.h:308
const_iterator end() const
void readIsolationLabels(const edm::ParameterSet &iConfig, const char *psetName, IsolationLabels &labels, std::vector< edm::EDGetTokenT< edm::ValueMap< T > > > &tokens)
void embedSuperCluster()
method to store the photon&#39;s supercluster internally
Definition: DetId.h:18
void addGenParticleRef(const reco::GenParticleRef &ref)
Definition: PATObject.h:678
void setCryPhi(float c)
Definition: Photon.h:306
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
void setHasPixelSeed(bool flag)
Definition: Photon.h:247
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_charged_hadrons_
T const * product() const
Definition: Handle.h:81
static void fillDescription(edm::ParameterSetDescription &iDesc)
Method for documentation and validation of PSet.
void setSubClusDEta2(float s)
Definition: Photon.h:301
void setMaxDR(float m)
Definition: Photon.h:276
bool hasPixelSeed() const
Bool flagging photons having a non-zero size vector of Ref to electornPixel seeds.
Definition: Photon.h:76
const T & get() const
Definition: EventSetup.h:56
void setEfficiencies(pat::PATObject< T > &obj, const R &originalRef) const
Sets the efficiencies for this object, using the reference to the original objects.
void setSubClusRawE2(float s)
Definition: Photon.h:287
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:26
const std::vector< float > & subClusDEta() const
void setEBottom(float e)
Definition: Photon.h:262
std::vector< std::pair< pat::IsolationKeys, float > > IsolationValuePairs
Definition: MultiIsolator.h:16
void setMaxDRDPhi(float m)
Definition: Photon.h:278
iterator find(key_type k)
const std::vector< float > & subClusDPhi() const
HLT enums.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
void setSubClusDEta3(float s)
Definition: Photon.h:303
size_type size() const
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_neutral_hadrons_
float eRight() const
void setSubClusRawE1(float s)
Definition: Photon.h:285
PATPhotonProducer(const edm::ParameterSet &iConfig)
const Point & position() const
position
Definition: BeamSpot.h:62
void setSubClusRawE3(float s)
Definition: Photon.h:289
edm::EDGetTokenT< EcalRecHitCollection > reducedBarrelRecHitCollectionToken_
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > isolationValueTokens_
edm::InputTag reducedBarrelRecHitCollection_
def move(src, dest)
Definition: eostools.py:510
void setHcalPFClusterIso(float hcalPFClus)
Definition: Photon.h:131
void setE3x3(float e)
Definition: Photon.h:258
float eBottom() const
edm::EDGetTokenT< reco::ConversionCollection > hConversionsToken_
void setSep(float s)
Definition: Photon.h:273
void fill(const edm::View< T > &coll, int idx, IsolationValuePairs &isolations) const
Definition: MultiIsolator.h:82
Produces the pat::Photon.
edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_
void setEcalPFClusterIso(float ecalPFClus)
Definition: Photon.h:130