Public Types | |
typedef std::vector< T > | JetCollection |
Public Member Functions | |
void | endJob () |
JetIdSelector (const edm::ParameterSet &iConfig) | |
void | produce (edm::Event &iEvent, const edm::EventSetup &iSetup) |
virtual | ~JetIdSelector () |
Private Attributes | |
JetIDSelectionFunctor * | jetIDFunctor |
edm::InputTag | jetIDMap_ |
std::string | moduleLabel_ |
unsigned int | nJetsPassed_ |
unsigned int | nJetsTot_ |
std::string | qualityStr |
edm::InputTag | src_ |
bool | use_pfloose |
bool | use_pfmedium |
bool | use_pftight |
Definition at line 60 of file JetIdSelector.cc.
typedef std::vector<T> JetIdSelector< T >::JetCollection |
Definition at line 63 of file JetIdSelector.cc.
JetIdSelector< T >::JetIdSelector | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 97 of file JetIdSelector.cc.
References Exception, JetIdSelector< T >::jetIDFunctor, JetIDSelectionFunctor::LOOSE, JetIDSelectionFunctor::LOOSE_AOD, JetIDSelectionFunctor::MINIMAL, JetIDSelectionFunctor::PURE09, JetIdSelector< T >::qualityStr, JetIDSelectionFunctor::TIGHT, JetIdSelector< T >::use_pfloose, JetIdSelector< T >::use_pfmedium, and JetIdSelector< T >::use_pftight.
: src_ (iConfig.getParameter<edm::InputTag> ("src")) , qualityStr (iConfig.getParameter<string> ("idLevel")) , jetIDMap_(iConfig.getUntrackedParameter<edm::InputTag> ("jetIDMap", edm::InputTag("ak5JetID"))) , moduleLabel_(iConfig.getParameter<string> ("@module_label")) , nJetsTot_(0) , nJetsPassed_(0) { produces<JetCollection>(); use_pfloose = false; use_pfmedium = false; use_pftight = false; if ( qualityStr == "MINIMAL" ) { jetIDFunctor = new JetIDSelectionFunctor( JetIDSelectionFunctor::PURE09, JetIDSelectionFunctor::MINIMAL); use_pfloose = true; } else if ( qualityStr == "LOOSE_AOD" ) { jetIDFunctor = new JetIDSelectionFunctor( JetIDSelectionFunctor::PURE09, JetIDSelectionFunctor::LOOSE_AOD); use_pfloose = true; } else if ( qualityStr == "LOOSE" ) { jetIDFunctor = new JetIDSelectionFunctor( JetIDSelectionFunctor::PURE09, JetIDSelectionFunctor::LOOSE); use_pfloose = true; } else if ( qualityStr == "MEDIUM" ) { jetIDFunctor = new JetIDSelectionFunctor( JetIDSelectionFunctor::PURE09, JetIDSelectionFunctor::LOOSE); // There is no medium quality for CaloJet !! use_pfmedium = true; } else if ( qualityStr == "TIGHT" ) { jetIDFunctor = new JetIDSelectionFunctor( JetIDSelectionFunctor::PURE09, JetIDSelectionFunctor::TIGHT); use_pftight = true; } else throw cms::Exception("InvalidInput") << "Expect quality to be one of MINIMAL, LOOSE_AOD, LOOSE, MEDIUM, TIGHT" << std::endl; }
JetIdSelector< T >::~JetIdSelector | ( | ) | [virtual] |
Definition at line 145 of file JetIdSelector.cc.
{ if(jetIDFunctor) delete jetIDFunctor; }
void JetIdSelector< T >::endJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDProducer.
Definition at line 252 of file JetIdSelector.cc.
References gather_cfg::cout.
{ stringstream ss; ss<<"nJetsTot="<<nJetsTot_<<" nJetsPassed="<<nJetsPassed_ <<" fJetsPassed="<<100.*(nJetsPassed_/(double)nJetsTot_)<<"%\n"; cout<<"++++++++++++++++++++++++++++++++++++++++++++++++++" <<"\n"<< moduleLabel_ << "(JetIdSelector) SUMMARY:\n"<<ss.str() <<"++++++++++++++++++++++++++++++++++++++++++++++++++" <<endl; }
void JetIdSelector< T >::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 157 of file JetIdSelector.cc.
References reco::PFJet::chargedEmEnergy(), reco::PFJet::chargedHadronEnergy(), reco::PFJet::chargedMultiplicity(), reco::LeafCandidate::energy(), reco::LeafCandidate::eta(), edm::Event::getByLabel(), analyzePatCleaning_cfg::jets, reco::Jet::nConstituents(), reco::PFJet::neutralEmEnergy(), reco::PFJet::neutralHadronEnergy(), and edm::Event::put().
{ auto_ptr<JetCollection> selectedJets(new JetCollection); edm::Handle<reco::JetView> jets; // uncorrected jets! iEvent.getByLabel(src_,jets); // handle to the jet ID variables edm::Handle<reco::JetIDValueMap> hJetIDMap; if(typeid((*jets)[0]) == typeid(reco::CaloJet)) iEvent.getByLabel( jetIDMap_, hJetIDMap ); unsigned int idx=0; bool passed = false; for ( edm::View<reco::Jet>::const_iterator ibegin = jets->begin(), iend = jets->end(), iJet = ibegin; iJet != iend; ++iJet ) { // initialize the boolean flag to false passed = false; //calculate the Calo jetID const std::type_info & type = typeid((*jets)[idx]); if( type == typeid(reco::CaloJet) ) { const reco::CaloJet calojet = static_cast<const reco::CaloJet &>((*jets)[idx]); edm::RefToBase<reco::Jet> jetRef = jets->refAt(idx); reco::JetID const & jetId = (*hJetIDMap)[ jetRef ]; passed = (*jetIDFunctor)( calojet, jetId); } //calculate the PF jetID if ( type == typeid(reco::PFJet) ) { const reco::PFJet pfjet = static_cast<const reco::PFJet &>((*jets)[idx]); bool passingLoose=false; bool passingMedium=false; bool passingTight=false; bool ThisIsClean=true; //apply following only if |eta|<2.4: CHF>0, CEMF<0.99, chargedMultiplicity>0 if(( pfjet.chargedHadronEnergy()/ pfjet.energy())<= 0.0 && fabs(pfjet.eta())<2.4) ThisIsClean=false; if( (pfjet.chargedEmEnergy()/pfjet.energy())>= 0.99 && fabs(pfjet.eta())<2.4 ) ThisIsClean=false; if( pfjet.chargedMultiplicity()<=0 && fabs(pfjet.eta())<2.4 ) ThisIsClean=false; // always require #Constituents > 1 if( pfjet.nConstituents() <=1 ) ThisIsClean=false; if(ThisIsClean && (pfjet.neutralHadronEnergy()/pfjet.energy())< 0.99 && (pfjet.neutralEmEnergy()/pfjet.energy())<0.99) passingLoose=true; if(ThisIsClean && (pfjet.neutralHadronEnergy()/pfjet.energy())< 0.95 && (pfjet.neutralEmEnergy()/pfjet.energy())<0.95) passingMedium=true; if(ThisIsClean && (pfjet.neutralHadronEnergy()/pfjet.energy())< 0.90 && (pfjet.neutralEmEnergy()/pfjet.energy())<0.90) passingTight=true; if ( use_pfloose && passingLoose) passed = true; if ( use_pfmedium && passingMedium) passed = true; if ( use_pftight && passingTight) passed = true; } if ( type == typeid(reco::GenJet) || type == typeid(reco::JPTJet)) { edm::LogWarning( "JetId" )<< "Criteria for jets other than CaloJets and PFJets are not yet implemented"; passed = true; } // close GenJet, JPT jet const T& goodJet = static_cast<const T&>((*jets)[idx]); if(passed) selectedJets->push_back( goodJet ); idx++; } // close jet iterator nJetsTot_ +=jets->size(); nJetsPassed_+=selectedJets->size(); iEvent.put(selectedJets); }
JetIDSelectionFunctor* JetIdSelector< T >::jetIDFunctor [private] |
Definition at line 82 of file JetIdSelector.cc.
Referenced by JetIdSelector< T >::JetIdSelector().
edm::InputTag JetIdSelector< T >::jetIDMap_ [private] |
Definition at line 76 of file JetIdSelector.cc.
std::string JetIdSelector< T >::moduleLabel_ [private] |
Definition at line 77 of file JetIdSelector.cc.
unsigned int JetIdSelector< T >::nJetsPassed_ [private] |
Definition at line 81 of file JetIdSelector.cc.
unsigned int JetIdSelector< T >::nJetsTot_ [private] |
Definition at line 80 of file JetIdSelector.cc.
std::string JetIdSelector< T >::qualityStr [private] |
Definition at line 75 of file JetIdSelector.cc.
Referenced by JetIdSelector< T >::JetIdSelector().
edm::InputTag JetIdSelector< T >::src_ [private] |
Definition at line 74 of file JetIdSelector.cc.
bool JetIdSelector< T >::use_pfloose [private] |
Definition at line 83 of file JetIdSelector.cc.
Referenced by JetIdSelector< T >::JetIdSelector().
bool JetIdSelector< T >::use_pfmedium [private] |
Definition at line 84 of file JetIdSelector.cc.
Referenced by JetIdSelector< T >::JetIdSelector().
bool JetIdSelector< T >::use_pftight [private] |
Definition at line 85 of file JetIdSelector.cc.
Referenced by JetIdSelector< T >::JetIdSelector().