CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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");
185  genJetMatchToken_ =
186  consumes<edm::Association<reco::GenJetCollection>>(iConfig.getParameter<edm::InputTag>("genJetMatch"));
187  }
188  addTauJetCorrFactors_ = iConfig.getParameter<bool>("addTauJetCorrFactors");
189  tauJetCorrFactorsTokens_ = edm::vector_transform(
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  }
230  pfTauIDTokens_ = edm::vector_transform(
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  }
263  isoDepositTokens_ =
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_) {
270  efficiencyLoader_ =
271  pat::helper::EfficiencyLoader(iConfig.getParameter<edm::ParameterSet>("efficiencies"), consumesCollector());
272  }
273  // Resolution configurables
274  addResolutions_ = iConfig.getParameter<bool>("addResolutions");
275  if (addResolutions_) {
276  resolutionLoader_ =
277  pat::helper::KinResolutionsLoader(iConfig.getParameter<edm::ParameterSet>("resolutions"), consumesCollector());
278  }
279  // Check to see if the user wants to add user data
280  if (useUserData_) {
281  userDataHelper_ = PATUserDataHelper<Tau>(iConfig.getParameter<edm::ParameterSet>("userData"), consumesCollector());
282  }
283  // produces vector of taus
284  produces<std::vector<Tau>>();
285 }
286 
287 PATTauProducer::~PATTauProducer() {}
288 
290  // switch off embedding (in unschedules mode)
291  if (iEvent.isRealData()) {
292  addGenMatch_ = false;
293  embedGenMatch_ = false;
294  addGenJetMatch_ = false;
295  }
296 
297  // Get the collection of taus from the event
299  try {
300  iEvent.getByToken(baseTauToken_, anyTaus);
301  } catch (const edm::Exception& e) {
302  edm::LogWarning("DataSource") << "WARNING! No Tau collection found. This missing input will not block the job. "
303  "Instead, an empty tau collection is being be produced.";
304  auto patTaus = std::make_unique<std::vector<Tau>>();
305  iEvent.put(std::move(patTaus));
306  return;
307  }
308 
310 
311  if (isolator_.enabled())
312  isolator_.beginEvent(iEvent, iSetup);
313 
315  efficiencyLoader_.newEvent(iEvent);
317  resolutionLoader_.newEvent(iEvent, iSetup);
318 
319  std::vector<edm::Handle<edm::ValueMap<IsoDeposit>>> deposits(isoDepositTokens_.size());
320  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
321  iEvent.getByToken(isoDepositTokens_[j], deposits[j]);
322  }
323 
324  // prepare the MC matching
325  std::vector<edm::Handle<edm::Association<reco::GenParticleCollection>>> genMatches(genMatchTokens_.size());
326  if (addGenMatch_) {
327  for (size_t j = 0, nd = genMatchTokens_.size(); j < nd; ++j) {
328  iEvent.getByToken(genMatchTokens_[j], genMatches[j]);
329  }
330  }
331 
333  if (addGenJetMatch_)
334  iEvent.getByToken(genJetMatchToken_, genJetMatch);
335 
336  // read in the jet correction factors ValueMap
337  std::vector<edm::ValueMap<TauJetCorrFactors>> tauJetCorrs;
338  if (addTauJetCorrFactors_) {
339  for (size_t i = 0; i < tauJetCorrFactorsTokens_.size(); ++i) {
341  iEvent.getByToken(tauJetCorrFactorsTokens_[i], tauJetCorr);
342  tauJetCorrs.push_back(*tauJetCorr);
343  }
344  }
345 
346  auto patTaus = std::make_unique<std::vector<Tau>>();
347 
348  bool first = true; // this is introduced to issue warnings only for the first tau-jet
349  for (size_t idx = 0, ntaus = anyTaus->size(); idx < ntaus; ++idx) {
350  edm::RefToBase<reco::BaseTau> tausRef = anyTaus->refAt(idx);
351  edm::Ptr<reco::BaseTau> tausPtr = anyTaus->ptrAt(idx);
352 
353  Tau aTau(tausRef);
354  if (embedLeadTrack_)
355  aTau.embedLeadTrack();
356  if (embedSignalTracks_)
357  aTau.embedSignalTracks();
359  aTau.embedIsolationTracks();
360  if (embedLeadPFCand_) {
361  if (aTau.isPFTau())
362  aTau.embedLeadPFCand();
363  else
364  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
365  "from a reco::PFTau is impossible.\n";
366  }
368  if (aTau.isPFTau())
370  else
371  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
372  "from a reco::PFTau is impossible.\n";
373  }
375  if (aTau.isPFTau())
376  aTau.embedLeadPFNeutralCand();
377  else
378  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
379  "from a reco::PFTau is impossible.\n";
380  }
381  if (embedSignalPFCands_) {
382  if (aTau.isPFTau())
383  aTau.embedSignalPFCands();
384  else
385  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
386  "from a reco::PFTau is impossible.\n";
387  }
389  if (aTau.isPFTau())
391  else
392  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
393  "from a reco::PFTau is impossible.\n";
394  }
396  if (aTau.isPFTau())
398  else
399  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
400  "from a reco::PFTau is impossible.\n";
401  }
403  if (aTau.isPFTau())
405  else
406  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
407  "from a reco::PFTau is impossible.\n";
408  }
410  if (aTau.isPFTau())
411  aTau.embedIsolationPFCands();
412  else
413  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
414  "from a reco::PFTau is impossible.\n";
415  }
417  if (aTau.isPFTau())
419  else
420  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
421  "from a reco::PFTau is impossible.\n";
422  }
424  if (aTau.isPFTau())
426  else
427  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
428  "from a reco::PFTau is impossible.\n";
429  }
431  if (aTau.isPFTau())
433  else
434  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
435  "from a reco::PFTau is impossible.\n";
436  }
437 
438  if (addTauJetCorrFactors_) {
439  // add additional JetCorrs to the jet
440  for (unsigned int i = 0; i < tauJetCorrs.size(); ++i) {
441  const TauJetCorrFactors& tauJetCorr = tauJetCorrs[i][tausRef];
442  // uncomment for debugging
443  // tauJetCorr.print();
444  aTau.addJECFactors(tauJetCorr);
445  }
446  std::vector<std::string> levels = tauJetCorrs[0][tausRef].correctionLabels();
447  if (std::find(levels.begin(), levels.end(), "L2L3Residual") != levels.end()) {
448  aTau.initializeJEC(tauJetCorrs[0][tausRef].jecLevel("L2L3Residual"));
449  } else if (std::find(levels.begin(), levels.end(), "L3Absolute") != levels.end()) {
450  aTau.initializeJEC(tauJetCorrs[0][tausRef].jecLevel("L3Absolute"));
451  } else {
452  aTau.initializeJEC(tauJetCorrs[0][tausRef].jecLevel("Uncorrected"));
453  if (first) {
454  edm::LogWarning("L3Absolute not found")
455  << "L2L3Residual and L3Absolute are not part of the correction applied jetCorrFactors \n"
456  << "of module " << tauJetCorrs[0][tausRef].jecSet() << " jets will remain"
457  << " uncorrected.";
458  first = false;
459  }
460  }
461  }
462 
463  // store the match to the generated final state muons
464  if (addGenMatch_) {
465  for (size_t i = 0, n = genMatches.size(); i < n; ++i) {
466  reco::GenParticleRef genTau = (*genMatches[i])[tausRef];
467  aTau.addGenParticleRef(genTau);
468  }
469  if (embedGenMatch_)
470  aTau.embedGenParticle();
471  }
472 
473  // store the match to the visible part of the generated tau
474  if (addGenJetMatch_) {
475  reco::GenJetRef genJetTau = (*genJetMatch)[tausRef];
476  if (genJetTau.isNonnull() && genJetTau.isAvailable()) {
477  aTau.setGenJet(genJetTau);
478  } // leave empty if no match found
479  }
480 
481  // prepare ID extraction
482  if (addTauID_) {
483  size_t numberPlainTauIds = tauIDSrcs_.size();
484  size_t numberTauIds = numberPlainTauIds;
485  for (auto const& it : tauIDSrcContainers_) {
486  numberTauIds += it.size();
487  }
488  // if ID containers exist, product incices need to be retrieved from provenanceConfigLabel.
489  // This is done if config history changes, in particular for the first event.
490  if (numberPlainTauIds != numberTauIds && phID_ != iEvent.processHistoryID()) {
491  phID_ = iEvent.processHistoryID();
492  for (size_t idx = 0; idx < tauIDSrcContainers_.size(); ++idx) {
493  auto pfTauIdDiscr = iEvent.getHandle(pfTauIDContainerTokens_[idx]);
494  if (!pfTauIdDiscr.isValid())
495  continue; // missing IDs will be skipped lateron or crash there depending on skipMissingTauID_
496  const edm::Provenance* prov = pfTauIdDiscr.provenance();
497  for (NameWPIdx& idcfg : tauIDSrcContainers_[idx]) {
498  std::string prov_cfg_label = idcfg.second.first.first;
499  std::string prov_ID_label = idcfg.second.first.second;
500  bool found = false;
501  if (prov_cfg_label == "rawValues" || prov_cfg_label == "workingPoints") {
502  const std::vector<std::string> psetsFromProvenance =
503  edm::parameterSet(prov->stable(), iEvent.processHistory())
504  .getParameter<std::vector<std::string>>(prov_cfg_label);
505  for (size_t i = 0; i < psetsFromProvenance.size(); ++i) {
506  if (psetsFromProvenance[i] == prov_ID_label) {
507  // using negative indices for raw values
508  if (prov_cfg_label == "rawValues")
509  idcfg.second.second = -1 - i;
510  else
511  idcfg.second.second = i;
512  found = true;
513  }
514  }
515  } else if (prov_cfg_label == "IDdefinitions" || prov_cfg_label == "IDWPdefinitions") {
516  const std::vector<edm::ParameterSet> psetsFromProvenance =
517  edm::parameterSet(prov->stable(), iEvent.processHistory())
518  .getParameter<std::vector<edm::ParameterSet>>(prov_cfg_label);
519  for (size_t i = 0; i < psetsFromProvenance.size(); ++i) {
520  if (psetsFromProvenance[i].getParameter<std::string>("IDname") == prov_ID_label) {
521  // using negative indices for raw values
522  if (prov_cfg_label == "IDdefinitions")
523  idcfg.second.second = -1 - i;
524  else
525  idcfg.second.second = i;
526  found = true;
527  }
528  }
529  } else {
530  // checked prov_cfg_label before, so it must be a direct access via indices
531  try {
532  int i = std::stoi(prov_ID_label);
533  if (prov_cfg_label == "direct_rawValues")
534  idcfg.second.second = -1 - i;
535  else
536  idcfg.second.second = i;
537  found = true;
538  } catch (std::invalid_argument const& e) {
539  throw cms::Exception("Configuration") << "PATTauProducer: Direct access to ID container requested, so "
540  "argument of 'idLabel' must be convertable to int!\n";
541  }
542  }
543  if (!found) {
544  throw cms::Exception("Configuration") << "PATTauProducer: Requested working point '" << prov_ID_label
545  << "' for ID '" << idcfg.first << "' not found!\n";
546  }
547  }
548  }
549  }
550  std::string missingDiscriminators;
551  std::vector<pat::Tau::IdPair> ids(numberTauIds);
552  auto const& tausDeref = *tausRef;
553  if (typeid(tausDeref) == typeid(reco::PFTau)) {
554  edm::Handle<reco::PFTauCollection> pfTauCollection;
555  iEvent.getByToken(pfTauToken_, pfTauCollection);
556  for (size_t i = 0; i < numberPlainTauIds; ++i) {
557  //std::cout << "filling PFTauDiscriminator '" << tauIDSrcs_[i].first << "' into pat::Tau object..." << std::endl;
558 
559  auto pfTauIdDiscr = iEvent.getHandle(pfTauIDTokens_[i]);
560 
561  if (skipMissingTauID_ && !pfTauIdDiscr.isValid()) {
562  if (!missingDiscriminators.empty()) {
563  missingDiscriminators += ", ";
564  }
565  missingDiscriminators += tauIDSrcs_[i].first;
566  continue;
567  }
568  ids[i].first = tauIDSrcs_[i].first;
569  ids[i].second = getTauIdDiscriminator(pfTauCollection, idx, pfTauIdDiscr);
570  }
571  for (size_t i = 0; i < tauIDSrcContainers_.size(); ++i) {
572  auto pfTauIdDiscr = iEvent.getHandle(pfTauIDContainerTokens_[i]);
573  if (skipMissingTauID_ && !pfTauIdDiscr.isValid()) {
574  for (auto const& it : tauIDSrcContainers_[i]) {
575  if (!missingDiscriminators.empty()) {
576  missingDiscriminators += ", ";
577  }
578  missingDiscriminators += it.first;
579  }
580  continue;
581  }
582  for (size_t j = 0; j < tauIDSrcContainers_[i].size(); ++j) {
583  ids[numberPlainTauIds + j].first = tauIDSrcContainers_[i][j].first;
584  ids[numberPlainTauIds + j].second = getTauIdDiscriminatorFromContainer(
585  pfTauCollection, idx, pfTauIdDiscr, tauIDSrcContainers_[i][j].second.second);
586  }
587  numberPlainTauIds += tauIDSrcContainers_[i].size();
588  }
589  } else {
590  throw cms::Exception("Type Mismatch")
591  << "PATTauProducer: unsupported datatype '" << typeid(tausDeref).name() << "' for tauSource\n";
592  }
593  if (!missingDiscriminators.empty() && firstOccurence_) {
594  edm::LogWarning("DataSource") << "The following tau discriminators have not been found in the event:\n"
595  << missingDiscriminators << "\n"
596  << "They will not be embedded into the pat::Tau object.\n"
597  << "Note: this message will be printed only at first occurence.";
598  firstOccurence_ = false;
599  }
600  aTau.setTauIDs(ids);
601  }
602 
603  // extraction of reconstructed tau decay mode
604  // (only available for PFTaus)
605  if (aTau.isPFTau()) {
607  iEvent.getByToken(pfTauToken_, pfTaus);
608  reco::PFTauRef pfTauRef(pfTaus, idx);
609 
610  aTau.setDecayMode(pfTauRef->decayMode());
611  }
612 
613  // extraction of variables needed to rerun MVA isolation and anti-electron discriminator on MiniAOD
614  if (!aTau.pfEssential_.empty()) {
616  iEvent.getByToken(pfTauToken_, pfTaus);
617  reco::PFTauRef pfTauRef(pfTaus, idx);
618  pat::tau::TauPFEssential& aTauPFEssential = aTau.pfEssential_[0];
619  float ecalEnergy = 0;
620  float hcalEnergy = 0;
621  float sumPhiTimesEnergy = 0.;
622  float sumEtaTimesEnergy = 0.;
623  float sumEnergy = 0.;
624  float leadChargedCandPt = -99;
625  float leadChargedCandEtaAtEcalEntrance = -99;
626  const std::vector<reco::CandidatePtr>& signalCands = pfTauRef->signalCands();
627  for (const auto& it : signalCands) {
628  const reco::PFCandidate* ipfcand = dynamic_cast<const reco::PFCandidate*>(it.get());
629  if (ipfcand != nullptr) {
630  ecalEnergy += ipfcand->ecalEnergy();
631  hcalEnergy += ipfcand->hcalEnergy();
632  sumPhiTimesEnergy += ipfcand->positionAtECALEntrance().phi() * ipfcand->energy();
633  sumEtaTimesEnergy += ipfcand->positionAtECALEntrance().eta() * ipfcand->energy();
634  sumEnergy += ipfcand->energy();
635  const reco::Track* track = nullptr;
636  if (ipfcand->trackRef().isNonnull())
637  track = ipfcand->trackRef().get();
638  else if (ipfcand->muonRef().isNonnull() && ipfcand->muonRef()->innerTrack().isNonnull())
639  track = ipfcand->muonRef()->innerTrack().get();
640  else if (ipfcand->muonRef().isNonnull() && ipfcand->muonRef()->globalTrack().isNonnull())
641  track = ipfcand->muonRef()->globalTrack().get();
642  else if (ipfcand->muonRef().isNonnull() && ipfcand->muonRef()->outerTrack().isNonnull())
643  track = ipfcand->muonRef()->outerTrack().get();
644  else if (ipfcand->gsfTrackRef().isNonnull())
645  track = ipfcand->gsfTrackRef().get();
646  if (track) {
647  if (track->pt() > leadChargedCandPt) {
648  leadChargedCandEtaAtEcalEntrance = ipfcand->positionAtECALEntrance().eta();
649  leadChargedCandPt = track->pt();
650  }
651  }
652  } else {
653  // TauReco@MiniAOD: individual ECAL and HCAL energies recovered from fractions,
654  // and position at ECAL entrance computed on-the-fly
655  const pat::PackedCandidate* ipatcand = dynamic_cast<const pat::PackedCandidate*>(it.get());
656  if (ipatcand != nullptr) {
657  ecalEnergy += ipatcand->caloFraction() * ipatcand->energy() * (1. - ipatcand->hcalFraction());
658  hcalEnergy += ipatcand->caloFraction() * ipatcand->energy() * ipatcand->hcalFraction();
659  double posAtECal_phi = ipatcand->phi();
660  double posAtECal_eta = ipatcand->eta();
661  bool success = false;
662  reco::Candidate::Point posAtECalEntrance = posAtECalEntranceComputer_(ipatcand, success);
663  if (success) {
664  posAtECal_phi = posAtECalEntrance.phi();
665  posAtECal_eta = posAtECalEntrance.eta();
666  }
667  sumPhiTimesEnergy += posAtECal_phi * ipatcand->energy();
668  sumEtaTimesEnergy += posAtECal_eta * ipatcand->energy();
669  sumEnergy += ipatcand->energy();
670  const reco::Track* track = ipatcand->bestTrack();
671  if (track != nullptr) {
672  if (track->pt() > leadChargedCandPt) {
673  leadChargedCandEtaAtEcalEntrance = posAtECal_eta;
674  leadChargedCandPt = track->pt();
675  }
676  }
677  }
678  }
679  }
680  aTauPFEssential.ecalEnergy_ = ecalEnergy;
681  aTauPFEssential.hcalEnergy_ = hcalEnergy;
682  aTauPFEssential.ptLeadChargedCand_ = leadChargedCandPt;
683  aTauPFEssential.etaAtEcalEntranceLeadChargedCand_ = leadChargedCandEtaAtEcalEntrance;
684  if (sumEnergy != 0.) {
685  aTauPFEssential.phiAtEcalEntrance_ = sumPhiTimesEnergy / sumEnergy;
686  aTauPFEssential.etaAtEcalEntrance_ = sumEtaTimesEnergy / sumEnergy;
687  } else {
688  aTauPFEssential.phiAtEcalEntrance_ = -99.;
689  aTauPFEssential.etaAtEcalEntrance_ = -99.;
690  }
691  float leadingTrackNormChi2 = 0;
692  float ecalEnergyLeadChargedHadrCand = -99.;
693  float hcalEnergyLeadChargedHadrCand = -99.;
694  float emFraction = -1.;
695  float myHCALenergy = 0.;
696  float myECALenergy = 0.;
697  const reco::CandidatePtr& leadingPFCharged = pfTauRef->leadChargedHadrCand();
698  if (leadingPFCharged.isNonnull()) {
699  const reco::PFCandidate* pfCandPtr = dynamic_cast<const reco::PFCandidate*>(leadingPFCharged.get());
700  if (pfCandPtr != nullptr) { // PFTau made from PFCandidates
701  ecalEnergyLeadChargedHadrCand = pfCandPtr->ecalEnergy();
702  hcalEnergyLeadChargedHadrCand = pfCandPtr->hcalEnergy();
703  reco::TrackRef trackRef = pfCandPtr->trackRef();
704  if (trackRef.isNonnull()) {
705  leadingTrackNormChi2 = trackRef->normalizedChi2();
706  for (const auto& isoPFCand : pfTauRef->isolationPFCands()) {
707  myHCALenergy += isoPFCand->hcalEnergy();
708  myECALenergy += isoPFCand->ecalEnergy();
709  }
710  for (const auto& signalPFCand : pfTauRef->signalPFCands()) {
711  myHCALenergy += signalPFCand->hcalEnergy();
712  myECALenergy += signalPFCand->ecalEnergy();
713  }
714  if (myHCALenergy + myECALenergy != 0.) {
715  emFraction = myECALenergy / (myHCALenergy + myECALenergy);
716  }
717  }
718  } else {
719  const pat::PackedCandidate* packedCandPtr = dynamic_cast<const pat::PackedCandidate*>(leadingPFCharged.get());
720  if (packedCandPtr != nullptr) {
721  // TauReco@MiniAOD: individual ECAL and HCAL energies recovered from fractions,
722  // and position at ECAL entrance computed on-the-fly
723  ecalEnergyLeadChargedHadrCand =
724  packedCandPtr->caloFraction() * packedCandPtr->energy() * (1. - packedCandPtr->hcalFraction());
725  hcalEnergyLeadChargedHadrCand =
726  packedCandPtr->caloFraction() * packedCandPtr->energy() * packedCandPtr->hcalFraction();
727  const reco::Track* track = packedCandPtr->bestTrack();
728  if (track != nullptr) {
729  leadingTrackNormChi2 = track->normalizedChi2();
730  for (const auto& isoCand : pfTauRef->isolationCands()) {
731  //can safely use static_cast as it is ensured that this PFTau is
732  //built with packedCands as its leadingCanidate
733  const pat::PackedCandidate* isoPackedCand = static_cast<const pat::PackedCandidate*>(isoCand.get());
734  myHCALenergy += isoPackedCand->caloFraction() * isoPackedCand->energy() * isoPackedCand->hcalFraction();
735  myECALenergy +=
736  isoPackedCand->caloFraction() * isoPackedCand->energy() * (1. - isoPackedCand->hcalFraction());
737  }
738  for (const auto& signalCand : pfTauRef->signalCands()) {
739  //can safely use static_cast as it is ensured that this PFTau is
740  //built with packedCands as its leadingCanidate
741  const pat::PackedCandidate* sigPackedCand = static_cast<const pat::PackedCandidate*>(signalCand.get());
742  myHCALenergy += sigPackedCand->caloFraction() * sigPackedCand->energy() * sigPackedCand->hcalFraction();
743  myECALenergy +=
744  sigPackedCand->caloFraction() * sigPackedCand->energy() * (1. - sigPackedCand->hcalFraction());
745  }
746  if (myHCALenergy + myECALenergy != 0.) {
747  emFraction = myECALenergy / (myHCALenergy + myECALenergy);
748  }
749  }
750  }
751  }
752  }
753 
754  aTauPFEssential.emFraction_ = emFraction;
755  aTauPFEssential.leadingTrackNormChi2_ = leadingTrackNormChi2;
756  aTauPFEssential.ecalEnergyLeadChargedHadrCand_ = ecalEnergyLeadChargedHadrCand;
757  aTauPFEssential.hcalEnergyLeadChargedHadrCand_ = hcalEnergyLeadChargedHadrCand;
758  // extraction of tau lifetime information
759  if (!tauTransverseImpactParameterSrc_.label().empty()) {
760  edm::Handle<PFTauTIPAssociationByRef> tauLifetimeInfos;
761  iEvent.getByToken(tauTransverseImpactParameterToken_, tauLifetimeInfos);
762  const reco::PFTauTransverseImpactParameter& tauLifetimeInfo = *(*tauLifetimeInfos)[pfTauRef];
763  pat::tau::TauPFEssential& aTauPFEssential = aTau.pfEssential_[0];
764  aTauPFEssential.dxy_PCA_ = tauLifetimeInfo.dxy_PCA();
765  aTauPFEssential.dxy_ = tauLifetimeInfo.dxy();
766  aTauPFEssential.dxy_error_ = tauLifetimeInfo.dxy_error();
767  aTauPFEssential.hasSV_ = tauLifetimeInfo.hasSecondaryVertex();
768  aTauPFEssential.flightLength_ = tauLifetimeInfo.flightLength();
769  aTauPFEssential.flightLengthSig_ = tauLifetimeInfo.flightLengthSig();
770  aTauPFEssential.ip3d_ = tauLifetimeInfo.ip3d();
771  aTauPFEssential.ip3d_error_ = tauLifetimeInfo.ip3d_error();
772  }
773  }
774 
775  // Isolation
776  if (isolator_.enabled()) {
777  isolator_.fill(*anyTaus, idx, isolatorTmpStorage_);
778  typedef pat::helper::MultiIsolator::IsolationValuePairs IsolationValuePairs;
779  // better to loop backwards, so the vector is resized less times
780  for (IsolationValuePairs::const_reverse_iterator it = isolatorTmpStorage_.rbegin(),
781  ed = isolatorTmpStorage_.rend();
782  it != ed;
783  ++it) {
784  aTau.setIsolation(it->first, it->second);
785  }
786  }
787 
788  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
789  aTau.setIsoDeposit(isoDepositLabels_[j].first, (*deposits[j])[tausRef]);
790  }
791 
792  if (efficiencyLoader_.enabled()) {
793  efficiencyLoader_.setEfficiencies(aTau, tausRef);
794  }
795 
796  if (resolutionLoader_.enabled()) {
798  }
799 
800  if (useUserData_) {
801  userDataHelper_.add(aTau, iEvent, iSetup);
802  }
803 
804  patTaus->push_back(aTau);
805  }
806 
807  // sort taus in pT
808  std::sort(patTaus->begin(), patTaus->end(), pTTauComparator_);
809 
810  // put genEvt object in Event
811  iEvent.put(std::move(patTaus));
812 
813  // clean up
814  if (isolator_.enabled())
816 }
817 
818 template <typename TauCollectionType, typename TauDiscrType>
820  size_t tauIdx,
821  const edm::Handle<TauDiscrType>& tauIdDiscr) {
822  edm::Ref<TauCollectionType> tauRef(tauCollection, tauIdx);
823  return (*tauIdDiscr)[tauRef];
824 }
826  size_t tauIdx,
828  int wpIdx) {
829  edm::Ref<reco::PFTauCollection> tauRef(tauCollection, tauIdx);
830  if (wpIdx < 0) {
831  //Only 0th component filled with default value if prediscriminor in RecoTauDiscriminator failed.
832  if ((*tauIdDiscr)[tauRef].rawValues.size() == 1)
833  return (*tauIdDiscr)[tauRef].rawValues.at(0);
834  //uses negative indices to access rawValues. In most cases only one rawValue at wpIdx=-1 exists.
835  return (*tauIdDiscr)[tauRef].rawValues.at(-1 - wpIdx);
836  } else {
837  //WP vector not filled if prediscriminor in RecoTauDiscriminator failed. Set PAT output to false in this case
838  if ((*tauIdDiscr)[tauRef].workingPoints.empty())
839  return 0.0;
840  return (*tauIdDiscr)[tauRef].workingPoints.at(wpIdx);
841  }
842 }
843 
844 // ParameterSet description for module
847  iDesc.setComment("PAT tau producer module");
848 
849  // input source
850  iDesc.add<edm::InputTag>("tauSource", edm::InputTag())->setComment("input collection");
851 
852  // embedding
853  iDesc.add<bool>("embedIsolationTracks", false)->setComment("embed external isolation tracks");
854  iDesc.add<bool>("embedLeadTrack", false)->setComment("embed external leading track");
855  iDesc.add<bool>("embedLeadTracks", false)->setComment("embed external signal tracks");
856 
857  // MC matching configurables
858  iDesc.add<bool>("addGenMatch", true)->setComment("add MC matching");
859  iDesc.add<bool>("embedGenMatch", false)->setComment("embed MC matched MC information");
860  std::vector<edm::InputTag> emptySourceVector;
861  iDesc
862  .addNode(edm::ParameterDescription<edm::InputTag>("genParticleMatch", edm::InputTag(), true) xor
863  edm::ParameterDescription<std::vector<edm::InputTag>>("genParticleMatch", emptySourceVector, true))
864  ->setComment("input with MC match information");
865 
866  // MC jet matching variables
867  iDesc.add<bool>("addGenJetMatch", true)->setComment("add MC jet matching");
868  iDesc.add<bool>("embedGenJetMatch", false)->setComment("embed MC jet matched jet information");
869  iDesc.add<edm::InputTag>("genJetMatch", edm::InputTag("tauGenJetMatch"));
870 
872 
873  // tau ID configurables
874  iDesc.add<bool>("addTauID", true)->setComment("add tau ID variables");
875  edm::ParameterSetDescription tauIDSourcesPSet;
876  tauIDSourcesPSet.setAllowAnything();
877  iDesc
879  edm::ParameterDescription<edm::ParameterSetDescription>("tauIDSources", tauIDSourcesPSet, true))
880  ->setComment("input with tau ID variables");
881  // (Dis)allow to skip missing tauId sources
882  iDesc.add<bool>("skipMissingTauID", false)
883  ->setComment("allow to skip a tau ID variable when not present in the event");
884 
885  // IsoDeposit configurables
886  edm::ParameterSetDescription isoDepositsPSet;
887  isoDepositsPSet.addOptional<edm::InputTag>("tracker");
888  isoDepositsPSet.addOptional<edm::InputTag>("ecal");
889  isoDepositsPSet.addOptional<edm::InputTag>("hcal");
890  isoDepositsPSet.addOptional<edm::InputTag>("pfAllParticles");
891  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedHadron");
892  isoDepositsPSet.addOptional<edm::InputTag>("pfNeutralHadron");
893  isoDepositsPSet.addOptional<edm::InputTag>("pfGamma");
894  isoDepositsPSet.addOptional<std::vector<edm::InputTag>>("user");
895  iDesc.addOptional("isoDeposits", isoDepositsPSet);
896 
897  // Efficiency configurables
898  edm::ParameterSetDescription efficienciesPSet;
899  efficienciesPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
900  iDesc.add("efficiencies", efficienciesPSet);
901  iDesc.add<bool>("addEfficiencies", false);
902 
903  // Check to see if the user wants to add user data
904  edm::ParameterSetDescription userDataPSet;
906  iDesc.addOptional("userData", userDataPSet);
907 
908  edm::ParameterSetDescription isolationPSet;
909  isolationPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
910  iDesc.add("userIsolation", isolationPSet);
911 }
912 
914 
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
~PATTauProducer() override
bool isAvailable() const
Definition: Ref.h:537
double ecalEnergy() const
return corrected Ecal energy
Definition: PFCandidate.h:221
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.
std::pair< std::string, edm::InputTag > NameTag
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
void setIsolation(IsolationKeys key, float value)
Definition: Lepton.h:115
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
tuple pfTaus
Definition: pfTaus_cff.py:135
std::vector< edm::EDGetTokenT< edm::ValueMap< IsoDeposit > > > isoDepositTokens_
std::pair< edm::InputTag, std::vector< NameWPIdx > > IDContainerData
void embedIsolationPFCands()
method to store the isolation candidates internally
void beginEvent(const edm::EventSetup &)
pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
Definition: TrackBase.h:593
void embedIsolationPFGammaCands()
method to store the isolation gamma candidates internally
float hcalFraction() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
void setAllowAnything()
allow any parameter label/value pairs
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:139
StableProvenance const & stable() const
Definition: Provenance.h:42
pat::helper::EfficiencyLoader efficiencyLoader_
void embedLeadTrack()
method to store the leading track internally
bool exists(std::string const &parameterName) const
checks if a parameter exists
void embedSignalPFChargedHadrCands()
method to store the signal charged hadrons candidates internally
pat::helper::KinResolutionsLoader resolutionLoader_
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
float getTauIdDiscriminator(const edm::Handle< TauCollectionType > &, size_t, const edm::Handle< TauDiscrType > &)
void setDecayMode(int)
set decay mode
void setTauIDs(const std::vector< IdPair > &ids)
Definition: Tau.h:347
IsolationKeys
Enum defining isolation keys.
Definition: Isolation.h:9
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 find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
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
const std::string names[nVars_]
const math::XYZPointF & positionAtECALEntrance() const
Definition: PFCandidate.h:388
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
std::vector< edm::EDGetTokenT< reco::TauDiscriminatorContainer > > pfTauIDContainerTokens_
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
bool embedIsolationPFChargedHadrCands_
static void fillDescription(edm::ParameterSetDescription &iDesc)
reco::TrackRef trackRef() const
Definition: PFCandidate.cc:430
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:179
U second(std::pair< T, U > const &p)
bool enabled() const
True if it has a non null configuration.
Definition: MultiIsolator.h:55
char const * label
void setComment(std::string const &value)
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:563
void embedSignalPFCands()
method to store the signal candidates internally
int iEvent
Definition: GenABIO.cc:224
void beginEvent(const edm::Event &event, const edm::EventSetup &eventSetup)
edm::EDGetTokenT< PFTauTIPAssociationByRef > tauTransverseImpactParameterToken_
double eta() const override
momentum pseudorapidity
pat::helper::MultiIsolator isolator_
edm::AssociationVector< reco::PFTauRefProd, std::vector< reco::PFTauTransverseImpactParameterRef > > PFTauTIPAssociationByRef
void embedGenParticle()
Definition: PATObject.h:768
edm::EDGetTokenT< edm::View< reco::BaseTau > > baseTauToken_
void newEvent(const edm::Event &event, const edm::EventSetup &setup)
To be called for each new event, reads in the EventSetup object.
bool embedIsolationPFNeutralHadrCands_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
double pt() const
track transverse momentum
Definition: TrackBase.h:637
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
def move
Definition: eostools.py:511
float getTauIdDiscriminatorFromContainer(const edm::Handle< reco::PFTauCollection > &, size_t, const edm::Handle< reco::TauDiscriminatorContainer > &, int)
tuple key
prepare the HTCondor submission files and eventually submit them
pat::PATUserDataHelper< pat::Tau > userDataHelper_
tuple workingPoints
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
std::vector< pat::tau::TauPFEssential > pfEssential_
Definition: Tau.h:493
void embedIsolationPFNeutralHadrCands()
method to store the isolation neutral hadrons candidates internally
float caloFraction() const
Set the fraction of ECAL+HCAL energy over candidate energy.
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void embedLeadPFChargedHadrCand()
method to store the leading charged hadron candidate internally
Analysis-level tau class.
Definition: Tau.h:53
void embedIsolationPFChargedHadrCands()
method to store the isolation charged hadrons candidates internally
reco::MuonRef muonRef() const
Definition: PFCandidate.cc:443
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:146
void setGenJet(const reco::GenJetRef &ref)
set the matched GenJet
const reco::Track * bestTrack() const override
return a pointer to the track if present. otherwise, return a null pointer
void embedLeadPFNeutralCand()
method to store the leading neutral candidate internally
std::vector< std::pair< pat::IsolationKeys, float > > IsolationValuePairs
Definition: MultiIsolator.h:17
ProcessHistory const & processHistory() const override
Definition: Event.cc:250
void addGenParticleRef(const reco::GenParticleRef &ref)
Definition: PATObject.h:751
std::vector< edm::EDGetTokenT< edm::ValueMap< TauJetCorrFactors > > > tauJetCorrFactorsTokens_
static void fillDescription(edm::ParameterSetDescription &iDesc)
Method for documentation and validation of PSet.
edm::InputTag tauTransverseImpactParameterSrc_
std::vector< edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > > genMatchTokens_
std::pair< std::string, WPIdx > NameWPIdx
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void setEfficiencies(pat::PATObject< T > &obj, const R &originalRef) const
Sets the efficiencies for this object, using the reference to the original objects.
std::pair< std::string, std::string > WPCfg
ProcessHistoryID const & processHistoryID() const
Definition: Event.cc:116
std::vector< std::vector< NameWPIdx > > tauIDSrcContainers_
edm::EDGetTokenT< edm::Association< reco::GenJetCollection > > genJetMatchToken_
std::string const & label() const
Definition: InputTag.h:36
std::pair< WPCfg, int > WPIdx
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
void initializeJEC(unsigned int level, const unsigned int set=0)
initialize the jet to a given JEC level during creation starting from Uncorrected ...
void embedSignalPFNeutralHadrCands()
method to store the signal neutral hadrons candidates internally
std::vector< std::pair< pat::IsolationKeys, edm::InputTag > > isoDepositLabels_
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
void addJECFactors(const TauJetCorrFactors &jec)
add more sets of energy correction factors
Definition: Tau.h:412
PATTauProducer(const edm::ParameterSet &iConfig)
double energy() const override
energy
reco::GsfTrackRef gsfTrackRef() const
Definition: PFCandidate.cc:462
double hcalEnergy() const
return corrected Hcal energy
Definition: PFCandidate.h:233
void embedSignalTracks()
method to store the signal tracks internally
bool isPFTau() const
Returns true if this pat::Tau was made from a reco::PFTau.
Definition: Tau.h:121
math::XYZPoint Point
point in the space
Definition: Candidate.h:40
void embedSignalPFGammaCands()
method to store the signal gamma candidates internally
Log< level::Warning, false > LogWarning
edm::ProcessHistoryID phID_
std::vector< edm::EDGetTokenT< reco::PFTauDiscriminator > > pfTauIDTokens_
void embedIsolationTracks()
method to store the isolation tracks internally
std::vector< NameTag > tauIDSrcs_
edm::EDGetTokenT< reco::PFTauCollection > pfTauToken_
double phi() const override
momentum azimuthal angle
GreaterByPt< Tau > pTTauComparator_
Produces pat::Tau&#39;s.
void fill(const edm::View< T > &coll, int idx, IsolationValuePairs &isolations) const
Definition: MultiIsolator.h:84
PositionAtECalEntranceComputer posAtECalEntranceComputer_
void embedLeadPFCand()
double energy() const final
energy