1 #ifndef PhysicsTools_PatUtils_interface_JetIDSelectionFunctor_h 2 #define PhysicsTools_PatUtils_interface_JetIDSelectionFunctor_h 53 if ( qualityStr ==
"MINIMAL" ) quality =
MINIMAL;
54 else if ( qualityStr ==
"LOOSE_AOD" ) quality =
LOOSE_AOD;
55 else if ( qualityStr ==
"LOOSE" ) quality =
LOOSE;
56 else if ( qualityStr ==
"TIGHT" ) quality =
TIGHT;
58 throw cms::Exception(
"InvalidInput") <<
"Expect quality to be one of MINIMAL, LOOSE_AOD, LOOSE,TIGHT" << std::endl;
61 if ( versionStr ==
"CRAFT08" ) {
64 else if ( versionStr ==
"PURE09" ) {
67 else if ( versionStr ==
"DQM09" ) {
71 throw cms::Exception(
"InvalidInput") <<
"Expect version to be one of CRAFT08, PURE09, DQM09" << std::endl;
116 set(
"MINIMAL_EMF" );
117 set(
"LOOSE_AOD_fHPD" );
118 set(
"LOOSE_AOD_N90Hits" );
119 set(
"LOOSE_AOD_EMF", ! use_09_fwd_id );
121 set(
"LOOSE_N90Hits" );
122 set(
"LOOSE_EMF", ! use_09_fwd_id );
126 set(
"LOOSE_nHit", use_09_fwd_id );
127 set(
"LOOSE_als", use_09_fwd_id );
128 set(
"TIGHT_nHit", use_09_fwd_id );
129 set(
"TIGHT_als", use_09_fwd_id );
130 set(
"widths", use_09_fwd_id );
131 set(
"EF_N90Hits", use_09_fwd_id );
132 set(
"EF_EMF", use_09_fwd_id );
134 set(
"LOOSE_fls", use_dqm_09 );
135 set(
"LOOSE_foot", use_dqm_09 );
136 set(
"TIGHT_fls", use_dqm_09 );
137 set(
"TIGHT_foot", use_dqm_09 );
169 bool use_loose_aod =
false;
170 bool use_loose =
false;
171 bool use_tight =
false;
172 bool use_tight_09_fwd_id =
false;
173 bool use_loose_09_fwd_id =
false;
177 if( use_09_fwd_id ) use_loose_09_fwd_id =
true;
180 use_loose_aod =
true;
181 if( use_09_fwd_id ) use_loose_09_fwd_id =
true;
185 if( use_09_fwd_id ) use_tight_09_fwd_id =
true;
188 if( ! use_loose_aod ) {
189 set(
"LOOSE_AOD_fHPD",
false );
190 set(
"LOOSE_AOD_N90Hits",
false );
191 set(
"LOOSE_AOD_EMF",
false );
194 if( ! ( use_loose || use_tight ) ) {
195 set(
"LOOSE_N90Hits",
false );
196 set(
"LOOSE_fHPD",
false );
197 set(
"LOOSE_EMF",
false );
201 set(
"TIGHT_fHPD",
false );
202 set(
"TIGHT_EMF",
false );
205 if( ! use_loose_09_fwd_id ) {
206 set(
"LOOSE_nHit",
false );
207 set(
"LOOSE_als",
false );
209 set(
"LOOSE_fls",
false );
210 set(
"LOOSE_foot",
false );
214 if( ! use_tight_09_fwd_id ) {
215 set(
"TIGHT_nHit",
false );
216 set(
"TIGHT_als",
false );
217 set(
"widths",
false );
218 set(
"EF_N90Hits",
false );
219 set(
"EF_EMF",
false );
221 set(
"TIGHT_fls",
false );
222 set(
"TIGHT_foot",
false );
230 unsigned int count_hits(
const std::vector<CaloTowerPtr> & towers )
232 unsigned int nHit = 0;
233 for (
unsigned int iTower = 0; iTower < towers.size() ; ++iTower ) {
234 const std::vector<DetId>& cellIDs = towers[iTower]->constituents();
235 nHit += cellIDs.size();
246 edm::LogWarning(
"NYI" )<<
"Criteria for pat::Jet-s other than CaloJets and JPTJets are not yet implemented";
273 double emEnergyFraction,
279 <<
") is unknown or doesn't match the depreceated interface used";
284 double emEnergyFraction,
325 double emEnergyFraction,
333 double abs_eta =
TMath::Abs( correctedP4.eta() );
334 double corrPt = correctedP4.pt();
335 double emf = emEnergyFraction;
346 bool emf_loose =
true;
347 if( abs_eta <= 2.6 ) {
348 if( emEnergyFraction <= 0.01 ) emf_loose =
false;
350 if( emEnergyFraction <= -0.9 ) emf_loose =
false;
351 if( corrPt > 80 && emEnergyFraction >= 1 ) emf_loose =
false;
363 bool emf_loose =
true;
364 if( abs_eta <= 2.6 ) {
365 if( emEnergyFraction <= 0.01 ) emf_loose =
false;
367 if( emEnergyFraction <= -0.9 ) emf_loose =
false;
368 if( corrPt > 80 && emEnergyFraction >= 1 ) emf_loose =
false;
374 bool tight_fhpd =
true;
375 if ( corrPt >= 25 && jetID.
fHPD >= 0.95 ) tight_fhpd =
false;
379 bool tight_emf =
true;
380 if( abs_eta >= 1 && corrPt >= 80 && emEnergyFraction >= 1 ) tight_emf =
false;
381 if( abs_eta >= 2.6 ) {
382 if( emEnergyFraction <= -0.3 ) tight_emf =
false;
383 if( abs_eta < 3.25 ) {
384 if( corrPt >= 50 && emEnergyFraction <= -0.2 ) tight_emf =
false;
385 if( corrPt >= 80 && emEnergyFraction <= -0.1 ) tight_emf =
false;
386 if( corrPt >= 340 && emEnergyFraction >= 0.95 ) tight_emf =
false;
388 if( emEnergyFraction >= 0.9 ) tight_emf =
false;
389 if( corrPt >= 50 && emEnergyFraction <= -0.2 ) tight_emf =
false;
390 if( corrPt >= 50 && emEnergyFraction >= 0.8 ) tight_emf =
false;
391 if( corrPt >= 130 && emEnergyFraction <= -0.1 ) tight_emf =
false;
392 if( corrPt >= 130 && emEnergyFraction >= 0.7 ) tight_emf =
false;
409 double emEnergyFraction,
double etaWidth,
double phiWidth,
unsigned int nHit,
417 double rawPt = rawP4.pt();
418 double emf = emEnergyFraction;
420 double lnpt = ( rawPt > 0 ) ? TMath::Log( rawPt ) : -10;
421 double lnE = ( rawP4.energy() > 0 ) ? TMath::Log( rawP4.energy() ) : -10;
423 bool HB = abs_eta < 1.0;
424 bool EF = 2.6 <= abs_eta && abs_eta < 3.4 && 0.1 <= fhf && fhf < 0.9;
425 bool HBHE = abs_eta < 2.6 || ( abs_eta < 3.4 && fhf < 0.1 );
426 bool HF = 3.4 <= abs_eta || ( 2.6 <= abs_eta && 0.9 <= fhf );
427 bool HFa = HF && abs_eta < 3.8;
428 bool HFb = HF && ! HFa;
472 || ( 1E-10 < etaWidth && etaWidth < 0.12 &&
473 1E-10 < phiWidth && phiWidth < 0.12 ) )
479 || ( HFa && nHit > 1 + 2.4*( lnpt - 1. ) )
480 || ( HFb && nHit > 1 + 3.*( lnpt - 1. ) ) )
484 || ( emf < 0.6 + 0.05 * TMath::Power(
TMath::Max( 0., 9 - lnE ), 1.5 ) &&
485 emf > -0.2 - 0.041 * TMath::Power(
TMath::Max( 0., 7.5 - lnE ), 2.2 ) ) )
498 || ( HFa && nHit > 1 + 2.7*( lnpt - 0.8 ) )
499 || ( HFb && nHit > 1 + 3.5*( lnpt - 0.8 ) ) )
503 || ( 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
T getParameter(std::string const &) const
index_type index_MINIMAL_EMF_
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
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
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)
const LorentzVector & p4() const final
four-momentum Lorentz vector
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>
reco::Candidate::LorentzVector correctedP4(const T &rawMEt, const CorrMETData &correction)
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
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
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
index_type index_LOOSE_AOD_EMF_
float emEnergyFraction() const