CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
SelectionStepHLT< Object > Class Template Reference

#include <TopHLTOfflineDQMHelper.h>

Inheritance diagram for SelectionStepHLT< Object >:
SelectionStepHLTBase

Public Member Functions

template<>
bool select (const edm::Event &event, const edm::EventSetup &setup)
 apply selection (w/o using the template class Object), override for jets More...
 
bool select (const edm::Event &event) override
 apply selection More...
 
bool select (const edm::Event &event, const edm::EventSetup &setup) override
 apply selection override for jets More...
 
 SelectionStepHLT (const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
 default constructor More...
 
bool selectVertex (const edm::Event &event)
 
 ~SelectionStepHLT () override=default
 default destructor More...
 
- Public Member Functions inherited from SelectionStepHLTBase
virtual ~SelectionStepHLTBase ()=default
 

Private Attributes

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

Detailed Description

template<typename Object>
class SelectionStepHLT< Object >

Definition at line 190 of file TopHLTOfflineDQMHelper.h.

Constructor & Destructor Documentation

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

default constructor

Definition at line 239 of file TopHLTOfflineDQMHelper.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_, SelectionStepHLT< Object >::min_, and AlCaHLTBitMon_QueryRunRegistry::string.

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

default destructor

Member Function Documentation

template<>
bool SelectionStepHLT< reco::Jet >::select ( const edm::Event event,
const edm::EventSetup setup 
)
virtual

apply selection (w/o using the template class Object), override for jets

Reimplemented from SelectionStepHLTBase.

Definition at line 9 of file TopHLTOfflineDQMHelper.cc.

References accept(), JetCorrector::correction(), mitigatedMETSequence_cff::corrector, edm::EventSetup::find(), edm::Event::getByToken(), JetCorrector::getJetCorrector(), training_settings::idx, metsig::jet, gen::n, GetRecoTauVFromDQM_MC_cff::obj, reco::Jet::scaleEnergy(), and TrackRefitter_38T_cff::src.

10 {
11  // fetch input collection
13  if( !event.getByToken(src_, src) ) return false;
14 
15  // load btag collection if configured such
16  // NOTE that the JetTagCollection needs an
17  // edm::View to reco::Jets; we have to add
18  // another Handle bjets for this purpose
23  if( !event.getByToken(src_, bjets) ) return false;
24  if( !event.getByToken(btagLabel_, btagger) ) return false;
25  if( !event.getByToken(pvs_, pvertex) ) return false;
26  }
27 
28  // load jetID value map if configured such
30  if(jetIDSelect_){
31  if( !event.getByToken(jetIDLabel_, jetID) ) return false;
32 
33  }
34 
35  // load jet corrector if configured such
36  const JetCorrector* corrector=nullptr;
37  if(!jetCorrector_.empty()){
38  // check whether a jet correcto is in the event setup or not
39  if(setup.find( edm::eventsetup::EventSetupRecordKey::makeKey<JetCorrectionsRecord>() )){
40  corrector = JetCorrector::getJetCorrector(jetCorrector_, setup);
41  }
42  else{
43  edm::LogVerbatim( "TopHLTOfflineDQMHelper" )
44  << "\n"
45  << "------------------------------------------------------------------------------------- \n"
46  << " No JetCorrectionsRecord available from EventSetup: \n"
47  << " - Jets will not be corrected. \n"
48  << " - If you want to change this add the following lines to your cfg file \n"
49  << " \n"
50  << " ## load jet corrections \n"
51  << " process.load(\"JetMETCorrections.Configuration.JetCorrectionServicesAllAlgos_cff\") \n"
52  << " process.prefer(\"ak5CaloL2L3\") \n"
53  << " \n"
54  << "------------------------------------------------------------------------------------- \n";
55  }
56  }
57  // determine multiplicity of selected objects
58  int n=0;
59  for(typename edm::View<reco::Jet>::const_iterator obj=src->begin(); obj!=src->end(); ++obj){
60  // check for chosen btag discriminator to be above the
61  // corresponding working point if configured such
62  unsigned int idx = obj-src->begin();
63  if( btagLabel_.isUninitialized() ? true : (*btagger)[bjets->refAt(idx)]>btagWorkingPoint_ ){
64  bool passedJetID=true;
65  // check jetID for calo jets
66  if( jetIDSelect_ && dynamic_cast<const reco::CaloJet*>(src->refAt(idx).get())){
67  passedJetID=(*jetIDSelect_)((*jetID)[src->refAt(idx)]);
68  }
69  if(passedJetID){
70  // scale jet energy if configured such
71  reco::Jet jet=*obj; jet.scaleEnergy(corrector ? corrector->correction(*obj) : 1.);
72  if(select_(jet))++n;
73  }
74  }
75  }
76  bool accept=(min_>=0 ? n>=min_:true) && (max_>=0 ? n<=max_:true);
77  return (min_<0 && max_<0) ? (n>0):accept;
78 }
virtual void scaleEnergy(double fScale)
scale energy of the jet
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
Base class for all types of Jets.
Definition: Jet.h:20
edm::EDGetTokenT< reco::JetTagCollection > btagLabel_
choice for b-tag as extra selection type
int min_
min/max for object multiplicity
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
const eventsetup::EventSetupRecord * find(const eventsetup::EventSetupRecordKey &) const
Definition: EventSetup.cc:85
StringCutObjectSelector< reco::JetID > * jetIDSelect_
selection string on the jetID
virtual double correction(const LorentzVector &fJet) const =0
get correction using Jet information only
StringCutObjectSelector< Object > select_
string cut selector
edm::EDGetTokenT< edm::View< Object > > src_
input collection
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
edm::EDGetTokenT< edm::View< reco::Vertex > > pvs_
double btagWorkingPoint_
choice of b-tag working point as extra selection type
std::string jetCorrector_
jet corrector as extra selection type
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
bool isUninitialized() const
Definition: EDGetToken.h:73
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
template<typename Object >
bool SelectionStepHLT< Object >::select ( const edm::Event event)
overridevirtual

apply selection

Reimplemented from SelectionStepHLTBase.

Definition at line 272 of file TopHLTOfflineDQMHelper.h.

References accept(), SelectionStepHLT< Object >::eidPattern_, SelectionStepHLT< Object >::electronId_, edm::Event::getByToken(), training_settings::idx, createfilelist::int, edm::EDGetTokenT< T >::isUninitialized(), SelectionStepHLT< Object >::max_, SelectionStepHLT< Object >::min_, gen::n, GetRecoTauVFromDQM_MC_cff::obj, SelectionStepHLT< Object >::select_, TrackRefitter_38T_cff::src, and SelectionStepHLT< Object >::src_.

Referenced by Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Views.LineDecayView.LineDecayContainer::mousePressEvent(), Vispa.Gui.PortConnection.PointToPointConnection::mousePressEvent(), Vispa.Gui.VispaWidget.VispaWidget::mousePressEvent(), and Vispa.Views.AbstractView.AbstractView::restoreSelection().

273 {
274  // fetch input collection
276  if( !event.getByToken(src_, src) ) return false;
277 
278  // load electronId value map if configured such
281  if( !event.getByToken(electronId_, electronId) ) return false;
282  }
283 
284  // determine multiplicity of selected objects
285  int n=0;
286  for(typename edm::View<Object>::const_iterator obj=src->begin(); obj!=src->end(); ++obj){
287  // special treatment for electrons
288  if(dynamic_cast<const reco::GsfElectron*>(&*obj)){
289  unsigned int idx = obj-src->begin();
290  if( electronId_.isUninitialized() ? true : ((int)(*electronId)[src->refAt(idx)] & eidPattern_) ){
291  if(select_(*obj))++n;
292  }
293  }
294  // normal treatment
295  else{
296  if(select_(*obj))++n;
297  }
298  }
299  bool accept=(min_>=0 ? n>=min_:true) && (max_>=0 ? n<=max_:true);
300  return (min_<0 && max_<0) ? (n>0):accept;
301 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
int min_
min/max for object multiplicity
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label as extra selection type
StringCutObjectSelector< Object > select_
string cut selector
edm::EDGetTokenT< edm::View< Object > > src_
input collection
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
bool isUninitialized() const
Definition: EDGetToken.h:73
template<typename Object >
bool SelectionStepHLT< Object >::select ( const edm::Event event,
const edm::EventSetup setup 
)
overridevirtual
template<typename Object >
bool SelectionStepHLT< Object >::selectVertex ( const edm::Event event)

Definition at line 303 of file TopHLTOfflineDQMHelper.h.

References accept(), SelectionStepHLT< Object >::electronId_, edm::Event::getByToken(), edm::EDGetTokenT< T >::isUninitialized(), SelectionStepHLT< Object >::max_, SelectionStepHLT< Object >::min_, gen::n, GetRecoTauVFromDQM_MC_cff::obj, SelectionStepHLT< Object >::select_, TrackRefitter_38T_cff::src, and SelectionStepHLT< Object >::src_.

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

Member Data Documentation

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

choice for b-tag as extra selection type

Definition at line 223 of file TopHLTOfflineDQMHelper.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 225 of file TopHLTOfflineDQMHelper.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 219 of file TopHLTOfflineDQMHelper.h.

Referenced by SelectionStepHLT< Object >::select(), and SelectionStepHLT< Object >::SelectionStepHLT().

template<typename Object >
edm::EDGetTokenT< edm::ValueMap<float> > SelectionStepHLT< Object >::electronId_
private
template<typename Object >
std::string SelectionStepHLT< Object >::jetCorrector_
private

jet corrector as extra selection type

Definition at line 221 of file TopHLTOfflineDQMHelper.h.

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

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

jetID as an extra selection type

Definition at line 227 of file TopHLTOfflineDQMHelper.h.

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

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

selection string on the jetID

Definition at line 234 of file TopHLTOfflineDQMHelper.h.

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

template<typename Object >
int SelectionStepHLT< Object >::max_
private
template<typename Object >
int SelectionStepHLT< Object >::min_
private
template<typename Object >
edm::EDGetTokenT< edm::View<reco::Vertex> > SelectionStepHLT< Object >::pvs_
private

Definition at line 229 of file TopHLTOfflineDQMHelper.h.

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

string cut selector

Definition at line 232 of file TopHLTOfflineDQMHelper.h.

Referenced by SelectionStepHLT< Object >::select(), and SelectionStepHLT< Object >::selectVertex().

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

input collection

Definition at line 204 of file TopHLTOfflineDQMHelper.h.

Referenced by SelectionStepHLT< Object >::select(), and SelectionStepHLT< Object >::selectVertex().