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