CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTPFJetIDProducer.cc
Go to the documentation of this file.
1 
10 
15 
16 
17 // Constructor
19  minPt_ (iConfig.getParameter<double>("minPt")),
20  CHF_ (iConfig.getParameter<double>("CHF")),
21  NHF_ (iConfig.getParameter<double>("NHF")),
22  CEF_ (iConfig.getParameter<double>("CEF")),
23  NEF_ (iConfig.getParameter<double>("NEF")),
24  NCH_ (iConfig.getParameter<int>("NCH")),
25  NTOT_ (iConfig.getParameter<int>("NTOT")),
26  inputTag_ (iConfig.getParameter<edm::InputTag>("jetsInput")) {
27  m_thePFJetToken = consumes<reco::PFJetCollection>(inputTag_);
28 
29  // Register the products
30  produces<reco::PFJetCollection>();
31 }
32 
33 // Destructor
35 
36 // Fill descriptions
39  desc.add<double>("minPt", 20.);
40  desc.add<double>("CHF", -99.);
41  desc.add<double>("NHF", 99.);
42  desc.add<double>("CEF", 99.);
43  desc.add<double>("NEF", 99.);
44  desc.add<int>("NCH", 0);
45  desc.add<int>("NTOT", 0);
46  desc.add<edm::InputTag>("jetsInput", edm::InputTag("hltAntiKT4PFJets"));
47  descriptions.add("hltPFJetIDProducer", desc);
48 }
49 
50 // Produce the products
52 
53  // Create a pointer to the products
54  std::auto_ptr<reco::PFJetCollection> result (new reco::PFJetCollection());
55 
57  iEvent.getByToken(m_thePFJetToken, pfjets);
58 
59  for (reco::PFJetCollection::const_iterator j = pfjets->begin(); j != pfjets->end(); ++j) {
60  bool pass = false;
61  double pt = j->pt();
62  double eta = j->eta();
63 
64  if (!(pt > 0.)) continue; // skip jets with zero or negative pt
65 
66  if (pt < minPt_) {
67  pass = true;
68 
69  //} else if (std::abs(eta) >= 2.4) {
70  // pass = true;
71 
72  } else {
73  double chf = j->chargedHadronEnergyFraction();
74  //double nhf = j->neutralHadronEnergyFraction() + j->HFHadronEnergyFraction();
75  double nhf = j->neutralHadronEnergyFraction();
76  double cef = j->chargedEmEnergyFraction();
77  double nef = j->neutralEmEnergyFraction();
78  int nch = j->chargedMultiplicity();
79  int ntot = j->numberOfDaughters();
80 
81  pass = true;
82  pass = pass && (ntot > NTOT_);
83  pass = pass && (nef < NEF_);
84  pass = pass && (nhf < NHF_);
85  pass = pass && (cef < CEF_ || std::abs(eta) >= 2.4);
86  pass = pass && (chf > CHF_ || std::abs(eta) >= 2.4);
87  pass = pass && (nch > NCH_ || std::abs(eta) >= 2.4);
88  }
89 
90  if (pass) result->push_back(*j);
91  }
92 
93  // Put the products into the Event
94  iEvent.put(result);
95 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
T eta() const
HLTPFJetIDProducer(const edm::ParameterSet &iConfig)
int iEvent
Definition: GenABIO.cc:230
edm::EDGetTokenT< reco::PFJetCollection > m_thePFJetToken
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
tuple result
Definition: query.py:137
double NHF_
neutral hadron fraction
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
ParameterDescriptionBase * add(U const &iLabel, T const &value)
double NEF_
neutral EM fraction
int NTOT_
number of constituents
double CHF_
charged hadron fraction
int NCH_
number of charged constituents
edm::InputTag inputTag_
input PFJet collection
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< PFJet > PFJetCollection
collection of PFJet objects
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup)