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 <TopHLTOfflineDQMHelper.h>

Inheritance diagram for SelectionStepHLT< Object >:
SelectionStepHLTBase

Public Member Functions

template<>
bool select (const edm::Event &event, const edm::EventSetup &setup)
 
virtual bool select (const edm::Event &event)
 apply selection More...
 
virtual 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)
 
virtual ~SelectionStepHLT ()
 default destructor More...
 

Private Attributes

edm::EDGetTokenT
< reco::JetTagCollection
btagLabel_
 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::JetIDValueMap
jetIDLabel_
 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 189 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 238 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.

238  :
240  select_( cfg.getParameter<std::string>("select")),
241  jetIDSelect_(0)
242 {
243  // construct min/max if the corresponding params
244  // exist otherwise they are initialized with -1
245  cfg.exists("min") ? min_= cfg.getParameter<int>("min") : min_= -1;
246  cfg.exists("max") ? max_= cfg.getParameter<int>("max") : max_= -1;
247  // read electron extras if they exist
248  if(cfg.existsAs<edm::ParameterSet>("electronId")){
249  edm::ParameterSet elecId=cfg.getParameter<edm::ParameterSet>("electronId");
251  eidPattern_= elecId.getParameter<int>("pattern");
252  }
253  // read jet corrector label if it exists
254  if(cfg.exists("jetCorrector")){ jetCorrector_= cfg.getParameter<std::string>("jetCorrector"); }
255  // read btag information if it exists
256  if(cfg.existsAs<edm::ParameterSet>("jetBTagger")){
257  edm::ParameterSet jetBTagger=cfg.getParameter<edm::ParameterSet>("jetBTagger");
259  btagWorkingPoint_=jetBTagger.getParameter<double>("workingPoint");
260  }
261  // read jetID information if it exists
262  if(cfg.existsAs<edm::ParameterSet>("jetID")){
265  jetIDSelect_= new StringCutObjectSelector<reco::JetID>(jetID.getParameter<std::string>("select"));
266  }
267 }
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 >
virtual SelectionStepHLT< Object >::~SelectionStepHLT ( )
inlinevirtual

default destructor

Definition at line 194 of file TopHLTOfflineDQMHelper.h.

194 {};

Member Function Documentation

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

Reimplemented from SelectionStepHLTBase.

Definition at line 9 of file TopHLTOfflineDQMHelper.cc.

References accept(), JetCorrector::correction(), mvaPFMET_cff::corrector, edm::EventSetup::find(), edm::Event::getByToken(), JetCorrector::getJetCorrector(), customizeTrackingMonitorSeedNumber::idx, metsig::jet, gen::n, getGTfromDQMFile::obj, reco::Jet::scaleEnergy(), and alcazmumu_cfi::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=0;
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:462
virtual double correction(const LorentzVector &fJet) const =0
get correction using Jet information only
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:91
tuple corrector
Definition: mvaPFMET_cff.py:86
StringCutObjectSelector< reco::JetID > * jetIDSelect_
selection string on the jetID
StringCutObjectSelector< Object > select_
string cut selector
edm::EDGetTokenT< edm::View< Object > > src_
input collection
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
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:81
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)
virtual

apply selection

Reimplemented from SelectionStepHLTBase.

Definition at line 271 of file TopHLTOfflineDQMHelper.h.

References accept(), edm::Event::getByToken(), customizeTrackingMonitorSeedNumber::idx, gen::n, getGTfromDQMFile::obj, and alcazmumu_cfi::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().

272 {
273  // fetch input collection
275  if( !event.getByToken(src_, src) ) return false;
276 
277  // load electronId value map if configured such
280  if( !event.getByToken(electronId_, electronId) ) return false;
281  }
282 
283  // determine multiplicity of selected objects
284  int n=0;
285  for(typename edm::View<Object>::const_iterator obj=src->begin(); obj!=src->end(); ++obj){
286  // special treatment for electrons
287  if(dynamic_cast<const reco::GsfElectron*>(&*obj)){
288  unsigned int idx = obj-src->begin();
289  if( electronId_.isUninitialized() ? true : ((int)(*electronId)[src->refAt(idx)] & eidPattern_) ){
290  if(select_(*obj))++n;
291  }
292  }
293  // normal treatment
294  else{
295  if(select_(*obj))++n;
296  }
297  }
298  bool accept=(min_>=0 ? n>=min_:true) && (max_>=0 ? n<=max_:true);
299  return (min_<0 && max_<0) ? (n>0):accept;
300 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
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
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
bool isUninitialized() const
Definition: EDGetToken.h:73
template<typename Object >
bool SelectionStepHLT< Object >::select ( const edm::Event event,
const edm::EventSetup setup 
)
virtual
template<typename Object >
bool SelectionStepHLT< Object >::selectVertex ( const edm::Event event)

Definition at line 302 of file TopHLTOfflineDQMHelper.h.

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

303 {
304  // fetch input collection
306  if( !event.getByToken(src_, src) ) return false;
307 
308  // load electronId value map if configured such
311  if( !event.getByToken(electronId_, electronId) ) return false;
312  }
313 
314  // determine multiplicity of selected objects
315  int n=0;
316  for(typename edm::View<Object>::const_iterator obj=src->begin(); obj!=src->end(); ++obj){
317 
318  if(select_(*obj))++n;
319  }
320  bool accept=(min_>=0 ? n>=min_:true) && (max_>=0 ? n<=max_:true);
321  return (min_<0 && max_<0) ? (n>0):accept;
322 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
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:81
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 222 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 224 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 218 of file TopHLTOfflineDQMHelper.h.

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

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

electronId label as extra selection type

Definition at line 207 of file TopHLTOfflineDQMHelper.h.

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

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

jet corrector as extra selection type

Definition at line 220 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 226 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 233 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

min/max for object multiplicity

Definition at line 205 of file TopHLTOfflineDQMHelper.h.

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

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

Definition at line 228 of file TopHLTOfflineDQMHelper.h.

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

string cut selector

Definition at line 231 of file TopHLTOfflineDQMHelper.h.

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

input collection

Definition at line 203 of file TopHLTOfflineDQMHelper.h.