CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
SelectionStepHLT< Object > Class Template Reference

#include <TopHLTDQMHelper.h>

Public Member Functions

bool select (const edm::Event &event)
 apply selection More...
 
bool select (const edm::Event &event, const edm::EventSetup &setup)
 apply selection override for jets More...
 
 SelectionStepHLT (const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
 default constructor More...
 
bool selectVertex (const edm::Event &event)
 
 ~SelectionStepHLT ()
 default destructor More...
 

Private Attributes

edm::InputTag btagLabel_
 choice for b-tag as extra selection type More...
 
edm::EDGetTokenT
< reco::JetTagCollection
btagToken_
 
double btagWorkingPoint_
 choice of b-tag working point as extra selection type More...
 
int eidPattern_
 
edm::InputTag electronId_
 electronId label as extra selection type More...
 
edm::EDGetTokenT
< edm::ValueMap< float > > 
electronIdToken_
 
std::string jetCorrector_
 jet corrector as extra selection type More...
 
edm::InputTag jetIDLabel_
 jetID as an extra selection type More...
 
StringCutObjectSelector
< reco::JetID > * 
jetIDSelect_
 selection string on the jetID More...
 
edm::EDGetTokenT
< reco::JetIDValueMap
jetIDToken_
 
int max_
 
int min_
 min/max for object multiplicity More...
 
edm::InputTag pvs_
 
edm::EDGetTokenT< edm::View
< reco::Vertex > > 
pvsToken_
 
StringCutObjectSelector< Object > select_
 string cut selector More...
 
edm::InputTag src_
 input collection More...
 
edm::EDGetTokenT< edm::View
< Object > > 
srcToken_
 

Detailed Description

template<typename Object>
class SelectionStepHLT< Object >

Definition at line 177 of file TopHLTDQMHelper.h.

Constructor & Destructor Documentation

template<typename Object >
SelectionStepHLT< Object >::SelectionStepHLT ( const edm::ParameterSet cfg,
edm::ConsumesCollector &&  iC 
)

default constructor

Definition at line 231 of file TopHLTDQMHelper.h.

References SelectionStepHLT< Object >::btagLabel_, SelectionStepHLT< Object >::btagToken_, SelectionStepHLT< Object >::btagWorkingPoint_, SelectionStepHLT< Object >::eidPattern_, SelectionStepHLT< Object >::electronId_, SelectionStepHLT< Object >::electronIdToken_, edm::ParameterSet::exists(), edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), SelectionStepHLT< Object >::jetCorrector_, bTagSequences_cff::jetID, SelectionStepHLT< Object >::jetIDLabel_, SelectionStepHLT< Object >::jetIDSelect_, SelectionStepHLT< Object >::jetIDToken_, SelectionStepHLT< Object >::max_, SelectionStepHLT< Object >::min_, SelectionStepHLT< Object >::pvsToken_, SelectionStepHLT< Object >::srcToken_, and AlCaHLTBitMon_QueryRunRegistry::string.

231  :
232  src_( cfg.getParameter<edm::InputTag>( "src" )),
233  select_( cfg.getParameter<std::string>("select")),
234  jetIDSelect_(0)
235 {
238  // construct min/max if the corresponding params
239  // exist otherwise they are initialized with -1
240  cfg.exists("min") ? min_= cfg.getParameter<int>("min") : min_= -1;
241  cfg.exists("max") ? max_= cfg.getParameter<int>("max") : max_= -1;
242  // read electron extras if they exist
243  if(cfg.existsAs<edm::ParameterSet>("electronId")){
244  edm::ParameterSet elecId=cfg.getParameter<edm::ParameterSet>("electronId");
245  electronId_= elecId.getParameter<edm::InputTag>("src");
247  eidPattern_= elecId.getParameter<int>("pattern");
248  }
249  // read jet corrector label if it exists
250  if(cfg.exists("jetCorrector")){ jetCorrector_= cfg.getParameter<std::string>("jetCorrector"); }
251  // read btag information if it exists
252  if(cfg.existsAs<edm::ParameterSet>("jetBTagger")){
253  edm::ParameterSet jetBTagger=cfg.getParameter<edm::ParameterSet>("jetBTagger");
254  btagLabel_=jetBTagger.getParameter<edm::InputTag>("label");
256  btagWorkingPoint_=jetBTagger.getParameter<double>("workingPoint");
257  }
258  // read jetID information if it exists
259  if(cfg.existsAs<edm::ParameterSet>("jetID")){
261  jetIDLabel_ =jetID.getParameter<edm::InputTag>("label");
264  }
265 }
edm::InputTag btagLabel_
choice for b-tag as extra selection type
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::InputTag src_
input collection
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:184
edm::EDGetTokenT< edm::View< reco::Vertex > > pvsToken_
edm::InputTag jetIDLabel_
jetID as an extra selection type
edm::InputTag electronId_
electronId label as extra selection type
int min_
min/max for object multiplicity
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< edm::ValueMap< float > > electronIdToken_
edm::EDGetTokenT< reco::JetIDValueMap > jetIDToken_
StringCutObjectSelector< reco::JetID > * jetIDSelect_
selection string on the jetID
StringCutObjectSelector< Object > select_
string cut selector
double btagWorkingPoint_
choice of b-tag working point as extra selection type
std::string jetCorrector_
jet corrector as extra selection type
edm::EDGetTokenT< reco::JetTagCollection > btagToken_
edm::EDGetTokenT< edm::View< Object > > srcToken_
template<typename Object>
SelectionStepHLT< Object >::~SelectionStepHLT ( )
inline

default destructor

Definition at line 182 of file TopHLTDQMHelper.h.

182 {};

Member Function Documentation

template<typename Object >
bool SelectionStepHLT< Object >::select ( const edm::Event event)

apply selection

Definition at line 269 of file TopHLTDQMHelper.h.

References accept(), edm::Event::getByToken(), customizeTrackingMonitorSeedNumber::idx, n, getGTfromDQMFile::obj, and alcazmumu_cfi::src.

Referenced by TopHLTSingleLeptonDQM::analyze(), and TopHLTDiLeptonOfflineDQM::analyze().

270 {
271  // fetch input collection
273  if( !event.getByToken(srcToken_, src) ) return false;
274 
275  // load electronId value map if configured such
277  if(!electronId_.label().empty()) {
278  if( !event.getByToken(electronIdToken_, electronId) ) return false;
279  }
280 
281  // determine multiplicity of selected objects
282  int n=0;
283  for(typename edm::View<Object>::const_iterator obj=src->begin(); obj!=src->end(); ++obj){
284  // special treatment for electrons
285  if(dynamic_cast<const reco::GsfElectron*>(&*obj)){
286  unsigned int idx = obj-src->begin();
287  if( electronId_.label().empty() ? true : ((int)(*electronId)[src->refAt(idx)] & eidPattern_) ){
288  if(select_(*obj))++n;
289  }
290  }
291  // normal treatment
292  else{
293  if(select_(*obj))++n;
294  }
295  }
296  bool accept=(min_>=0 ? n>=min_:true) && (max_>=0 ? n<=max_:true);
297  return (min_<0 && max_<0) ? (n>0):accept;
298 }
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
edm::InputTag electronId_
electronId label as extra selection type
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
int min_
min/max for object multiplicity
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:26
edm::EDGetTokenT< edm::ValueMap< float > > electronIdToken_
StringCutObjectSelector< Object > select_
string cut selector
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
std::string const & label() const
Definition: InputTag.h:42
edm::EDGetTokenT< edm::View< Object > > srcToken_
template<typename Object >
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 324 of file TopHLTDQMHelper.h.

References accept(), JetCorrector::correction(), edm::EventSetup::find(), edm::Event::getByToken(), JetCorrector::getJetCorrector(), customizeTrackingMonitorSeedNumber::idx, metsig::jet, bTagSequences_cff::jetID, n, getGTfromDQMFile::obj, and alcazmumu_cfi::src.

325 {
326  // fetch input collection
328  if( !event.getByToken(srcToken_, src) ) return false;
329 
330  // load btag collection if configured such
331  // NOTE that the JetTagCollection needs an
332  // edm::View to reco::Jets; we have to add
333  // another Handle bjets for this purpose
337  if(!btagLabel_.label().empty()){
338  if( !event.getByToken(srcToken_, bjets) ) return false;
339  if( !event.getByToken(btagToken_, btagger) ) return false;
340  if( !event.getByToken(pvsToken_, pvertex) ) return false;
341  }
342 
343  // load jetID value map if configured such
345  if(jetIDSelect_){
346  if( !event.getByToken(jetIDToken_, jetID) ) return false;
347 
348  }
349 
350  // load jet corrector if configured such
351  const JetCorrector* corrector=0;
352  if(!jetCorrector_.empty()){
353  // check whether a jet correcto is in the event setup or not
354  if(setup.find( edm::eventsetup::EventSetupRecordKey::makeKey<JetCorrectionsRecord>() )){
355  corrector = JetCorrector::getJetCorrector(jetCorrector_, setup);
356  }
357  else{
358  edm::LogVerbatim( "TopDQMHelpers" )
359  << "\n"
360  << "------------------------------------------------------------------------------------- \n"
361  << " No JetCorrectionsRecord available from EventSetup: \n"
362  << " - Jets will not be corrected. \n"
363  << " - If you want to change this add the following lines to your cfg file \n"
364  << " \n"
365  << " ## load jet corrections \n"
366  << " process.load(\"JetMETCorrections.Configuration.JetCorrectionServicesAllAlgos_cff\") \n"
367  << " process.prefer(\"ak5CaloL2L3\") \n"
368  << " \n"
369  << "------------------------------------------------------------------------------------- \n";
370  }
371  }
372  // determine multiplicity of selected objects
373  int n=0;
374  for(typename edm::View<Object>::const_iterator obj=src->begin(); obj!=src->end(); ++obj){
375  // check for chosen btag discriminator to be above the
376  // corresponding working point if configured such
377  unsigned int idx = obj-src->begin();
378  if( btagLabel_.label().empty() ? true : (*btagger)[bjets->refAt(idx)]>btagWorkingPoint_ ){
379  bool passedJetID=true;
380  // check jetID for calo jets
381  if( jetIDSelect_ && dynamic_cast<const reco::CaloJet*>(src->refAt(idx).get())){
382  passedJetID=(*jetIDSelect_)((*jetID)[src->refAt(idx)]);
383  }
384  if(passedJetID){
385  // scale jet energy if configured such
386  Object jet=*obj; jet.scaleEnergy(corrector ? corrector->correction(*obj) : 1.);
387  if(select_(jet))++n;
388  }
389  }
390  }
391  bool accept=(min_>=0 ? n>=min_:true) && (max_>=0 ? n<=max_:true);
392  return (min_<0 && max_<0) ? (n>0):accept;
393 }
edm::InputTag btagLabel_
choice for b-tag as extra selection type
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
edm::EDGetTokenT< edm::View< reco::Vertex > > pvsToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
virtual double correction(const LorentzVector &fJet) const =0
get correction using Jet information only
int min_
min/max for object multiplicity
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:26
const eventsetup::EventSetupRecord * find(const eventsetup::EventSetupRecordKey &) const
Definition: EventSetup.cc:90
edm::EDGetTokenT< reco::JetIDValueMap > jetIDToken_
StringCutObjectSelector< reco::JetID > * jetIDSelect_
selection string on the jetID
StringCutObjectSelector< Object > select_
string cut selector
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
static const JetCorrector * getJetCorrector(const std::string &fName, const edm::EventSetup &fSetup)
retrieve corrector from the event setup. troughs exception if something is missing ...
Definition: JetCorrector.cc:50
std::string const & label() const
Definition: InputTag.h:42
double btagWorkingPoint_
choice of b-tag working point as extra selection type
std::string jetCorrector_
jet corrector as extra selection type
edm::EDGetTokenT< reco::JetTagCollection > btagToken_
edm::EDGetTokenT< edm::View< Object > > srcToken_
template<typename Object >
bool SelectionStepHLT< Object >::selectVertex ( const edm::Event event)

Definition at line 300 of file TopHLTDQMHelper.h.

References accept(), edm::Event::getByToken(), n, getGTfromDQMFile::obj, and alcazmumu_cfi::src.

301 {
302  // fetch input collection
304  if( !event.getByToken(srcToken_, src) ) return false;
305 
306  // load electronId value map if configured such
308  if(!electronId_.label().empty()) {
309  if( !event.getByToken(electronIdToken_, electronId) ) return false;
310  }
311 
312  // determine multiplicity of selected objects
313  int n=0;
314  for(typename edm::View<Object>::const_iterator obj=src->begin(); obj!=src->end(); ++obj){
315 
316  if(select_(*obj))++n;
317  }
318  bool accept=(min_>=0 ? n>=min_:true) && (max_>=0 ? n<=max_:true);
319  return (min_<0 && max_<0) ? (n>0):accept;
320 }
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
edm::InputTag electronId_
electronId label as extra selection type
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
int min_
min/max for object multiplicity
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:26
edm::EDGetTokenT< edm::ValueMap< float > > electronIdToken_
StringCutObjectSelector< Object > select_
string cut selector
std::string const & label() const
Definition: InputTag.h:42
edm::EDGetTokenT< edm::View< Object > > srcToken_

Member Data Documentation

template<typename Object>
edm::InputTag SelectionStepHLT< Object >::btagLabel_
private

choice for b-tag as extra selection type

Definition at line 212 of file TopHLTDQMHelper.h.

Referenced by SelectionStepHLT< Object >::SelectionStepHLT().

template<typename Object>
edm::EDGetTokenT<reco::JetTagCollection> SelectionStepHLT< Object >::btagToken_
private

Definition at line 213 of file TopHLTDQMHelper.h.

Referenced by SelectionStepHLT< Object >::SelectionStepHLT().

template<typename Object>
double SelectionStepHLT< Object >::btagWorkingPoint_
private

choice of b-tag working point as extra selection type

Definition at line 215 of file TopHLTDQMHelper.h.

Referenced by SelectionStepHLT< Object >::SelectionStepHLT().

template<typename Object>
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 208 of file TopHLTDQMHelper.h.

Referenced by SelectionStepHLT< Object >::SelectionStepHLT().

template<typename Object>
edm::InputTag SelectionStepHLT< Object >::electronId_
private

electronId label as extra selection type

Definition at line 196 of file TopHLTDQMHelper.h.

Referenced by SelectionStepHLT< Object >::SelectionStepHLT().

template<typename Object>
edm::EDGetTokenT< edm::ValueMap<float> > SelectionStepHLT< Object >::electronIdToken_
private

Definition at line 197 of file TopHLTDQMHelper.h.

Referenced by SelectionStepHLT< Object >::SelectionStepHLT().

template<typename Object>
std::string SelectionStepHLT< Object >::jetCorrector_
private

jet corrector as extra selection type

Definition at line 210 of file TopHLTDQMHelper.h.

Referenced by SelectionStepHLT< Object >::SelectionStepHLT().

template<typename Object>
edm::InputTag SelectionStepHLT< Object >::jetIDLabel_
private

jetID as an extra selection type

Definition at line 217 of file TopHLTDQMHelper.h.

Referenced by SelectionStepHLT< Object >::SelectionStepHLT().

template<typename Object>
StringCutObjectSelector<reco::JetID>* SelectionStepHLT< Object >::jetIDSelect_
private

selection string on the jetID

Definition at line 226 of file TopHLTDQMHelper.h.

Referenced by SelectionStepHLT< Object >::SelectionStepHLT().

template<typename Object>
edm::EDGetTokenT<reco::JetIDValueMap> SelectionStepHLT< Object >::jetIDToken_
private

Definition at line 218 of file TopHLTDQMHelper.h.

Referenced by SelectionStepHLT< Object >::SelectionStepHLT().

template<typename Object>
int SelectionStepHLT< Object >::max_
private

Definition at line 194 of file TopHLTDQMHelper.h.

Referenced by SelectionStepHLT< Object >::SelectionStepHLT().

template<typename Object>
int SelectionStepHLT< Object >::min_
private

min/max for object multiplicity

Definition at line 194 of file TopHLTDQMHelper.h.

Referenced by SelectionStepHLT< Object >::SelectionStepHLT().

template<typename Object>
edm::InputTag SelectionStepHLT< Object >::pvs_
private

Definition at line 220 of file TopHLTDQMHelper.h.

template<typename Object>
edm::EDGetTokenT<edm::View<reco::Vertex> > SelectionStepHLT< Object >::pvsToken_
private

Definition at line 221 of file TopHLTDQMHelper.h.

Referenced by SelectionStepHLT< Object >::SelectionStepHLT().

template<typename Object>
StringCutObjectSelector<Object> SelectionStepHLT< Object >::select_
private

string cut selector

Definition at line 224 of file TopHLTDQMHelper.h.

template<typename Object>
edm::InputTag SelectionStepHLT< Object >::src_
private

input collection

Definition at line 191 of file TopHLTDQMHelper.h.

template<typename Object>
edm::EDGetTokenT< edm::View<Object> > SelectionStepHLT< Object >::srcToken_
private

Definition at line 192 of file TopHLTDQMHelper.h.

Referenced by SelectionStepHLT< Object >::SelectionStepHLT().