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 
40 using namespace pat;
41 
42 
44  useUserData_(iConfig.exists("userData"))
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  discriminatorLabels_.push_back(label);
103  }
104  }
105  if (tagInfoTags_.empty()) {
106  addTagInfos_ = false;
107  } else {
108  for (std::vector<edm::InputTag>::const_iterator it = tagInfoTags_.begin(), ed = tagInfoTags_.end(); it != ed; ++it) {
109  std::string label = it->label();
110  std::string::size_type pos = label.find("TagInfos");
111  if ((pos != std::string::npos) && (pos != label.length() - 8)) {
112  label.erase(pos+8); // trim a tail after "TagInfos"
113  }
114  tagInfoLabels_.push_back(label);
115  }
116  }
117  if (!addBTagInfo_) { addDiscriminators_ = false; addTagInfos_ = false; }
118  // Check to see if the user wants to add user data
119  if ( useUserData_ ) {
120  userDataHelper_ = PATUserDataHelper<Jet>(iConfig.getParameter<edm::ParameterSet>("userData"), consumesCollector());
121  }
122  // produces vector of jets
123  produces<std::vector<Jet> >();
124  produces<reco::GenJetCollection> ("genJets");
125  produces<std::vector<CaloTower> > ("caloTowers");
126  produces<reco::PFCandidateCollection > ("pfCandidates");
127  produces<edm::OwnVector<reco::BaseTagInfo> > ("tagInfos");
128 }
129 
130 
131 PATJetProducer::~PATJetProducer() {
132 
133 }
134 
135 
137 {
138  // check whether dealing with MC or real data
139  if (iEvent.isRealData()){
140  getJetMCFlavour_ = false;
141  useLegacyJetMCFlavour_ = false;
142  addJetFlavourInfo_ = false;
143  addGenPartonMatch_ = false;
144  addGenJetMatch_ = false;
145  addPartonJetMatch_ = false;
146  }
147 
148  // Get the vector of jets
150  iEvent.getByToken(jetsToken_, jets);
151 
153  if (resolutionLoader_.enabled()) resolutionLoader_.newEvent(iEvent, iSetup);
154 
155  // for jet flavour
159  else if (getJetMCFlavour_ && !useLegacyJetMCFlavour_) iEvent.getByToken (jetFlavourInfoToken_, jetFlavInfoMatch);
160 
161  // Get the vector of generated particles from the event if needed
163  if (addGenPartonMatch_) iEvent.getByToken(genPartonToken_, partonMatch);
164  // Get the vector of GenJets from the event if needed
166  if (addGenJetMatch_) iEvent.getByToken(genJetToken_, genJetMatch);
167 /* TO BE IMPLEMENTED FOR >= 1_5_X
168  // Get the vector of PartonJets from the event if needed
169  edm::Handle<edm::View<reco::SomePartonJetType> > partonJets;
170  if (addPartonJetMatch_) iEvent.getByToken(partonJetToken_, partonJets);
171 */
172 
173  // read in the jet correction factors ValueMap
174  std::vector<edm::ValueMap<JetCorrFactors> > jetCorrs;
175  if (addJetCorrFactors_) {
176  for ( size_t i = 0; i < jetCorrFactorsTokens_.size(); ++i ) {
178  iEvent.getByToken(jetCorrFactorsTokens_[i], jetCorr);
179  jetCorrs.push_back( *jetCorr );
180  }
181  }
182 
183  // Get the vector of jet tags with b-tagging info
184  std::vector<edm::Handle<reco::JetFloatAssociation::Container> > jetDiscriminators;
186  jetDiscriminators.resize(discriminatorTokens_.size());
187  for (size_t i = 0; i < discriminatorTokens_.size(); ++i) {
188  iEvent.getByToken(discriminatorTokens_[i], jetDiscriminators[i]);
189  }
190  }
191  std::vector<edm::Handle<edm::View<reco::BaseTagInfo> > > jetTagInfos;
192  if (addBTagInfo_ && addTagInfos_) {
193  jetTagInfos.resize(tagInfoTokens_.size());
194  for (size_t i = 0; i < tagInfoTokens_.size(); ++i) {
195  iEvent.getByToken(tagInfoTokens_[i], jetTagInfos[i]);
196  }
197  }
198 
199  // tracks Jet Track Association
203  if (addJetCharge_) iEvent.getByToken(jetChargeToken_, hJetChargeAss);
204 
205  // jet ID handle
207  if ( addJetID_ ) iEvent.getByToken( jetIDMapToken_, hJetIDMap );
208 
209  // loop over jets
210  std::auto_ptr< std::vector<Jet> > patJets ( new std::vector<Jet>() );
211 
212  std::auto_ptr<reco::GenJetCollection > genJetsOut ( new reco::GenJetCollection() );
213  std::auto_ptr<std::vector<CaloTower> > caloTowersOut( new std::vector<CaloTower> () );
214  std::auto_ptr<reco::PFCandidateCollection > pfCandidatesOut( new reco::PFCandidateCollection() );
215  std::auto_ptr<edm::OwnVector<reco::BaseTagInfo> > tagInfosOut ( new edm::OwnVector<reco::BaseTagInfo>() );
216 
217 
219  edm::RefProd<std::vector<CaloTower> > h_caloTowersOut = iEvent.getRefBeforePut<std::vector<CaloTower> > ( "caloTowers" );
220  edm::RefProd<reco::PFCandidateCollection > h_pfCandidatesOut = iEvent.getRefBeforePut<reco::PFCandidateCollection > ( "pfCandidates" );
222 
223  bool first=true; // this is introduced to issue warnings only for the first jet
224  for (edm::View<reco::Jet>::const_iterator itJet = jets->begin(); itJet != jets->end(); itJet++) {
225 
226  // construct the Jet from the ref -> save ref to original object
227  unsigned int idx = itJet - jets->begin();
228  edm::RefToBase<reco::Jet> jetRef = jets->refAt(idx);
229  edm::Ptr<reco::Jet> jetPtr = jets->ptrAt(idx);
230  Jet ajet(jetRef);
231 
232  // add the FwdPtrs to the CaloTowers
233  if ( (ajet.isCaloJet() || ajet.isJPTJet() ) && embedCaloTowers_) {
234  const reco::CaloJet *cj = 0;
235  const reco::JPTJet * jptj = 0;
236  if ( ajet.isCaloJet()) cj = dynamic_cast<const reco::CaloJet *>(jetRef.get());
237  else {
238  jptj = dynamic_cast<const reco::JPTJet *>(jetRef.get() );
239  cj = dynamic_cast<const reco::CaloJet *>(jptj->getCaloJetRef().get() );
240  }
242  std::vector< CaloTowerPtr > itowers = cj->getCaloConstituents();
243  for ( std::vector<CaloTowerPtr>::const_iterator towBegin = itowers.begin(), towEnd = itowers.end(), itow = towBegin; itow != towEnd; ++itow ) {
244  if( itow->isAvailable() && itow->isNonnull() ){
245  caloTowersOut->push_back( **itow );
246  // set the "forward" ref to the thinned collection
247  edm::Ref<std::vector<CaloTower> > caloTowerRef( h_caloTowersOut, caloTowersOut->size() - 1);
248  edm::Ptr<CaloTower> caloForwardRef ( h_caloTowersOut.id(), caloTowerRef.key(), h_caloTowersOut.productGetter() );
249  // set the "backward" ref to the original collection for association
250  edm::Ptr<CaloTower> caloBackRef ( *itow );
251  // add to the list of FwdPtr's
252  itowersRef.push_back( pat::CaloTowerFwdPtrCollection::value_type ( caloForwardRef, caloBackRef ) );
253  }
254  }
255  ajet.setCaloTowers( itowersRef );
256  }
257 
258  // add the FwdPtrs to the PFCandidates
259  if (ajet.isPFJet() && embedPFCandidates_) {
260  const reco::PFJet *cj = dynamic_cast<const reco::PFJet *>(jetRef.get());
261  pat::PFCandidateFwdPtrCollection iparticlesRef;
262  std::vector< reco::PFCandidatePtr > iparticles = cj->getPFConstituents();
263  for ( std::vector<reco::PFCandidatePtr>::const_iterator partBegin = iparticles.begin(),
264  partEnd = iparticles.end(), ipart = partBegin;
265  ipart != partEnd; ++ipart ) {
266  pfCandidatesOut->push_back( **ipart );
267  // set the "forward" ref to the thinned collection
268  edm::Ref<reco::PFCandidateCollection> pfCollectionRef( h_pfCandidatesOut, pfCandidatesOut->size() - 1);
269  edm::Ptr<reco::PFCandidate> pfForwardRef ( h_pfCandidatesOut.id(), pfCollectionRef.key(), h_pfCandidatesOut.productGetter() );
270  // set the "backward" ref to the original collection for association
271  edm::Ptr<reco::PFCandidate> pfBackRef ( *ipart );
272  // add to the list of FwdPtr's
273  iparticlesRef.push_back( pat::PFCandidateFwdPtrCollection::value_type ( pfForwardRef, pfBackRef ) );
274  }
275  ajet.setPFCandidates( iparticlesRef );
276  }
277 
278  if (addJetCorrFactors_) {
279  // add additional JetCorrs to the jet
280  for ( unsigned int i=0; i<jetCorrFactorsTokens_.size(); ++i ) {
281  const JetCorrFactors& jcf = jetCorrs[i][jetRef];
282  // uncomment for debugging
283  // jcf.print();
284  ajet.addJECFactors(jcf);
285  }
286  std::vector<std::string> levels = jetCorrs[0][jetRef].correctionLabels();
287  if(std::find(levels.begin(), levels.end(), "L2L3Residual")!=levels.end()){
288  ajet.initializeJEC(jetCorrs[0][jetRef].jecLevel("L2L3Residual"));
289  }
290  else if(std::find(levels.begin(), levels.end(), "L3Absolute")!=levels.end()){
291  ajet.initializeJEC(jetCorrs[0][jetRef].jecLevel("L3Absolute"));
292  }
293  else{
294  ajet.initializeJEC(jetCorrs[0][jetRef].jecLevel("Uncorrected"));
295  if(first){
296  edm::LogWarning("L3Absolute not found") << "L2L3Residual and L3Absolute are not part of the correction applied jetCorrFactors \n"
297  << "of module " << jetCorrs[0][jetRef].jecSet() << " jets will remain"
298  << " uncorrected."; first=false;
299  }
300  }
301  }
302 
303  // get the MC flavour information for this jet
305  ajet.setPartonFlavour( (*jetFlavMatch)[edm::RefToBase<reco::Jet>(jetRef)].getFlavour() );
306  }
308  if ( addJetFlavourInfo_ ) ajet.setJetFlavourInfo( (*jetFlavInfoMatch)[edm::RefToBase<reco::Jet>(jetRef)] );
309  else
310  {
311  ajet.setPartonFlavour( (*jetFlavInfoMatch)[edm::RefToBase<reco::Jet>(jetRef)].getPartonFlavour() );
312  ajet.setHadronFlavour( (*jetFlavInfoMatch)[edm::RefToBase<reco::Jet>(jetRef)].getHadronFlavour() );
313  }
314  }
315  // store the match to the generated partons
316  if (addGenPartonMatch_) {
317  reco::GenParticleRef parton = (*partonMatch)[jetRef];
318  if (parton.isNonnull() && parton.isAvailable()) {
319  ajet.setGenParton(parton, embedGenPartonMatch_);
320  } // leave empty if no match found
321  }
322  // store the match to the GenJets
323  if (addGenJetMatch_) {
324  reco::GenJetRef genjet = (*genJetMatch)[jetRef];
325  if (genjet.isNonnull() && genjet.isAvailable()) {
326  genJetsOut->push_back( *genjet );
327  // set the "forward" ref to the thinned collection
328  edm::Ref<reco::GenJetCollection > genForwardRef ( h_genJetsOut, genJetsOut->size() - 1 );
329  // set the "backward" ref to the original collection
330  edm::Ref<reco::GenJetCollection > genBackRef ( genjet );
331  // make the FwdPtr
332  edm::FwdRef<reco::GenJetCollection > genjetFwdRef ( genForwardRef, genBackRef );
333  ajet.setGenJetRef(genjetFwdRef );
334  } // leave empty if no match found
335  }
336 
337  if (efficiencyLoader_.enabled()) {
338  efficiencyLoader_.setEfficiencies( ajet, jetRef );
339  }
340 
341  // IMPORTANT: DO THIS AFTER JES CORRECTIONS
342  if (resolutionLoader_.enabled()) {
344  }
345 
346  // TO BE IMPLEMENTED FOR >=1_5_X: do the PartonJet matching
347  if (addPartonJetMatch_) {
348  }
349 
350  // add b-tag info if available & required
351  if (addBTagInfo_) {
352  if (addDiscriminators_) {
353  for (size_t k=0; k<jetDiscriminators.size(); ++k) {
354  float value = (*jetDiscriminators[k])[jetRef];
355  ajet.addBDiscriminatorPair(std::make_pair(discriminatorLabels_[k], value));
356  }
357  }
358  if (addTagInfos_) {
359  for (size_t k=0; k<jetTagInfos.size(); ++k) {
360  const edm::View<reco::BaseTagInfo> & taginfos = *jetTagInfos[k];
361  // This is not associative, so we have to search the jet
363  // Try first by 'same index'
364  if ((idx < taginfos.size()) && (taginfos[idx].jet() == jetRef)) {
365  match = taginfos.ptrAt(idx);
366  } else {
367  // otherwise fail back to a simple search
368  for (edm::View<reco::BaseTagInfo>::const_iterator itTI = taginfos.begin(), edTI = taginfos.end(); itTI != edTI; ++itTI) {
369  if (itTI->jet() == jetRef) { match = taginfos.ptrAt( itTI - taginfos.begin() ); break; }
370  }
371  }
372  if (match.isNonnull()) {
373  tagInfosOut->push_back( match->clone() );
374  // set the "forward" ptr to the thinned collection
375  edm::Ptr<reco::BaseTagInfo> tagInfoForwardPtr ( h_tagInfosOut.id(), &tagInfosOut->back(), tagInfosOut->size() - 1 );
376  // set the "backward" ptr to the original collection for association
377  edm::Ptr<reco::BaseTagInfo> tagInfoBackPtr ( match );
378  // make FwdPtr
379  TagInfoFwdPtrCollection::value_type tagInfoFwdPtr( tagInfoForwardPtr, tagInfoBackPtr ) ;
380  ajet.addTagInfo(tagInfoLabels_[k], tagInfoFwdPtr );
381  }
382  }
383  }
384  }
385 
386  if (addAssociatedTracks_) ajet.setAssociatedTracks( (*hTrackAss)[jetRef] );
387 
388  if (addJetCharge_) ajet.setJetCharge( (*hJetChargeAss)[jetRef] );
389 
390  // add jet ID for calo jets
391  if (addJetID_ && ajet.isCaloJet() ) {
392  reco::JetID jetId = (*hJetIDMap)[ jetRef ];
393  ajet.setJetID( jetId );
394  }
395  // add jet ID jpt jets
396  else if ( addJetID_ && ajet.isJPTJet() ){
397  const reco::JPTJet *jptj = dynamic_cast<const reco::JPTJet *>(jetRef.get());
398  reco::JetID jetId = (*hJetIDMap)[ jptj->getCaloJetRef() ];
399  ajet.setJetID( jetId );
400  }
401  if ( useUserData_ ) {
402  userDataHelper_.add( ajet, iEvent, iSetup );
403  }
404  patJets->push_back(ajet);
405  }
406 
407  // sort jets in pt
408  std::sort(patJets->begin(), patJets->end(), pTComparator_);
409 
410  // put genEvt in Event
411  iEvent.put(patJets);
412 
413  iEvent.put( genJetsOut, "genJets" );
414  iEvent.put( caloTowersOut, "caloTowers" );
415  iEvent.put( pfCandidatesOut, "pfCandidates" );
416  iEvent.put( tagInfosOut, "tagInfos" );
417 
418 
419 }
420 
421 // ParameterSet description for module
423 {
425  iDesc.setComment("PAT jet producer module");
426 
427  // input source
428  iDesc.add<edm::InputTag>("jetSource", edm::InputTag("no default"))->setComment("input collection");
429 
430  // embedding
431  iDesc.addOptional<bool>("embedCaloTowers", false)->setComment("embed external CaloTowers (not to be used on AOD input)");
432  iDesc.add<bool>("embedPFCandidates", true)->setComment("embed external PFCandidates");
433 
434  // MC matching configurables
435  iDesc.add<bool>("addGenPartonMatch", true)->setComment("add MC matching");
436  iDesc.add<bool>("embedGenPartonMatch", false)->setComment("embed MC matched MC information");
437  iDesc.add<edm::InputTag>("genPartonMatch", edm::InputTag())->setComment("input with MC match information");
438 
439  iDesc.add<bool>("addGenJetMatch", true)->setComment("add MC matching");
440  iDesc.add<bool>("embedGenJetMatch", false)->setComment("embed MC matched MC information");
441  iDesc.add<edm::InputTag>("genJetMatch", edm::InputTag())->setComment("input with MC match information");
442 
443  iDesc.add<bool>("addJetCharge", true);
444  iDesc.add<edm::InputTag>("jetChargeSource", edm::InputTag("patJetCharge"));
445 
446  // jet id
447  iDesc.add<bool>("addJetID", true)->setComment("Add jet ID information");
448  iDesc.add<edm::InputTag>("jetIDMap", edm::InputTag())->setComment("jet id map");
449 
450  iDesc.add<bool>("addPartonJetMatch", false);
451  iDesc.add<edm::InputTag>("partonJetSource", edm::InputTag("NOT IMPLEMENTED"));
452 
453  // track association
454  iDesc.add<bool>("addAssociatedTracks", true);
455  iDesc.add<edm::InputTag>("trackAssociationSource", edm::InputTag("ak4JTA"));
456 
457  // tag info
458  iDesc.add<bool>("addTagInfos", true);
459  std::vector<edm::InputTag> emptyVInputTags;
460  iDesc.add<std::vector<edm::InputTag> >("tagInfoSources", emptyVInputTags);
461 
462  // jet energy corrections
463  iDesc.add<bool>("addJetCorrFactors", true);
464  iDesc.add<std::vector<edm::InputTag> >("jetCorrFactorsSource", emptyVInputTags);
465 
466  // btag discriminator tags
467  iDesc.add<bool>("addBTagInfo",true);
468  iDesc.add<bool>("addDiscriminators", true);
469  iDesc.add<std::vector<edm::InputTag> >("discriminatorSources", emptyVInputTags);
470 
471  // jet flavour idetification configurables
472  iDesc.add<bool>("getJetMCFlavour", true);
473  iDesc.add<bool>("useLegacyJetMCFlavour", false);
474  iDesc.add<bool>("addJetFlavourInfo", false);
475  iDesc.add<edm::InputTag>("JetPartonMapSource", edm::InputTag("jetFlavourAssociationLegacy"));
476  iDesc.add<edm::InputTag>("JetFlavourInfoSource", edm::InputTag("jetFlavourAssociation"));
477 
479 
480  // Efficiency configurables
481  edm::ParameterSetDescription efficienciesPSet;
482  efficienciesPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
483  iDesc.add("efficiencies", efficienciesPSet);
484  iDesc.add<bool>("addEfficiencies", false);
485 
486  // Check to see if the user wants to add user data
487  edm::ParameterSetDescription userDataPSet;
489  iDesc.addOptional("userData", userDataPSet);
490 
491  descriptions.add("PATJetProducer", iDesc);
492 }
493 
495 
497 
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:242
bool isAvailable() const
Definition: Ref.h:614
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:212
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:230
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:171
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
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:449
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:64
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:247
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:113
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)
Container::value_type value_type
RefProd< PROD > getRefBeforePut()
Definition: Event.h:133
bool isPFJet() const
check to see if the jet is a reco::PFJet
Definition: Jet.h:251
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:152
bool isJPTJet() const
check to see if the jet is a reco::JPTJet
Definition: Jet.h:249
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:73
std::vector< edm::FwdPtr< reco::PFCandidate > > PFCandidateFwdPtrCollection
Definition: Jet.h:72
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:77
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)