CMS 3D CMS Logo

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