CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PATJetProducer.cc
Go to the documentation of this file.
1 //
2 
3 
5 
8 
12 
20 
22 
25 
27 
29 
32 
34 
35 #include <vector>
36 #include <memory>
37 #include <algorithm>
38 
39 using namespace pat;
40 
41 
43  useUserData_(iConfig.exists("userData")),
44  printWarning_(true)
45 {
46  // initialize configurables
47  jetsToken_ = consumes<edm::View<reco::Jet> >(iConfig.getParameter<edm::InputTag>( "jetSource" ));
48  embedCaloTowers_ = false; // parameter is optional
49  if ( iConfig.exists("embedCaloTowers") ) {
50  embedCaloTowers_ = iConfig.getParameter<bool>( "embedCaloTowers" );
51  }
52  embedPFCandidates_ = iConfig.getParameter<bool>( "embedPFCandidates" );
53  getJetMCFlavour_ = iConfig.getParameter<bool>( "getJetMCFlavour" );
54  useLegacyJetMCFlavour_ = iConfig.getParameter<bool>( "useLegacyJetMCFlavour" );
55  addJetFlavourInfo_ = ( useLegacyJetMCFlavour_ ? false : iConfig.getParameter<bool>( "addJetFlavourInfo" ) );
56  jetPartonMapToken_ = mayConsume<reco::JetFlavourMatchingCollection>(iConfig.getParameter<edm::InputTag>( "JetPartonMapSource" ));
57  jetFlavourInfoToken_ = mayConsume<reco::JetFlavourInfoMatchingCollection>(iConfig.getParameter<edm::InputTag>( "JetFlavourInfoSource" ));
58  addGenPartonMatch_ = iConfig.getParameter<bool>( "addGenPartonMatch" );
59  embedGenPartonMatch_ = iConfig.getParameter<bool>( "embedGenPartonMatch" );
60  genPartonToken_ = mayConsume<edm::Association<reco::GenParticleCollection> >(iConfig.getParameter<edm::InputTag>( "genPartonMatch" ));
61  addGenJetMatch_ = iConfig.getParameter<bool>( "addGenJetMatch" );
62  embedGenJetMatch_ = iConfig.getParameter<bool>( "embedGenJetMatch" );
63  genJetToken_ = mayConsume<edm::Association<reco::GenJetCollection> >(iConfig.getParameter<edm::InputTag>( "genJetMatch" ));
64  addPartonJetMatch_ = iConfig.getParameter<bool>( "addPartonJetMatch" );
65 // partonJetToken_ = mayConsume<reco::SomePartonJetType>(iConfig.getParameter<edm::InputTag>( "partonJetSource" ));
66  addJetCorrFactors_ = iConfig.getParameter<bool>( "addJetCorrFactors" );
67  if( addJetCorrFactors_ ) {
68  jetCorrFactorsTokens_ = edm::vector_transform(iConfig.getParameter<std::vector<edm::InputTag> >( "jetCorrFactorsSource" ), [this](edm::InputTag const & tag){return consumes<edm::ValueMap<JetCorrFactors> >(tag);});
69  }
70  addBTagInfo_ = iConfig.getParameter<bool>( "addBTagInfo" );
71  addDiscriminators_ = iConfig.getParameter<bool>( "addDiscriminators" );
72  discriminatorTags_ = iConfig.getParameter<std::vector<edm::InputTag> >( "discriminatorSources" );
73  discriminatorTokens_ = edm::vector_transform(discriminatorTags_, [this](edm::InputTag const & tag){return mayConsume<reco::JetFloatAssociation::Container>(tag);});
74  addTagInfos_ = iConfig.getParameter<bool>( "addTagInfos" );
75  tagInfoTags_ = iConfig.getParameter<std::vector<edm::InputTag> >( "tagInfoSources" );
76  tagInfoTokens_ =edm::vector_transform(tagInfoTags_, [this](edm::InputTag const & tag){return mayConsume<edm::View<reco::BaseTagInfo> >(tag);});
77  addAssociatedTracks_ = iConfig.getParameter<bool>( "addAssociatedTracks" );
78  trackAssociationToken_ = mayConsume<reco::JetTracksAssociation::Container>(iConfig.getParameter<edm::InputTag>( "trackAssociationSource" ));
79  addJetCharge_ = iConfig.getParameter<bool>( "addJetCharge" );
80  jetChargeToken_ = mayConsume<reco::JetFloatAssociation::Container>(iConfig.getParameter<edm::InputTag>( "jetChargeSource" ));
81  addJetID_ = iConfig.getParameter<bool>( "addJetID");
82  jetIDMapToken_ = mayConsume<reco::JetIDValueMap>(iConfig.getParameter<edm::InputTag>( "jetIDMap"));
83  // Efficiency configurables
84  addEfficiencies_ = iConfig.getParameter<bool>("addEfficiencies");
85  if (addEfficiencies_) {
86  efficiencyLoader_ = pat::helper::EfficiencyLoader(iConfig.getParameter<edm::ParameterSet>("efficiencies"), consumesCollector());
87  }
88  // Resolution configurables
89  addResolutions_ = iConfig.getParameter<bool>("addResolutions");
90  if (addResolutions_) {
91  resolutionLoader_ = pat::helper::KinResolutionsLoader(iConfig.getParameter<edm::ParameterSet>("resolutions"));
92  }
93  if (discriminatorTags_.empty()) {
94  addDiscriminators_ = false;
95  } else {
96  for (std::vector<edm::InputTag>::const_iterator it = discriminatorTags_.begin(), ed = discriminatorTags_.end(); it != ed; ++it) {
97  std::string label = it->label();
98  std::string::size_type pos = label.find("JetTags");
99  if ((pos != std::string::npos) && (pos != label.length() - 7)) {
100  label.erase(pos+7); // trim a tail after "JetTags"
101  }
102  if(it->instance().size()) {
103  label = (label+std::string(":")+it->instance());
104  }
105  discriminatorLabels_.push_back(label);
106  }
107  }
108  if (tagInfoTags_.empty()) {
109  addTagInfos_ = false;
110  } else {
111  for (std::vector<edm::InputTag>::const_iterator it = tagInfoTags_.begin(), ed = tagInfoTags_.end(); it != ed; ++it) {
112  std::string label = it->label();
113  std::string::size_type pos = label.find("TagInfos");
114  if ((pos != std::string::npos) && (pos != label.length() - 8)) {
115  label.erase(pos+8); // trim a tail after "TagInfos"
116  }
117  tagInfoLabels_.push_back(label);
118  }
119  }
120  if (!addBTagInfo_) { addDiscriminators_ = false; addTagInfos_ = false; }
121  // Check to see if the user wants to add user data
122  if ( useUserData_ ) {
123  userDataHelper_ = PATUserDataHelper<Jet>(iConfig.getParameter<edm::ParameterSet>("userData"), consumesCollector());
124  }
125  // produces vector of jets
126  produces<std::vector<Jet> >();
127  produces<reco::GenJetCollection> ("genJets");
128  produces<std::vector<CaloTower> > ("caloTowers");
129  produces<reco::PFCandidateCollection > ("pfCandidates");
130  produces<edm::OwnVector<reco::BaseTagInfo> > ("tagInfos");
131 }
132 
133 
134 PATJetProducer::~PATJetProducer() {
135 
136 }
137 
138 
140 {
141  // check whether dealing with MC or real data
142  if (iEvent.isRealData()){
143  getJetMCFlavour_ = false;
144  useLegacyJetMCFlavour_ = false;
145  addJetFlavourInfo_ = false;
146  addGenPartonMatch_ = false;
147  addGenJetMatch_ = false;
148  addPartonJetMatch_ = false;
149  }
150 
151  // Get the vector of jets
153  iEvent.getByToken(jetsToken_, jets);
154 
156  if (resolutionLoader_.enabled()) resolutionLoader_.newEvent(iEvent, iSetup);
157 
158  // for jet flavour
162  else if (getJetMCFlavour_ && !useLegacyJetMCFlavour_) iEvent.getByToken (jetFlavourInfoToken_, jetFlavInfoMatch);
163 
164  // Get the vector of generated particles from the event if needed
166  if (addGenPartonMatch_) iEvent.getByToken(genPartonToken_, partonMatch);
167  // Get the vector of GenJets from the event if needed
169  if (addGenJetMatch_) iEvent.getByToken(genJetToken_, genJetMatch);
170 /* TO BE IMPLEMENTED FOR >= 1_5_X
171  // Get the vector of PartonJets from the event if needed
172  edm::Handle<edm::View<reco::SomePartonJetType> > partonJets;
173  if (addPartonJetMatch_) iEvent.getByToken(partonJetToken_, partonJets);
174 */
175 
176  // read in the jet correction factors ValueMap
177  std::vector<edm::ValueMap<JetCorrFactors> > jetCorrs;
178  if (addJetCorrFactors_) {
179  for ( size_t i = 0; i < jetCorrFactorsTokens_.size(); ++i ) {
181  iEvent.getByToken(jetCorrFactorsTokens_[i], jetCorr);
182  jetCorrs.push_back( *jetCorr );
183  }
184  }
185 
186  // Get the vector of jet tags with b-tagging info
187  std::vector<edm::Handle<reco::JetFloatAssociation::Container> > jetDiscriminators;
189  jetDiscriminators.resize(discriminatorTokens_.size());
190  for (size_t i = 0; i < discriminatorTokens_.size(); ++i) {
191  iEvent.getByToken(discriminatorTokens_[i], jetDiscriminators[i]);
192  }
193  }
194  std::vector<edm::Handle<edm::View<reco::BaseTagInfo> > > jetTagInfos;
195  if (addBTagInfo_ && addTagInfos_) {
196  jetTagInfos.resize(tagInfoTokens_.size());
197  for (size_t i = 0; i < tagInfoTokens_.size(); ++i) {
198  iEvent.getByToken(tagInfoTokens_[i], jetTagInfos[i]);
199  }
200  }
201 
202  // tracks Jet Track Association
206  if (addJetCharge_) iEvent.getByToken(jetChargeToken_, hJetChargeAss);
207 
208  // jet ID handle
210  if ( addJetID_ ) iEvent.getByToken( jetIDMapToken_, hJetIDMap );
211 
212  // loop over jets
213  std::auto_ptr< std::vector<Jet> > patJets ( new std::vector<Jet>() );
214 
215  std::auto_ptr<reco::GenJetCollection > genJetsOut ( new reco::GenJetCollection() );
216  std::auto_ptr<std::vector<CaloTower> > caloTowersOut( new std::vector<CaloTower> () );
217  std::auto_ptr<reco::PFCandidateCollection > pfCandidatesOut( new reco::PFCandidateCollection() );
218  std::auto_ptr<edm::OwnVector<reco::BaseTagInfo> > tagInfosOut ( new edm::OwnVector<reco::BaseTagInfo>() );
219 
220 
222  edm::RefProd<std::vector<CaloTower> > h_caloTowersOut = iEvent.getRefBeforePut<std::vector<CaloTower> > ( "caloTowers" );
223  edm::RefProd<reco::PFCandidateCollection > h_pfCandidatesOut = iEvent.getRefBeforePut<reco::PFCandidateCollection > ( "pfCandidates" );
225 
226  for (edm::View<reco::Jet>::const_iterator itJet = jets->begin(); itJet != jets->end(); itJet++) {
227 
228  // construct the Jet from the ref -> save ref to original object
229  unsigned int idx = itJet - jets->begin();
230  edm::RefToBase<reco::Jet> jetRef = jets->refAt(idx);
231  edm::Ptr<reco::Jet> jetPtr = jets->ptrAt(idx);
232  Jet ajet(jetRef);
233 
234  // add the FwdPtrs to the CaloTowers
235  if ( (ajet.isCaloJet() || ajet.isJPTJet() ) && embedCaloTowers_) {
236  const reco::CaloJet *cj = 0;
237  const reco::JPTJet * jptj = 0;
238  if ( ajet.isCaloJet()) cj = dynamic_cast<const reco::CaloJet *>(jetRef.get());
239  else {
240  jptj = dynamic_cast<const reco::JPTJet *>(jetRef.get() );
241  cj = dynamic_cast<const reco::CaloJet *>(jptj->getCaloJetRef().get() );
242  }
244  std::vector< CaloTowerPtr > itowers = cj->getCaloConstituents();
245  for ( std::vector<CaloTowerPtr>::const_iterator towBegin = itowers.begin(), towEnd = itowers.end(), itow = towBegin; itow != towEnd; ++itow ) {
246  if( itow->isAvailable() && itow->isNonnull() ){
247  caloTowersOut->push_back( **itow );
248  // set the "forward" ref to the thinned collection
249  edm::Ref<std::vector<CaloTower> > caloTowerRef( h_caloTowersOut, caloTowersOut->size() - 1);
250  edm::Ptr<CaloTower> caloForwardRef ( h_caloTowersOut.id(), caloTowerRef.key(), h_caloTowersOut.productGetter() );
251  // set the "backward" ref to the original collection for association
252  edm::Ptr<CaloTower> caloBackRef ( *itow );
253  // add to the list of FwdPtr's
254  itowersRef.push_back( pat::CaloTowerFwdPtrCollection::value_type ( caloForwardRef, caloBackRef ) );
255  }
256  }
257  ajet.setCaloTowers( itowersRef );
258  }
259 
260  // add the FwdPtrs to the PFCandidates
261  if (ajet.isPFJet() && embedPFCandidates_) {
262  const reco::PFJet *cj = dynamic_cast<const reco::PFJet *>(jetRef.get());
263  pat::PFCandidateFwdPtrCollection iparticlesRef;
264  std::vector< reco::PFCandidatePtr > iparticles = cj->getPFConstituents();
265  for ( std::vector<reco::PFCandidatePtr>::const_iterator partBegin = iparticles.begin(),
266  partEnd = iparticles.end(), ipart = partBegin;
267  ipart != partEnd; ++ipart ) {
268  pfCandidatesOut->push_back( **ipart );
269  // set the "forward" ref to the thinned collection
270  edm::Ref<reco::PFCandidateCollection> pfCollectionRef( h_pfCandidatesOut, pfCandidatesOut->size() - 1);
271  edm::Ptr<reco::PFCandidate> pfForwardRef ( h_pfCandidatesOut.id(), pfCollectionRef.key(), h_pfCandidatesOut.productGetter() );
272  // set the "backward" ref to the original collection for association
273  edm::Ptr<reco::PFCandidate> pfBackRef ( *ipart );
274  // add to the list of FwdPtr's
275  iparticlesRef.push_back( pat::PFCandidateFwdPtrCollection::value_type ( pfForwardRef, pfBackRef ) );
276  }
277  ajet.setPFCandidates( iparticlesRef );
278  }
279 
280  if (addJetCorrFactors_) {
281  // add additional JetCorrs to the jet
282  for ( unsigned int i=0; i<jetCorrFactorsTokens_.size(); ++i ) {
283  const JetCorrFactors& jcf = jetCorrs[i][jetRef];
284  // uncomment for debugging
285  // jcf.print();
286  ajet.addJECFactors(jcf);
287  }
288  std::vector<std::string> levels = jetCorrs[0][jetRef].correctionLabels();
289  if(std::find(levels.begin(), levels.end(), "L2L3Residual")!=levels.end()){
290  ajet.initializeJEC(jetCorrs[0][jetRef].jecLevel("L2L3Residual"));
291  }
292  else if(std::find(levels.begin(), levels.end(), "L3Absolute")!=levels.end()){
293  ajet.initializeJEC(jetCorrs[0][jetRef].jecLevel("L3Absolute"));
294  }
295  else{
296  ajet.initializeJEC(jetCorrs[0][jetRef].jecLevel("Uncorrected"));
297  if(printWarning_){
298  edm::LogWarning("L3Absolute not found") << "L2L3Residual and L3Absolute are not part of the jetCorrFactors\n"
299  << "of module " << jetCorrs[0][jetRef].jecSet() << ". Jets will remain"
300  << " uncorrected."; printWarning_=false;
301  }
302  }
303  }
304 
305  // get the MC flavour information for this jet
307  ajet.setPartonFlavour( (*jetFlavMatch)[edm::RefToBase<reco::Jet>(jetRef)].getFlavour() );
308  }
310  if ( addJetFlavourInfo_ ) ajet.setJetFlavourInfo( (*jetFlavInfoMatch)[edm::RefToBase<reco::Jet>(jetRef)] );
311  else
312  {
313  ajet.setPartonFlavour( (*jetFlavInfoMatch)[edm::RefToBase<reco::Jet>(jetRef)].getPartonFlavour() );
314  ajet.setHadronFlavour( (*jetFlavInfoMatch)[edm::RefToBase<reco::Jet>(jetRef)].getHadronFlavour() );
315  }
316  }
317  // store the match to the generated partons
318  if (addGenPartonMatch_) {
319  reco::GenParticleRef parton = (*partonMatch)[jetRef];
320  if (parton.isNonnull() && parton.isAvailable()) {
321  ajet.setGenParton(parton, embedGenPartonMatch_);
322  } // leave empty if no match found
323  }
324  // store the match to the GenJets
325  if (addGenJetMatch_) {
326  reco::GenJetRef genjet = (*genJetMatch)[jetRef];
327  if (genjet.isNonnull() && genjet.isAvailable()) {
328  genJetsOut->push_back( *genjet );
329  // set the "forward" ref to the thinned collection
330  edm::Ref<reco::GenJetCollection > genForwardRef ( h_genJetsOut, genJetsOut->size() - 1 );
331  // set the "backward" ref to the original collection
332  edm::Ref<reco::GenJetCollection > genBackRef ( genjet );
333  // make the FwdPtr
334  edm::FwdRef<reco::GenJetCollection > genjetFwdRef ( genForwardRef, genBackRef );
335  ajet.setGenJetRef(genjetFwdRef );
336  } // leave empty if no match found
337  }
338 
339  if (efficiencyLoader_.enabled()) {
340  efficiencyLoader_.setEfficiencies( ajet, jetRef );
341  }
342 
343  // IMPORTANT: DO THIS AFTER JES CORRECTIONS
344  if (resolutionLoader_.enabled()) {
346  }
347 
348  // TO BE IMPLEMENTED FOR >=1_5_X: do the PartonJet matching
349  if (addPartonJetMatch_) {
350  }
351 
352  // add b-tag info if available & required
353  if (addBTagInfo_) {
354  if (addDiscriminators_) {
355  for (size_t k=0; k<jetDiscriminators.size(); ++k) {
356  float value = (*jetDiscriminators[k])[jetRef];
357  ajet.addBDiscriminatorPair(std::make_pair(discriminatorLabels_[k], value));
358  }
359  }
360  if (addTagInfos_) {
361  for (size_t k=0; k<jetTagInfos.size(); ++k) {
362  const edm::View<reco::BaseTagInfo> & taginfos = *jetTagInfos[k];
363  // This is not associative, so we have to search the jet
365  // Try first by 'same index'
366  if ((idx < taginfos.size()) && (taginfos[idx].jet() == jetRef)) {
367  match = taginfos.ptrAt(idx);
368  } else {
369  // otherwise fail back to a simple search
370  for (edm::View<reco::BaseTagInfo>::const_iterator itTI = taginfos.begin(), edTI = taginfos.end(); itTI != edTI; ++itTI) {
371  if (itTI->jet() == jetRef) { match = taginfos.ptrAt( itTI - taginfos.begin() ); break; }
372  }
373  }
374  if (match.isNonnull()) {
375  tagInfosOut->push_back( match->clone() );
376  // set the "forward" ptr to the thinned collection
377  edm::Ptr<reco::BaseTagInfo> tagInfoForwardPtr ( h_tagInfosOut.id(), &tagInfosOut->back(), tagInfosOut->size() - 1 );
378  // set the "backward" ptr to the original collection for association
379  edm::Ptr<reco::BaseTagInfo> tagInfoBackPtr ( match );
380  // make FwdPtr
381  TagInfoFwdPtrCollection::value_type tagInfoFwdPtr( tagInfoForwardPtr, tagInfoBackPtr ) ;
382  ajet.addTagInfo(tagInfoLabels_[k], tagInfoFwdPtr );
383  }
384  }
385  }
386  }
387 
388  if (addAssociatedTracks_) ajet.setAssociatedTracks( (*hTrackAss)[jetRef] );
389 
390  if (addJetCharge_) ajet.setJetCharge( (*hJetChargeAss)[jetRef] );
391 
392  // add jet ID for calo jets
393  if (addJetID_ && ajet.isCaloJet() ) {
394  reco::JetID jetId = (*hJetIDMap)[ jetRef ];
395  ajet.setJetID( jetId );
396  }
397  // add jet ID jpt jets
398  else if ( addJetID_ && ajet.isJPTJet() ){
399  const reco::JPTJet *jptj = dynamic_cast<const reco::JPTJet *>(jetRef.get());
400  reco::JetID jetId = (*hJetIDMap)[ jptj->getCaloJetRef() ];
401  ajet.setJetID( jetId );
402  }
403  if ( useUserData_ ) {
404  userDataHelper_.add( ajet, iEvent, iSetup );
405  }
406  patJets->push_back(ajet);
407  }
408 
409  // sort jets in pt
410  std::sort(patJets->begin(), patJets->end(), pTComparator_);
411 
412  // put genEvt in Event
413  iEvent.put(patJets);
414 
415  iEvent.put( genJetsOut, "genJets" );
416  iEvent.put( caloTowersOut, "caloTowers" );
417  iEvent.put( pfCandidatesOut, "pfCandidates" );
418  iEvent.put( tagInfosOut, "tagInfos" );
419 
420 
421 }
422 
423 // ParameterSet description for module
425 {
427  iDesc.setComment("PAT jet producer module");
428 
429  // input source
430  iDesc.add<edm::InputTag>("jetSource", edm::InputTag("no default"))->setComment("input collection");
431 
432  // embedding
433  iDesc.addOptional<bool>("embedCaloTowers", false)->setComment("embed external CaloTowers (not to be used on AOD input)");
434  iDesc.add<bool>("embedPFCandidates", true)->setComment("embed external PFCandidates");
435 
436  // MC matching configurables
437  iDesc.add<bool>("addGenPartonMatch", true)->setComment("add MC matching");
438  iDesc.add<bool>("embedGenPartonMatch", false)->setComment("embed MC matched MC information");
439  iDesc.add<edm::InputTag>("genPartonMatch", edm::InputTag())->setComment("input with MC match information");
440 
441  iDesc.add<bool>("addGenJetMatch", true)->setComment("add MC matching");
442  iDesc.add<bool>("embedGenJetMatch", false)->setComment("embed MC matched MC information");
443  iDesc.add<edm::InputTag>("genJetMatch", edm::InputTag())->setComment("input with MC match information");
444 
445  iDesc.add<bool>("addJetCharge", true);
446  iDesc.add<edm::InputTag>("jetChargeSource", edm::InputTag("patJetCharge"));
447 
448  // jet id
449  iDesc.add<bool>("addJetID", true)->setComment("Add jet ID information");
450  iDesc.add<edm::InputTag>("jetIDMap", edm::InputTag())->setComment("jet id map");
451 
452  iDesc.add<bool>("addPartonJetMatch", false);
453  iDesc.add<edm::InputTag>("partonJetSource", edm::InputTag("NOT IMPLEMENTED"));
454 
455  // track association
456  iDesc.add<bool>("addAssociatedTracks", true);
457  iDesc.add<edm::InputTag>("trackAssociationSource", edm::InputTag("ak4JTA"));
458 
459  // tag info
460  iDesc.add<bool>("addTagInfos", true);
461  std::vector<edm::InputTag> emptyVInputTags;
462  iDesc.add<std::vector<edm::InputTag> >("tagInfoSources", emptyVInputTags);
463 
464  // jet energy corrections
465  iDesc.add<bool>("addJetCorrFactors", true);
466  iDesc.add<std::vector<edm::InputTag> >("jetCorrFactorsSource", emptyVInputTags);
467 
468  // btag discriminator tags
469  iDesc.add<bool>("addBTagInfo",true);
470  iDesc.add<bool>("addDiscriminators", true);
471  iDesc.add<std::vector<edm::InputTag> >("discriminatorSources", emptyVInputTags);
472 
473  // jet flavour idetification configurables
474  iDesc.add<bool>("getJetMCFlavour", true);
475  iDesc.add<bool>("useLegacyJetMCFlavour", false);
476  iDesc.add<bool>("addJetFlavourInfo", false);
477  iDesc.add<edm::InputTag>("JetPartonMapSource", edm::InputTag("jetFlavourAssociationLegacy"));
478  iDesc.add<edm::InputTag>("JetFlavourInfoSource", edm::InputTag("jetFlavourAssociation"));
479 
481 
482  // Efficiency configurables
483  edm::ParameterSetDescription efficienciesPSet;
484  efficienciesPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
485  iDesc.add("efficiencies", efficienciesPSet);
486  iDesc.add<bool>("addEfficiencies", false);
487 
488  // Check to see if the user wants to add user data
489  edm::ParameterSetDescription userDataPSet;
491  iDesc.addOptional("userData", userDataPSet);
492 
493  descriptions.add("PATJetProducer", iDesc);
494 }
495 
497 
499 
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
void setJetID(reco::JetID const &id)
methods for jet ID
Definition: Jet.h:244
bool isAvailable() const
Definition: Ref.h:576
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 ...
value_type const * get() const
Definition: RefToBase.h:234
T getParameter(std::string const &) const
pat::helper::EfficiencyLoader efficiencyLoader_
Assists in assimilating all pat::UserData into pat objects.
void setGenParton(const reco::GenParticleRef &gp, bool embed=false)
method to set the matched parton
Definition: Jet.h:232
int i
Definition: DBlmapReader.cc:9
void newEvent(const edm::Event &event)
To be called for each new event, reads in the ValueMaps for efficiencies.
edm::EDGetTokenT< edm::View< reco::Jet > > jetsToken_
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
void addJECFactors(const JetCorrFactors &jec)
add more sets of energy correction factors
Definition: Jet.h:172
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
std::vector< edm::EDGetTokenT< edm::View< reco::BaseTagInfo > > > tagInfoTokens_
edm::EDGetTokenT< reco::JetTracksAssociation::Container > trackAssociationToken_
Jets made from CaloTowers.
Definition: CaloJet.h:29
std::vector< std::string > tagInfoLabels_
std::vector< edm::EDGetTokenT< edm::ValueMap< JetCorrFactors > > > jetCorrFactorsTokens_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
void setAllowAnything()
allow any parameter label/value pairs
Ptr< value_type > ptrAt(size_type i) const
pat::helper::KinResolutionsLoader resolutionLoader_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::vector< GenJet > GenJetCollection
collection of GenJet objects
std::vector< std::string > discriminatorLabels_
bool exists(std::string const &parameterName) const
checks if a parameter exists
size_type size() const
const edm::RefToBase< reco::Jet > & getCaloJetRef() const
Definition: JPTJet.h:130
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
Jet ID object.
Definition: JetID.h:16
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
virtual std::vector< CaloTowerPtr > getCaloConstituents() const
get all constituents
Definition: CaloJet.cc:93
void addBDiscriminatorPair(const std::pair< std::string, float > &thePair)
method to add a algolabel-discriminator pair
void setResolutions(pat::PATObject< T > &obj) const
Sets the efficiencies for this object, using the reference to the original objects.
edm::EDGetTokenT< reco::JetFlavourInfoMatchingCollection > jetFlavourInfoToken_
uint16_t size_type
bool isRealData() const
Definition: EventBase.h:63
Jets made from PFObjects.
Definition: PFJet.h:21
void setCaloTowers(const CaloTowerFwdPtrCollection &caloTowers)
method to store the CaloJet constituents internally
GreaterByPt< Jet > pTComparator_
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
static void fillDescription(edm::ParameterSetDescription &iDesc)
PATJetProducer(const edm::ParameterSet &iConfig)
bool isCaloJet() const
check to see if the jet is a reco::CaloJet
Definition: Jet.h:249
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::EDGetTokenT< reco::JetFloatAssociation::Container > jetChargeToken_
void setHadronFlavour(int hadronFl)
method to set the hadron-based flavour of the jet
void setComment(std::string const &value)
int iEvent
Definition: GenABIO.cc:230
const_iterator begin() const
void setPartonFlavour(int partonFl)
method to set the parton-based flavour of the jet
void setPFCandidates(const PFCandidateFwdPtrCollection &pfCandidates)
method to store the PFCandidate constituents internally
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
void newEvent(const edm::Event &event, const edm::EventSetup &setup)
To be called for each new event, reads in the EventSetup object.
Jets made from CaloJets corrected for ZSP and tracks.
Definition: JPTJet.h:29
Class for the storage of jet correction factors.
vector< PseudoJet > jets
void setJetCharge(float jetCharge)
method to set the jet charge
edm::EDGetTokenT< reco::JetIDValueMap > jetIDMapToken_
Produces pat::Jet&#39;s.
void setJetFlavourInfo(const reco::JetFlavourInfo &jetFlavourInfo)
method to set the JetFlavourInfo of the jet
ParameterDescriptionBase * add(U const &iLabel, T const &value)
RefProd< PROD > getRefBeforePut()
Definition: Event.h:141
bool isPFJet() const
check to see if the jet is a reco::PFJet
Definition: Jet.h:253
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:169
bool isJPTJet() const
check to see if the jet is a reco::JPTJet
Definition: Jet.h:251
pat::PATUserDataHelper< pat::Jet > userDataHelper_
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
void setAssociatedTracks(const reco::TrackRefVector &tracks)
method to set the vector of refs to the tracks associated to this jet
edm::EDGetTokenT< reco::JetFlavourMatchingCollection > jetPartonMapToken_
static void fillDescription(edm::ParameterSetDescription &iDesc)
Method for documentation and validation of PSet.
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
std::vector< edm::FwdPtr< CaloTower > > CaloTowerFwdPtrCollection
Definition: Jet.h:74
std::vector< edm::FwdPtr< reco::PFCandidate > > PFCandidateFwdPtrCollection
Definition: Jet.h:73
void setGenJetRef(const edm::FwdRef< reco::GenJetCollection > &gj)
method to set the matched generated jet reference, embedding if requested
void setEfficiencies(pat::PATObject< T > &obj, const R &originalRef) const
Sets the efficiencies for this object, using the reference to the original objects.
Analysis-level calorimeter jet class.
Definition: Jet.h:78
void add(std::string const &label, ParameterSetDescription const &psetDescription)
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
edm::EDGetTokenT< edm::Association< reco::GenJetCollection > > genJetToken_
std::vector< edm::EDGetTokenT< reco::JetFloatAssociation::Container > > discriminatorTokens_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > genPartonToken_
virtual std::vector< reco::PFCandidatePtr > getPFConstituents() const
get all constituents
Definition: PFJet.cc:52
const_iterator end() const
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
void addTagInfo(const std::string &label, const TagInfoFwdPtrCollection::value_type &info)