CMS 3D CMS Logo

PATTauProducer.cc
Go to the documentation of this file.
2 
8 
15 
21 
24 
25 #include <vector>
26 #include <memory>
27 
28 using namespace pat;
29 
31  : isolator_(iConfig.exists("userIsolation") ? iConfig.getParameter<edm::ParameterSet>("userIsolation")
32  : edm::ParameterSet(),
33  consumesCollector(),
34  false),
35  useUserData_(iConfig.exists("userData")) {
36  firstOccurence_ = true;
37  // initialize the configurables
38  baseTauToken_ = consumes<edm::View<reco::BaseTau>>(iConfig.getParameter<edm::InputTag>("tauSource"));
39  tauTransverseImpactParameterSrc_ = iConfig.getParameter<edm::InputTag>("tauTransverseImpactParameterSource");
40  tauTransverseImpactParameterToken_ = consumes<PFTauTIPAssociationByRef>(tauTransverseImpactParameterSrc_);
41  pfTauToken_ = consumes<reco::PFTauCollection>(iConfig.getParameter<edm::InputTag>("tauSource"));
42  embedIsolationTracks_ = iConfig.getParameter<bool>("embedIsolationTracks");
43  embedLeadTrack_ = iConfig.getParameter<bool>("embedLeadTrack");
44  embedSignalTracks_ = iConfig.getParameter<bool>("embedSignalTracks");
45  embedLeadPFCand_ = iConfig.getParameter<bool>("embedLeadPFCand");
46  embedLeadPFChargedHadrCand_ = iConfig.getParameter<bool>("embedLeadPFChargedHadrCand");
47  embedLeadPFNeutralCand_ = iConfig.getParameter<bool>("embedLeadPFNeutralCand");
48  embedSignalPFCands_ = iConfig.getParameter<bool>("embedSignalPFCands");
49  embedSignalPFChargedHadrCands_ = iConfig.getParameter<bool>("embedSignalPFChargedHadrCands");
50  embedSignalPFNeutralHadrCands_ = iConfig.getParameter<bool>("embedSignalPFNeutralHadrCands");
51  embedSignalPFGammaCands_ = iConfig.getParameter<bool>("embedSignalPFGammaCands");
52  embedIsolationPFCands_ = iConfig.getParameter<bool>("embedIsolationPFCands");
53  embedIsolationPFChargedHadrCands_ = iConfig.getParameter<bool>("embedIsolationPFChargedHadrCands");
54  embedIsolationPFNeutralHadrCands_ = iConfig.getParameter<bool>("embedIsolationPFNeutralHadrCands");
55  embedIsolationPFGammaCands_ = iConfig.getParameter<bool>("embedIsolationPFGammaCands");
56  addGenMatch_ = iConfig.getParameter<bool>("addGenMatch");
57  if (addGenMatch_) {
58  embedGenMatch_ = iConfig.getParameter<bool>("embedGenMatch");
59  if (iConfig.existsAs<edm::InputTag>("genParticleMatch")) {
61  iConfig.getParameter<edm::InputTag>("genParticleMatch")));
62  } else {
64  iConfig.getParameter<std::vector<edm::InputTag>>("genParticleMatch"),
65  [this](edm::InputTag const& tag) { return consumes<edm::Association<reco::GenParticleCollection>>(tag); });
66  }
67  }
68  addGenJetMatch_ = iConfig.getParameter<bool>("addGenJetMatch");
69  if (addGenJetMatch_) {
70  embedGenJetMatch_ = iConfig.getParameter<bool>("embedGenJetMatch");
72  consumes<edm::Association<reco::GenJetCollection>>(iConfig.getParameter<edm::InputTag>("genJetMatch"));
73  }
74  addTauJetCorrFactors_ = iConfig.getParameter<bool>("addTauJetCorrFactors");
76  iConfig.getParameter<std::vector<edm::InputTag>>("tauJetCorrFactorsSource"),
77  [this](edm::InputTag const& tag) { return mayConsume<edm::ValueMap<TauJetCorrFactors>>(tag); });
78  // tau ID configurables
79  addTauID_ = iConfig.getParameter<bool>("addTauID");
80  if (addTauID_) {
81  // read the different tau ID names
82  edm::ParameterSet idps = iConfig.getParameter<edm::ParameterSet>("tauIDSources");
83  std::vector<std::string> names = idps.getParameterNamesForType<edm::ParameterSet>();
84  std::map<std::string, IDContainerData> idContainerMap;
85  for (auto const& name : names) {
86  auto const& idp = idps.getParameter<edm::ParameterSet>(name);
87  std::string prov_cfg_label = idp.getParameter<std::string>("provenanceConfigLabel");
88  std::string prov_ID_label = idp.getParameter<std::string>("idLabel");
89  edm::InputTag tag = idp.getParameter<edm::InputTag>("inputTag");
90  if (prov_cfg_label.empty()) {
91  tauIDSrcs_.push_back(NameTag(name, tag));
92  } else {
93  if (prov_cfg_label != "rawValues" && prov_cfg_label != "workingPoints" && prov_cfg_label != "IDdefinitions" &&
94  prov_cfg_label != "IDWPdefinitions" && prov_cfg_label != "direct_rawValues" &&
95  prov_cfg_label != "direct_workingPoints")
96  throw cms::Exception("Configuration")
97  << "PATTauProducer: Parameter 'provenanceConfigLabel' does only accept 'rawValues', 'workingPoints', "
98  "'IDdefinitions', 'IDWPdefinitions', 'direct_rawValues', 'direct_workingPoints'\n";
99  std::map<std::string, IDContainerData>::iterator it;
100  it = idContainerMap.insert({tag.label() + tag.instance(), {tag, std::vector<NameWPIdx>()}}).first;
101  it->second.second.push_back(NameWPIdx(name, WPIdx(WPCfg(prov_cfg_label, prov_ID_label), -99)));
102  }
103  }
104  // but in any case at least once
105  if (tauIDSrcs_.empty() && idContainerMap.empty())
106  throw cms::Exception("Configuration") << "PATTauProducer: id addTauID is true, you must specify either:\n"
107  << "\tPSet tauIDSources = { \n"
108  << "\t\tInputTag <someName> = <someTag> // as many as you want \n "
109  << "\t}\n";
110 
111  for (auto const& mapEntry : idContainerMap) {
112  tauIDSrcContainers_.push_back(mapEntry.second.second);
113  pfTauIDContainerTokens_.push_back(mayConsume<reco::TauDiscriminatorContainer>(mapEntry.second.first));
114  }
115  }
117  tauIDSrcs_, [this](NameTag const& tag) { return mayConsume<reco::PFTauDiscriminator>(tag.second); });
118  skipMissingTauID_ = iConfig.getParameter<bool>("skipMissingTauID");
119  // IsoDeposit configurables
120  if (iConfig.exists("isoDeposits")) {
121  edm::ParameterSet depconf = iConfig.getParameter<edm::ParameterSet>("isoDeposits");
122  if (depconf.exists("tracker"))
123  isoDepositLabels_.push_back(std::make_pair(pat::TrackIso, depconf.getParameter<edm::InputTag>("tracker")));
124  if (depconf.exists("ecal"))
125  isoDepositLabels_.push_back(std::make_pair(pat::EcalIso, depconf.getParameter<edm::InputTag>("ecal")));
126  if (depconf.exists("hcal"))
127  isoDepositLabels_.push_back(std::make_pair(pat::HcalIso, depconf.getParameter<edm::InputTag>("hcal")));
128  if (depconf.exists("pfAllParticles"))
129  isoDepositLabels_.push_back(
130  std::make_pair(pat::PfAllParticleIso, depconf.getParameter<edm::InputTag>("pfAllParticles")));
131  if (depconf.exists("pfChargedHadron"))
132  isoDepositLabels_.push_back(
133  std::make_pair(pat::PfChargedHadronIso, depconf.getParameter<edm::InputTag>("pfChargedHadron")));
134  if (depconf.exists("pfNeutralHadron"))
135  isoDepositLabels_.push_back(
136  std::make_pair(pat::PfNeutralHadronIso, depconf.getParameter<edm::InputTag>("pfNeutralHadron")));
137  if (depconf.exists("pfGamma"))
138  isoDepositLabels_.push_back(std::make_pair(pat::PfGammaIso, depconf.getParameter<edm::InputTag>("pfGamma")));
139 
140  if (depconf.exists("user")) {
141  std::vector<edm::InputTag> userdeps = depconf.getParameter<std::vector<edm::InputTag>>("user");
142  std::vector<edm::InputTag>::const_iterator it = userdeps.begin(), ed = userdeps.end();
143  int key = UserBaseIso;
144  for (; it != ed; ++it, ++key) {
145  isoDepositLabels_.push_back(std::make_pair(IsolationKeys(key), *it));
146  }
147  }
148  }
150  edm::vector_transform(isoDepositLabels_, [this](std::pair<IsolationKeys, edm::InputTag> const& label) {
151  return consumes<edm::ValueMap<IsoDeposit>>(label.second);
152  });
153  // Efficiency configurables
154  addEfficiencies_ = iConfig.getParameter<bool>("addEfficiencies");
155  if (addEfficiencies_) {
157  pat::helper::EfficiencyLoader(iConfig.getParameter<edm::ParameterSet>("efficiencies"), consumesCollector());
158  }
159  // Resolution configurables
160  addResolutions_ = iConfig.getParameter<bool>("addResolutions");
161  if (addResolutions_) {
163  }
164  // Check to see if the user wants to add user data
165  if (useUserData_) {
166  userDataHelper_ = PATUserDataHelper<Tau>(iConfig.getParameter<edm::ParameterSet>("userData"), consumesCollector());
167  }
168  // produces vector of taus
169  produces<std::vector<Tau>>();
170 }
171 
173 
175  // switch off embedding (in unschedules mode)
176  if (iEvent.isRealData()) {
177  addGenMatch_ = false;
178  embedGenMatch_ = false;
179  addGenJetMatch_ = false;
180  }
181 
182  // Get the collection of taus from the event
184  try {
185  iEvent.getByToken(baseTauToken_, anyTaus);
186  } catch (const edm::Exception& e) {
187  edm::LogWarning("DataSource") << "WARNING! No Tau collection found. This missing input will not block the job. "
188  "Instead, an empty tau collection is being be produced.";
189  auto patTaus = std::make_unique<std::vector<Tau>>();
190  iEvent.put(std::move(patTaus));
191  return;
192  }
193 
194  if (isolator_.enabled())
195  isolator_.beginEvent(iEvent, iSetup);
196 
201 
202  std::vector<edm::Handle<edm::ValueMap<IsoDeposit>>> deposits(isoDepositTokens_.size());
203  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
204  iEvent.getByToken(isoDepositTokens_[j], deposits[j]);
205  }
206 
207  // prepare the MC matching
208  std::vector<edm::Handle<edm::Association<reco::GenParticleCollection>>> genMatches(genMatchTokens_.size());
209  if (addGenMatch_) {
210  for (size_t j = 0, nd = genMatchTokens_.size(); j < nd; ++j) {
211  iEvent.getByToken(genMatchTokens_[j], genMatches[j]);
212  }
213  }
214 
216  if (addGenJetMatch_)
217  iEvent.getByToken(genJetMatchToken_, genJetMatch);
218 
219  // read in the jet correction factors ValueMap
220  std::vector<edm::ValueMap<TauJetCorrFactors>> tauJetCorrs;
221  if (addTauJetCorrFactors_) {
222  for (size_t i = 0; i < tauJetCorrFactorsTokens_.size(); ++i) {
224  iEvent.getByToken(tauJetCorrFactorsTokens_[i], tauJetCorr);
225  tauJetCorrs.push_back(*tauJetCorr);
226  }
227  }
228 
229  auto patTaus = std::make_unique<std::vector<Tau>>();
230 
231  bool first = true; // this is introduced to issue warnings only for the first tau-jet
232  for (size_t idx = 0, ntaus = anyTaus->size(); idx < ntaus; ++idx) {
233  edm::RefToBase<reco::BaseTau> tausRef = anyTaus->refAt(idx);
234  edm::Ptr<reco::BaseTau> tausPtr = anyTaus->ptrAt(idx);
235 
236  Tau aTau(tausRef);
237  if (embedLeadTrack_)
238  aTau.embedLeadTrack();
239  if (embedSignalTracks_)
240  aTau.embedSignalTracks();
242  aTau.embedIsolationTracks();
243  if (embedLeadPFCand_) {
244  if (aTau.isPFTau())
245  aTau.embedLeadPFCand();
246  else
247  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
248  "from a reco::PFTau is impossible.\n";
249  }
251  if (aTau.isPFTau())
253  else
254  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
255  "from a reco::PFTau is impossible.\n";
256  }
258  if (aTau.isPFTau())
259  aTau.embedLeadPFNeutralCand();
260  else
261  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
262  "from a reco::PFTau is impossible.\n";
263  }
264  if (embedSignalPFCands_) {
265  if (aTau.isPFTau())
266  aTau.embedSignalPFCands();
267  else
268  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
269  "from a reco::PFTau is impossible.\n";
270  }
272  if (aTau.isPFTau())
274  else
275  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
276  "from a reco::PFTau is impossible.\n";
277  }
279  if (aTau.isPFTau())
281  else
282  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
283  "from a reco::PFTau is impossible.\n";
284  }
286  if (aTau.isPFTau())
288  else
289  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
290  "from a reco::PFTau is impossible.\n";
291  }
293  if (aTau.isPFTau())
294  aTau.embedIsolationPFCands();
295  else
296  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
297  "from a reco::PFTau is impossible.\n";
298  }
300  if (aTau.isPFTau())
302  else
303  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
304  "from a reco::PFTau is impossible.\n";
305  }
307  if (aTau.isPFTau())
309  else
310  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
311  "from a reco::PFTau is impossible.\n";
312  }
314  if (aTau.isPFTau())
316  else
317  edm::LogWarning("Type Error") << "Embedding a PFTau-specific information into a pat::Tau which wasn't made "
318  "from a reco::PFTau is impossible.\n";
319  }
320 
321  if (addTauJetCorrFactors_) {
322  // add additional JetCorrs to the jet
323  for (unsigned int i = 0; i < tauJetCorrs.size(); ++i) {
324  const TauJetCorrFactors& tauJetCorr = tauJetCorrs[i][tausRef];
325  // uncomment for debugging
326  // tauJetCorr.print();
327  aTau.addJECFactors(tauJetCorr);
328  }
329  std::vector<std::string> levels = tauJetCorrs[0][tausRef].correctionLabels();
330  if (std::find(levels.begin(), levels.end(), "L2L3Residual") != levels.end()) {
331  aTau.initializeJEC(tauJetCorrs[0][tausRef].jecLevel("L2L3Residual"));
332  } else if (std::find(levels.begin(), levels.end(), "L3Absolute") != levels.end()) {
333  aTau.initializeJEC(tauJetCorrs[0][tausRef].jecLevel("L3Absolute"));
334  } else {
335  aTau.initializeJEC(tauJetCorrs[0][tausRef].jecLevel("Uncorrected"));
336  if (first) {
337  edm::LogWarning("L3Absolute not found")
338  << "L2L3Residual and L3Absolute are not part of the correction applied jetCorrFactors \n"
339  << "of module " << tauJetCorrs[0][tausRef].jecSet() << " jets will remain"
340  << " uncorrected.";
341  first = false;
342  }
343  }
344  }
345 
346  // store the match to the generated final state muons
347  if (addGenMatch_) {
348  for (size_t i = 0, n = genMatches.size(); i < n; ++i) {
349  reco::GenParticleRef genTau = (*genMatches[i])[tausRef];
350  aTau.addGenParticleRef(genTau);
351  }
352  if (embedGenMatch_)
353  aTau.embedGenParticle();
354  }
355 
356  // store the match to the visible part of the generated tau
357  if (addGenJetMatch_) {
358  reco::GenJetRef genJetTau = (*genJetMatch)[tausRef];
359  if (genJetTau.isNonnull() && genJetTau.isAvailable()) {
360  aTau.setGenJet(genJetTau);
361  } // leave empty if no match found
362  }
363 
364  // prepare ID extraction
365  if (addTauID_) {
366  size_t numberPlainTauIds = tauIDSrcs_.size();
367  size_t numberTauIds = numberPlainTauIds;
368  for (auto const& it : tauIDSrcContainers_) {
369  numberTauIds += it.size();
370  }
371  // if ID containers exist, product incices need to be retrieved from provenanceConfigLabel.
372  // This is done if config history changes, in particular for the first event.
373  if (numberPlainTauIds != numberTauIds && phID_ != iEvent.processHistoryID()) {
374  phID_ = iEvent.processHistoryID();
375  for (size_t idx = 0; idx < tauIDSrcContainers_.size(); ++idx) {
376  auto pfTauIdDiscr = iEvent.getHandle(pfTauIDContainerTokens_[idx]);
377  if (!pfTauIdDiscr.isValid())
378  continue; // missing IDs will be skipped lateron or crash there depending on skipMissingTauID_
379  const edm::Provenance* prov = pfTauIdDiscr.provenance();
380  for (NameWPIdx& idcfg : tauIDSrcContainers_[idx]) {
381  std::string prov_cfg_label = idcfg.second.first.first;
382  std::string prov_ID_label = idcfg.second.first.second;
383  bool found = false;
384  if (prov_cfg_label == "rawValues" || prov_cfg_label == "workingPoints") {
385  const std::vector<std::string> psetsFromProvenance =
386  edm::parameterSet(*prov, iEvent.processHistory())
387  .getParameter<std::vector<std::string>>(prov_cfg_label);
388  for (size_t i = 0; i < psetsFromProvenance.size(); ++i) {
389  if (psetsFromProvenance[i] == prov_ID_label) {
390  // using negative indices for raw values
391  if (prov_cfg_label == "rawValues")
392  idcfg.second.second = -1 - i;
393  else
394  idcfg.second.second = i;
395  found = true;
396  }
397  }
398  } else if (prov_cfg_label == "IDdefinitions" || prov_cfg_label == "IDWPdefinitions") {
399  const std::vector<edm::ParameterSet> psetsFromProvenance =
400  edm::parameterSet(*prov, iEvent.processHistory())
401  .getParameter<std::vector<edm::ParameterSet>>(prov_cfg_label);
402  for (size_t i = 0; i < psetsFromProvenance.size(); ++i) {
403  if (psetsFromProvenance[i].getParameter<std::string>("IDname") == prov_ID_label) {
404  // using negative indices for raw values
405  if (prov_cfg_label == "IDdefinitions")
406  idcfg.second.second = -1 - i;
407  else
408  idcfg.second.second = i;
409  found = true;
410  }
411  }
412  } else {
413  // checked prov_cfg_label before, so it must be a direct access via indices
414  try {
415  int i = std::stoi(prov_ID_label);
416  if (prov_cfg_label == "direct_rawValues")
417  idcfg.second.second = -i;
418  else
419  idcfg.second.second = i;
420  } catch (std::invalid_argument const& e) {
421  throw cms::Exception("Configuration") << "PATTauProducer: Direct access to ID container requested, so "
422  "argument of 'idLabel' must be convertable to int!\n";
423  }
424  }
425  if (!found) {
426  throw cms::Exception("Configuration") << "PATTauProducer: Requested working point '" << prov_ID_label
427  << "' for ID '" << idcfg.first << "' not found!\n";
428  }
429  }
430  }
431  }
432  std::string missingDiscriminators;
433  std::vector<pat::Tau::IdPair> ids(numberTauIds);
434  auto const& tausDeref = *tausRef;
435  if (typeid(tausDeref) == typeid(reco::PFTau)) {
436  edm::Handle<reco::PFTauCollection> pfTauCollection;
437  iEvent.getByToken(pfTauToken_, pfTauCollection);
438  for (size_t i = 0; i < numberPlainTauIds; ++i) {
439  //std::cout << "filling PFTauDiscriminator '" << tauIDSrcs_[i].first << "' into pat::Tau object..." << std::endl;
440 
441  auto pfTauIdDiscr = iEvent.getHandle(pfTauIDTokens_[i]);
442 
443  if (skipMissingTauID_ && !pfTauIdDiscr.isValid()) {
444  if (!missingDiscriminators.empty()) {
445  missingDiscriminators += ", ";
446  }
447  missingDiscriminators += tauIDSrcs_[i].first;
448  continue;
449  }
450  ids[i].first = tauIDSrcs_[i].first;
451  ids[i].second = getTauIdDiscriminator(pfTauCollection, idx, pfTauIdDiscr);
452  }
453  for (size_t i = 0; i < tauIDSrcContainers_.size(); ++i) {
454  auto pfTauIdDiscr = iEvent.getHandle(pfTauIDContainerTokens_[i]);
455  if (skipMissingTauID_ && !pfTauIdDiscr.isValid()) {
456  for (auto const& it : tauIDSrcContainers_[i]) {
457  if (!missingDiscriminators.empty()) {
458  missingDiscriminators += ", ";
459  }
460  missingDiscriminators += it.first;
461  }
462  continue;
463  }
464  for (size_t j = 0; j < tauIDSrcContainers_[i].size(); ++j) {
465  ids[numberPlainTauIds + j].first = tauIDSrcContainers_[i][j].first;
466  ids[numberPlainTauIds + j].second = getTauIdDiscriminatorFromContainer(
467  pfTauCollection, idx, pfTauIdDiscr, tauIDSrcContainers_[i][j].second.second);
468  }
469  numberPlainTauIds += tauIDSrcContainers_[i].size();
470  }
471  } else {
472  throw cms::Exception("Type Mismatch")
473  << "PATTauProducer: unsupported datatype '" << typeid(tausDeref).name() << "' for tauSource\n";
474  }
475  if (!missingDiscriminators.empty() && firstOccurence_) {
476  edm::LogWarning("DataSource") << "The following tau discriminators have not been found in the event:\n"
477  << missingDiscriminators << "\n"
478  << "They will not be embedded into the pat::Tau object.\n"
479  << "Note: this message will be printed only at first occurence.";
480  firstOccurence_ = false;
481  }
482  aTau.setTauIDs(ids);
483  }
484 
485  // extraction of reconstructed tau decay mode
486  // (only available for PFTaus)
487  if (aTau.isPFTau()) {
489  iEvent.getByToken(pfTauToken_, pfTaus);
490  reco::PFTauRef pfTauRef(pfTaus, idx);
491 
492  aTau.setDecayMode(pfTauRef->decayMode());
493  }
494 
495  // extraction of variables needed to rerun MVA isolation and anti-electron discriminator on MiniAOD
496  if (!aTau.pfEssential_.empty()) {
498  iEvent.getByToken(pfTauToken_, pfTaus);
499  reco::PFTauRef pfTauRef(pfTaus, idx);
500  pat::tau::TauPFEssential& aTauPFEssential = aTau.pfEssential_[0];
501  float ecalEnergy = 0;
502  float hcalEnergy = 0;
503  float sumPhiTimesEnergy = 0.;
504  float sumEtaTimesEnergy = 0.;
505  float sumEnergy = 0.;
506  float leadChargedCandPt = -99;
507  float leadChargedCandEtaAtEcalEntrance = -99;
508  const std::vector<reco::CandidatePtr>& signalCands = pfTauRef->signalCands();
509  for (const auto& it : signalCands) {
510  const reco::PFCandidate* icand = dynamic_cast<const reco::PFCandidate*>(it.get());
511  if (icand != nullptr) {
512  ecalEnergy += icand->ecalEnergy();
513  hcalEnergy += icand->hcalEnergy();
514  sumPhiTimesEnergy += icand->positionAtECALEntrance().phi() * icand->energy();
515  sumEtaTimesEnergy += icand->positionAtECALEntrance().eta() * icand->energy();
516  sumEnergy += icand->energy();
517  const reco::Track* track = nullptr;
518  if (icand->trackRef().isNonnull())
519  track = icand->trackRef().get();
520  else if (icand->muonRef().isNonnull() && icand->muonRef()->innerTrack().isNonnull())
521  track = icand->muonRef()->innerTrack().get();
522  else if (icand->muonRef().isNonnull() && icand->muonRef()->globalTrack().isNonnull())
523  track = icand->muonRef()->globalTrack().get();
524  else if (icand->muonRef().isNonnull() && icand->muonRef()->outerTrack().isNonnull())
525  track = icand->muonRef()->outerTrack().get();
526  else if (icand->gsfTrackRef().isNonnull())
527  track = icand->gsfTrackRef().get();
528  if (track) {
529  if (track->pt() > leadChargedCandPt) {
530  leadChargedCandEtaAtEcalEntrance = icand->positionAtECALEntrance().eta();
531  leadChargedCandPt = track->pt();
532  }
533  }
534  } else {
535  // TauReco@MiniAOD: individual ECAL and HCAL energies currently not available for PackedCandidates
536  // (see above implementation for PFCandidates).
537  // Should be added if available, as well as on-the-fly computation of position at ECAL entrance
538  sumEnergy += it->energy();
539  const reco::Track* track = it->bestTrack();
540  if (track != nullptr) {
541  if (track->pt() > leadChargedCandPt) {
542  leadChargedCandPt = track->pt();
543  }
544  }
545  }
546  }
547  aTauPFEssential.ecalEnergy_ = ecalEnergy;
548  aTauPFEssential.hcalEnergy_ = hcalEnergy;
549  aTauPFEssential.ptLeadChargedCand_ = leadChargedCandPt;
550  aTauPFEssential.etaAtEcalEntranceLeadChargedCand_ = leadChargedCandEtaAtEcalEntrance;
551  if (sumEnergy != 0.) {
552  aTauPFEssential.phiAtEcalEntrance_ = sumPhiTimesEnergy / sumEnergy;
553  aTauPFEssential.etaAtEcalEntrance_ = sumEtaTimesEnergy / sumEnergy;
554  } else {
555  aTauPFEssential.phiAtEcalEntrance_ = -99.;
556  aTauPFEssential.etaAtEcalEntrance_ = -99.;
557  }
558  float leadingTrackNormChi2 = 0;
559  float ecalEnergyLeadChargedHadrCand = -99.;
560  float hcalEnergyLeadChargedHadrCand = -99.;
561  float emFraction = -1.;
562  float myHCALenergy = 0.;
563  float myECALenergy = 0.;
564  const reco::CandidatePtr& leadingPFCharged = pfTauRef->leadChargedHadrCand();
565  if (leadingPFCharged.isNonnull()) {
566  const reco::PFCandidate* pfCandPtr = dynamic_cast<const reco::PFCandidate*>(leadingPFCharged.get());
567  if (pfCandPtr != nullptr) { // PFTau made from PFCandidates
568  ecalEnergyLeadChargedHadrCand = pfCandPtr->ecalEnergy();
569  hcalEnergyLeadChargedHadrCand = pfCandPtr->hcalEnergy();
570  reco::TrackRef trackRef = pfCandPtr->trackRef();
571  if (trackRef.isNonnull()) {
572  leadingTrackNormChi2 = trackRef->normalizedChi2();
573  for (const auto& isoPFCand : pfTauRef->isolationPFCands()) {
574  myHCALenergy += isoPFCand->hcalEnergy();
575  myECALenergy += isoPFCand->ecalEnergy();
576  }
577  for (const auto& signalPFCand : pfTauRef->signalPFCands()) {
578  myHCALenergy += signalPFCand->hcalEnergy();
579  myECALenergy += signalPFCand->ecalEnergy();
580  }
581  if (myHCALenergy + myECALenergy != 0.) {
582  emFraction = myECALenergy / (myHCALenergy + myECALenergy);
583  }
584  }
585  } else {
586  const pat::PackedCandidate* packedCandPtr = dynamic_cast<const pat::PackedCandidate*>(leadingPFCharged.get());
587  if (packedCandPtr != nullptr) {
588  // TauReco@MiniAOD: Update code below if ecal/hcal energies are available.
589  const reco::Track* track = packedCandPtr->hasTrackDetails() ? &packedCandPtr->pseudoTrack() : nullptr;
590  if (track != nullptr) {
591  leadingTrackNormChi2 = track->normalizedChi2();
592  }
593  }
594  }
595  }
596 
597  aTauPFEssential.emFraction_ = emFraction;
598  aTauPFEssential.leadingTrackNormChi2_ = leadingTrackNormChi2;
599  aTauPFEssential.ecalEnergyLeadChargedHadrCand_ = ecalEnergyLeadChargedHadrCand;
600  aTauPFEssential.hcalEnergyLeadChargedHadrCand_ = hcalEnergyLeadChargedHadrCand;
601  // extraction of tau lifetime information
602  if (!tauTransverseImpactParameterSrc_.label().empty()) {
603  edm::Handle<PFTauTIPAssociationByRef> tauLifetimeInfos;
604  iEvent.getByToken(tauTransverseImpactParameterToken_, tauLifetimeInfos);
605  const reco::PFTauTransverseImpactParameter& tauLifetimeInfo = *(*tauLifetimeInfos)[pfTauRef];
606  pat::tau::TauPFEssential& aTauPFEssential = aTau.pfEssential_[0];
607  aTauPFEssential.dxy_PCA_ = tauLifetimeInfo.dxy_PCA();
608  aTauPFEssential.dxy_ = tauLifetimeInfo.dxy();
609  aTauPFEssential.dxy_error_ = tauLifetimeInfo.dxy_error();
610  aTauPFEssential.hasSV_ = tauLifetimeInfo.hasSecondaryVertex();
611  aTauPFEssential.flightLength_ = tauLifetimeInfo.flightLength();
612  aTauPFEssential.flightLengthSig_ = tauLifetimeInfo.flightLengthSig();
613  aTauPFEssential.ip3d_ = tauLifetimeInfo.ip3d();
614  aTauPFEssential.ip3d_error_ = tauLifetimeInfo.ip3d_error();
615  }
616  }
617 
618  // Isolation
619  if (isolator_.enabled()) {
621  typedef pat::helper::MultiIsolator::IsolationValuePairs IsolationValuePairs;
622  // better to loop backwards, so the vector is resized less times
623  for (IsolationValuePairs::const_reverse_iterator it = isolatorTmpStorage_.rbegin(),
624  ed = isolatorTmpStorage_.rend();
625  it != ed;
626  ++it) {
627  aTau.setIsolation(it->first, it->second);
628  }
629  }
630 
631  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
632  aTau.setIsoDeposit(isoDepositLabels_[j].first, (*deposits[j])[tausRef]);
633  }
634 
635  if (efficiencyLoader_.enabled()) {
636  efficiencyLoader_.setEfficiencies(aTau, tausRef);
637  }
638 
639  if (resolutionLoader_.enabled()) {
641  }
642 
643  if (useUserData_) {
644  userDataHelper_.add(aTau, iEvent, iSetup);
645  }
646 
647  patTaus->push_back(aTau);
648  }
649 
650  // sort taus in pT
651  std::sort(patTaus->begin(), patTaus->end(), pTTauComparator_);
652 
653  // put genEvt object in Event
654  iEvent.put(std::move(patTaus));
655 
656  // clean up
657  if (isolator_.enabled())
659 }
660 
661 template <typename TauCollectionType, typename TauDiscrType>
663  size_t tauIdx,
664  const edm::Handle<TauDiscrType>& tauIdDiscr) {
666  return (*tauIdDiscr)[tauRef];
667 }
669  size_t tauIdx,
671  int wpIdx) {
673  if (wpIdx < 0) {
674  //Only 0th component filled with default value if prediscriminor in RecoTauDiscriminator failed.
675  if ((*tauIdDiscr)[tauRef].rawValues.size() == 1)
676  return (*tauIdDiscr)[tauRef].rawValues.at(0);
677  //uses negative indices to access rawValues. In most cases only one rawValue at wpIdx=-1 exists.
678  return (*tauIdDiscr)[tauRef].rawValues.at(-1 - wpIdx);
679  } else {
680  //WP vector not filled if prediscriminor in RecoTauDiscriminator failed. Set PAT output to false in this case
681  if ((*tauIdDiscr)[tauRef].workingPoints.empty())
682  return 0.0;
683  return (*tauIdDiscr)[tauRef].workingPoints.at(wpIdx);
684  }
685 }
686 
687 // ParameterSet description for module
690  iDesc.setComment("PAT tau producer module");
691 
692  // input source
693  iDesc.add<edm::InputTag>("tauSource", edm::InputTag())->setComment("input collection");
694 
695  // embedding
696  iDesc.add<bool>("embedIsolationTracks", false)->setComment("embed external isolation tracks");
697  iDesc.add<bool>("embedLeadTrack", false)->setComment("embed external leading track");
698  iDesc.add<bool>("embedLeadTracks", false)->setComment("embed external signal tracks");
699 
700  // MC matching configurables
701  iDesc.add<bool>("addGenMatch", true)->setComment("add MC matching");
702  iDesc.add<bool>("embedGenMatch", false)->setComment("embed MC matched MC information");
703  std::vector<edm::InputTag> emptySourceVector;
704  iDesc
705  .addNode(edm::ParameterDescription<edm::InputTag>("genParticleMatch", edm::InputTag(), true) xor
706  edm::ParameterDescription<std::vector<edm::InputTag>>("genParticleMatch", emptySourceVector, true))
707  ->setComment("input with MC match information");
708 
709  // MC jet matching variables
710  iDesc.add<bool>("addGenJetMatch", true)->setComment("add MC jet matching");
711  iDesc.add<bool>("embedGenJetMatch", false)->setComment("embed MC jet matched jet information");
712  iDesc.add<edm::InputTag>("genJetMatch", edm::InputTag("tauGenJetMatch"));
713 
715 
716  // tau ID configurables
717  iDesc.add<bool>("addTauID", true)->setComment("add tau ID variables");
718  edm::ParameterSetDescription tauIDSourcesPSet;
719  tauIDSourcesPSet.setAllowAnything();
720  iDesc
722  edm::ParameterDescription<edm::ParameterSetDescription>("tauIDSources", tauIDSourcesPSet, true))
723  ->setComment("input with tau ID variables");
724  // (Dis)allow to skip missing tauId sources
725  iDesc.add<bool>("skipMissingTauID", false)
726  ->setComment("allow to skip a tau ID variable when not present in the event");
727 
728  // IsoDeposit configurables
729  edm::ParameterSetDescription isoDepositsPSet;
730  isoDepositsPSet.addOptional<edm::InputTag>("tracker");
731  isoDepositsPSet.addOptional<edm::InputTag>("ecal");
732  isoDepositsPSet.addOptional<edm::InputTag>("hcal");
733  isoDepositsPSet.addOptional<edm::InputTag>("pfAllParticles");
734  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedHadron");
735  isoDepositsPSet.addOptional<edm::InputTag>("pfNeutralHadron");
736  isoDepositsPSet.addOptional<edm::InputTag>("pfGamma");
737  isoDepositsPSet.addOptional<std::vector<edm::InputTag>>("user");
738  iDesc.addOptional("isoDeposits", isoDepositsPSet);
739 
740  // Efficiency configurables
741  edm::ParameterSetDescription efficienciesPSet;
742  efficienciesPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
743  iDesc.add("efficiencies", efficienciesPSet);
744  iDesc.add<bool>("addEfficiencies", false);
745 
746  // Check to see if the user wants to add user data
747  edm::ParameterSetDescription userDataPSet;
749  iDesc.addOptional("userData", userDataPSet);
750 
751  edm::ParameterSetDescription isolationPSet;
752  isolationPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
753  iDesc.add("userIsolation", isolationPSet);
754 }
755 
757 
ConfigurationDescriptions.h
reco::PFCandidate::trackRef
reco::TrackRef trackRef() const
Definition: PFCandidate.cc:408
pat::PackedCandidate::hasTrackDetails
bool hasTrackDetails() const
Return true if a bestTrack can be extracted from this Candidate.
Definition: PackedCandidate.h:787
pat::PATTauProducer::firstOccurence_
bool firstOccurence_
Definition: PATTauProducer.h:59
hemisphereProducer_cfi.patTaus
patTaus
Definition: hemisphereProducer_cfi.py:8
pat::tau::TauPFEssential::hasSV_
bool hasSV_
Definition: TauPFEssential.h:46
GenJetCollection.h
pat::PATTauProducer::pfTauToken_
edm::EDGetTokenT< reco::PFTauCollection > pfTauToken_
Definition: PATTauProducer.h:64
pat::Tau::embedSignalPFCands
void embedSignalPFCands()
method to store the signal candidates internally
PDWG_TauSkim_cff.rawValues
rawValues
Definition: PDWG_TauSkim_cff.py:13
pat::PATUserDataHelper
Assists in assimilating all pat::UserData into pat objects.
Definition: PATUserDataHelper.h:49
mps_fire.i
i
Definition: mps_fire.py:355
pat::EcalIso
Definition: Isolation.h:11
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:53
MessageLogger.h
pat::PATTauProducer::addGenJetMatch_
bool addGenJetMatch_
Definition: PATTauProducer.h:85
funct::false
false
Definition: Factorize.h:34
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:30
PFTauDiscriminator.h
pat::PATTauProducer::tauIDSrcContainers_
std::vector< std::vector< NameWPIdx > > tauIDSrcContainers_
Definition: PATTauProducer.h:100
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.h:95
TauPFSpecific.h
pat::PATTauProducer
Produces pat::Tau's.
Definition: PATTauProducer.h:49
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.h:78
PFTauTransverseImpactParameterAssociation.h
pat::PATTauProducer::embedSignalTracks_
bool embedSignalTracks_
Definition: PATTauProducer.h:68
pat::PATUserDataHelper::fillDescription
static void fillDescription(edm::ParameterSetDescription &iDesc)
Definition: PATUserDataHelper.h:135
pat::tau::TauPFEssential::ptLeadChargedCand_
float ptLeadChargedCand_
Definition: TauPFEssential.h:62
pat::PATTauProducer::embedIsolationTracks_
bool embedIsolationTracks_
Definition: PATTauProducer.h:66
pat::PATTauProducer::embedGenMatch_
bool embedGenMatch_
Definition: PATTauProducer.h:82
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
reco::PFCandidate::positionAtECALEntrance
const math::XYZPointF & positionAtECALEntrance() const
Definition: PFCandidate.h:362
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
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:215
pat::PATObject::addGenParticleRef
void addGenParticleRef(const reco::GenParticleRef &ref)
Definition: PATObject.h:756
pat::PfAllParticleIso
Definition: Isolation.h:13
reco::PFTau
Definition: PFTau.h:36
pat::PATTauProducer::embedLeadPFCand_
bool embedLeadPFCand_
Definition: PATTauProducer.h:69
TauJetCorrFactors.h
pat::PATTauProducer::embedIsolationPFGammaCands_
bool embedIsolationPFGammaCands_
Definition: PATTauProducer.h:79
edm::Ptr::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:139
pat::PATTauProducer::embedLeadPFChargedHadrCand_
bool embedLeadPFChargedHadrCand_
Definition: PATTauProducer.h:70
pat::PATTauProducer::isolator_
pat::helper::MultiIsolator isolator_
Definition: PATTauProducer.h:108
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:160
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.h:102
Association.h
pat::PATTauProducer::addGenMatch_
bool addGenMatch_
Definition: PATTauProducer.h:81
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
training_settings.idx
idx
Definition: training_settings.py:16
edm::ParameterSetDescription::addOptional
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:105
dqmdumpme.first
first
Definition: dqmdumpme.py:55
pat::helper::MultiIsolator::IsolationValuePairs
std::vector< std::pair< pat::IsolationKeys, float > > IsolationValuePairs
Definition: MultiIsolator.h:17
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.h:104
pat::helper::MultiIsolator::enabled
bool enabled() const
True if it has a non null configuration.
Definition: MultiIsolator.h:55
edm::Ref< GenParticleCollection >
FileInPath.h
RecoTauValidationMiniAOD_cfi.tauCollection
tauCollection
Definition: RecoTauValidationMiniAOD_cfi.py:5
pat::PATTauProducer::addResolutions_
bool addResolutions_
Definition: PATTauProducer.h:116
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.h:75
reco::PFTauTransverseImpactParameter::dxy
double dxy() const
Definition: PFTauTransverseImpactParameter.h:52
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.h:83
MakerMacros.h
pat::Tau::embedLeadPFCand
void embedLeadPFCand()
reco::PFCandidate::muonRef
reco::MuonRef muonRef() const
Definition: PFCandidate.cc:421
pat::PATTauProducer::NameTag
std::pair< std::string, edm::InputTag > NameTag
Definition: PATTauProducer.h:93
pat::PATTauProducer::embedLeadTrack_
bool embedLeadTrack_
Definition: PATTauProducer.h:67
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
pat::PATTauProducer::isoDepositLabels_
std::vector< std::pair< pat::IsolationKeys, edm::InputTag > > isoDepositLabels_
Definition: PATTauProducer.h:110
reco::PFTauTransverseImpactParameter::flightLengthSig
double flightLengthSig() const
Definition: PFTauTransverseImpactParameter.cc:71
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:122
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
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.h:109
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
PATTauProducer.h
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.h:96
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
pat::PATTauProducer::~PATTauProducer
~PATTauProducer() override
Definition: PATTauProducer.cc:172
pat::Tau::embedSignalPFGammaCands
void embedSignalPFGammaCands()
method to store the signal gamma candidates internally
TauSpinnerFilter_cfi.ntaus
ntaus
Definition: TauSpinnerFilter_cfi.py:5
pat::PATTauProducer::tauIDSrcs_
std::vector< NameTag > tauIDSrcs_
Definition: PATTauProducer.h:99
pat::PATTauProducer::genJetMatchToken_
edm::EDGetTokenT< edm::Association< reco::GenJetCollection > > genJetMatchToken_
Definition: PATTauProducer.h:87
pat::PATTauProducer::addTauJetCorrFactors_
bool addTauJetCorrFactors_
Definition: PATTauProducer.h:89
ParameterSetDescription.h
pat::tau::TauPFEssential::hcalEnergy_
float hcalEnergy_
Definition: TauPFEssential.h:55
reco::PFTauTransverseImpactParameter
Definition: PFTauTransverseImpactParameter.h:25
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
pat::Tau::embedIsolationTracks
void embedIsolationTracks()
method to store the isolation tracks internally
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
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
reco::PFTauTransverseImpactParameter::hasSecondaryVertex
bool hasSecondaryVertex() const
Definition: PFTauTransverseImpactParameter.h:62
PFTauTransverseImpactParameter.h
edm::LogWarning
Definition: MessageLogger.h:141
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:674
pat::PATTauProducer::WPCfg
std::pair< std::string, std::string > WPCfg
Definition: PATTauProducer.h:94
pat::PackedCandidate::pseudoTrack
virtual const reco::Track & pseudoTrack() const
Definition: PackedCandidate.h:772
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
pat::Tau::embedIsolationPFCands
void embedIsolationPFCands()
method to store the isolation candidates internally
edm::ParameterSet
Definition: ParameterSet.h:36
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.h:73
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
pat::PATTauProducer::efficiencyLoader_
pat::helper::EfficiencyLoader efficiencyLoader_
Definition: PATTauProducer.h:114
ParameterSet
Definition: Functions.h:16
pat::PfGammaIso
Definition: Isolation.h:16
pat::helper::KinResolutionsLoader::fillDescription
static void fillDescription(edm::ParameterSetDescription &iDesc)
Method for documentation and validation of PSet.
Definition: KinResolutionsLoader.cc:34
pat::PATTauProducer::pfTauIDTokens_
std::vector< edm::EDGetTokenT< reco::PFTauDiscriminator > > pfTauIDTokens_
Definition: PATTauProducer.h:101
pat::PackedCandidate
Definition: PackedCandidate.h:22
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.h:62
pat::PATTauProducer::skipMissingTauID_
bool skipMissingTauID_
Definition: PATTauProducer.h:103
pat::TrackIso
Definition: Isolation.h:10
edm::ParameterSet::getParameterNamesForType
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:168
iEvent
int iEvent
Definition: GenABIO.cc:224
pat::PATTauProducer::isoDepositTokens_
std::vector< edm::EDGetTokenT< edm::ValueMap< IsoDeposit > > > isoDepositTokens_
Definition: PATTauProducer.h:111
pat::PATTauProducer::embedSignalPFNeutralHadrCands_
bool embedSignalPFNeutralHadrCands_
Definition: PATTauProducer.h:74
pat::PATTauProducer::embedIsolationPFCands_
bool embedIsolationPFCands_
Definition: PATTauProducer.h:76
pat::HcalIso
Definition: Isolation.h:12
reco::PFTauTransverseImpactParameter::ip3d
double ip3d() const
Definition: PFTauTransverseImpactParameter.h:56
pat::PfNeutralHadronIso
Definition: Isolation.h:15
TauDiscriminatorContainer.h
reco::PFTauTransverseImpactParameter::ip3d_error
double ip3d_error() const
Definition: PFTauTransverseImpactParameter.h:57
pat::Tau::embedLeadTrack
void embedLeadTrack()
method to store the leading track internally
edm::Association
Definition: Association.h:18
edm::EventSetup
Definition: EventSetup.h:57
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:51
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.h:86
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
pat::Tau::setDecayMode
void setDecayMode(int)
set decay mode
reco::PFCandidate::ecalEnergy
double ecalEnergy() const
return corrected Ecal energy
Definition: PFCandidate.h:220
pat::TauJetCorrFactors
Definition: TauJetCorrFactors.h:31
edm::Ptr
Definition: AssociationVector.h:31
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
pat::PATTauProducer::pTTauComparator_
GreaterByPt< Tau > pTTauComparator_
Definition: PATTauProducer.h:106
pat::tau::TauPFEssential::ecalEnergyLeadChargedHadrCand_
float ecalEnergyLeadChargedHadrCand_
Definition: TauPFEssential.h:59
eostools.move
def move(src, dest)
Definition: eostools.py:511
Ref.h
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:232
pat::PATTauProducer::userDataHelper_
pat::PATUserDataHelper< pat::Tau > userDataHelper_
Definition: PATTauProducer.h:120
pat::PATTauProducer::embedIsolationPFChargedHadrCands_
bool embedIsolationPFChargedHadrCands_
Definition: PATTauProducer.h:77
pat::PATTauProducer::addTauID_
bool addTauID_
Definition: PATTauProducer.h:92
Exception
Definition: hltDiff.cc:246
pat::PATTauProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: PATTauProducer.cc:688
pat::PATTauProducer::embedLeadPFNeutralCand_
bool embedLeadPFNeutralCand_
Definition: PATTauProducer.h:71
pat::PATTauProducer::getTauIdDiscriminator
float getTauIdDiscriminator(const edm::Handle< TauCollectionType > &, size_t, const edm::Handle< TauDiscrType > &)
Definition: PATTauProducer.cc:662
pat::tau::TauPFEssential::etaAtEcalEntrance_
float etaAtEcalEntrance_
Definition: TauPFEssential.h:58
edm::parameterSet
ParameterSet const & parameterSet(Provenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
PFTau.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:668
edm::Ptr::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:146
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:40
pat::PATTauProducer::tauJetCorrFactorsTokens_
std::vector< edm::EDGetTokenT< edm::ValueMap< TauJetCorrFactors > > > tauJetCorrFactorsTokens_
Definition: PATTauProducer.h:90
pat::PATTauProducer::resolutionLoader_
pat::helper::KinResolutionsLoader resolutionLoader_
Definition: PATTauProducer.h:117
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
pat::PATTauProducer::tauTransverseImpactParameterToken_
edm::EDGetTokenT< PFTauTIPAssociationByRef > tauTransverseImpactParameterToken_
Definition: PATTauProducer.h:63
pat::PATTauProducer::embedSignalPFCands_
bool embedSignalPFCands_
Definition: PATTauProducer.h:72
cms::Exception
Definition: Exception.h:70
View.h
pat::PATTauProducer::tauTransverseImpactParameterSrc_
edm::InputTag tauTransverseImpactParameterSrc_
Definition: PATTauProducer.h:65
pat::PATTauProducer::useUserData_
bool useUserData_
Definition: PATTauProducer.h:119
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
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
pat::PATObject::embedGenParticle
void embedGenParticle()
Definition: PATObject.h:773
edm::Provenance
Definition: Provenance.h:34
pat::PATTauProducer::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition: PATTauProducer.cc:174
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.h:113
edm::ParameterDescription
Definition: ParameterDescription.h:110
CandIsolatorFromDeposits_cfi.deposits
deposits
Definition: CandIsolatorFromDeposits_cfi.py:4
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:23
pat::tau::TauPFEssential::ecalEnergy_
float ecalEnergy_
Definition: TauPFEssential.h:54
pat::tau::TauPFEssential::dxy_PCA_
Point dxy_PCA_
Definition: TauPFEssential.h:39
pat::tau::TauPFEssential::phiAtEcalEntrance_
float phiAtEcalEntrance_
Definition: TauPFEssential.h:57
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