1 #ifndef PhysicsTools_PatUtils_interface_JetIDSelectionFunctor_h
2 #define PhysicsTools_PatUtils_interface_JetIDSelectionFunctor_h
40 std::string versionStr = parameters.
getParameter<std::string>(
"version");
41 std::string qualityStr = parameters.
getParameter<std::string>(
"quality");
44 if ( qualityStr ==
"MINIMAL" ) quality =
MINIMAL;
45 else if ( qualityStr ==
"LOOSE_AOD" ) quality =
LOOSE_AOD;
46 else if ( qualityStr ==
"LOOSE" ) quality =
LOOSE;
47 else if ( qualityStr ==
"TIGHT" ) quality =
TIGHT;
49 throw cms::Exception(
"InvalidInput") <<
"Expect quality to be one of MINIMAL, LOOSE_AOD, LOOSE,TIGHT" << std::endl;
52 if ( versionStr ==
"CRAFT08" ) {
55 else if ( versionStr ==
"PURE09" ) {
58 else if ( versionStr ==
"DQM09" ) {
62 throw cms::Exception(
"InvalidInput") <<
"Expect version to be one of CRAFT08, PURE09, DQM09" << std::endl;
107 set(
"MINIMAL_EMF" );
108 set(
"LOOSE_AOD_fHPD" );
109 set(
"LOOSE_AOD_N90Hits" );
110 set(
"LOOSE_AOD_EMF", ! use_09_fwd_id );
112 set(
"LOOSE_N90Hits" );
113 set(
"LOOSE_EMF", ! use_09_fwd_id );
117 set(
"LOOSE_nHit", use_09_fwd_id );
118 set(
"LOOSE_als", use_09_fwd_id );
119 set(
"TIGHT_nHit", use_09_fwd_id );
120 set(
"TIGHT_als", use_09_fwd_id );
121 set(
"widths", use_09_fwd_id );
122 set(
"EF_N90Hits", use_09_fwd_id );
123 set(
"EF_EMF", use_09_fwd_id );
125 set(
"LOOSE_fls", use_dqm_09 );
126 set(
"LOOSE_foot", use_dqm_09 );
127 set(
"TIGHT_fls", use_dqm_09 );
128 set(
"TIGHT_foot", use_dqm_09 );
160 bool use_loose_aod =
false;
161 bool use_loose =
false;
162 bool use_tight =
false;
163 bool use_tight_09_fwd_id =
false;
164 bool use_loose_09_fwd_id =
false;
168 if( use_09_fwd_id ) use_loose_09_fwd_id =
true;
171 use_loose_aod =
true;
172 if( use_09_fwd_id ) use_loose_09_fwd_id =
true;
176 if( use_09_fwd_id ) use_tight_09_fwd_id =
true;
179 if( ! use_loose_aod ) {
180 set(
"LOOSE_AOD_fHPD",
false );
181 set(
"LOOSE_AOD_N90Hits",
false );
182 set(
"LOOSE_AOD_EMF",
false );
185 if( ! ( use_loose || use_tight ) ) {
186 set(
"LOOSE_N90Hits",
false );
187 set(
"LOOSE_fHPD",
false );
188 set(
"LOOSE_EMF",
false );
192 set(
"TIGHT_fHPD",
false );
193 set(
"TIGHT_EMF",
false );
196 if( ! use_loose_09_fwd_id ) {
197 set(
"LOOSE_nHit",
false );
198 set(
"LOOSE_als",
false );
200 set(
"LOOSE_fls",
false );
201 set(
"LOOSE_foot",
false );
205 if( ! use_tight_09_fwd_id ) {
206 set(
"TIGHT_nHit",
false );
207 set(
"TIGHT_als",
false );
208 set(
"widths",
false );
209 set(
"EF_N90Hits",
false );
210 set(
"EF_EMF",
false );
212 set(
"TIGHT_fls",
false );
213 set(
"TIGHT_foot",
false );
221 unsigned int count_hits(
const std::vector<CaloTowerPtr> & towers )
223 unsigned int nHit = 0;
224 for (
unsigned int iTower = 0; iTower < towers.size() ; ++iTower ) {
225 const std::vector<DetId>& cellIDs = towers[iTower]->constituents();
226 nHit += cellIDs.size();
237 edm::LogWarning(
"NYI" )<<
"Criteria for pat::Jet-s other than CaloJets and JPTJets are not yet implemented";
264 double emEnergyFraction,
270 <<
") is unknown or doesn't match the depreceated interface used";
275 double emEnergyFraction,
316 double emEnergyFraction,
324 double abs_eta = TMath::Abs( correctedP4.eta() );
325 double corrPt = correctedP4.pt();
326 double emf = emEnergyFraction;
337 bool emf_loose =
true;
338 if( abs_eta <= 2.6 ) {
339 if( emEnergyFraction <= 0.01 ) emf_loose =
false;
341 if( emEnergyFraction <= -0.9 ) emf_loose =
false;
342 if( corrPt > 80 && emEnergyFraction >= 1 ) emf_loose =
false;
354 bool emf_loose =
true;
355 if( abs_eta <= 2.6 ) {
356 if( emEnergyFraction <= 0.01 ) emf_loose =
false;
358 if( emEnergyFraction <= -0.9 ) emf_loose =
false;
359 if( corrPt > 80 && emEnergyFraction >= 1 ) emf_loose =
false;
365 bool tight_fhpd =
true;
366 if ( corrPt >= 25 && jetID.
fHPD >= 0.95 ) tight_fhpd =
false;
370 bool tight_emf =
true;
371 if( abs_eta >= 1 && corrPt >= 80 && emEnergyFraction >= 1 ) tight_emf =
false;
372 if( abs_eta >= 2.6 ) {
373 if( emEnergyFraction <= -0.3 ) tight_emf =
false;
374 if( abs_eta < 3.25 ) {
375 if( corrPt >= 50 && emEnergyFraction <= -0.2 ) tight_emf =
false;
376 if( corrPt >= 80 && emEnergyFraction <= -0.1 ) tight_emf =
false;
377 if( corrPt >= 340 && emEnergyFraction >= 0.95 ) tight_emf =
false;
379 if( emEnergyFraction >= 0.9 ) tight_emf =
false;
380 if( corrPt >= 50 && emEnergyFraction <= -0.2 ) tight_emf =
false;
381 if( corrPt >= 50 && emEnergyFraction >= 0.8 ) tight_emf =
false;
382 if( corrPt >= 130 && emEnergyFraction <= -0.1 ) tight_emf =
false;
383 if( corrPt >= 130 && emEnergyFraction >= 0.7 ) tight_emf =
false;
400 double emEnergyFraction,
double etaWidth,
double phiWidth,
unsigned int nHit,
407 double abs_eta = TMath::Abs( rawP4.eta() );
408 double rawPt = rawP4.pt();
409 double emf = emEnergyFraction;
411 double lnpt = ( rawPt > 0 ) ? TMath::Log( rawPt ) : -10;
412 double lnE = ( rawP4.energy() > 0 ) ? TMath::Log( rawP4.energy() ) : -10;
414 bool HB = abs_eta < 1.0;
415 bool EF = 2.6 <= abs_eta && abs_eta < 3.4 && 0.1 <= fhf && fhf < 0.9;
416 bool HBHE = abs_eta < 2.6 || ( abs_eta < 3.4 && fhf < 0.1 );
417 bool HF = 3.4 <= abs_eta || ( 2.6 <= abs_eta && 0.9 <= fhf );
418 bool HFa = HF && abs_eta < 3.8;
419 bool HFb = HF && ! HFa;
463 || ( 1E-10 < etaWidth && etaWidth < 0.12 &&
464 1E-10 < phiWidth && phiWidth < 0.12 ) )
470 || ( HFa && nHit > 1 + 2.4*( lnpt - 1. ) )
471 || ( HFb && nHit > 1 + 3.*( lnpt - 1. ) ) )
475 || ( emf < 0.6 + 0.05 * TMath::Power(
TMath::Max( 0., 9 - lnE ), 1.5 ) &&
476 emf > -0.2 - 0.041 * TMath::Power(
TMath::Max( 0., 7.5 - lnE ), 2.2 ) ) )
489 || ( HFa && nHit > 1 + 2.7*( lnpt - 0.8 ) )
490 || ( HFb && nHit > 1 + 3.5*( lnpt - 0.8 ) ) )
494 || ( emf < 0.5 + 0.057 * TMath::Power(
TMath::Max( 0., 9 - lnE ), 1.5 ) &&
T getParameter(std::string const &) const
void set(std::string const &s, bool val=true)
Set a given selection cut, on or off.
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
bool operator()(const pat::Jet &jet, pat::strbitset &ret)
This provides the interface for base classes to select objects.
index_type index_LOOSE_EMF_
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
const LorentzVector & correctedP4(const std::string &level, const std::string &flavor="none", const std::string &set="") const
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
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_
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
std::vector< CaloTowerPtr > const & getCaloConstituents() const
index_type index_LOOSE_AOD_fHPD_
index_type index_LOOSE_als_
bool isJPTJet() const
check to see if the jet is a reco::JPTJet
float etaetaMoment() const
eta-eta second moment, ET weighted
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_
float phiphiMoment() const
phi-phi second moment, ET weighted
math::XYZTLorentzVector LorentzVector
Lorentz vector.
pat::strbitset getBitTemplate() const
Get an empty bitset with the proper names.
index_type index_LOOSE_N90Hits_
virtual bool operator()(reco::CaloJet const &jet, reco::JetID const &jetID)
accessor like previous, without the ret
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
index_type index_LOOSE_AOD_EMF_
float emEnergyFraction() const