CMS 3D CMS Logo

PATTauProducer.cc
Go to the documentation of this file.
1 
47 
48 #include <memory>
49 #include <string>
50 #include <vector>
51 
54 namespace pat {
55 
57  public:
58  explicit PATTauProducer(const edm::ParameterSet& iConfig);
59  ~PATTauProducer() override;
60 
61  void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;
62 
63  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
64 
65  private:
66  bool firstOccurence_; // used to print LogWarnings only at first occurnece in the event loop
67 
68  // configurables
87 
90  std::vector<edm::EDGetTokenT<edm::Association<reco::GenParticleCollection>>> genMatchTokens_;
91 
95 
97  std::vector<edm::EDGetTokenT<edm::ValueMap<TauJetCorrFactors>>> tauJetCorrFactorsTokens_;
98 
99  bool addTauID_;
100  typedef std::pair<std::string, edm::InputTag> NameTag;
101  typedef std::pair<std::string, std::string> WPCfg;
102  typedef std::pair<WPCfg, int> WPIdx;
103  typedef std::pair<std::string, WPIdx> NameWPIdx;
104  typedef std::pair<edm::InputTag, std::vector<NameWPIdx>>
105  IDContainerData; //to save input module tag and corresponding pairs <working point name for the output tree, WP index in the input ID container>
106  std::vector<NameTag> tauIDSrcs_;
107  std::vector<std::vector<NameWPIdx>> tauIDSrcContainers_;
108  std::vector<edm::EDGetTokenT<reco::PFTauDiscriminator>> pfTauIDTokens_;
109  std::vector<edm::EDGetTokenT<reco::TauDiscriminatorContainer>> pfTauIDContainerTokens_;
112  // tools
114 
116  pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_; // better here than recreate at each event
117  std::vector<std::pair<pat::IsolationKeys, edm::InputTag>> isoDepositLabels_;
118  std::vector<edm::EDGetTokenT<edm::ValueMap<IsoDeposit>>> isoDepositTokens_;
119 
122 
125 
128 
129  template <typename TauCollectionType, typename TauDiscrType>
132  size_t,
134  int);
135 
137  };
138 
139 } // namespace pat
140 
141 using namespace pat;
142 
144  : isolator_(iConfig.exists("userIsolation") ? iConfig.getParameter<edm::ParameterSet>("userIsolation")
145  : edm::ParameterSet(),
146  consumesCollector(),
147  false),
148  useUserData_(iConfig.exists("userData")),
149  posAtECalEntranceComputer_(consumesCollector()) {
150  firstOccurence_ = true;
151  // initialize the configurables
152  baseTauToken_ = consumes<edm::View<reco::BaseTau>>(iConfig.getParameter<edm::InputTag>("tauSource"));
153  tauTransverseImpactParameterSrc_ = iConfig.getParameter<edm::InputTag>("tauTransverseImpactParameterSource");
154  tauTransverseImpactParameterToken_ = consumes<PFTauTIPAssociationByRef>(tauTransverseImpactParameterSrc_);
155  pfTauToken_ = consumes<reco::PFTauCollection>(iConfig.getParameter<edm::InputTag>("tauSource"));
156  embedIsolationTracks_ = iConfig.getParameter<bool>("embedIsolationTracks");
157  embedLeadTrack_ = iConfig.getParameter<bool>("embedLeadTrack");
158  embedSignalTracks_ = iConfig.getParameter<bool>("embedSignalTracks");
159  embedLeadPFCand_ = iConfig.getParameter<bool>("embedLeadPFCand");
160  embedLeadPFChargedHadrCand_ = iConfig.getParameter<bool>("embedLeadPFChargedHadrCand");
161  embedLeadPFNeutralCand_ = iConfig.getParameter<bool>("embedLeadPFNeutralCand");
162  embedSignalPFCands_ = iConfig.getParameter<bool>("embedSignalPFCands");
163  embedSignalPFChargedHadrCands_ = iConfig.getParameter<bool>("embedSignalPFChargedHadrCands");
164  embedSignalPFNeutralHadrCands_ = iConfig.getParameter<bool>("embedSignalPFNeutralHadrCands");
165  embedSignalPFGammaCands_ = iConfig.getParameter<bool>("embedSignalPFGammaCands");
166  embedIsolationPFCands_ = iConfig.getParameter<bool>("embedIsolationPFCands");
167  embedIsolationPFChargedHadrCands_ = iConfig.getParameter<bool>("embedIsolationPFChargedHadrCands");
168  embedIsolationPFNeutralHadrCands_ = iConfig.getParameter<bool>("embedIsolationPFNeutralHadrCands");
169  embedIsolationPFGammaCands_ = iConfig.getParameter<bool>("embedIsolationPFGammaCands");
170  addGenMatch_ = iConfig.getParameter<bool>("addGenMatch");
171  if (addGenMatch_) {
172  embedGenMatch_ = iConfig.getParameter<bool>("embedGenMatch");
173  if (iConfig.existsAs<edm::InputTag>("genParticleMatch")) {
175  iConfig.getParameter<edm::InputTag>("genParticleMatch")));
176  } else {
178  iConfig.getParameter<std::vector<edm::InputTag>>("genParticleMatch"),
179  [this](edm::InputTag const& tag) { return consumes<edm::Association<reco::GenParticleCollection>>(tag); });
180  }
181  }
182  addGenJetMatch_ = iConfig.getParameter<bool>("addGenJetMatch");
183  if (addGenJetMatch_) {
184  embedGenJetMatch_ = iConfig.getParameter<bool>("embedGenJetMatch");
186  consumes<edm::Association<reco::GenJetCollection>>(iConfig.getParameter<edm::InputTag>("genJetMatch"));
187  }
188  addTauJetCorrFactors_ = iConfig.getParameter<bool>("addTauJetCorrFactors");
190  iConfig.getParameter<std::vector<edm::InputTag>>("tauJetCorrFactorsSource"),
191  [this](edm::InputTag const& tag) { return mayConsume<edm::ValueMap<TauJetCorrFactors>>(tag); });
192  // tau ID configurables
193  addTauID_ = iConfig.getParameter<bool>("addTauID");
194  if (addTauID_) {
195  // read the different tau ID names
196  edm::ParameterSet idps = iConfig.getParameter<edm::ParameterSet>("tauIDSources");
197  std::vector<std::string> names = idps.getParameterNamesForType<edm::ParameterSet>();
198  std::map<std::string, IDContainerData> idContainerMap;
199  for (auto const& name : names) {
200  auto const& idp = idps.getParameter<edm::ParameterSet>(name);
201  std::string prov_cfg_label = idp.getParameter<std::string>("provenanceConfigLabel");
202  std::string prov_ID_label = idp.getParameter<std::string>("idLabel");
203  edm::InputTag tag = idp.getParameter<edm::InputTag>("inputTag");
204  if (prov_cfg_label.empty()) {
205  tauIDSrcs_.push_back(NameTag(name, tag));
206  } else {
207  if (prov_cfg_label != "rawValues" && prov_cfg_label != "workingPoints" && prov_cfg_label != "IDdefinitions" &&
208  prov_cfg_label != "IDWPdefinitions" && prov_cfg_label != "direct_rawValues" &&
209  prov_cfg_label != "direct_workingPoints")
210  throw cms::Exception("Configuration")
211  << "PATTauProducer: Parameter 'provenanceConfigLabel' does only accept 'rawValues', 'workingPoints', "
212  "'IDdefinitions', 'IDWPdefinitions', 'direct_rawValues', 'direct_workingPoints'\n";
213  std::map<std::string, IDContainerData>::iterator it;
214  it = idContainerMap.insert({tag.label() + tag.instance(), {tag, std::vector<NameWPIdx>()}}).first;
215  it->second.second.push_back(NameWPIdx(name, WPIdx(WPCfg(prov_cfg_label, prov_ID_label), -99)));
216  }
217  }
218  // but in any case at least once
219  if (tauIDSrcs_.empty() && idContainerMap.empty())
220  throw cms::Exception("Configuration") << "PATTauProducer: id addTauID is true, you must specify either:\n"
221  << "\tPSet tauIDSources = { \n"
222  << "\t\tInputTag <someName> = <someTag> // as many as you want \n "
223  << "\t}\n";
224 
225  for (auto const& mapEntry : idContainerMap) {
226  tauIDSrcContainers_.push_back(mapEntry.second.second);
227  pfTauIDContainerTokens_.push_back(mayConsume<reco::TauDiscriminatorContainer>(mapEntry.second.first));
228  }
229  }
231  tauIDSrcs_, [this](NameTag const& tag) { return mayConsume<reco::PFTauDiscriminator>(tag.second); });
232  skipMissingTauID_ = iConfig.getParameter<bool>("skipMissingTauID");
233  // IsoDeposit configurables
234  if (iConfig.exists("isoDeposits")) {
235  edm::ParameterSet depconf = iConfig.getParameter<edm::ParameterSet>("isoDeposits");
236  if (depconf.exists("tracker"))
237  isoDepositLabels_.push_back(std::make_pair(pat::TrackIso, depconf.getParameter<edm::InputTag>("tracker")));
238  if (depconf.exists("ecal"))
239  isoDepositLabels_.push_back(std::make_pair(pat::EcalIso, depconf.getParameter<edm::InputTag>("ecal")));
240  if (depconf.exists("hcal"))
241  isoDepositLabels_.push_back(std::make_pair(pat::HcalIso, depconf.getParameter<edm::InputTag>("hcal")));
242  if (depconf.exists("pfAllParticles"))
243  isoDepositLabels_.push_back(
244  std::make_pair(pat::PfAllParticleIso, depconf.getParameter<edm::InputTag>("pfAllParticles")));
245  if (depconf.exists("pfChargedHadron"))
246  isoDepositLabels_.push_back(
247  std::make_pair(pat::PfChargedHadronIso, depconf.getParameter<edm::InputTag>("pfChargedHadron")));
248  if (depconf.exists("pfNeutralHadron"))
249  isoDepositLabels_.push_back(
250  std::make_pair(pat::PfNeutralHadronIso, depconf.getParameter<edm::InputTag>("pfNeutralHadron")));
251  if (depconf.exists("pfGamma"))
252  isoDepositLabels_.push_back(std::make_pair(pat::PfGammaIso, depconf.getParameter<edm::InputTag>("pfGamma")));
253 
254  if (depconf.exists("user")) {
255  std::vector<edm::InputTag> userdeps = depconf.getParameter<std::vector<edm::InputTag>>("user");
256  std::vector<edm::InputTag>::const_iterator it = userdeps.begin(), ed = userdeps.end();
257  int key = UserBaseIso;
258  for (; it != ed; ++it, ++key) {
259  isoDepositLabels_.push_back(std::make_pair(IsolationKeys(key), *it));
260  }
261  }
262  }
264  edm::vector_transform(isoDepositLabels_, [this](std::pair<IsolationKeys, edm::InputTag> const& label) {
265  return consumes<edm::ValueMap<IsoDeposit>>(label.second);
266  });
267  // Efficiency configurables
268  addEfficiencies_ = iConfig.getParameter<bool>("addEfficiencies");
269  if (addEfficiencies_) {
271  pat::helper::EfficiencyLoader(iConfig.getParameter<edm::ParameterSet>("efficiencies"), consumesCollector());
272  }
273  // Resolution configurables
274  addResolutions_ = iConfig.getParameter<bool>("addResolutions");
275  if (addResolutions_) {
277  }
278  // Check to see if the user wants to add user data
279  if (useUserData_) {
280  userDataHelper_ = PATUserDataHelper<Tau>(iConfig.getParameter<edm::ParameterSet>("userData"), consumesCollector());
281  }
282  // produces vector of taus
283  produces<std::vector<Tau>>();
284 }
285 
287 
289  // switch off embedding (in unschedules mode)
290  if (iEvent.isRealData()) {
291  addGenMatch_ = false;
292  embedGenMatch_ = false;
293  addGenJetMatch_ = false;
294  }
295 
296  // Get the collection of taus from the event
298  try {
299  iEvent.getByToken(baseTauToken_, anyTaus);
300  } catch (const edm::Exception& e) {
301  edm::LogWarning("DataSource") << "WARNING! No Tau collection found. This missing input will not block the job. "
302  "Instead, an empty tau collection is being be produced.";
303  auto patTaus = std::make_unique<std::vector<Tau>>();
304  iEvent.put(std::move(patTaus));
305  return;
306  }
307 
309 
310  if (isolator_.enabled())
311  isolator_.beginEvent(iEvent, iSetup);
312 
317 
318  std::vector<edm::Handle<edm::ValueMap<IsoDeposit>>> deposits(isoDepositTokens_.size());
319  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
320  iEvent.getByToken(isoDepositTokens_[j], deposits[j]);
321  }
322 
323  // prepare the MC matching
324  std::vector<edm::Handle<edm::Association<reco::GenParticleCollection>>> genMatches(genMatchTokens_.size());
325  if (addGenMatch_) {
326  for (size_t j = 0, nd = genMatchTokens_.size(); j < nd; ++j) {
327  iEvent.getByToken(genMatchTokens_[j], genMatches[j]);
328  }
329  }
330 
332  if (addGenJetMatch_)
333  iEvent.getByToken(genJetMatchToken_, genJetMatch);
334 
335  // read in the jet correction factors ValueMap
336  std::vector<edm::ValueMap<TauJetCorrFactors>> tauJetCorrs;
337  if (addTauJetCorrFactors_) {
338  for (size_t i = 0; i < tauJetCorrFactorsTokens_.size(); ++i) {
340  iEvent.getByToken(tauJetCorrFactorsTokens_[i], tauJetCorr);
341  tauJetCorrs.push_back(*tauJetCorr);
342  }
343  }
344 
345  auto patTaus = std::make_unique<std::vector<Tau>>();
346 
347  bool first = true; // this is introduced to issue warnings only for the first tau-jet
348  for (size_t idx = 0, ntaus = anyTaus->size(); idx < ntaus; ++idx) {
349  edm::RefToBase<reco::BaseTau> tausRef = anyTaus->refAt(idx);
350  edm::Ptr<reco::BaseTau> tausPtr = anyTaus->ptrAt(idx);
351 
352  Tau aTau(tausRef);
353  if (embedLeadTrack_)
354  aTau.embedLeadTrack();
355  if (embedSignalTracks_)
356  aTau.embedSignalTracks();
358  aTau.embedIsolationTracks();
359  if (embedLeadPFCand_) {
360  if (aTau.isPFTau())
361  aTau.embedLeadPFCand();
362  else
363  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
364  "from a reco::PFTau is impossible.\n";
365  }
367  if (aTau.isPFTau())
369  else
370  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
371  "from a reco::PFTau is impossible.\n";
372  }
374  if (aTau.isPFTau())
375  aTau.embedLeadPFNeutralCand();
376  else
377  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
378  "from a reco::PFTau is impossible.\n";
379  }
380  if (embedSignalPFCands_) {
381  if (aTau.isPFTau())
382  aTau.embedSignalPFCands();
383  else
384  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
385  "from a reco::PFTau is impossible.\n";
386  }
388  if (aTau.isPFTau())
390  else
391  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
392  "from a reco::PFTau is impossible.\n";
393  }
395  if (aTau.isPFTau())
397  else
398  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
399  "from a reco::PFTau is impossible.\n";
400  }
402  if (aTau.isPFTau())
404  else
405  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
406  "from a reco::PFTau is impossible.\n";
407  }
409  if (aTau.isPFTau())
410  aTau.embedIsolationPFCands();
411  else
412  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
413  "from a reco::PFTau is impossible.\n";
414  }
416  if (aTau.isPFTau())
418  else
419  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
420  "from a reco::PFTau is impossible.\n";
421  }
423  if (aTau.isPFTau())
425  else
426  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
427  "from a reco::PFTau is impossible.\n";
428  }
430  if (aTau.isPFTau())
432  else
433  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
434  "from a reco::PFTau is impossible.\n";
435  }
436 
437  if (addTauJetCorrFactors_) {
438  // add additional JetCorrs to the jet
439  for (unsigned int i = 0; i < tauJetCorrs.size(); ++i) {
440  const TauJetCorrFactors& tauJetCorr = tauJetCorrs[i][tausRef];
441  // uncomment for debugging
442  // tauJetCorr.print();
443  aTau.addJECFactors(tauJetCorr);
444  }
445  std::vector<std::string> levels = tauJetCorrs[0][tausRef].correctionLabels();
446  if (std::find(levels.begin(), levels.end(), "L2L3Residual") != levels.end()) {
447  aTau.initializeJEC(tauJetCorrs[0][tausRef].jecLevel("L2L3Residual"));
448  } else if (std::find(levels.begin(), levels.end(), "L3Absolute") != levels.end()) {
449  aTau.initializeJEC(tauJetCorrs[0][tausRef].jecLevel("L3Absolute"));
450  } else {
451  aTau.initializeJEC(tauJetCorrs[0][tausRef].jecLevel("Uncorrected"));
452  if (first) {
453  edm::LogWarning("L3Absolute not found")
454  << "L2L3Residual and L3Absolute are not part of the correction applied jetCorrFactors \n"
455  << "of module " << tauJetCorrs[0][tausRef].jecSet() << " jets will remain"
456  << " uncorrected.";
457  first = false;
458  }
459  }
460  }
461 
462  // store the match to the generated final state muons
463  if (addGenMatch_) {
464  for (size_t i = 0, n = genMatches.size(); i < n; ++i) {
465  reco::GenParticleRef genTau = (*genMatches[i])[tausRef];
466  aTau.addGenParticleRef(genTau);
467  }
468  if (embedGenMatch_)
469  aTau.embedGenParticle();
470  }
471 
472  // store the match to the visible part of the generated tau
473  if (addGenJetMatch_) {
474  reco::GenJetRef genJetTau = (*genJetMatch)[tausRef];
475  if (genJetTau.isNonnull() && genJetTau.isAvailable()) {
476  aTau.setGenJet(genJetTau);
477  } // leave empty if no match found
478  }
479 
480  // prepare ID extraction
481  if (addTauID_) {
482  size_t numberPlainTauIds = tauIDSrcs_.size();
483  size_t numberTauIds = numberPlainTauIds;
484  for (auto const& it : tauIDSrcContainers_) {
485  numberTauIds += it.size();
486  }
487  // if ID containers exist, product incices need to be retrieved from provenanceConfigLabel.
488  // This is done if config history changes, in particular for the first event.
489  if (numberPlainTauIds != numberTauIds && phID_ != iEvent.processHistoryID()) {
490  phID_ = iEvent.processHistoryID();
491  for (size_t idx = 0; idx < tauIDSrcContainers_.size(); ++idx) {
492  auto pfTauIdDiscr = iEvent.getHandle(pfTauIDContainerTokens_[idx]);
493  if (!pfTauIdDiscr.isValid())
494  continue; // missing IDs will be skipped lateron or crash there depending on skipMissingTauID_
495  const edm::Provenance* prov = pfTauIdDiscr.provenance();
496  for (NameWPIdx& idcfg : tauIDSrcContainers_[idx]) {
497  std::string prov_cfg_label = idcfg.second.first.first;
498  std::string prov_ID_label = idcfg.second.first.second;
499  bool found = false;
500  if (prov_cfg_label == "rawValues" || prov_cfg_label == "workingPoints") {
501  const std::vector<std::string> psetsFromProvenance =
502  edm::parameterSet(prov->stable(), iEvent.processHistory())
503  .getParameter<std::vector<std::string>>(prov_cfg_label);
504  for (size_t i = 0; i < psetsFromProvenance.size(); ++i) {
505  if (psetsFromProvenance[i] == prov_ID_label) {
506  // using negative indices for raw values
507  if (prov_cfg_label == "rawValues")
508  idcfg.second.second = -1 - i;
509  else
510  idcfg.second.second = i;
511  found = true;
512  }
513  }
514  } else if (prov_cfg_label == "IDdefinitions" || prov_cfg_label == "IDWPdefinitions") {
515  const std::vector<edm::ParameterSet> psetsFromProvenance =
516  edm::parameterSet(prov->stable(), iEvent.processHistory())
517  .getParameter<std::vector<edm::ParameterSet>>(prov_cfg_label);
518  for (size_t i = 0; i < psetsFromProvenance.size(); ++i) {
519  if (psetsFromProvenance[i].getParameter<std::string>("IDname") == prov_ID_label) {
520  // using negative indices for raw values
521  if (prov_cfg_label == "IDdefinitions")
522  idcfg.second.second = -1 - i;
523  else
524  idcfg.second.second = i;
525  found = true;
526  }
527  }
528  } else {
529  // checked prov_cfg_label before, so it must be a direct access via indices
530  try {
531  int i = std::stoi(prov_ID_label);
532  if (prov_cfg_label == "direct_rawValues")
533  idcfg.second.second = -1 - i;
534  else
535  idcfg.second.second = i;
536  found = true;
537  } catch (std::invalid_argument const& e) {
538  throw cms::Exception("Configuration") << "PATTauProducer: Direct access to ID container requested, so "
539  "argument of 'idLabel' must be convertable to int!\n";
540  }
541  }
542  if (!found) {
543  throw cms::Exception("Configuration") << "PATTauProducer: Requested working point '" << prov_ID_label
544  << "' for ID '" << idcfg.first << "' not found!\n";
545  }
546  }
547  }
548  }
549  std::string missingDiscriminators;
550  std::vector<pat::Tau::IdPair> ids(numberTauIds);
551  auto const& tausDeref = *tausRef;
552  if (typeid(tausDeref) == typeid(reco::PFTau)) {
553  edm::Handle<reco::PFTauCollection> pfTauCollection;
554  iEvent.getByToken(pfTauToken_, pfTauCollection);
555  for (size_t i = 0; i < numberPlainTauIds; ++i) {
556  //std::cout << "filling PFTauDiscriminator '" << tauIDSrcs_[i].first << "' into pat::Tau object..." << std::endl;
557 
558  auto pfTauIdDiscr = iEvent.getHandle(pfTauIDTokens_[i]);
559 
560  if (skipMissingTauID_ && !pfTauIdDiscr.isValid()) {
561  if (!missingDiscriminators.empty()) {
562  missingDiscriminators += ", ";
563  }
564  missingDiscriminators += tauIDSrcs_[i].first;
565  continue;
566  }
567  ids[i].first = tauIDSrcs_[i].first;
568  ids[i].second = getTauIdDiscriminator(pfTauCollection, idx, pfTauIdDiscr);
569  }
570  for (size_t i = 0; i < tauIDSrcContainers_.size(); ++i) {
571  auto pfTauIdDiscr = iEvent.getHandle(pfTauIDContainerTokens_[i]);
572  if (skipMissingTauID_ && !pfTauIdDiscr.isValid()) {
573  for (auto const& it : tauIDSrcContainers_[i]) {
574  if (!missingDiscriminators.empty()) {
575  missingDiscriminators += ", ";
576  }
577  missingDiscriminators += it.first;
578  }
579  continue;
580  }
581  for (size_t j = 0; j < tauIDSrcContainers_[i].size(); ++j) {
582  ids[numberPlainTauIds + j].first = tauIDSrcContainers_[i][j].first;
583  ids[numberPlainTauIds + j].second = getTauIdDiscriminatorFromContainer(
584  pfTauCollection, idx, pfTauIdDiscr, tauIDSrcContainers_[i][j].second.second);
585  }
586  numberPlainTauIds += tauIDSrcContainers_[i].size();
587  }
588  } else {
589  throw cms::Exception("Type Mismatch")
590  << "PATTauProducer: unsupported datatype '" << typeid(tausDeref).name() << "' for tauSource\n";
591  }
592  if (!missingDiscriminators.empty() && firstOccurence_) {
593  edm::LogWarning("DataSource") << "The following tau discriminators have not been found in the event:\n"
594  << missingDiscriminators << "\n"
595  << "They will not be embedded into the pat::Tau object.\n"
596  << "Note: this message will be printed only at first occurence.";
597  firstOccurence_ = false;
598  }
599  aTau.setTauIDs(ids);
600  }
601 
602  // extraction of reconstructed tau decay mode
603  // (only available for PFTaus)
604  if (aTau.isPFTau()) {
606  iEvent.getByToken(pfTauToken_, pfTaus);
607  reco::PFTauRef pfTauRef(pfTaus, idx);
608 
609  aTau.setDecayMode(pfTauRef->decayMode());
610  }
611 
612  // extraction of variables needed to rerun MVA isolation and anti-electron discriminator on MiniAOD
613  if (!aTau.pfEssential_.empty()) {
615  iEvent.getByToken(pfTauToken_, pfTaus);
616  reco::PFTauRef pfTauRef(pfTaus, idx);
617  pat::tau::TauPFEssential& aTauPFEssential = aTau.pfEssential_[0];
618  float ecalEnergy = 0;
619  float hcalEnergy = 0;
620  float sumPhiTimesEnergy = 0.;
621  float sumEtaTimesEnergy = 0.;
622  float sumEnergy = 0.;
623  float leadChargedCandPt = -99;
624  float leadChargedCandEtaAtEcalEntrance = -99;
625  const std::vector<reco::CandidatePtr>& signalCands = pfTauRef->signalCands();
626  for (const auto& it : signalCands) {
627  const reco::PFCandidate* ipfcand = dynamic_cast<const reco::PFCandidate*>(it.get());
628  if (ipfcand != nullptr) {
629  ecalEnergy += ipfcand->ecalEnergy();
630  hcalEnergy += ipfcand->hcalEnergy();
631  sumPhiTimesEnergy += ipfcand->positionAtECALEntrance().phi() * ipfcand->energy();
632  sumEtaTimesEnergy += ipfcand->positionAtECALEntrance().eta() * ipfcand->energy();
633  sumEnergy += ipfcand->energy();
634  const reco::Track* track = nullptr;
635  if (ipfcand->trackRef().isNonnull())
636  track = ipfcand->trackRef().get();
637  else if (ipfcand->muonRef().isNonnull() && ipfcand->muonRef()->innerTrack().isNonnull())
638  track = ipfcand->muonRef()->innerTrack().get();
639  else if (ipfcand->muonRef().isNonnull() && ipfcand->muonRef()->globalTrack().isNonnull())
640  track = ipfcand->muonRef()->globalTrack().get();
641  else if (ipfcand->muonRef().isNonnull() && ipfcand->muonRef()->outerTrack().isNonnull())
642  track = ipfcand->muonRef()->outerTrack().get();
643  else if (ipfcand->gsfTrackRef().isNonnull())
644  track = ipfcand->gsfTrackRef().get();
645  if (track) {
646  if (track->pt() > leadChargedCandPt) {
647  leadChargedCandEtaAtEcalEntrance = ipfcand->positionAtECALEntrance().eta();
648  leadChargedCandPt = track->pt();
649  }
650  }
651  } else {
652  // TauReco@MiniAOD: individual ECAL and HCAL energies recovered from fractions,
653  // and position at ECAL entrance computed on-the-fly
654  const pat::PackedCandidate* ipatcand = dynamic_cast<const pat::PackedCandidate*>(it.get());
655  if (ipatcand != nullptr) {
656  ecalEnergy += ipatcand->caloFraction() * ipatcand->energy() * (1. - ipatcand->hcalFraction());
657  hcalEnergy += ipatcand->caloFraction() * ipatcand->energy() * ipatcand->hcalFraction();
658  double posAtECal_phi = ipatcand->phi();
659  double posAtECal_eta = ipatcand->eta();
660  bool success = false;
661  reco::Candidate::Point posAtECalEntrance = posAtECalEntranceComputer_(ipatcand, success);
662  if (success) {
663  posAtECal_phi = posAtECalEntrance.phi();
664  posAtECal_eta = posAtECalEntrance.eta();
665  }
666  sumPhiTimesEnergy += posAtECal_phi * ipatcand->energy();
667  sumEtaTimesEnergy += posAtECal_eta * ipatcand->energy();
668  sumEnergy += ipatcand->energy();
669  const reco::Track* track = ipatcand->bestTrack();
670  if (track != nullptr) {
671  if (track->pt() > leadChargedCandPt) {
672  leadChargedCandEtaAtEcalEntrance = posAtECal_eta;
673  leadChargedCandPt = track->pt();
674  }
675  }
676  }
677  }
678  }
679  aTauPFEssential.ecalEnergy_ = ecalEnergy;
680  aTauPFEssential.hcalEnergy_ = hcalEnergy;
681  aTauPFEssential.ptLeadChargedCand_ = leadChargedCandPt;
682  aTauPFEssential.etaAtEcalEntranceLeadChargedCand_ = leadChargedCandEtaAtEcalEntrance;
683  if (sumEnergy != 0.) {
684  aTauPFEssential.phiAtEcalEntrance_ = sumPhiTimesEnergy / sumEnergy;
685  aTauPFEssential.etaAtEcalEntrance_ = sumEtaTimesEnergy / sumEnergy;
686  } else {
687  aTauPFEssential.phiAtEcalEntrance_ = -99.;
688  aTauPFEssential.etaAtEcalEntrance_ = -99.;
689  }
690  float leadingTrackNormChi2 = 0;
691  float ecalEnergyLeadChargedHadrCand = -99.;
692  float hcalEnergyLeadChargedHadrCand = -99.;
693  float emFraction = -1.;
694  float myHCALenergy = 0.;
695  float myECALenergy = 0.;
696  const reco::CandidatePtr& leadingPFCharged = pfTauRef->leadChargedHadrCand();
697  if (leadingPFCharged.isNonnull()) {
698  const reco::PFCandidate* pfCandPtr = dynamic_cast<const reco::PFCandidate*>(leadingPFCharged.get());
699  if (pfCandPtr != nullptr) { // PFTau made from PFCandidates
700  ecalEnergyLeadChargedHadrCand = pfCandPtr->ecalEnergy();
701  hcalEnergyLeadChargedHadrCand = pfCandPtr->hcalEnergy();
702  reco::TrackRef trackRef = pfCandPtr->trackRef();
703  if (trackRef.isNonnull()) {
704  leadingTrackNormChi2 = trackRef->normalizedChi2();
705  for (const auto& isoPFCand : pfTauRef->isolationPFCands()) {
706  myHCALenergy += isoPFCand->hcalEnergy();
707  myECALenergy += isoPFCand->ecalEnergy();
708  }
709  for (const auto& signalPFCand : pfTauRef->signalPFCands()) {
710  myHCALenergy += signalPFCand->hcalEnergy();
711  myECALenergy += signalPFCand->ecalEnergy();
712  }
713  if (myHCALenergy + myECALenergy != 0.) {
714  emFraction = myECALenergy / (myHCALenergy + myECALenergy);
715  }
716  }
717  } else {
718  const pat::PackedCandidate* packedCandPtr = dynamic_cast<const pat::PackedCandidate*>(leadingPFCharged.get());
719  if (packedCandPtr != nullptr) {
720  // TauReco@MiniAOD: individual ECAL and HCAL energies recovered from fractions,
721  // and position at ECAL entrance computed on-the-fly
722  ecalEnergyLeadChargedHadrCand =
723  packedCandPtr->caloFraction() * packedCandPtr->energy() * (1. - packedCandPtr->hcalFraction());
724  hcalEnergyLeadChargedHadrCand =
725  packedCandPtr->caloFraction() * packedCandPtr->energy() * packedCandPtr->hcalFraction();
726  const reco::Track* track = packedCandPtr->bestTrack();
727  if (track != nullptr) {
728  leadingTrackNormChi2 = track->normalizedChi2();
729  for (const auto& isoCand : pfTauRef->isolationCands()) {
730  //can safely use static_cast as it is ensured that this PFTau is
731  //built with packedCands as its leadingCanidate
732  const pat::PackedCandidate* isoPackedCand = static_cast<const pat::PackedCandidate*>(isoCand.get());
733  myHCALenergy += isoPackedCand->caloFraction() * isoPackedCand->energy() * isoPackedCand->hcalFraction();
734  myECALenergy +=
735  isoPackedCand->caloFraction() * isoPackedCand->energy() * (1. - isoPackedCand->hcalFraction());
736  }
737  for (const auto& signalCand : pfTauRef->signalCands()) {
738  //can safely use static_cast as it is ensured that this PFTau is
739  //built with packedCands as its leadingCanidate
740  const pat::PackedCandidate* sigPackedCand = static_cast<const pat::PackedCandidate*>(signalCand.get());
741  myHCALenergy += sigPackedCand->caloFraction() * sigPackedCand->energy() * sigPackedCand->hcalFraction();
742  myECALenergy +=
743  sigPackedCand->caloFraction() * sigPackedCand->energy() * (1. - sigPackedCand->hcalFraction());
744  }
745  if (myHCALenergy + myECALenergy != 0.) {
746  emFraction = myECALenergy / (myHCALenergy + myECALenergy);
747  }
748  }
749  }
750  }
751  }
752 
753  aTauPFEssential.emFraction_ = emFraction;
754  aTauPFEssential.leadingTrackNormChi2_ = leadingTrackNormChi2;
755  aTauPFEssential.ecalEnergyLeadChargedHadrCand_ = ecalEnergyLeadChargedHadrCand;
756  aTauPFEssential.hcalEnergyLeadChargedHadrCand_ = hcalEnergyLeadChargedHadrCand;
757  // extraction of tau lifetime information
758  if (!tauTransverseImpactParameterSrc_.label().empty()) {
759  edm::Handle<PFTauTIPAssociationByRef> tauLifetimeInfos;
760  iEvent.getByToken(tauTransverseImpactParameterToken_, tauLifetimeInfos);
761  const reco::PFTauTransverseImpactParameter& tauLifetimeInfo = *(*tauLifetimeInfos)[pfTauRef];
762  pat::tau::TauPFEssential& aTauPFEssential = aTau.pfEssential_[0];
763  aTauPFEssential.dxy_PCA_ = tauLifetimeInfo.dxy_PCA();
764  aTauPFEssential.dxy_ = tauLifetimeInfo.dxy();
765  aTauPFEssential.dxy_error_ = tauLifetimeInfo.dxy_error();
766  aTauPFEssential.hasSV_ = tauLifetimeInfo.hasSecondaryVertex();
767  aTauPFEssential.flightLength_ = tauLifetimeInfo.flightLength();
768  aTauPFEssential.flightLengthSig_ = tauLifetimeInfo.flightLengthSig();
769  aTauPFEssential.ip3d_ = tauLifetimeInfo.ip3d();
770  aTauPFEssential.ip3d_error_ = tauLifetimeInfo.ip3d_error();
771  }
772  }
773 
774  // Isolation
775  if (isolator_.enabled()) {
777  typedef pat::helper::MultiIsolator::IsolationValuePairs IsolationValuePairs;
778  // better to loop backwards, so the vector is resized less times
779  for (IsolationValuePairs::const_reverse_iterator it = isolatorTmpStorage_.rbegin(),
780  ed = isolatorTmpStorage_.rend();
781  it != ed;
782  ++it) {
783  aTau.setIsolation(it->first, it->second);
784  }
785  }
786 
787  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
788  aTau.setIsoDeposit(isoDepositLabels_[j].first, (*deposits[j])[tausRef]);
789  }
790 
791  if (efficiencyLoader_.enabled()) {
792  efficiencyLoader_.setEfficiencies(aTau, tausRef);
793  }
794 
795  if (resolutionLoader_.enabled()) {
797  }
798 
799  if (useUserData_) {
800  userDataHelper_.add(aTau, iEvent, iSetup);
801  }
802 
803  patTaus->push_back(aTau);
804  }
805 
806  // sort taus in pT
807  std::sort(patTaus->begin(), patTaus->end(), pTTauComparator_);
808 
809  // put genEvt object in Event
810  iEvent.put(std::move(patTaus));
811 
812  // clean up
813  if (isolator_.enabled())
815 }
816 
817 template <typename TauCollectionType, typename TauDiscrType>
819  size_t tauIdx,
820  const edm::Handle<TauDiscrType>& tauIdDiscr) {
822  return (*tauIdDiscr)[tauRef];
823 }
825  size_t tauIdx,
827  int wpIdx) {
829  if (wpIdx < 0) {
830  //Only 0th component filled with default value if prediscriminor in RecoTauDiscriminator failed.
831  if ((*tauIdDiscr)[tauRef].rawValues.size() == 1)
832  return (*tauIdDiscr)[tauRef].rawValues.at(0);
833  //uses negative indices to access rawValues. In most cases only one rawValue at wpIdx=-1 exists.
834  return (*tauIdDiscr)[tauRef].rawValues.at(-1 - wpIdx);
835  } else {
836  //WP vector not filled if prediscriminor in RecoTauDiscriminator failed. Set PAT output to false in this case
837  if ((*tauIdDiscr)[tauRef].workingPoints.empty())
838  return 0.0;
839  return (*tauIdDiscr)[tauRef].workingPoints.at(wpIdx);
840  }
841 }
842 
843 // ParameterSet description for module
846  iDesc.setComment("PAT tau producer module");
847 
848  // input source
849  iDesc.add<edm::InputTag>("tauSource", edm::InputTag())->setComment("input collection");
850 
851  // embedding
852  iDesc.add<bool>("embedIsolationTracks", false)->setComment("embed external isolation tracks");
853  iDesc.add<bool>("embedLeadTrack", false)->setComment("embed external leading track");
854  iDesc.add<bool>("embedLeadTracks", false)->setComment("embed external signal tracks");
855 
856  // MC matching configurables
857  iDesc.add<bool>("addGenMatch", true)->setComment("add MC matching");
858  iDesc.add<bool>("embedGenMatch", false)->setComment("embed MC matched MC information");
859  std::vector<edm::InputTag> emptySourceVector;
860  iDesc
861  .addNode(edm::ParameterDescription<edm::InputTag>("genParticleMatch", edm::InputTag(), true) xor
862  edm::ParameterDescription<std::vector<edm::InputTag>>("genParticleMatch", emptySourceVector, true))
863  ->setComment("input with MC match information");
864 
865  // MC jet matching variables
866  iDesc.add<bool>("addGenJetMatch", true)->setComment("add MC jet matching");
867  iDesc.add<bool>("embedGenJetMatch", false)->setComment("embed MC jet matched jet information");
868  iDesc.add<edm::InputTag>("genJetMatch", edm::InputTag("tauGenJetMatch"));
869 
871 
872  // tau ID configurables
873  iDesc.add<bool>("addTauID", true)->setComment("add tau ID variables");
874  edm::ParameterSetDescription tauIDSourcesPSet;
875  tauIDSourcesPSet.setAllowAnything();
876  iDesc
878  edm::ParameterDescription<edm::ParameterSetDescription>("tauIDSources", tauIDSourcesPSet, true))
879  ->setComment("input with tau ID variables");
880  // (Dis)allow to skip missing tauId sources
881  iDesc.add<bool>("skipMissingTauID", false)
882  ->setComment("allow to skip a tau ID variable when not present in the event");
883 
884  // IsoDeposit configurables
885  edm::ParameterSetDescription isoDepositsPSet;
886  isoDepositsPSet.addOptional<edm::InputTag>("tracker");
887  isoDepositsPSet.addOptional<edm::InputTag>("ecal");
888  isoDepositsPSet.addOptional<edm::InputTag>("hcal");
889  isoDepositsPSet.addOptional<edm::InputTag>("pfAllParticles");
890  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedHadron");
891  isoDepositsPSet.addOptional<edm::InputTag>("pfNeutralHadron");
892  isoDepositsPSet.addOptional<edm::InputTag>("pfGamma");
893  isoDepositsPSet.addOptional<std::vector<edm::InputTag>>("user");
894  iDesc.addOptional("isoDeposits", isoDepositsPSet);
895 
896  // Efficiency configurables
897  edm::ParameterSetDescription efficienciesPSet;
898  efficienciesPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
899  iDesc.add("efficiencies", efficienciesPSet);
900  iDesc.add<bool>("addEfficiencies", false);
901 
902  // Check to see if the user wants to add user data
903  edm::ParameterSetDescription userDataPSet;
905  iDesc.addOptional("userData", userDataPSet);
906 
907  edm::ParameterSetDescription isolationPSet;
908  isolationPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
909  iDesc.add("userIsolation", isolationPSet);
910 }
911 
913 
ConfigurationDescriptions.h
reco::PFCandidate::trackRef
reco::TrackRef trackRef() const
Definition: PFCandidate.cc:408
pat::PATTauProducer::firstOccurence_
bool firstOccurence_
Definition: PATTauProducer.cc:66
hemisphereProducer_cfi.patTaus
patTaus
Definition: hemisphereProducer_cfi.py:8
pat::tau::TauPFEssential::hasSV_
bool hasSV_
Definition: TauPFEssential.h:46
GenJetCollection.h
ProcessHistoryID.h
pat::PATTauProducer::pfTauToken_
edm::EDGetTokenT< reco::PFTauCollection > pfTauToken_
Definition: PATTauProducer.cc:71
Handle.h
pat::Tau::embedSignalPFCands
void embedSignalPFCands()
method to store the signal candidates internally
PDWG_TauSkim_cff.rawValues
rawValues
Definition: PDWG_TauSkim_cff.py:13
PATUserDataMerger.h
pat::PATUserDataHelper< pat::Tau >
mps_fire.i
i
Definition: mps_fire.py:428
pat::EcalIso
Definition: Isolation.h:11
GreaterByPt
Definition: PtComparator.h:24
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
reco::PFTauTransverseImpactParameter::dxy_error
double dxy_error() const
Definition: PFTauTransverseImpactParameter.h:52
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11724
MessageLogger.h
pat::PATTauProducer::addGenJetMatch_
bool addGenJetMatch_
Definition: PATTauProducer.cc:92
funct::false
false
Definition: Factorize.h:29
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
pat::Tau::setGenJet
void setGenJet(const reco::GenJetRef &ref)
set the matched GenJet
pat::tau::TauPFEssential::dxy_error_
float dxy_error_
Definition: TauPFEssential.h:41
pat::tau::TauPFEssential::flightLengthSig_
float flightLengthSig_
Definition: TauPFEssential.h:48
pat::PATTauProducer::PATTauProducer
PATTauProducer(const edm::ParameterSet &iConfig)
Definition: PATTauProducer.cc:143
PFTauDiscriminator.h
pat::PATTauProducer::tauIDSrcContainers_
std::vector< std::vector< NameWPIdx > > tauIDSrcContainers_
Definition: PATTauProducer.cc:107
pat::tau::TauPFEssential::etaAtEcalEntranceLeadChargedCand_
float etaAtEcalEntranceLeadChargedCand_
Definition: TauPFEssential.h:61
pat::helper::EfficiencyLoader
Definition: EfficiencyLoader.h:16
edm::Ref::isAvailable
bool isAvailable() const
Definition: Ref.h:537
pat::Tau::embedLeadPFChargedHadrCand
void embedLeadPFChargedHadrCand()
method to store the leading charged hadron candidate internally
pat::PATTauProducer::WPIdx
std::pair< WPCfg, int > WPIdx
Definition: PATTauProducer.cc:102
edm::EDGetTokenT
Definition: EDGetToken.h:33
TauPFSpecific.h
pat::PATTauProducer
Produces pat::Tau's.
Definition: PATTauProducer.cc:56
pat::helper::MultiIsolator::fill
void fill(const edm::View< T > &coll, int idx, IsolationValuePairs &isolations) const
Definition: MultiIsolator.h:84
pat::Tau::embedSignalPFNeutralHadrCands
void embedSignalPFNeutralHadrCands()
method to store the signal neutral hadrons candidates internally
edm
HLT enums.
Definition: AlignableModifier.h:19
pat::PATTauProducer::embedIsolationPFNeutralHadrCands_
bool embedIsolationPFNeutralHadrCands_
Definition: PATTauProducer.cc:85
PFTauTransverseImpactParameterAssociation.h
pat::PATTauProducer::embedSignalTracks_
bool embedSignalTracks_
Definition: PATTauProducer.cc:75
pat::PATUserDataHelper::fillDescription
static void fillDescription(edm::ParameterSetDescription &iDesc)
Definition: PATUserDataHelper.h:135
pat::PackedCandidate::caloFraction
float caloFraction() const
Set the fraction of ECAL+HCAL energy over candidate energy.
Definition: PackedCandidate.h:929
pat::tau::TauPFEssential::ptLeadChargedCand_
float ptLeadChargedCand_
Definition: TauPFEssential.h:62
pat::PATTauProducer::embedIsolationTracks_
bool embedIsolationTracks_
Definition: PATTauProducer.cc:73
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
pat::PATTauProducer::embedGenMatch_
bool embedGenMatch_
Definition: PATTauProducer.cc:89
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
reco::PFCandidate::positionAtECALEntrance
const math::XYZPointF & positionAtECALEntrance() const
Definition: PFCandidate.h:363
pat::tau::TauPFEssential::flightLength_
Vector flightLength_
Definition: TauPFEssential.h:47
pat::Tau::embedLeadPFNeutralCand
void embedLeadPFNeutralCand()
method to store the leading neutral candidate internally
pat::Lepton::setIsolation
void setIsolation(IsolationKeys key, float value)
Definition: Lepton.h:115
pat::helper::EfficiencyLoader::enabled
bool enabled() const
'true' if this there is at least one efficiency configured
Definition: EfficiencyLoader.h:25
edm::Ref::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
EDProducer.h
pat::Tau::pfEssential_
std::vector< pat::tau::TauPFEssential > pfEssential_
Definition: Tau.h:493
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
pat::PATObject::addGenParticleRef
void addGenParticleRef(const reco::GenParticleRef &ref)
Definition: PATObject.h:751
pat::PfAllParticleIso
Definition: Isolation.h:13
PtComparator.h
reco::PFTau
Definition: PFTau.h:36
pat::PATTauProducer::embedLeadPFCand_
bool embedLeadPFCand_
Definition: PATTauProducer.cc:76
TauJetCorrFactors.h
pat::PATTauProducer::embedIsolationPFGammaCands_
bool embedIsolationPFGammaCands_
Definition: PATTauProducer.cc:86
edm::Ptr::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:139
pat::PATTauProducer::embedLeadPFChargedHadrCand_
bool embedLeadPFChargedHadrCand_
Definition: PATTauProducer.cc:77
pat::PATTauProducer::isolator_
pat::helper::MultiIsolator isolator_
Definition: PATTauProducer.cc:115
pat::tau::TauPFEssential::ip3d_
float ip3d_
Definition: TauPFEssential.h:52
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
Tau
Definition: Tau.py:1
pat::Tau::addJECFactors
void addJECFactors(const TauJetCorrFactors &jec)
add more sets of energy correction factors
Definition: Tau.h:412
pat::PATTauProducer::pfTauIDContainerTokens_
std::vector< edm::EDGetTokenT< reco::TauDiscriminatorContainer > > pfTauIDContainerTokens_
Definition: PATTauProducer.cc:109
Association.h
pat::PATTauProducer::addGenMatch_
bool addGenMatch_
Definition: PATTauProducer.cc:88
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
edm::Handle
Definition: AssociativeIterator.h:50
edm::ParameterSetDescription::addOptional
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:105
Tau.h
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
pat::helper::MultiIsolator::IsolationValuePairs
std::vector< std::pair< pat::IsolationKeys, float > > IsolationValuePairs
Definition: MultiIsolator.h:17
MultiIsolator.h
EfficiencyLoader.h
pat::helper::KinResolutionsLoader::enabled
bool enabled() const
'true' if this there is at least one efficiency configured
Definition: KinResolutionsLoader.h:27
pat::PATTauProducer::phID_
edm::ProcessHistoryID phID_
Definition: PATTauProducer.cc:111
PositionAtECalEntranceComputer
Definition: PositionAtECalEntranceComputer.h:25
pat::helper::MultiIsolator::enabled
bool enabled() const
True if it has a non null configuration.
Definition: MultiIsolator.h:55
edm::Ref< GenParticleCollection >
RecoTauValidationMiniAOD_cfi.tauCollection
tauCollection
Definition: RecoTauValidationMiniAOD_cfi.py:5
pat::PATTauProducer::addResolutions_
bool addResolutions_
Definition: PATTauProducer.cc:123
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
edm::Exception
Definition: EDMException.h:77
pat::helper::MultiIsolator::endEvent
void endEvent()
Definition: MultiIsolator.cc:85
GenParticle.h
pat::PATTauProducer::embedSignalPFGammaCands_
bool embedSignalPFGammaCands_
Definition: PATTauProducer.cc:82
reco::PFTauTransverseImpactParameter::dxy
double dxy() const
Definition: PFTauTransverseImpactParameter.h:51
PositionAtECalEntranceComputer::beginEvent
void beginEvent(const edm::EventSetup &)
Definition: PositionAtECalEntranceComputer.cc:25
edm::parameterSet
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
pat::PATTauProducer::posAtECalEntranceComputer_
PositionAtECalEntranceComputer posAtECalEntranceComputer_
Definition: PATTauProducer.cc:136
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
pat::tau::TauPFEssential::dxy_
float dxy_
Definition: TauPFEssential.h:40
pat::PATTauProducer::genMatchTokens_
std::vector< edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > > genMatchTokens_
Definition: PATTauProducer.cc:90
MakerMacros.h
pat::Tau::embedLeadPFCand
void embedLeadPFCand()
reco::PFCandidate::muonRef
reco::MuonRef muonRef() const
Definition: PFCandidate.cc:421
pat::PackedCandidate::energy
double energy() const override
energy
Definition: PackedCandidate.h:469
pat::PATTauProducer::NameTag
std::pair< std::string, edm::InputTag > NameTag
Definition: PATTauProducer.cc:100
pat::PATTauProducer::embedLeadTrack_
bool embedLeadTrack_
Definition: PATTauProducer.cc:74
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
pat::PackedCandidate::bestTrack
const reco::Track * bestTrack() const override
return a pointer to the track if present. otherwise, return a null pointer
Definition: PackedCandidate.h:780
pat::PATTauProducer::isoDepositLabels_
std::vector< std::pair< pat::IsolationKeys, edm::InputTag > > isoDepositLabels_
Definition: PATTauProducer.cc:117
reco::PFTauTransverseImpactParameter::flightLengthSig
double flightLengthSig() const
Definition: PFTauTransverseImpactParameter.cc:71
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:124
pat::PfChargedHadronIso
Definition: Isolation.h:14
pat::Tau::isPFTau
bool isPFTau() const
Returns true if this pat::Tau was made from a reco::PFTau.
Definition: Tau.h:121
pat::PATUserDataHelper::add
void add(ObjectType &patObject, edm::Event const &iEvent, edm::EventSetup const &iSetup)
Definition: PATUserDataHelper.h:114
pat::PATTauProducer::isolatorTmpStorage_
pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_
Definition: PATTauProducer.cc:116
ProductProvenance.h
pat::Tau::embedSignalTracks
void embedSignalTracks()
method to store the signal tracks internally
pat::helper::EfficiencyLoader::newEvent
void newEvent(const edm::Event &event)
To be called for each new event, reads in the ValueMaps for efficiencies.
Definition: EfficiencyLoader.cc:21
pat::tau::TauPFEssential::ip3d_error_
float ip3d_error_
Definition: TauPFEssential.h:53
GenParticleFwd.h
pat::PATTauProducer::NameWPIdx
std::pair< std::string, WPIdx > NameWPIdx
Definition: PATTauProducer.cc:103
pat::Tau::initializeJEC
void initializeJEC(unsigned int level, const unsigned int set=0)
initialize the jet to a given JEC level during creation starting from Uncorrected
reco::Track
Definition: Track.h:27
pat::helper::KinResolutionsLoader
Definition: KinResolutionsLoader.h:18
pat::Lepton::setIsoDeposit
void setIsoDeposit(IsolationKeys key, const IsoDeposit &dep)
Sets the IsoDeposit associated with some key; if it is already existent, it is overwritten.
Definition: Lepton.h:191
summarizeEdmComparisonLogfiles.success
success
Definition: summarizeEdmComparisonLogfiles.py:114
KinResolutionsLoader.h
pat::PATTauProducer::~PATTauProducer
~PATTauProducer() override
Definition: PATTauProducer.cc:286
pat::Tau::embedSignalPFGammaCands
void embedSignalPFGammaCands()
method to store the signal gamma candidates internally
TauSpinnerFilter_cfi.ntaus
ntaus
Definition: TauSpinnerFilter_cfi.py:5
edm::Hash< ProcessHistoryType >
pat::PATTauProducer::tauIDSrcs_
std::vector< NameTag > tauIDSrcs_
Definition: PATTauProducer.cc:106
pat::PATTauProducer::genJetMatchToken_
edm::EDGetTokenT< edm::Association< reco::GenJetCollection > > genJetMatchToken_
Definition: PATTauProducer.cc:94
pat::PATTauProducer::addTauJetCorrFactors_
bool addTauJetCorrFactors_
Definition: PATTauProducer.cc:96
ParameterSetDescription.h
PFTauTransverseImpactParameterFwd.h
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:125
pat::tau::TauPFEssential::hcalEnergy_
float hcalEnergy_
Definition: TauPFEssential.h:55
reco::PFTauTransverseImpactParameter
Definition: PFTauTransverseImpactParameter.h:24
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
pat::Tau::embedIsolationTracks
void embedIsolationTracks()
method to store the isolation tracks internally
edm::vector_transform
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
FileInPath.h
reco::PFTauTransverseImpactParameter::hasSecondaryVertex
bool hasSecondaryVertex() const
Definition: PFTauTransverseImpactParameter.h:61
PFTauTransverseImpactParameter.h
edm::AssociationVector
Definition: AssociationVector.h:67
pat::helper::KinResolutionsLoader::setResolutions
void setResolutions(pat::PATObject< T > &obj) const
Sets the efficiencies for this object, using the reference to the original objects.
Definition: KinResolutionsLoader.h:49
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:681
pat::PATTauProducer::WPCfg
std::pair< std::string, std::string > WPCfg
Definition: PATTauProducer.cc:101
pat::Tau::embedIsolationPFCands
void embedIsolationPFCands()
method to store the isolation candidates internally
edm::ParameterSet
Definition: ParameterSet.h:47
edm::ParameterSetDescription::setComment
void setComment(std::string const &value)
Definition: ParameterSetDescription.cc:33
reco::PFCandidate::gsfTrackRef
reco::GsfTrackRef gsfTrackRef() const
Definition: PFCandidate.cc:440
pat::tau::TauPFEssential
Definition: TauPFEssential.h:22
pat::PATTauProducer::embedSignalPFChargedHadrCands_
bool embedSignalPFChargedHadrCands_
Definition: PATTauProducer.cc:80
jetProducer_cfi.genJetMatch
genJetMatch
switch on/off embedding of matched genJet's
Definition: jetProducer_cfi.py:85
PDWG_TauSkim_cff.workingPoints
workingPoints
Definition: PDWG_TauSkim_cff.py:15
Event.h
pat::PATTauProducer::efficiencyLoader_
pat::helper::EfficiencyLoader efficiencyLoader_
Definition: PATTauProducer.cc:121
ParameterSet
Definition: Functions.h:16
pat::PfGammaIso
Definition: Isolation.h:16
makeGlobalPositionRcd_cfg.tag
tag
Definition: makeGlobalPositionRcd_cfg.py:6
pat::helper::KinResolutionsLoader::fillDescription
static void fillDescription(edm::ParameterSetDescription &iDesc)
Method for documentation and validation of PSet.
Definition: KinResolutionsLoader.cc:34
UserData.h
pat::PATTauProducer::pfTauIDTokens_
std::vector< edm::EDGetTokenT< reco::PFTauDiscriminator > > pfTauIDTokens_
Definition: PATTauProducer.cc:108
pat::PackedCandidate
Definition: PackedCandidate.h:22
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
PackedCandidate.h
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
pat::tau::TauPFEssential::emFraction_
float emFraction_
Definition: TauPFEssential.h:63
pat::UserBaseIso
Definition: Isolation.h:22
pat::PATTauProducer::baseTauToken_
edm::EDGetTokenT< edm::View< reco::BaseTau > > baseTauToken_
Definition: PATTauProducer.cc:69
pat::PATTauProducer::skipMissingTauID_
bool skipMissingTauID_
Definition: PATTauProducer.cc:110
pat::TrackIso
Definition: Isolation.h:10
pat::PackedCandidate::phi
double phi() const override
momentum azimuthal angle
Definition: PackedCandidate.h:529
edm::ParameterSet::getParameterNamesForType
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:179
iEvent
int iEvent
Definition: GenABIO.cc:224
pat::PATTauProducer::isoDepositTokens_
std::vector< edm::EDGetTokenT< edm::ValueMap< IsoDeposit > > > isoDepositTokens_
Definition: PATTauProducer.cc:118
pat::PATTauProducer::embedSignalPFNeutralHadrCands_
bool embedSignalPFNeutralHadrCands_
Definition: PATTauProducer.cc:81
pat::PATTauProducer::embedIsolationPFCands_
bool embedIsolationPFCands_
Definition: PATTauProducer.cc:83
pat::HcalIso
Definition: Isolation.h:12
reco::PFTauTransverseImpactParameter::ip3d
double ip3d() const
Definition: PFTauTransverseImpactParameter.h:55
pat::PfNeutralHadronIso
Definition: Isolation.h:15
edm::stream::EDProducer
Definition: EDProducer.h:36
TauDiscriminatorContainer.h
reco::PFTauTransverseImpactParameter::ip3d_error
double ip3d_error() const
Definition: PFTauTransverseImpactParameter.h:56
pat::Tau::embedLeadTrack
void embedLeadTrack()
method to store the leading track internally
edm::Association
Definition: Association.h:18
edm::EventSetup
Definition: EventSetup.h:58
edm::ParameterSetDescription::addNode
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
Definition: ParameterSetDescription.cc:41
pat::tau::TauPFEssential::leadingTrackNormChi2_
float leadingTrackNormChi2_
Definition: TauPFEssential.h:56
reco::PFTauTransverseImpactParameter::dxy_PCA
const Point & dxy_PCA() const
Definition: PFTauTransverseImpactParameter.h:50
pat
Definition: HeavyIon.h:7
pat::Tau::embedSignalPFChargedHadrCands
void embedSignalPFChargedHadrCands()
method to store the signal charged hadrons candidates internally
edm::ParameterSetDescription::setAllowAnything
void setAllowAnything()
allow any parameter label/value pairs
Definition: ParameterSetDescription.cc:37
pat::Tau::embedIsolationPFGammaCands
void embedIsolationPFGammaCands()
method to store the isolation gamma candidates internally
pat::PATTauProducer::embedGenJetMatch_
bool embedGenJetMatch_
Definition: PATTauProducer.cc:93
pat::helper::KinResolutionsLoader::newEvent
void newEvent(const edm::Event &event, const edm::EventSetup &setup)
To be called for each new event, reads in the EventSetup object.
Definition: KinResolutionsLoader.cc:27
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
pat::Tau::setDecayMode
void setDecayMode(int)
set decay mode
reco::PFCandidate::ecalEnergy
double ecalEnergy() const
return corrected Ecal energy
Definition: PFCandidate.h:221
InputTag.h
pat::TauJetCorrFactors
Definition: TauJetCorrFactors.h:31
edm::Ptr
Definition: AssociationVector.h:31
pat::helper::MultiIsolator
Definition: MultiIsolator.h:15
pat::PATTauProducer::pTTauComparator_
GreaterByPt< Tau > pTTauComparator_
Definition: PATTauProducer.cc:113
pat::tau::TauPFEssential::ecalEnergyLeadChargedHadrCand_
float ecalEnergyLeadChargedHadrCand_
Definition: TauPFEssential.h:59
eostools.move
def move(src, dest)
Definition: eostools.py:511
Ref.h
pat::PackedCandidate::hcalFraction
float hcalFraction() const
Definition: PackedCandidate.h:934
pat::IsolationKeys
IsolationKeys
Enum defining isolation keys.
Definition: Isolation.h:9
pat::helper::MultiIsolator::beginEvent
void beginEvent(const edm::Event &event, const edm::EventSetup &eventSetup)
Definition: MultiIsolator.cc:79
pat::helper::EfficiencyLoader::setEfficiencies
void setEfficiencies(pat::PATObject< T > &obj, const R &originalRef) const
Sets the efficiencies for this object, using the reference to the original objects.
Definition: EfficiencyLoader.h:41
reco::PFCandidate::hcalEnergy
double hcalEnergy() const
return corrected Hcal energy
Definition: PFCandidate.h:233
pat::PATTauProducer::userDataHelper_
pat::PATUserDataHelper< pat::Tau > userDataHelper_
Definition: PATTauProducer.cc:127
pat::PATTauProducer::embedIsolationPFChargedHadrCands_
bool embedIsolationPFChargedHadrCands_
Definition: PATTauProducer.cc:84
edm::Provenance::stable
StableProvenance const & stable() const
Definition: Provenance.h:42
pat::PATTauProducer::addTauID_
bool addTauID_
Definition: PATTauProducer.cc:99
Exception
Definition: hltDiff.cc:245
pat::PATTauProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: PATTauProducer.cc:844
pat::PATTauProducer::embedLeadPFNeutralCand_
bool embedLeadPFNeutralCand_
Definition: PATTauProducer.cc:78
pat::PATTauProducer::getTauIdDiscriminator
float getTauIdDiscriminator(const edm::Handle< TauCollectionType > &, size_t, const edm::Handle< TauDiscrType > &)
Definition: PATTauProducer.cc:818
pat::tau::TauPFEssential::etaAtEcalEntrance_
float etaAtEcalEntrance_
Definition: TauPFEssential.h:58
PFTau.h
Provenance.h
PATUserDataHelper.h
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
pat::PATTauProducer::getTauIdDiscriminatorFromContainer
float getTauIdDiscriminatorFromContainer(const edm::Handle< reco::PFTauCollection > &, size_t, const edm::Handle< reco::TauDiscriminatorContainer > &, int)
Definition: PATTauProducer.cc:824
edm::Ptr::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:146
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::RefToBase
Definition: AssociativeIterator.h:54
reco::LeafCandidate::energy
double energy() const final
energy
Definition: LeafCandidate.h:125
reco::PFCandidate
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
pat::PATTauProducer::tauJetCorrFactorsTokens_
std::vector< edm::EDGetTokenT< edm::ValueMap< TauJetCorrFactors > > > tauJetCorrFactorsTokens_
Definition: PATTauProducer.cc:97
pat::PATTauProducer::resolutionLoader_
pat::helper::KinResolutionsLoader resolutionLoader_
Definition: PATTauProducer.cc:124
pat::PATTauProducer::tauTransverseImpactParameterToken_
edm::EDGetTokenT< PFTauTIPAssociationByRef > tauTransverseImpactParameterToken_
Definition: PATTauProducer.cc:70
pat::PATTauProducer::embedSignalPFCands_
bool embedSignalPFCands_
Definition: PATTauProducer.cc:79
cms::Exception
Definition: Exception.h:70
View.h
pat::PATTauProducer::tauTransverseImpactParameterSrc_
edm::InputTag tauTransverseImpactParameterSrc_
Definition: PATTauProducer.cc:72
ParameterSet.h
pat::PATTauProducer::useUserData_
bool useUserData_
Definition: PATTauProducer.cc:126
edm::ParameterDescriptionNode::setComment
void setComment(std::string const &value)
Definition: ParameterDescriptionNode.cc:106
pat::Tau::setTauIDs
void setTauIDs(const std::vector< IdPair > &ids)
Definition: Tau.h:347
reco::Candidate::Point
math::XYZPoint Point
point in the space
Definition: Candidate.h:40
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
pat::PATObject::embedGenParticle
void embedGenParticle()
Definition: PATObject.h:768
edm::Provenance
Definition: Provenance.h:34
pat::PATTauProducer::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition: PATTauProducer.cc:288
edm::Event
Definition: Event.h:73
crabWrapper.key
key
Definition: crabWrapper.py:19
pat::Tau::embedIsolationPFNeutralHadrCands
void embedIsolationPFNeutralHadrCands()
method to store the isolation neutral hadrons candidates internally
pat::PATTauProducer::addEfficiencies_
bool addEfficiencies_
Definition: PATTauProducer.cc:120
edm::ParameterDescription
Definition: ParameterDescription.h:110
PositionAtECalEntranceComputer.h
CandIsolatorFromDeposits_cfi.deposits
deposits
Definition: CandIsolatorFromDeposits_cfi.py:4
PFTauTIPAssociationByRef
edm::AssociationVector< reco::PFTauRefProd, std::vector< reco::PFTauTransverseImpactParameterRef > > PFTauTIPAssociationByRef
Definition: PATTauProducer.cc:53
edm::InputTag
Definition: InputTag.h:15
label
const char * label
Definition: PFTauDecayModeTools.cc:11
pat::Tau::embedIsolationPFChargedHadrCands
void embedIsolationPFChargedHadrCands()
method to store the isolation charged hadrons candidates internally
jets_cff.levels
levels
Definition: jets_cff.py:21
pat::tau::TauPFEssential::ecalEnergy_
float ecalEnergy_
Definition: TauPFEssential.h:54
pat::PATTauProducer::IDContainerData
std::pair< edm::InputTag, std::vector< NameWPIdx > > IDContainerData
Definition: PATTauProducer.cc:105
pat::tau::TauPFEssential::dxy_PCA_
Point dxy_PCA_
Definition: TauPFEssential.h:39
pat::tau::TauPFEssential::phiAtEcalEntrance_
float phiAtEcalEntrance_
Definition: TauPFEssential.h:57
pat::PackedCandidate::eta
double eta() const override
momentum pseudorapidity
Definition: PackedCandidate.h:563
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
reco::PFTauTransverseImpactParameter::flightLength
const Vector & flightLength() const
Definition: PFTauTransverseImpactParameter.cc:67
pat::tau::TauPFEssential::hcalEnergyLeadChargedHadrCand_
float hcalEnergyLeadChargedHadrCand_
Definition: TauPFEssential.h:60