CMS 3D CMS Logo

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

define MonitorDiLepton to be used More...

#include <TopDiLeptonHLTOfflineDQM.h>

Inheritance diagram for TopDiLeptonHLTOfflineDQM:
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...
 
 TopDiLeptonHLTOfflineDQM (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< HLTOfflineDQMTopDiLepton::MonitorDiLepton > > > 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 MonitorDiLepton to be used

Module to apply a monitored selection of top like events in the di-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 MonitorDiLepton 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 MonitorDiLepton 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 MonitorDiLepton 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 253 of file TopDiLeptonHLTOfflineDQM.h.

Constructor & Destructor Documentation

TopDiLeptonHLTOfflineDQM::TopDiLeptonHLTOfflineDQM ( const edm::ParameterSet cfg)

default constructor

Definition at line 794 of file TopDiLeptonHLTOfflineDQM.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_.

794  : vertexSelect_(nullptr), beamspotSelect_(nullptr)
795 {
796  // configure the preselection
797  edm::ParameterSet presel=cfg.getParameter<edm::ParameterSet>("preselection");
798  if( presel.existsAs<edm::ParameterSet>("trigger") ){
800  triggerTable_= consumes< edm::TriggerResults >(trigger.getParameter<edm::InputTag>("src"));
801  triggerPaths_=trigger.getParameter<std::vector<std::string> >("select");
802  }
803  if( presel.existsAs<edm::ParameterSet>("vertex" ) ){
804  edm::ParameterSet vertex=presel.getParameter<edm::ParameterSet>("vertex");
805  vertex_= consumes< std::vector<reco::Vertex> >(vertex.getParameter<edm::InputTag>("src"));
806  vertexSelect_= std::make_unique<StringCutObjectSelector<reco::Vertex>>(vertex.getParameter<std::string>("select"));
807  }
808  if( presel.existsAs<edm::ParameterSet>("beamspot" ) ){
809  edm::ParameterSet beamspot=presel.getParameter<edm::ParameterSet>("beamspot");
810  beamspot_= consumes< reco::BeamSpot >(beamspot.getParameter<edm::InputTag>("src"));
811  beamspotSelect_= std::make_unique<StringCutObjectSelector<reco::BeamSpot>>(beamspot.getParameter<std::string>("select"));
812  }
813 
814  // configure the selection
815  std::vector<edm::ParameterSet> sel=cfg.getParameter<std::vector<edm::ParameterSet> >("selection");
816  for(auto & i : sel){
817  selectionOrder_.push_back(i.getParameter<std::string>("label"));
818  selection_[selectionStep(selectionOrder_.back())] = std::make_pair(i, std::make_unique<HLTOfflineDQMTopDiLepton::MonitorDiLepton>(selectionStep(selectionOrder_.back()).c_str(), cfg.getParameter<edm::ParameterSet>("setup"), consumesCollector()));
819  }
820 
821  for (const std::string& s: selectionOrder_) {
823 
824  if (selection_.find(key) == selection_.end())
825  continue;
826 
827  if (type == "muons"){
828  selectmap_[type] = std::make_unique<SelectionStepHLT<reco::Muon>>(selection_[key].first, consumesCollector());
829  }
830  if (type == "elecs"){
831  selectmap_[type] = std::make_unique<SelectionStepHLT<reco::GsfElectron>>(selection_[key].first, consumesCollector());
832  }
833  if (type == "jets"){
834  selectmap_[type] = std::make_unique<SelectionStepHLT<reco::Jet>>(selection_[key].first, consumesCollector());
835  }
836  if (type == "jets/pf"){
837  selectmap_[type] = std::make_unique<SelectionStepHLT<reco::PFJet>>(selection_[key].first, consumesCollector());
838  }
839  if (type == "jets/calo"){
840  selectmap_[type] = std::make_unique<SelectionStepHLT<reco::CaloJet>>(selection_[key].first, consumesCollector());
841  }
842  if (type == "met"){
843  selectmap_[type] = std::make_unique<SelectionStepHLT<reco::MET>>(selection_[key].first, consumesCollector());
844  }
845  }
846 }
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
edm::EDGetTokenT< reco::BeamSpot > beamspot_
beamspot
std::string selectionStep(const std::string &label)
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
std::vector< std::string > triggerPaths_
trigger paths
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > vertexSelect_
string cut selector
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< HLTOfflineDQMTopDiLepton::MonitorDiLepton > > > selection_
std::vector< std::string > selectionOrder_
std::string objectType(const std::string &label)
std::map< std::string, std::unique_ptr< SelectionStepHLTBase > > selectmap_
edm::EDGetTokenT< std::vector< reco::Vertex > > vertex_
primary vertex
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table

Member Function Documentation

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

Definition at line 865 of file TopDiLeptonHLTOfflineDQM.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_.

866 {
869  if( !event.getByToken(triggerTable_, triggerTable) ) return;
870  if(!acceptHLT(event, *triggerTable, triggerPaths_)) return;
871  }
872  if(!vertex_.isUninitialized()){
874  if( !event.getByToken(vertex_, vertex) ) return;
875  if(vertex->empty() || !(*vertexSelect_)(vertex->front())) return;
876  }
877  if(!beamspot_.isUninitialized()){
879  if( !event.getByToken(beamspot_, beamspot) ) return;
880  if(!(*beamspotSelect_)(*beamspot)) return;
881  }
882  // apply selection steps
883  for(auto selIt=selectionOrder_.begin(); selIt!=selectionOrder_.end(); ++selIt){
884  std::string key = selectionStep(*selIt), type = objectType(*selIt);
885  if(selection_.find(key)!=selection_.end()){
886 
887  if(type=="empty"){
888  selection_[key].second->fill(event, setup, hltConfig_, triggerPaths_);
889  continue;
890  }
891  if(type=="Hlt" ){
892  selection_[key].second->fill(event, setup, hltConfig_, triggerPaths_);
893  continue;
894  }
895 
896  bool passSel = true;
897 
898  for(auto selIt2=selectionOrder_.begin(); selIt2<=selIt; ++selIt2){
899  std::string key2 = selectionStep(*selIt2), type2 = objectType(*selIt2);
900  if(selection_.find(key2)==selection_.end()) continue;
901 
902  if(type2=="Hlt" || type2=="empty" ) continue;
903  if (!selectmap_[type2]->select(event)) passSel=false;
904 
905  } // end 2nd loop
906 
907  // Apply cumulative event selection
908  if ( !passSel ) continue;
909 
910  selection_[key].second->fill(event, setup, hltConfig_, triggerPaths_);
911 
912  }
913  }
914 }
type
Definition: HCALResponse.h:21
edm::EDGetTokenT< reco::BeamSpot > beamspot_
beamspot
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 > triggerPaths_
trigger paths
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< HLTOfflineDQMTopDiLepton::MonitorDiLepton > > > selection_
bool acceptHLT(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
std::vector< std::string > selectionOrder_
std::string objectType(const std::string &label)
std::map< std::string, std::unique_ptr< SelectionStepHLTBase > > selectmap_
bool isUninitialized() const
Definition: EDGetToken.h:70
edm::EDGetTokenT< std::vector< reco::Vertex > > vertex_
primary vertex
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
void TopDiLeptonHLTOfflineDQM::bookHistograms ( DQMStore::IBooker i,
edm::Run const &  ,
edm::EventSetup const &   
)
override

Definition at line 917 of file TopDiLeptonHLTOfflineDQM.cc.

References triggerObjects_cff::sel, and selection_.

918 {
919  for (auto& sel: selection_) {
920  sel.second.second->book(i);
921  }
922 }
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< HLTOfflineDQMTopDiLepton::MonitorDiLepton > > > selection_
void TopDiLeptonHLTOfflineDQM::dqmBeginRun ( const edm::Run r,
const edm::EventSetup c 
)
override

do this during the event loop

Definition at line 849 of file TopDiLeptonHLTOfflineDQM.cc.

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

850 {
851  using namespace std;
852  using namespace edm;
853 
854  bool changed(true);
855  if (!hltConfig_.init(iRun,iSetup,"*",changed)) {
856  edm::LogWarning( "TopSingleLeptonHLTOfflineDQM" )
857  << "Config extraction failure with process name "
859  << "\n";
860  return;
861  }
862 }
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 TopDiLeptonHLTOfflineDQM::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 266 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by analyze(), and TopDiLeptonHLTOfflineDQM().

266 { return label.substr(0, label.find(':')); };
char const * label
std::string TopDiLeptonHLTOfflineDQM::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 269 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by analyze(), and TopDiLeptonHLTOfflineDQM().

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

Member Data Documentation

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

beamspot

Definition at line 281 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by analyze(), and TopDiLeptonHLTOfflineDQM().

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

string cut selector

Definition at line 283 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by analyze(), and TopDiLeptonHLTOfflineDQM().

HLTConfigProvider TopDiLeptonHLTOfflineDQM::hltConfig_
private

Definition at line 285 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by analyze(), and dqmBeginRun().

std::map<std::string, std::pair<edm::ParameterSet, std::unique_ptr<HLTOfflineDQMTopDiLepton::MonitorDiLepton> > > TopDiLeptonHLTOfflineDQM::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 MonitorDiLepton class to be filled after each selection step

Definition at line 295 of file TopDiLeptonHLTOfflineDQM.h.

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

std::vector<std::string> TopDiLeptonHLTOfflineDQM::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 289 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by analyze(), and TopDiLeptonHLTOfflineDQM().

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

Definition at line 297 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by analyze(), and TopDiLeptonHLTOfflineDQM().

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

trigger paths

Definition at line 275 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by analyze(), and TopDiLeptonHLTOfflineDQM().

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

trigger table

Definition at line 269 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by analyze(), and TopDiLeptonHLTOfflineDQM().

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

primary vertex

Definition at line 277 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by analyze(), and TopDiLeptonHLTOfflineDQM().

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

string cut selector

Definition at line 279 of file TopDiLeptonHLTOfflineDQM.h.

Referenced by TopDiLeptonHLTOfflineDQM().