#include <TopHLTDQMHelper.h>
Public Member Functions | |
bool | select (const edm::Event &event) |
apply selection | |
bool | select (const edm::Event &event, const edm::EventSetup &setup) |
apply selection override for jets | |
SelectionStepHLT (const edm::ParameterSet &cfg) | |
default constructor | |
bool | selectVertex (const edm::Event &event) |
~SelectionStepHLT () | |
default destructor | |
Private Attributes | |
edm::InputTag | btagLabel_ |
choice for b-tag as extra selection type | |
double | btagWorkingPoint_ |
choice of b-tag working point as extra selection type | |
int | eidPattern_ |
edm::InputTag | electronId_ |
electronId label as extra selection type | |
std::string | jetCorrector_ |
jet corrector as extra selection type | |
edm::InputTag | jetIDLabel_ |
jetID as an extra selection type | |
StringCutObjectSelector < reco::JetID > * | jetIDSelect_ |
selection string on the jetID | |
int | max_ |
int | min_ |
min/max for object multiplicity | |
edm::InputTag | pvs_ |
StringCutObjectSelector< Object > | select_ |
string cut selector | |
edm::InputTag | src_ |
input collection |
Definition at line 173 of file TopHLTDQMHelper.h.
SelectionStepHLT< Object >::SelectionStepHLT | ( | const edm::ParameterSet & | cfg | ) |
default constructor
Definition at line 222 of file TopHLTDQMHelper.h.
References SelectionStepHLT< Object >::btagLabel_, SelectionStepHLT< Object >::btagWorkingPoint_, SelectionStepHLT< Object >::eidPattern_, SelectionStepHLT< Object >::electronId_, edm::ParameterSet::exists(), edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), SelectionStepHLT< Object >::jetCorrector_, SelectionStepHLT< Object >::jetIDLabel_, SelectionStepHLT< Object >::jetIDSelect_, SelectionStepHLT< Object >::max_, and SelectionStepHLT< Object >::min_.
: src_( cfg.getParameter<edm::InputTag>( "src" )), select_( cfg.getParameter<std::string>("select")), jetIDSelect_(0) { // construct min/max if the corresponding params // exist otherwise they are initialized with -1 cfg.exists("min") ? min_= cfg.getParameter<int>("min") : min_= -1; cfg.exists("max") ? max_= cfg.getParameter<int>("max") : max_= -1; // read electron extras if they exist if(cfg.existsAs<edm::ParameterSet>("electronId")){ edm::ParameterSet elecId=cfg.getParameter<edm::ParameterSet>("electronId"); electronId_= elecId.getParameter<edm::InputTag>("src"); eidPattern_= elecId.getParameter<int>("pattern"); } // read jet corrector label if it exists if(cfg.exists("jetCorrector")){ jetCorrector_= cfg.getParameter<std::string>("jetCorrector"); } // read btag information if it exists if(cfg.existsAs<edm::ParameterSet>("jetBTagger")){ edm::ParameterSet jetBTagger=cfg.getParameter<edm::ParameterSet>("jetBTagger"); btagLabel_=jetBTagger.getParameter<edm::InputTag>("label"); btagWorkingPoint_=jetBTagger.getParameter<double>("workingPoint"); } // read jetID information if it exists if(cfg.existsAs<edm::ParameterSet>("jetID")){ edm::ParameterSet jetID=cfg.getParameter<edm::ParameterSet>("jetID"); jetIDLabel_ =jetID.getParameter<edm::InputTag>("label"); jetIDSelect_= new StringCutObjectSelector<reco::JetID>(jetID.getParameter<std::string>("select")); } }
SelectionStepHLT< Object >::~SelectionStepHLT | ( | ) | [inline] |
bool SelectionStepHLT< Object >::select | ( | const edm::Event & | event | ) |
apply selection
Definition at line 255 of file TopHLTDQMHelper.h.
References accept(), edm::Event::getByLabel(), n, getGTfromDQMFile::obj, and alcazmumu_cfi::src.
Referenced by TopHLTDiLeptonOfflineDQM::analyze().
{ // fetch input collection edm::Handle<edm::View<Object> > src; if( !event.getByLabel(src_, src) ) return false; // load electronId value map if configured such edm::Handle<edm::ValueMap<float> > electronId; if(!electronId_.label().empty()) { if( !event.getByLabel(electronId_, electronId) ) return false; } // determine multiplicity of selected objects int n=0; for(typename edm::View<Object>::const_iterator obj=src->begin(); obj!=src->end(); ++obj){ // special treatment for electrons if(dynamic_cast<const reco::GsfElectron*>(&*obj)){ unsigned int idx = obj-src->begin(); if( electronId_.label().empty() ? true : ((int)(*electronId)[src->refAt(idx)] & eidPattern_) ){ if(select_(*obj))++n; } } // normal treatment else{ if(select_(*obj))++n; } } bool accept=(min_>=0 ? n>=min_:true) && (max_>=0 ? n<=max_:true); return (min_<0 && max_<0) ? (n>0):accept; }
bool SelectionStepHLT< Object >::select | ( | const edm::Event & | event, |
const edm::EventSetup & | setup | ||
) |
apply selection override for jets
apply selection (w/o using the template class Object), override for jets
Definition at line 310 of file TopHLTDQMHelper.h.
References accept(), JetCorrector::correction(), edm::EventSetup::find(), edm::Event::getByLabel(), JetCorrector::getJetCorrector(), metsig::jet, n, getGTfromDQMFile::obj, and alcazmumu_cfi::src.
{ // fetch input collection edm::Handle<edm::View<Object> > src; if( !event.getByLabel(src_, src) ) return false; // load btag collection if configured such // NOTE that the JetTagCollection needs an // edm::View to reco::Jets; we have to add // another Handle bjets for this purpose edm::Handle<edm::View<reco::Jet> > bjets; edm::Handle<reco::JetTagCollection> btagger; edm::Handle<edm::View<reco::Vertex> > pvertex; if(!btagLabel_.label().empty()){ if( !event.getByLabel(src_, bjets) ) return false; if( !event.getByLabel(btagLabel_, btagger) ) return false; if( !event.getByLabel(pvs_, pvertex) ) return false; } // load jetID value map if configured such edm::Handle<reco::JetIDValueMap> jetID; if(jetIDSelect_){ if( !event.getByLabel(jetIDLabel_, jetID) ) return false; } // load jet corrector if configured such const JetCorrector* corrector=0; if(!jetCorrector_.empty()){ // check whether a jet correcto is in the event setup or not if(setup.find( edm::eventsetup::EventSetupRecordKey::makeKey<JetCorrectionsRecord>() )){ corrector = JetCorrector::getJetCorrector(jetCorrector_, setup); } else{ edm::LogVerbatim( "TopDQMHelpers" ) << "\n" << "------------------------------------------------------------------------------------- \n" << " No JetCorrectionsRecord available from EventSetup: \n" << " - Jets will not be corrected. \n" << " - If you want to change this add the following lines to your cfg file \n" << " \n" << " ## load jet corrections \n" << " process.load(\"JetMETCorrections.Configuration.JetCorrectionServicesAllAlgos_cff\") \n" << " process.prefer(\"ak5CaloL2L3\") \n" << " \n" << "------------------------------------------------------------------------------------- \n"; } } // determine multiplicity of selected objects int n=0; for(typename edm::View<Object>::const_iterator obj=src->begin(); obj!=src->end(); ++obj){ // check for chosen btag discriminator to be above the // corresponding working point if configured such unsigned int idx = obj-src->begin(); if( btagLabel_.label().empty() ? true : (*btagger)[bjets->refAt(idx)]>btagWorkingPoint_ ){ bool passedJetID=true; // check jetID for calo jets if( jetIDSelect_ && dynamic_cast<const reco::CaloJet*>(src->refAt(idx).get())){ passedJetID=(*jetIDSelect_)((*jetID)[src->refAt(idx)]); } if(passedJetID){ // scale jet energy if configured such Object jet=*obj; jet.scaleEnergy(corrector ? corrector->correction(*obj) : 1.); if(select_(jet))++n; } } } bool accept=(min_>=0 ? n>=min_:true) && (max_>=0 ? n<=max_:true); return (min_<0 && max_<0) ? (n>0):accept; }
bool SelectionStepHLT< Object >::selectVertex | ( | const edm::Event & | event | ) |
Definition at line 286 of file TopHLTDQMHelper.h.
References accept(), edm::Event::getByLabel(), n, getGTfromDQMFile::obj, and alcazmumu_cfi::src.
{ // fetch input collection edm::Handle<edm::View<Object> > src; if( !event.getByLabel(src_, src) ) return false; // load electronId value map if configured such edm::Handle<edm::ValueMap<float> > electronId; if(!electronId_.label().empty()) { if( !event.getByLabel(electronId_, electronId) ) return false; } // determine multiplicity of selected objects int n=0; for(typename edm::View<Object>::const_iterator obj=src->begin(); obj!=src->end(); ++obj){ if(select_(*obj))++n; } bool accept=(min_>=0 ? n>=min_:true) && (max_>=0 ? n<=max_:true); return (min_<0 && max_<0) ? (n>0):accept; }
edm::InputTag SelectionStepHLT< Object >::btagLabel_ [private] |
choice for b-tag as extra selection type
Definition at line 206 of file TopHLTDQMHelper.h.
Referenced by SelectionStepHLT< Object >::SelectionStepHLT().
double SelectionStepHLT< Object >::btagWorkingPoint_ [private] |
choice of b-tag working point as extra selection type
Definition at line 208 of file TopHLTDQMHelper.h.
Referenced by SelectionStepHLT< Object >::SelectionStepHLT().
int SelectionStepHLT< Object >::eidPattern_ [private] |
electronId pattern we expect the following pattern: 0: fails 1: passes electron ID only 2: passes electron Isolation only 3: passes electron ID and Isolation only 4: passes conversion rejection 5: passes conversion rejection and ID 6: passes conversion rejection and Isolation 7: passes the whole selection As described on https://twiki.cern.ch/twiki/bin/view/CMS/SimpleCutBasedEleID
Definition at line 202 of file TopHLTDQMHelper.h.
Referenced by SelectionStepHLT< Object >::SelectionStepHLT().
edm::InputTag SelectionStepHLT< Object >::electronId_ [private] |
electronId label as extra selection type
Definition at line 191 of file TopHLTDQMHelper.h.
Referenced by SelectionStepHLT< Object >::SelectionStepHLT().
std::string SelectionStepHLT< Object >::jetCorrector_ [private] |
jet corrector as extra selection type
Definition at line 204 of file TopHLTDQMHelper.h.
Referenced by SelectionStepHLT< Object >::SelectionStepHLT().
edm::InputTag SelectionStepHLT< Object >::jetIDLabel_ [private] |
jetID as an extra selection type
Definition at line 210 of file TopHLTDQMHelper.h.
Referenced by SelectionStepHLT< Object >::SelectionStepHLT().
StringCutObjectSelector<reco::JetID>* SelectionStepHLT< Object >::jetIDSelect_ [private] |
selection string on the jetID
Definition at line 217 of file TopHLTDQMHelper.h.
Referenced by SelectionStepHLT< Object >::SelectionStepHLT().
int SelectionStepHLT< Object >::max_ [private] |
Definition at line 189 of file TopHLTDQMHelper.h.
Referenced by SelectionStepHLT< Object >::SelectionStepHLT().
int SelectionStepHLT< Object >::min_ [private] |
min/max for object multiplicity
Definition at line 189 of file TopHLTDQMHelper.h.
Referenced by SelectionStepHLT< Object >::SelectionStepHLT().
edm::InputTag SelectionStepHLT< Object >::pvs_ [private] |
Definition at line 212 of file TopHLTDQMHelper.h.
StringCutObjectSelector<Object> SelectionStepHLT< Object >::select_ [private] |
string cut selector
Definition at line 215 of file TopHLTDQMHelper.h.
edm::InputTag SelectionStepHLT< Object >::src_ [private] |
input collection
Definition at line 187 of file TopHLTDQMHelper.h.