CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
TopSingleLeptonHLTOfflineDQM Class Reference

define MonitorSingleLepton to be used More...

#include <TopSingleLeptonHLTOfflineDQM.h>

Inheritance diagram for TopSingleLeptonHLTOfflineDQM:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &setup) override
 
void bookHistograms (DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
 
void dqmBeginRun (const edm::Run &r, const edm::EventSetup &c) override
 do this during the event loop More...
 
 TopSingleLeptonHLTOfflineDQM (const edm::ParameterSet &cfg)
 default constructor More...
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Private Member Functions

std::string objectType (const std::string &label)
 
std::string selectionStep (const std::string &label)
 

Private Attributes

edm::EDGetTokenT< reco::BeamSpotbeamspot_
 beamspot More...
 
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
 string cut selector More...
 
HLTConfigProvider hltConfig_
 
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< HLTOfflineDQMTopSingleLepton::MonitorSingleLepton > > > selection_
 
std::vector< std::string > selectionOrder_
 
std::map< std::string, std::unique_ptr< SelectionStepHLTBase > > selectmap_
 
std::vector< std::string > triggerPaths_
 trigger paths More...
 
edm::EDGetTokenT< edm::TriggerResultstriggerTable_
 trigger table More...
 
edm::EDGetTokenT< std::vector< reco::Vertex > > vertex_
 primary vertex More...
 
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > vertexSelect_
 string cut selector More...
 

Detailed Description

define MonitorSingleLepton to be used

Module to apply a monitored selection of top like events in the semi-leptonic channel.

Plugin to apply a monitored selection of top like events with some minimal flexibility in the number and definition of the selection steps. To achieve this flexibility it employes the SelectionStep class. The MonitorSingleLepton class is used to provide a well defined set of histograms to be monitored after each selection step. The SelectionStep class provides a flexible and intuitive selection via the StringCutParser. SelectionStep and MonitorSingleLepton classes are interleaved. The monitoring starts after a preselection step (which is not monitored in the context of this module) with an instance of the MonitorSingleLepton class. The following objects are supported for selection:

These types have to be present as prefix of the selection step paramter label separated from the rest of the label by a ':' (e.g. in the form "jets:step0"). The class expects selection labels of this type. They will be disentangled by the private helper functions objectType and seletionStep as declared below.

Definition at line 231 of file TopSingleLeptonHLTOfflineDQM.h.

Constructor & Destructor Documentation

TopSingleLeptonHLTOfflineDQM::TopSingleLeptonHLTOfflineDQM ( const edm::ParameterSet cfg)

default constructor

===========================================================================================================

Definition at line 742 of file TopSingleLeptonHLTOfflineDQM.cc.

References beamspot_, beamspotSelect_, edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), mps_fire::i, crabWrapper::key, objectType(), alignCSCRings::s, triggerObjects_cff::sel, selection_, selectionOrder_, selectionStep(), selectmap_, AlCaHLTBitMon_QueryRunRegistry::string, triggerPaths_, triggerTable_, vertex_, and vertexSelect_.

742  : vertexSelect_(nullptr), beamspotSelect_(nullptr)
743 {
744  // configure preselection
745  edm::ParameterSet presel=cfg.getParameter<edm::ParameterSet>("preselection");
746  if( presel.existsAs<edm::ParameterSet>("trigger") ){
748  triggerTable_= consumes< edm::TriggerResults >(trigger.getParameter<edm::InputTag>("src"));
749  triggerPaths_=trigger.getParameter<std::vector<std::string> >("select");
750  }
751  if( presel.existsAs<edm::ParameterSet>("vertex" ) ){
752  edm::ParameterSet vertex=presel.getParameter<edm::ParameterSet>("vertex");
753  vertex_= consumes< std::vector<reco::Vertex> >(vertex.getParameter<edm::InputTag>("src"));
754  vertexSelect_= std::make_unique<StringCutObjectSelector<reco::Vertex>>(vertex.getParameter<std::string>("select"));
755  }
756  if( presel.existsAs<edm::ParameterSet>("beamspot" ) ){
757  edm::ParameterSet beamspot=presel.getParameter<edm::ParameterSet>("beamspot");
758  beamspot_= consumes< reco::BeamSpot >(beamspot.getParameter<edm::InputTag>("src"));
759  beamspotSelect_= std::make_unique<StringCutObjectSelector<reco::BeamSpot>>(beamspot.getParameter<std::string>("select"));
760  }
761 
762  // configure the selection
763  std::vector<edm::ParameterSet> sel=cfg.getParameter<std::vector<edm::ParameterSet> >("selection");
764  for(auto & i : sel){
765  selectionOrder_.push_back(i.getParameter<std::string>("label"));
766  selection_[selectionStep(selectionOrder_.back())] = std::make_pair(i, std::make_unique<HLTOfflineDQMTopSingleLepton::MonitorSingleLepton>(selectionStep(selectionOrder_.back()).c_str(), cfg.getParameter<edm::ParameterSet>("setup"), consumesCollector()));
767  }
768 
769  for (const std::string& s: selectionOrder_) {
771 
772  if (selection_.find(key) == selection_.end())
773  continue;
774 
775  if (type == "muons"){
776  selectmap_[type] = std::make_unique<SelectionStepHLT<reco::Muon>>(selection_[key].first, consumesCollector());
777  }
778  if (type == "elecs"){
779  selectmap_[type] = std::make_unique<SelectionStepHLT<reco::GsfElectron>>(selection_[key].first, consumesCollector());
780  }
781  if (type == "jets"){
782  selectmap_[type] = std::make_unique<SelectionStepHLT<reco::Jet>>(selection_[key].first, consumesCollector());
783  }
784  if (type == "jets/pf"){
785  selectmap_[type] = std::make_unique<SelectionStepHLT<reco::PFJet>>(selection_[key].first, consumesCollector());
786  }
787  if (type == "jets/calo"){
788  selectmap_[type] = std::make_unique<SelectionStepHLT<reco::CaloJet>>(selection_[key].first, consumesCollector());
789  }
790  if (type == "met"){
791  selectmap_[type] = std::make_unique<SelectionStepHLT<reco::MET>>(selection_[key].first, consumesCollector());
792  }
793  }
794 }
type
Definition: HCALResponse.h:21
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:161
std::string selectionStep(const std::string &label)
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
std::vector< std::string > selectionOrder_
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
edm::EDGetTokenT< std::vector< reco::Vertex > > vertex_
primary vertex
std::vector< std::string > triggerPaths_
trigger paths
edm::EDGetTokenT< reco::BeamSpot > beamspot_
beamspot
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< HLTOfflineDQMTopSingleLepton::MonitorSingleLepton > > > selection_
std::string objectType(const std::string &label)
std::map< std::string, std::unique_ptr< SelectionStepHLTBase > > selectmap_
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > vertexSelect_
string cut selector

Member Function Documentation

void TopSingleLeptonHLTOfflineDQM::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
override

Definition at line 813 of file TopSingleLeptonHLTOfflineDQM.cc.

References acceptHLT(), egammaObjectModificationsInMiniAOD_cff::beamspot, beamspot_, beamspotSelect_, edm::Event::getByToken(), hltConfig_, edm::EDGetTokenT< T >::isUninitialized(), crabWrapper::key, objectType(), TauGenJetsDecayModeSelectorAllHadrons_cfi::select, selection_, selectionOrder_, selectionStep(), selectmap_, AlCaHLTBitMon_QueryRunRegistry::string, triggerPaths_, triggerTable_, and vertex_.

814 {
817  if( !event.getByToken(triggerTable_, triggerTable) ) return;
818  if(!acceptHLT(event, *triggerTable, triggerPaths_)) return;
819  }
820  if(!vertex_.isUninitialized()){
822  if( !event.getByToken(vertex_, vertex) ) return;
823  if(vertex->empty() || !(*vertexSelect_)(vertex->front())) return;
824  }
825  if(!beamspot_.isUninitialized()){
827  if( !event.getByToken(beamspot_, beamspot) ) return;
828  if(!(*beamspotSelect_)(*beamspot)) return;
829  }
830  // apply selection steps
831  for(auto selIt=selectionOrder_.begin(); selIt!=selectionOrder_.end(); ++selIt){
832  std::string key = selectionStep(*selIt), type = objectType(*selIt);
833  if(selection_.find(key)!=selection_.end()){
834 
835  if(type=="empty"){
836  selection_[key].second->fill(event, setup, hltConfig_, triggerPaths_);
837  continue;
838  }
839  if(type=="Hlt" ){
840  selection_[key].second->fill(event, setup, hltConfig_, triggerPaths_);
841  continue;
842  }
843 
844  bool passSel = true;
845 
846  for(auto selIt2=selectionOrder_.begin(); selIt2<=selIt; ++selIt2){
847  std::string key2 = selectionStep(*selIt2), type2 = objectType(*selIt2);
848  if(selection_.find(key2)==selection_.end()) continue;
849 
850  if(type2=="Hlt" || type2=="empty" ) continue;
851  if (!selectmap_[type2]->select(event)) passSel=false;
852 
853  } // end 2nd loop
854 
855  // Apply cumulative event selection
856  if ( !passSel ) continue;
857 
858  selection_[key].second->fill(event, setup, hltConfig_, triggerPaths_);
859 
860  }
861  }
862 }
type
Definition: HCALResponse.h:21
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::string selectionStep(const std::string &label)
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
std::vector< std::string > selectionOrder_
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
edm::EDGetTokenT< std::vector< reco::Vertex > > vertex_
primary vertex
std::vector< std::string > triggerPaths_
trigger paths
edm::EDGetTokenT< reco::BeamSpot > beamspot_
beamspot
bool acceptHLT(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< HLTOfflineDQMTopSingleLepton::MonitorSingleLepton > > > selection_
std::string objectType(const std::string &label)
std::map< std::string, std::unique_ptr< SelectionStepHLTBase > > selectmap_
bool isUninitialized() const
Definition: EDGetToken.h:70
void TopSingleLeptonHLTOfflineDQM::bookHistograms ( DQMStore::IBooker i,
edm::Run const &  ,
edm::EventSetup const &   
)
override

Definition at line 865 of file TopSingleLeptonHLTOfflineDQM.cc.

References triggerObjects_cff::sel, and selection_.

866 {
867  for (auto& sel: selection_) {
868  sel.second.second->book(i);
869  }
870 }
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< HLTOfflineDQMTopSingleLepton::MonitorSingleLepton > > > selection_
void TopSingleLeptonHLTOfflineDQM::dqmBeginRun ( const edm::Run r,
const edm::EventSetup c 
)
override

do this during the event loop

Definition at line 797 of file TopSingleLeptonHLTOfflineDQM.cc.

References hltConfig_, HLTConfigProvider::init(), and HLTConfigProvider::processName().

798 {
799  using namespace std;
800  using namespace edm;
801 
802  bool changed(true);
803  if (!hltConfig_.init(iRun,iSetup,"*",changed)) {
804  edm::LogWarning( "TopSingleLeptonHLTOfflineDQM" )
805  << "Config extraction failure with process name "
807  << "\n";
808  return;
809  }
810 }
const std::string & processName() const
process name
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
HLT enums.
std::string TopSingleLeptonHLTOfflineDQM::objectType ( const std::string &  label)
inlineprivate

deduce object type from ParameterSet label, the label is expected to be of type 'objectType:selectionStep'

Definition at line 244 of file TopSingleLeptonHLTOfflineDQM.h.

Referenced by analyze(), and TopSingleLeptonHLTOfflineDQM().

244 { return label.substr(0, label.find(':')); };
char const * label
std::string TopSingleLeptonHLTOfflineDQM::selectionStep ( const std::string &  label)
inlineprivate

deduce selection step from ParameterSet label, the label is expected to be of type 'objectType:selectionStep'

Definition at line 247 of file TopSingleLeptonHLTOfflineDQM.h.

Referenced by analyze(), and TopSingleLeptonHLTOfflineDQM().

247 { return label.substr(label.find(':')+1); };
char const * label

Member Data Documentation

edm::EDGetTokenT< reco::BeamSpot > TopSingleLeptonHLTOfflineDQM::beamspot_
private

beamspot

Definition at line 260 of file TopSingleLeptonHLTOfflineDQM.h.

Referenced by analyze(), and TopSingleLeptonHLTOfflineDQM().

std::unique_ptr<StringCutObjectSelector<reco::BeamSpot> > TopSingleLeptonHLTOfflineDQM::beamspotSelect_
private

string cut selector

Definition at line 262 of file TopSingleLeptonHLTOfflineDQM.h.

Referenced by analyze(), and TopSingleLeptonHLTOfflineDQM().

HLTConfigProvider TopSingleLeptonHLTOfflineDQM::hltConfig_
private

Definition at line 264 of file TopSingleLeptonHLTOfflineDQM.h.

Referenced by analyze(), and dqmBeginRun().

std::map<std::string, std::pair<edm::ParameterSet, std::unique_ptr<HLTOfflineDQMTopSingleLepton::MonitorSingleLepton> > > TopSingleLeptonHLTOfflineDQM::selection_
private

this is the heart component of the plugin; std::string keeps a label the selection step for later identification, edm::ParameterSet keeps the configuration of the selection for the SelectionStep class, MonitoringEnsemble keeps an instance of the MonitorSingleLepton class to be filled after each selection step

Definition at line 276 of file TopSingleLeptonHLTOfflineDQM.h.

Referenced by analyze(), bookHistograms(), and TopSingleLeptonHLTOfflineDQM().

std::vector<std::string> TopSingleLeptonHLTOfflineDQM::selectionOrder_
private

needed to guarantee the selection order as defined by the order of ParameterSets in the selection vector as defined in the config

Definition at line 270 of file TopSingleLeptonHLTOfflineDQM.h.

Referenced by analyze(), and TopSingleLeptonHLTOfflineDQM().

std::map<std::string, std::unique_ptr<SelectionStepHLTBase> > TopSingleLeptonHLTOfflineDQM::selectmap_
private

Definition at line 278 of file TopSingleLeptonHLTOfflineDQM.h.

Referenced by analyze(), and TopSingleLeptonHLTOfflineDQM().

std::vector<std::string> TopSingleLeptonHLTOfflineDQM::triggerPaths_
private

trigger paths

Definition at line 253 of file TopSingleLeptonHLTOfflineDQM.h.

Referenced by analyze(), and TopSingleLeptonHLTOfflineDQM().

edm::EDGetTokenT< edm::TriggerResults > TopSingleLeptonHLTOfflineDQM::triggerTable_
private

trigger table

Definition at line 247 of file TopSingleLeptonHLTOfflineDQM.h.

Referenced by analyze(), and TopSingleLeptonHLTOfflineDQM().

edm::EDGetTokenT< std::vector<reco::Vertex> > TopSingleLeptonHLTOfflineDQM::vertex_
private

primary vertex

Definition at line 255 of file TopSingleLeptonHLTOfflineDQM.h.

Referenced by analyze(), and TopSingleLeptonHLTOfflineDQM().

std::unique_ptr<StringCutObjectSelector<reco::Vertex> > TopSingleLeptonHLTOfflineDQM::vertexSelect_
private

string cut selector

Definition at line 257 of file TopSingleLeptonHLTOfflineDQM.h.

Referenced by TopSingleLeptonHLTOfflineDQM().