1 #ifndef PhysicsTools_PatUtils_interface_JetIDSelectionFunctor_h
2 #define PhysicsTools_PatUtils_interface_JetIDSelectionFunctor_h
45 if (qualityStr ==
"MINIMAL")
47 else if (qualityStr ==
"LOOSE_AOD")
49 else if (qualityStr ==
"LOOSE")
51 else if (qualityStr ==
"TIGHT")
55 <<
"Expect quality to be one of MINIMAL, LOOSE_AOD, LOOSE,TIGHT" << std::endl;
57 if (versionStr ==
"CRAFT08") {
59 }
else if (versionStr ==
"PURE09") {
61 }
else if (versionStr ==
"DQM09") {
64 throw cms::Exception(
"InvalidInput") <<
"Expect version to be one of CRAFT08, PURE09, DQM09" << std::endl;
105 set(
"LOOSE_AOD_fHPD");
106 set(
"LOOSE_AOD_N90Hits");
107 set(
"LOOSE_AOD_EMF", !use_09_fwd_id);
109 set(
"LOOSE_N90Hits");
110 set(
"LOOSE_EMF", !use_09_fwd_id);
114 set(
"LOOSE_nHit", use_09_fwd_id);
115 set(
"LOOSE_als", use_09_fwd_id);
116 set(
"TIGHT_nHit", use_09_fwd_id);
117 set(
"TIGHT_als", use_09_fwd_id);
118 set(
"widths", use_09_fwd_id);
119 set(
"EF_N90Hits", use_09_fwd_id);
120 set(
"EF_EMF", use_09_fwd_id);
122 set(
"LOOSE_fls", use_dqm_09);
123 set(
"LOOSE_foot", use_dqm_09);
124 set(
"TIGHT_fls", use_dqm_09);
125 set(
"TIGHT_foot", use_dqm_09);
154 bool use_loose_aod =
false;
155 bool use_loose =
false;
156 bool use_tight =
false;
157 bool use_tight_09_fwd_id =
false;
158 bool use_loose_09_fwd_id =
false;
163 use_loose_09_fwd_id =
true;
166 use_loose_aod =
true;
168 use_loose_09_fwd_id =
true;
173 use_tight_09_fwd_id =
true;
176 if (!use_loose_aod) {
177 set(
"LOOSE_AOD_fHPD",
false);
178 set(
"LOOSE_AOD_N90Hits",
false);
179 set(
"LOOSE_AOD_EMF",
false);
182 if (!(use_loose || use_tight)) {
183 set(
"LOOSE_N90Hits",
false);
184 set(
"LOOSE_fHPD",
false);
185 set(
"LOOSE_EMF",
false);
189 set(
"TIGHT_fHPD",
false);
190 set(
"TIGHT_EMF",
false);
193 if (!use_loose_09_fwd_id) {
194 set(
"LOOSE_nHit",
false);
195 set(
"LOOSE_als",
false);
197 set(
"LOOSE_fls",
false);
198 set(
"LOOSE_foot",
false);
202 if (!use_tight_09_fwd_id) {
203 set(
"TIGHT_nHit",
false);
204 set(
"TIGHT_als",
false);
205 set(
"widths",
false);
206 set(
"EF_N90Hits",
false);
207 set(
"EF_EMF",
false);
209 set(
"TIGHT_fls",
false);
210 set(
"TIGHT_foot",
false);
219 unsigned int nHit = 0;
220 for (
unsigned int iTower = 0; iTower < towers.size(); ++iTower) {
221 const std::vector<DetId>& cellIDs = towers[iTower]->constituents();
222 nHit += cellIDs.size();
232 edm::LogWarning(
"NYI") <<
"Criteria for pat::Jet-s other than CaloJets and JPTJets are not yet implemented";
264 double emEnergyFraction,
268 return craft08Cuts(correctedP4, emEnergyFraction, jetID, ret);
270 <<
") is unknown or doesn't match the depreceated interface used";
275 double emEnergyFraction,
310 double emEnergyFraction,
316 double abs_eta =
TMath::Abs(correctedP4.eta());
317 double corrPt = correctedP4.pt();
318 double emf = emEnergyFraction;
332 bool emf_loose =
true;
333 if (abs_eta <= 2.6) {
334 if (emEnergyFraction <= 0.01)
337 if (emEnergyFraction <= -0.9)
339 if (corrPt > 80 && emEnergyFraction >= 1)
354 bool emf_loose =
true;
355 if (abs_eta <= 2.6) {
356 if (emEnergyFraction <= 0.01)
359 if (emEnergyFraction <= -0.9)
361 if (corrPt > 80 && emEnergyFraction >= 1)
369 bool tight_fhpd =
true;
370 if (corrPt >= 25 && jetID.
fHPD >= 0.95)
376 bool tight_emf =
true;
377 if (abs_eta >= 1 && corrPt >= 80 && emEnergyFraction >= 1)
379 if (abs_eta >= 2.6) {
380 if (emEnergyFraction <= -0.3)
382 if (abs_eta < 3.25) {
383 if (corrPt >= 50 && emEnergyFraction <= -0.2)
385 if (corrPt >= 80 && emEnergyFraction <= -0.1)
387 if (corrPt >= 340 && emEnergyFraction >= 0.95)
390 if (emEnergyFraction >= 0.9)
392 if (corrPt >= 50 && emEnergyFraction <= -0.2)
394 if (corrPt >= 50 && emEnergyFraction >= 0.8)
396 if (corrPt >= 130 && emEnergyFraction <= -0.1)
398 if (corrPt >= 130 && emEnergyFraction >= 0.7)
417 double emEnergyFraction,
427 double rawPt = rawP4.pt();
428 double emf = emEnergyFraction;
430 double lnpt = (rawPt > 0) ? TMath::Log(rawPt) : -10;
431 double lnE = (rawP4.energy() > 0) ? TMath::Log(rawP4.energy()) : -10;
433 bool HB = abs_eta < 1.0;
434 bool EF = 2.6 <= abs_eta && abs_eta < 3.4 && 0.1 <= fhf && fhf < 0.9;
435 bool HBHE = abs_eta < 2.6 || (abs_eta < 3.4 && fhf < 0.1);
436 bool HF = 3.4 <= abs_eta || (2.6 <= abs_eta && 0.9 <= fhf);
437 bool HFa = HF && abs_eta < 3.8;
438 bool HFb = HF && !HFa;
487 (1E-10 < etaWidth && etaWidth < 0.12 && 1E-10 < phiWidth && phiWidth < 0.12))
493 (HFb && nHit > 1 + 3. * (lnpt - 1.)))
497 (emf < 0.6 + 0.05 * TMath::Power(
TMath::Max(0., 9 - lnE), 1.5) &&
498 emf > -0.2 - 0.041 * TMath::Power(
TMath::Max(0., 7.5 - lnE), 2.2)))
510 (HFb && nHit > 1 + 3.5 * (lnpt - 0.8)))
514 (emf < 0.5 + 0.057 * TMath::Power(
TMath::Max(0., 9 - lnE), 1.5) &&
const LorentzVector correctedP4(const std::string &level, const std::string &flavor="none", const std::string &set="") const
void set(std::string const &s, bool val=true)
Set a given selection cut, on or off.
index_type index_MINIMAL_EMF_
tuple ret
prodAgent to be discontinued
void initialize(Version_t version, Quality_t quality)
JetIDSelectionFunctor(Version_t version, Quality_t quality)
Jets made from CaloTowers.
index_type index_TIGHT_EMF_
unsigned int count_hits(const std::vector< CaloTowerPtr > &towers)
index_type index_TIGHT_fHPD_
virtual bool operator()(reco::Candidate::LorentzVector const &correctedP4, double emEnergyFraction, reco::JetID const &jetID)
accessor like previous, without the ret
uint32_t const *__restrict__ Quality * quality
index_type index_LOOSE_EMF_
float etaetaMoment() const
eta-eta second moment, ET weighted
pat::strbitset::index_type index_type
void setIgnored(pat::strbitset &ret)
set ignored bits
pat::strbitset retInternal_
internal ret if users don't care about return bits
JetIDSelectionFunctor(edm::ParameterSet const ¶meters)
virtual std::vector< CaloTowerPtr > getCaloConstituents() const
get all constituents
const LorentzVector & p4() const final
four-momentum Lorentz vector
bool operator()(reco::Candidate::LorentzVector const &correctedP4, double emEnergyFraction, reco::JetID const &jetID, pat::strbitset &ret)
index_type index_LOOSE_fls_
bool craft08Cuts(reco::Candidate::LorentzVector const &correctedP4, double emEnergyFraction, reco::JetID const &jetID, pat::strbitset &ret)
bool isCaloJet() const
check to see if the jet is a reco::CaloJet
std::vector< CaloTowerPtr > const & getCaloConstituents() const
pat::strbitset bits_
the bitset indexed by strings
void passCut(pat::strbitset &ret, std::string const &s)
Passing cuts.
index_type index_TIGHT_fls_
index_type index_LOOSE_foot_
index_type index_TIGHT_als_
index_type index_TIGHT_nHit_
index_type index_TIGHT_foot_
index_type index_LOOSE_nHit_
bool ignoreCut(std::string const &s) const
ignore the cut at index "s"
index_type index_LOOSE_fHPD_
JetIDSelectionFunctor(edm::ParameterSet const ¶meters, edm::ConsumesCollector &iC)
bool operator()(reco::CaloJet const &jet, reco::JetID const &jetID, pat::strbitset &ret)
virtual void push_back(std::string const &s)
This is the registration of an individual cut string.
Functor that operates on <T>
bool fwd09Cuts(reco::Candidate::LorentzVector const &rawP4, double emEnergyFraction, double etaWidth, double phiWidth, unsigned int nHit, reco::JetID const &jetID, pat::strbitset &ret)
float emEnergyFraction() const
returns the jet electromagnetic energy fraction
index_type index_LOOSE_AOD_fHPD_
index_type index_LOOSE_als_
bool operator()(const pat::Jet &jet, pat::strbitset &ret) override
This provides the interface for base classes to select objects.
bool isJPTJet() const
check to see if the jet is a reco::JPTJet
Jet selector for pat::Jets and for CaloJets.
reco::JetID const & jetID() const
accessing Jet ID information
index_type index_LOOSE_AOD_N90Hits_
strbitset & set(bool val=true)
set method of all bits
std::string currentJECLevel() const
return the name of the current step of jet energy corrections
T getParameter(std::string const &) const
Analysis-level calorimeter jet class.
index_type index_EF_N90Hits_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
pat::strbitset getBitTemplate() const
Get an empty bitset with the proper names.
float phiphiMoment() const
phi-phi second moment, ET weighted
index_type index_LOOSE_N90Hits_
virtual bool operator()(reco::CaloJet const &jet, reco::JetID const &jetID)
accessor like previous, without the ret
Log< level::Warning, false > LogWarning
index_type index_LOOSE_AOD_EMF_
float emEnergyFraction() const