CMS 3D CMS Logo

PATJetProducer.cc
Go to the documentation of this file.
1 
47 
48 #include <algorithm>
49 #include <memory>
50 #include <vector>
51 
52 class JetFlavourIdentifier;
53 
54 namespace pat {
55 
57  public:
58  explicit PATJetProducer(const edm::ParameterSet &iConfig);
59  ~PATJetProducer() override;
60 
61  void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override;
62 
63  static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
64 
65  private:
66  // configurables
82  // edm::EDGetTokenT<edm::View<reco::SomePartonJetType> > partonJetToken_;
84  std::vector<edm::EDGetTokenT<edm::ValueMap<JetCorrFactors>>> jetCorrFactorsTokens_;
85 
88  std::vector<edm::InputTag> discriminatorTags_;
89  std::vector<edm::EDGetTokenT<reco::JetFloatAssociation::Container>> discriminatorTokens_;
90  std::vector<std::string> discriminatorLabels_;
92  std::vector<edm::InputTag> tagInfoTags_;
93  std::vector<edm::EDGetTokenT<edm::View<reco::BaseTagInfo>>> tagInfoTokens_;
94  std::vector<std::string> tagInfoLabels_;
99  bool addJetID_;
101  // tools
104 
107 
110 
113  //
114  bool printWarning_; // this is introduced to issue warnings only once per job
115  };
116 
117 } // namespace pat
118 
119 using namespace pat;
120 
122  : useUserData_(iConfig.exists("userData")), printWarning_(true) {
123  // initialize configurables
124  jetsToken_ = consumes<edm::View<reco::Jet>>(iConfig.getParameter<edm::InputTag>("jetSource"));
125  embedCaloTowers_ = false; // parameter is optional
126  if (iConfig.exists("embedCaloTowers")) {
127  embedCaloTowers_ = iConfig.getParameter<bool>("embedCaloTowers");
128  }
129  embedPFCandidates_ = iConfig.getParameter<bool>("embedPFCandidates");
130  getJetMCFlavour_ = iConfig.getParameter<bool>("getJetMCFlavour");
131  useLegacyJetMCFlavour_ = iConfig.getParameter<bool>("useLegacyJetMCFlavour");
132  addJetFlavourInfo_ = (useLegacyJetMCFlavour_ ? false : iConfig.getParameter<bool>("addJetFlavourInfo"));
135  consumes<reco::JetFlavourMatchingCollection>(iConfig.getParameter<edm::InputTag>("JetPartonMapSource"));
138  consumes<reco::JetFlavourInfoMatchingCollection>(iConfig.getParameter<edm::InputTag>("JetFlavourInfoSource"));
139  addGenPartonMatch_ = iConfig.getParameter<bool>("addGenPartonMatch");
140  embedGenPartonMatch_ = iConfig.getParameter<bool>("embedGenPartonMatch");
141  if (addGenPartonMatch_)
143  consumes<edm::Association<reco::GenParticleCollection>>(iConfig.getParameter<edm::InputTag>("genPartonMatch"));
144  addGenJetMatch_ = iConfig.getParameter<bool>("addGenJetMatch");
145  embedGenJetMatch_ = iConfig.getParameter<bool>("embedGenJetMatch");
146  if (addGenJetMatch_)
147  genJetToken_ =
148  consumes<edm::Association<reco::GenJetCollection>>(iConfig.getParameter<edm::InputTag>("genJetMatch"));
149  addPartonJetMatch_ = iConfig.getParameter<bool>("addPartonJetMatch");
150  // partonJetToken_ = mayConsume<reco::SomePartonJetType>(iConfig.getParameter<edm::InputTag>( "partonJetSource" ));
151  addJetCorrFactors_ = iConfig.getParameter<bool>("addJetCorrFactors");
152  if (addJetCorrFactors_) {
154  iConfig.getParameter<std::vector<edm::InputTag>>("jetCorrFactorsSource"),
155  [this](edm::InputTag const &tag) { return consumes<edm::ValueMap<JetCorrFactors>>(tag); });
156  }
157  addBTagInfo_ = iConfig.getParameter<bool>("addBTagInfo");
158  addDiscriminators_ = iConfig.getParameter<bool>("addDiscriminators");
159  discriminatorTags_ = iConfig.getParameter<std::vector<edm::InputTag>>("discriminatorSources");
161  return mayConsume<reco::JetFloatAssociation::Container>(tag);
162  });
163  addTagInfos_ = iConfig.getParameter<bool>("addTagInfos");
164  tagInfoTags_ = iConfig.getParameter<std::vector<edm::InputTag>>("tagInfoSources");
166  tagInfoTags_, [this](edm::InputTag const &tag) { return mayConsume<edm::View<reco::BaseTagInfo>>(tag); });
167  addAssociatedTracks_ = iConfig.getParameter<bool>("addAssociatedTracks");
170  consumes<reco::JetTracksAssociation::Container>(iConfig.getParameter<edm::InputTag>("trackAssociationSource"));
171  addJetCharge_ = iConfig.getParameter<bool>("addJetCharge");
172  if (addJetCharge_)
174  consumes<reco::JetFloatAssociation::Container>(iConfig.getParameter<edm::InputTag>("jetChargeSource"));
175  addJetID_ = iConfig.getParameter<bool>("addJetID");
176  if (addJetID_)
177  jetIDMapToken_ = consumes<reco::JetIDValueMap>(iConfig.getParameter<edm::InputTag>("jetIDMap"));
178  // Efficiency configurables
179  addEfficiencies_ = iConfig.getParameter<bool>("addEfficiencies");
180  if (addEfficiencies_) {
182  pat::helper::EfficiencyLoader(iConfig.getParameter<edm::ParameterSet>("efficiencies"), consumesCollector());
183  }
184  // Resolution configurables
185  addResolutions_ = iConfig.getParameter<bool>("addResolutions");
186  if (addResolutions_) {
188  }
189  if (discriminatorTags_.empty()) {
190  addDiscriminators_ = false;
191  } else {
192  for (std::vector<edm::InputTag>::const_iterator it = discriminatorTags_.begin(), ed = discriminatorTags_.end();
193  it != ed;
194  ++it) {
195  std::string label = it->label();
196  std::string::size_type pos = label.find("JetTags");
197  if ((pos != std::string::npos) && (pos != label.length() - 7)) {
198  label.erase(pos + 7); // trim a tail after "JetTags"
199  }
200  if (!it->instance().empty()) {
201  label = (label + std::string(":") + it->instance());
202  }
203  discriminatorLabels_.push_back(label);
204  }
205  }
206  if (tagInfoTags_.empty()) {
207  addTagInfos_ = false;
208  } else {
209  for (std::vector<edm::InputTag>::const_iterator it = tagInfoTags_.begin(), ed = tagInfoTags_.end(); it != ed;
210  ++it) {
211  std::string label = it->label();
212  std::string::size_type pos = label.find("TagInfos");
213  if ((pos != std::string::npos) && (pos != label.length() - 8)) {
214  label.erase(pos + 8); // trim a tail after "TagInfos"
215  }
216  tagInfoLabels_.push_back(label);
217  }
218  }
219  if (!addBTagInfo_) {
220  addDiscriminators_ = false;
221  addTagInfos_ = false;
222  }
223  // Check to see if the user wants to add user data
224  if (useUserData_) {
225  userDataHelper_ = PATUserDataHelper<Jet>(iConfig.getParameter<edm::ParameterSet>("userData"), consumesCollector());
226  }
227  // produces vector of jets
228  produces<std::vector<Jet>>();
229  produces<reco::GenJetCollection>("genJets");
230  produces<std::vector<CaloTower>>("caloTowers");
231  produces<reco::PFCandidateCollection>("pfCandidates");
232  produces<edm::OwnVector<reco::BaseTagInfo>>("tagInfos");
233 }
234 
236 
238  // check whether dealing with MC or real data
239  if (iEvent.isRealData()) {
240  getJetMCFlavour_ = false;
241  useLegacyJetMCFlavour_ = false;
242  addJetFlavourInfo_ = false;
243  addGenPartonMatch_ = false;
244  addGenJetMatch_ = false;
245  addPartonJetMatch_ = false;
246  }
247 
248  // Get the vector of jets
250  iEvent.getByToken(jetsToken_, jets);
251 
256 
257  // for jet flavour
261  iEvent.getByToken(jetPartonMapToken_, jetFlavMatch);
263  iEvent.getByToken(jetFlavourInfoToken_, jetFlavInfoMatch);
264 
265  // Get the vector of generated particles from the event if needed
267  if (addGenPartonMatch_)
268  iEvent.getByToken(genPartonToken_, partonMatch);
269  // Get the vector of GenJets from the event if needed
271  if (addGenJetMatch_)
272  iEvent.getByToken(genJetToken_, genJetMatch);
273  /* TO BE IMPLEMENTED FOR >= 1_5_X
274  // Get the vector of PartonJets from the event if needed
275  edm::Handle<edm::View<reco::SomePartonJetType> > partonJets;
276  if (addPartonJetMatch_) iEvent.getByToken(partonJetToken_, partonJets);
277 */
278 
279  // read in the jet correction factors ValueMap
280  std::vector<edm::ValueMap<JetCorrFactors>> jetCorrs;
281  if (addJetCorrFactors_) {
282  for (size_t i = 0; i < jetCorrFactorsTokens_.size(); ++i) {
284  iEvent.getByToken(jetCorrFactorsTokens_[i], jetCorr);
285  jetCorrs.push_back(*jetCorr);
286  }
287  }
288 
289  // Get the vector of jet tags with b-tagging info
290  std::vector<edm::Handle<reco::JetFloatAssociation::Container>> jetDiscriminators;
292  jetDiscriminators.resize(discriminatorTokens_.size());
293  for (size_t i = 0; i < discriminatorTokens_.size(); ++i) {
294  iEvent.getByToken(discriminatorTokens_[i], jetDiscriminators[i]);
295  }
296  }
297  std::vector<edm::Handle<edm::View<reco::BaseTagInfo>>> jetTagInfos;
298  if (addBTagInfo_ && addTagInfos_) {
299  jetTagInfos.resize(tagInfoTokens_.size());
300  for (size_t i = 0; i < tagInfoTokens_.size(); ++i) {
301  iEvent.getByToken(tagInfoTokens_[i], jetTagInfos[i]);
302  }
303  }
304 
305  // tracks Jet Track Association
308  iEvent.getByToken(trackAssociationToken_, hTrackAss);
310  if (addJetCharge_)
311  iEvent.getByToken(jetChargeToken_, hJetChargeAss);
312 
313  // jet ID handle
315  if (addJetID_)
316  iEvent.getByToken(jetIDMapToken_, hJetIDMap);
317 
318  // loop over jets
319  auto patJets = std::make_unique<std::vector<Jet>>();
320 
321  auto genJetsOut = std::make_unique<reco::GenJetCollection>();
322  auto caloTowersOut = std::make_unique<std::vector<CaloTower>>();
323  auto pfCandidatesOut = std::make_unique<reco::PFCandidateCollection>();
324  auto tagInfosOut = std::make_unique<edm::OwnVector<reco::BaseTagInfo>>();
325 
326  edm::RefProd<reco::GenJetCollection> h_genJetsOut = iEvent.getRefBeforePut<reco::GenJetCollection>("genJets");
327  edm::RefProd<std::vector<CaloTower>> h_caloTowersOut = iEvent.getRefBeforePut<std::vector<CaloTower>>("caloTowers");
329  iEvent.getRefBeforePut<reco::PFCandidateCollection>("pfCandidates");
331  iEvent.getRefBeforePut<edm::OwnVector<reco::BaseTagInfo>>("tagInfos");
332 
333  for (edm::View<reco::Jet>::const_iterator itJet = jets->begin(); itJet != jets->end(); itJet++) {
334  // construct the Jet from the ref -> save ref to original object
335  unsigned int idx = itJet - jets->begin();
336  edm::RefToBase<reco::Jet> jetRef = jets->refAt(idx);
337  edm::Ptr<reco::Jet> jetPtr = jets->ptrAt(idx);
338  Jet ajet(jetRef);
339 
340  // add the FwdPtrs to the CaloTowers
341  if ((ajet.isCaloJet() || ajet.isJPTJet()) && embedCaloTowers_) {
342  const reco::CaloJet *cj = nullptr;
343  const reco::JPTJet *jptj = nullptr;
344  if (ajet.isCaloJet())
345  cj = dynamic_cast<const reco::CaloJet *>(jetRef.get());
346  else {
347  jptj = dynamic_cast<const reco::JPTJet *>(jetRef.get());
348  cj = dynamic_cast<const reco::CaloJet *>(jptj->getCaloJetRef().get());
349  }
351  std::vector<CaloTowerPtr> itowers = cj->getCaloConstituents();
352  for (std::vector<CaloTowerPtr>::const_iterator towBegin = itowers.begin(),
353  towEnd = itowers.end(),
354  itow = towBegin;
355  itow != towEnd;
356  ++itow) {
357  if (itow->isAvailable() && itow->isNonnull()) {
358  caloTowersOut->push_back(**itow);
359  // set the "forward" ref to the thinned collection
360  edm::Ref<std::vector<CaloTower>> caloTowerRef(h_caloTowersOut, caloTowersOut->size() - 1);
361  edm::Ptr<CaloTower> caloForwardRef(h_caloTowersOut.id(), caloTowerRef.key(), h_caloTowersOut.productGetter());
362  // set the "backward" ref to the original collection for association
363  edm::Ptr<CaloTower> caloBackRef(*itow);
364  // add to the list of FwdPtr's
365  itowersRef.push_back(pat::CaloTowerFwdPtrCollection::value_type(caloForwardRef, caloBackRef));
366  }
367  }
368  ajet.setCaloTowers(itowersRef);
369  }
370 
371  // add the FwdPtrs to the PFCandidates
372  if (ajet.isPFJet() && embedPFCandidates_) {
373  const reco::PFJet *cj = dynamic_cast<const reco::PFJet *>(jetRef.get());
374  pat::PFCandidateFwdPtrCollection iparticlesRef;
375  std::vector<reco::PFCandidatePtr> iparticles = cj->getPFConstituents();
376  for (std::vector<reco::PFCandidatePtr>::const_iterator partBegin = iparticles.begin(),
377  partEnd = iparticles.end(),
378  ipart = partBegin;
379  ipart != partEnd;
380  ++ipart) {
381  pfCandidatesOut->push_back(**ipart);
382  // set the "forward" ref to the thinned collection
383  edm::Ref<reco::PFCandidateCollection> pfCollectionRef(h_pfCandidatesOut, pfCandidatesOut->size() - 1);
384  edm::Ptr<reco::PFCandidate> pfForwardRef(
385  h_pfCandidatesOut.id(), pfCollectionRef.key(), h_pfCandidatesOut.productGetter());
386  // set the "backward" ref to the original collection for association
387  edm::Ptr<reco::PFCandidate> pfBackRef(*ipart);
388  // add to the list of FwdPtr's
389  iparticlesRef.push_back(pat::PFCandidateFwdPtrCollection::value_type(pfForwardRef, pfBackRef));
390  }
391  ajet.setPFCandidates(iparticlesRef);
392  }
393 
394  if (addJetCorrFactors_) {
395  // add additional JetCorrs to the jet
396  for (unsigned int i = 0; i < jetCorrFactorsTokens_.size(); ++i) {
397  const JetCorrFactors &jcf = jetCorrs[i][jetRef];
398  // uncomment for debugging
399  // jcf.print();
400  ajet.addJECFactors(jcf);
401  }
402  std::vector<std::string> levels = jetCorrs[0][jetRef].correctionLabels();
403  if (std::find(levels.begin(), levels.end(), "L2L3Residual") != levels.end()) {
404  ajet.initializeJEC(jetCorrs[0][jetRef].jecLevel("L2L3Residual"));
405  } else if (std::find(levels.begin(), levels.end(), "L3Absolute") != levels.end()) {
406  ajet.initializeJEC(jetCorrs[0][jetRef].jecLevel("L3Absolute"));
407  } else {
408  ajet.initializeJEC(jetCorrs[0][jetRef].jecLevel("Uncorrected"));
409  if (printWarning_) {
410  edm::LogWarning("L3Absolute not found")
411  << "L2L3Residual and L3Absolute are not part of the jetCorrFactors\n"
412  << "of module " << jetCorrs[0][jetRef].jecSet() << ". Jets will remain"
413  << " uncorrected.";
414  printWarning_ = false;
415  }
416  }
417  }
418 
419  // get the MC flavour information for this jet
421  ajet.setPartonFlavour((*jetFlavMatch)[edm::RefToBase<reco::Jet>(jetRef)].getFlavour());
422  } else if (getJetMCFlavour_ && !useLegacyJetMCFlavour_) {
423  if (addJetFlavourInfo_)
424  ajet.setJetFlavourInfo((*jetFlavInfoMatch)[edm::RefToBase<reco::Jet>(jetRef)]);
425  else {
426  ajet.setPartonFlavour((*jetFlavInfoMatch)[edm::RefToBase<reco::Jet>(jetRef)].getPartonFlavour());
427  ajet.setHadronFlavour((*jetFlavInfoMatch)[edm::RefToBase<reco::Jet>(jetRef)].getHadronFlavour());
428  }
429  }
430  // store the match to the generated partons
431  if (addGenPartonMatch_) {
432  reco::GenParticleRef parton = (*partonMatch)[jetRef];
433  if (parton.isNonnull() && parton.isAvailable()) {
434  ajet.setGenParton(parton, embedGenPartonMatch_);
435  } // leave empty if no match found
436  }
437  // store the match to the GenJets
438  if (addGenJetMatch_) {
439  reco::GenJetRef genjet = (*genJetMatch)[jetRef];
440  if (genjet.isNonnull() && genjet.isAvailable()) {
441  genJetsOut->push_back(*genjet);
442  // set the "forward" ref to the thinned collection
443  edm::Ref<reco::GenJetCollection> genForwardRef(h_genJetsOut, genJetsOut->size() - 1);
444  // set the "backward" ref to the original collection
445  const edm::Ref<reco::GenJetCollection> &genBackRef(genjet);
446  // make the FwdPtr
447  edm::FwdRef<reco::GenJetCollection> genjetFwdRef(genForwardRef, genBackRef);
448  ajet.setGenJetRef(genjetFwdRef);
449  } // leave empty if no match found
450  }
451 
452  if (efficiencyLoader_.enabled()) {
453  efficiencyLoader_.setEfficiencies(ajet, jetRef);
454  }
455 
456  // IMPORTANT: DO THIS AFTER JES CORRECTIONS
457  if (resolutionLoader_.enabled()) {
459  }
460 
461  // TO BE IMPLEMENTED FOR >=1_5_X: do the PartonJet matching
462  if (addPartonJetMatch_) {
463  }
464 
465  // add b-tag info if available & required
466  if (addBTagInfo_) {
467  if (addDiscriminators_) {
468  for (size_t k = 0; k < jetDiscriminators.size(); ++k) {
469  float value = (*jetDiscriminators[k])[jetRef];
470  ajet.addBDiscriminatorPair(std::make_pair(discriminatorLabels_[k], value));
471  }
472  }
473  if (addTagInfos_) {
474  for (size_t k = 0; k < jetTagInfos.size(); ++k) {
475  const edm::View<reco::BaseTagInfo> &taginfos = *jetTagInfos[k];
476  // This is not associative, so we have to search the jet
478  // Try first by 'same index'
479  if ((idx < taginfos.size()) && (taginfos[idx].jet() == jetRef)) {
480  match = taginfos.ptrAt(idx);
481  } else {
482  // otherwise fail back to a simple search
483  for (edm::View<reco::BaseTagInfo>::const_iterator itTI = taginfos.begin(), edTI = taginfos.end();
484  itTI != edTI;
485  ++itTI) {
486  if (itTI->jet() == jetRef) {
487  match = taginfos.ptrAt(itTI - taginfos.begin());
488  break;
489  }
490  }
491  }
492  if (match.isNonnull()) {
493  tagInfosOut->push_back(match->clone());
494  // set the "forward" ptr to the thinned collection
495  edm::Ptr<reco::BaseTagInfo> tagInfoForwardPtr(
496  h_tagInfosOut.id(), &tagInfosOut->back(), tagInfosOut->size() - 1);
497  // set the "backward" ptr to the original collection for association
498  const edm::Ptr<reco::BaseTagInfo> &tagInfoBackPtr(match);
499  // make FwdPtr
500  TagInfoFwdPtrCollection::value_type tagInfoFwdPtr(tagInfoForwardPtr, tagInfoBackPtr);
501  ajet.addTagInfo(tagInfoLabels_[k], tagInfoFwdPtr);
502  }
503  }
504  }
505  }
506 
508  ajet.setAssociatedTracks((*hTrackAss)[jetRef]);
509 
510  if (addJetCharge_)
511  ajet.setJetCharge((*hJetChargeAss)[jetRef]);
512 
513  // add jet ID for calo jets
514  if (addJetID_ && ajet.isCaloJet()) {
515  reco::JetID jetId = (*hJetIDMap)[jetRef];
516  ajet.setJetID(jetId);
517  }
518  // add jet ID jpt jets
519  else if (addJetID_ && ajet.isJPTJet()) {
520  const reco::JPTJet *jptj = dynamic_cast<const reco::JPTJet *>(jetRef.get());
521  reco::JetID jetId = (*hJetIDMap)[jptj->getCaloJetRef()];
522  ajet.setJetID(jetId);
523  }
524  if (useUserData_) {
525  userDataHelper_.add(ajet, iEvent, iSetup);
526  }
527  patJets->push_back(ajet);
528  }
529 
530  // sort jets in pt
531  std::sort(patJets->begin(), patJets->end(), pTComparator_);
532 
533  // put genEvt in Event
534  iEvent.put(std::move(patJets));
535 
536  iEvent.put(std::move(genJetsOut), "genJets");
537  iEvent.put(std::move(caloTowersOut), "caloTowers");
538  iEvent.put(std::move(pfCandidatesOut), "pfCandidates");
539  iEvent.put(std::move(tagInfosOut), "tagInfos");
540 }
541 
542 // ParameterSet description for module
545  iDesc.setComment("PAT jet producer module");
546 
547  // input source
548  iDesc.add<edm::InputTag>("jetSource", edm::InputTag("no default"))->setComment("input collection");
549 
550  // embedding
551  iDesc.addOptional<bool>("embedCaloTowers", false)
552  ->setComment("embed external CaloTowers (not to be used on AOD input)");
553  iDesc.add<bool>("embedPFCandidates", true)->setComment("embed external PFCandidates");
554 
555  // MC matching configurables
556  iDesc.add<bool>("addGenPartonMatch", true)->setComment("add MC matching");
557  iDesc.add<bool>("embedGenPartonMatch", false)->setComment("embed MC matched MC information");
558  iDesc.add<edm::InputTag>("genPartonMatch", edm::InputTag())->setComment("input with MC match information");
559 
560  iDesc.add<bool>("addGenJetMatch", true)->setComment("add MC matching");
561  iDesc.add<bool>("embedGenJetMatch", false)->setComment("embed MC matched MC information");
562  iDesc.add<edm::InputTag>("genJetMatch", edm::InputTag())->setComment("input with MC match information");
563 
564  iDesc.add<bool>("addJetCharge", true);
565  iDesc.add<edm::InputTag>("jetChargeSource", edm::InputTag("patJetCharge"));
566 
567  // jet id
568  iDesc.add<bool>("addJetID", true)->setComment("Add jet ID information");
569  iDesc.add<edm::InputTag>("jetIDMap", edm::InputTag())->setComment("jet id map");
570 
571  iDesc.add<bool>("addPartonJetMatch", false);
572  iDesc.add<edm::InputTag>("partonJetSource", edm::InputTag("NOT IMPLEMENTED"));
573 
574  // track association
575  iDesc.add<bool>("addAssociatedTracks", true);
576  iDesc.add<edm::InputTag>("trackAssociationSource", edm::InputTag("ak4JTA"));
577 
578  // tag info
579  iDesc.add<bool>("addTagInfos", true);
580  std::vector<edm::InputTag> emptyVInputTags;
581  iDesc.add<std::vector<edm::InputTag>>("tagInfoSources", emptyVInputTags);
582 
583  // jet energy corrections
584  iDesc.add<bool>("addJetCorrFactors", true);
585  iDesc.add<std::vector<edm::InputTag>>("jetCorrFactorsSource", emptyVInputTags);
586 
587  // btag discriminator tags
588  iDesc.add<bool>("addBTagInfo", true);
589  iDesc.add<bool>("addDiscriminators", true);
590  iDesc.add<std::vector<edm::InputTag>>("discriminatorSources", emptyVInputTags);
591 
592  // jet flavour idetification configurables
593  iDesc.add<bool>("getJetMCFlavour", true);
594  iDesc.add<bool>("useLegacyJetMCFlavour", false);
595  iDesc.add<bool>("addJetFlavourInfo", false);
596  iDesc.add<edm::InputTag>("JetPartonMapSource", edm::InputTag("jetFlavourAssociationLegacy"));
597  iDesc.add<edm::InputTag>("JetFlavourInfoSource", edm::InputTag("jetFlavourAssociation"));
598 
600 
601  // Efficiency configurables
602  edm::ParameterSetDescription efficienciesPSet;
603  efficienciesPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
604  iDesc.add("efficiencies", efficienciesPSet);
605  iDesc.add<bool>("addEfficiencies", false);
606 
607  // Check to see if the user wants to add user data
608  edm::ParameterSetDescription userDataPSet;
610  iDesc.addOptional("userData", userDataPSet);
611 
612  descriptions.add("PATJetProducer", iDesc);
613 }
614 
ConfigurationDescriptions.h
edm::RefProd
Definition: EDProductfwd.h:25
pat::PATJetProducer::discriminatorTags_
std::vector< edm::InputTag > discriminatorTags_
Definition: PATJetProducer.cc:88
reco::JPTJet
Jets made from CaloJets corrected for ZSP and tracks.
Definition: JPTJet.h:28
pat::PATJetProducer::printWarning_
bool printWarning_
Definition: PATJetProducer.cc:114
pat::PFCandidateFwdPtrCollection
std::vector< edm::FwdPtr< reco::PFCandidate > > PFCandidateFwdPtrCollection
Definition: Jet.h:73
JetTracksAssociation.h
pat::Jet::addBDiscriminatorPair
void addBDiscriminatorPair(const std::pair< std::string, float > &thePair)
method to add a algolabel-discriminator pair
reco::JetID
Jet ID object.
Definition: JetID.h:16
reco::CaloJet
Jets made from CaloTowers.
Definition: CaloJet.h:27
edm::View::begin
const_iterator begin() const
JetTag.h
pat::PATJetProducer::addGenJetMatch_
bool addGenJetMatch_
Definition: PATJetProducer.cc:78
pat::PATUserDataHelper< pat::Jet >
mps_fire.i
i
Definition: mps_fire.py:428
pat::Jet::initializeJEC
void initializeJEC(unsigned int level, const JetCorrFactors::Flavor &flavor=JetCorrFactors::NONE, unsigned int set=0)
initialize the jet to a given JEC level during creation starting from Uncorrected
GreaterByPt
Definition: PtComparator.h:24
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
MessageLogger.h
funct::false
false
Definition: Factorize.h:29
pat::PATJetProducer::addJetFlavourInfo_
bool addJetFlavourInfo_
Definition: PATJetProducer.cc:72
pat::PATJetProducer::genPartonToken_
edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > genPartonToken_
Definition: PATJetProducer.cc:77
edm::FwdRef< reco::GenJetCollection >
pat::PATJetProducer::jetIDMapToken_
edm::EDGetTokenT< reco::JetIDValueMap > jetIDMapToken_
Definition: PATJetProducer.cc:100
reco::PFJet::getPFConstituents
virtual std::vector< reco::PFCandidatePtr > getPFConstituents() const
get all constituents
Definition: PFJet.cc:41
SoftLeptonTagInfo.h
pat::PATJetProducer::PATJetProducer
PATJetProducer(const edm::ParameterSet &iConfig)
Definition: PATJetProducer.cc:121
pat::PATJetProducer::addBTagInfo_
bool addBTagInfo_
Definition: PATJetProducer.cc:86
reco::GenJetCollection
std::vector< GenJet > GenJetCollection
collection of GenJet objects
Definition: GenJetCollection.h:14
pat::helper::EfficiencyLoader
Definition: EfficiencyLoader.h:16
edm::Ref::isAvailable
bool isAvailable() const
Definition: Ref.h:537
pat::Jet::setHadronFlavour
void setHadronFlavour(int hadronFl)
method to set the hadron-based flavour of the jet
edm::EDGetTokenT
Definition: EDGetToken.h:33
JetFlavourInfoMatching.h
Muon.h
pat::Jet::setJetID
void setJetID(reco::JetID const &id)
methods for jet ID
Definition: Jet.h:266
pat::PATUserDataHelper::fillDescription
static void fillDescription(edm::ParameterSetDescription &iDesc)
Definition: PATUserDataHelper.h:135
pos
Definition: PixelAliasList.h:18
pat::PATJetProducer::addEfficiencies_
bool addEfficiencies_
Definition: PATJetProducer.cc:105
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
pat::PATJetProducer::addResolutions_
bool addResolutions_
Definition: PATJetProducer.cc:108
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
pat::Jet::setPFCandidates
void setPFCandidates(const PFCandidateFwdPtrCollection &pfCandidates)
method to store the PFCandidate constituents internally
pat::helper::EfficiencyLoader::enabled
bool enabled() const
'true' if this there is at least one efficiency configured
Definition: EfficiencyLoader.h:25
pat::PATJetProducer::discriminatorTokens_
std::vector< edm::EDGetTokenT< reco::JetFloatAssociation::Container > > discriminatorTokens_
Definition: PATJetProducer.cc:89
pat::CaloTowerFwdPtrCollection
std::vector< edm::FwdPtr< CaloTower > > CaloTowerFwdPtrCollection
Definition: Jet.h:74
EDProducer.h
PtComparator.h
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
pat::PATJetProducer::embedPFCandidates_
bool embedPFCandidates_
Definition: PATJetProducer.cc:69
Association.h
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
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::PATJetProducer::efficiencyLoader_
pat::helper::EfficiencyLoader efficiencyLoader_
Definition: PATJetProducer.cc:106
EfficiencyLoader.h
pat::Jet::setGenParton
void setGenParton(const reco::GenParticleRef &gp, bool embed=false)
method to set the matched parton
Definition: Jet.h:255
pat::helper::KinResolutionsLoader::enabled
bool enabled() const
'true' if this there is at least one efficiency configured
Definition: KinResolutionsLoader.h:27
pat::PATJetProducer::caloPTComparator_
GreaterByPt< CaloTower > caloPTComparator_
Definition: PATJetProducer.cc:103
pat::Jet::setPartonFlavour
void setPartonFlavour(int partonFl)
method to set the parton-based flavour of the jet
CandMatchMap.h
edm::Ref
Definition: AssociativeIterator.h:58
pat::PATJetProducer::embedGenPartonMatch_
bool embedGenPartonMatch_
Definition: PATJetProducer.cc:76
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
GenParticle.h
pat::PATJetProducer::embedGenJetMatch_
bool embedGenJetMatch_
Definition: PATJetProducer.cc:79
pat::JetCorrFactors
Class for the storage of jet correction factors.
Definition: JetCorrFactors.h:37
pat::PATJetProducer::discriminatorLabels_
std::vector< std::string > discriminatorLabels_
Definition: PATJetProducer.cc:90
MakerMacros.h
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
pat::PATJetProducer::jetPartonMapToken_
edm::EDGetTokenT< reco::JetFlavourMatchingCollection > jetPartonMapToken_
Definition: PATJetProducer.cc:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Jet
Definition: Jet.py:1
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
pat::PATJetProducer::addJetCorrFactors_
bool addJetCorrFactors_
Definition: PATJetProducer.cc:83
pat::PATJetProducer::userDataHelper_
pat::PATUserDataHelper< pat::Jet > userDataHelper_
Definition: PATJetProducer.cc:112
pat::PATUserDataHelper::add
void add(ObjectType &patObject, edm::Event const &iEvent, edm::EventSetup const &iSetup)
Definition: PATUserDataHelper.h:114
SecondaryVertexTagInfo.h
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
reco::JPTJet::getCaloJetRef
const edm::RefToBase< reco::Jet > & getCaloJetRef() const
Definition: JPTJet.h:133
pat::PATJetProducer::~PATJetProducer
~PATJetProducer() override
Definition: PATJetProducer.cc:235
TrackIPTagInfo.h
GenParticleFwd.h
pat::PATJetProducer::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition: PATJetProducer.cc:237
pat::Jet::addJECFactors
void addJECFactors(const JetCorrFactors &jec)
add more sets of energy correction factors
Definition: Jet.h:191
pat::helper::KinResolutionsLoader
Definition: KinResolutionsLoader.h:18
KinResolutionsLoader.h
pat::PATJetProducer::addDiscriminators_
bool addDiscriminators_
Definition: PATJetProducer.cc:87
pat::PATJetProducer::addPartonJetMatch_
bool addPartonJetMatch_
Definition: PATJetProducer.cc:81
pat::PATJetProducer::tagInfoTags_
std::vector< edm::InputTag > tagInfoTags_
Definition: PATJetProducer.cc:92
pat::Jet::setCaloTowers
void setCaloTowers(const CaloTowerFwdPtrCollection &caloTowers)
method to store the CaloJet constituents internally
dqmdumpme.k
k
Definition: dqmdumpme.py:60
ParameterSetDescription.h
edm::RefToBase::get
value_type const * get() const
Definition: RefToBase.h:209
pat::PATJetProducer
Produces pat::Jet's.
Definition: PATJetProducer.cc:56
pat::PATJetProducer::useUserData_
bool useUserData_
Definition: PATJetProducer.cc:111
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
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
edm::View::size
size_type size() const
FileInPath.h
pat::Jet::isJPTJet
bool isJPTJet() const
check to see if the jet is a reco::JPTJet
Definition: Jet.h:273
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
TrackProbabilityTagInfo.h
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:681
pat::PATJetProducer::tagInfoTokens_
std::vector< edm::EDGetTokenT< edm::View< reco::BaseTagInfo > > > tagInfoTokens_
Definition: PATJetProducer.cc:93
edm::View
Definition: CaloClusterFwd.h:14
funct::true
true
Definition: Factorize.h:173
pat::PATJetProducer::addJetID_
bool addJetID_
Definition: PATJetProducer.cc:99
edm::ParameterSet
Definition: ParameterSet.h:47
edm::ParameterSetDescription::setComment
void setComment(std::string const &value)
Definition: ParameterSetDescription.cc:33
jetProducer_cfi.genJetMatch
genJetMatch
switch on/off embedding of matched genJet's
Definition: jetProducer_cfi.py:85
CandAssociation.h
pat::PATJetProducer::tagInfoLabels_
std::vector< std::string > tagInfoLabels_
Definition: PATJetProducer.cc:94
Event.h
pat::PATJetProducer::jetFlavourInfoToken_
edm::EDGetTokenT< reco::JetFlavourInfoMatchingCollection > jetFlavourInfoToken_
Definition: PATJetProducer.cc:74
deltaR.h
makeGlobalPositionRcd_cfg.tag
tag
Definition: makeGlobalPositionRcd_cfg.py:6
pat::helper::KinResolutionsLoader::fillDescription
static void fillDescription(edm::ParameterSetDescription &iDesc)
Method for documentation and validation of PSet.
Definition: KinResolutionsLoader.cc:34
UserData.h
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
pat::PATJetProducer::addGenPartonMatch_
bool addGenPartonMatch_
Definition: PATJetProducer.cc:75
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
pat::Jet::setGenJetRef
void setGenJetRef(const edm::FwdRef< reco::GenJetCollection > &gj)
method to set the matched generated jet reference, embedding if requested
iEvent
int iEvent
Definition: GenABIO.cc:224
pat::PATJetProducer::genJetToken_
edm::EDGetTokenT< edm::Association< reco::GenJetCollection > > genJetToken_
Definition: PATJetProducer.cc:80
reco::CaloJet::getCaloConstituents
virtual std::vector< CaloTowerPtr > getCaloConstituents() const
get all constituents
Definition: CaloJet.cc:78
value
Definition: value.py:1
pat::PATJetProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: PATJetProducer.cc:543
edm::stream::EDProducer
Definition: EDProducer.h:36
pat::Jet::isCaloJet
bool isCaloJet() const
check to see if the jet is a reco::CaloJet
Definition: Jet.h:271
edm::EventSetup
Definition: EventSetup.h:58
pat
Definition: HeavyIon.h:7
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
edm::ParameterSetDescription::setAllowAnything
void setAllowAnything()
allow any parameter label/value pairs
Definition: ParameterSetDescription.cc:37
hemisphereProducer_cfi.patJets
patJets
Definition: hemisphereProducer_cfi.py:5
Jet.h
pat::helper::KinResolutionsLoader::newEvent
void newEvent(const edm::Event &event, const edm::EventSetup &setup)
To be called for each new event, reads in the EventSetup object.
Definition: KinResolutionsLoader.cc:27
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
pat::PATJetProducer::jetChargeToken_
edm::EDGetTokenT< reco::JetFloatAssociation::Container > jetChargeToken_
Definition: PATJetProducer.cc:98
InputTag.h
edm::Ptr< reco::Jet >
pat::Jet::isPFJet
bool isPFJet() const
check to see if the jet is a reco::PFJet
Definition: Jet.h:275
ValueMap.h
pat::PATJetProducer::getJetMCFlavour_
bool getJetMCFlavour_
Definition: PATJetProducer.cc:70
eostools.move
def move(src, dest)
Definition: eostools.py:511
pat::PATJetProducer::addTagInfos_
bool addTagInfos_
Definition: PATJetProducer.cc:91
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
TrackCountingTagInfo.h
pat::PATJetProducer::pTComparator_
GreaterByPt< Jet > pTComparator_
Definition: PATJetProducer.cc:102
metsig::jet
Definition: SignAlgoResolutions.h:47
transform.h
pat::PATJetProducer::jetsToken_
edm::EDGetTokenT< edm::View< reco::Jet > > jetsToken_
Definition: PATJetProducer.cc:67
reco::PFCandidateCollection
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
Definition: PFCandidateFwd.h:12
pat::PATJetProducer::useLegacyJetMCFlavour_
bool useLegacyJetMCFlavour_
Definition: PATJetProducer.cc:71
pat::PATJetProducer::addAssociatedTracks_
bool addAssociatedTracks_
Definition: PATJetProducer.cc:95
reco::PFJet
Jets made from PFObjects.
Definition: PFJet.h:20
PATUserDataHelper.h
pat::Jet::addTagInfo
void addTagInfo(const std::string &label, const TagInfoFwdPtrCollection::value_type &info)
pat::PATJetProducer::resolutionLoader_
pat::helper::KinResolutionsLoader resolutionLoader_
Definition: PATJetProducer.cc:109
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::RefToBase< reco::Jet >
pat::Jet::setJetCharge
void setJetCharge(float jetCharge)
method to set the jet charge
pat::PATJetProducer::addJetCharge_
bool addJetCharge_
Definition: PATJetProducer.cc:97
Electron.h
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
pat::PATJetProducer::jetCorrFactorsTokens_
std::vector< edm::EDGetTokenT< edm::ValueMap< JetCorrFactors > > > jetCorrFactorsTokens_
Definition: PATJetProducer.cc:84
JetCorrFactors.h
edm::View::end
const_iterator end() const
View.h
ParameterSet.h
PhotonMonitor_cff.jetId
jetId
Definition: PhotonMonitor_cff.py:70
pat::Jet::setJetFlavourInfo
void setJetFlavourInfo(const reco::JetFlavourInfo &jetFlavourInfo)
method to set the JetFlavourInfo of the jet
edm::Event
Definition: Event.h:73
JetFlavourMatching.h
pat::PATJetProducer::embedCaloTowers_
bool embedCaloTowers_
Definition: PATJetProducer.cc:68
edm::View::ptrAt
Ptr< value_type > ptrAt(size_type i) const
pat::Jet::setAssociatedTracks
void setAssociatedTracks(const reco::TrackRefVector &tracks)
method to set the vector of refs to the tracks associated to this jet
edm::InputTag
Definition: InputTag.h:15
label
const char * label
Definition: PFTauDecayModeTools.cc:11
pat::PATJetProducer::trackAssociationToken_
edm::EDGetTokenT< reco::JetTracksAssociation::Container > trackAssociationToken_
Definition: PATJetProducer.cc:96
jets_cff.levels
levels
Definition: jets_cff.py:21
edm::OwnVector< reco::BaseTagInfo >