CMS 3D CMS Logo

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

define MonitorEnsembple to be used More...

#include <TopDiLeptonOfflineDQM.h>

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

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &setup) override
 do this during the event loop More...
 
 TopDiLeptonOfflineDQM (const edm::ParameterSet &cfg)
 default constructor More...
 
 ~TopDiLeptonOfflineDQM () override
 default destructor More...
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Protected Member Functions

void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 

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...
 
std::vector< std::unique_ptr< SelectionStep< reco::CaloJet > > > CaloJetSteps
 
std::unique_ptr< SelectionStep< reco::PFCandidate > > ElectronStep
 
std::vector< std::unique_ptr< SelectionStep< reco::Jet > > > JetSteps
 
std::unique_ptr< SelectionStep< reco::MET > > METStep
 
std::unique_ptr< SelectionStep< reco::PFCandidate > > MuonStep
 
std::vector< std::unique_ptr< SelectionStep< reco::PFJet > > > PFJetSteps
 
std::unique_ptr< SelectionStep< reco::Vertex > > PvStep
 
std::vector< edm::ParameterSetsel_
 
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< TopDiLeptonOffline::MonitorEnsemble > > > selection_
 
std::vector< std::string > selectionOrder_
 
edm::ParameterSet setup_
 
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 MonitorEnsembple to be used

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

"DQM/Physics/plugins/TopDiLeptonOfflineDQM.h"

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 MonitorEnsemble 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 MonitorEnsemble 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 MonitorEnsemble 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 323 of file TopDiLeptonOfflineDQM.h.

Constructor & Destructor Documentation

TopDiLeptonOfflineDQM::TopDiLeptonOfflineDQM ( const edm::ParameterSet cfg)

default constructor

Definition at line 767 of file TopDiLeptonOfflineDQM.cc.

References beamspot_, beamspotSelect_, CaloJetSteps, ElectronStep, edm::ParameterSet::existsAs(), plotBeamSpotDB::first, edm::ParameterSet::getParameter(), mps_fire::i, JetSteps, crabWrapper::key, METStep, MuonStep, objectType(), PFJetSteps, PvStep, sel_, selection_, selectionOrder_, selectionStep(), setup_, AlCaHLTBitMon_QueryRunRegistry::string, triggerPaths_, triggerTable_, vertex_, and vertexSelect_.

768  : vertexSelect_(nullptr),
769  beamspotSelect_(nullptr),
770  MuonStep(nullptr),
771  ElectronStep(nullptr),
772  PvStep(nullptr),
773  METStep(nullptr) {
774  JetSteps.clear();
775  CaloJetSteps.clear();
776  PFJetSteps.clear();
777  // configure the preselection
778  edm::ParameterSet presel =
779  cfg.getParameter<edm::ParameterSet>("preselection");
780  if (presel.existsAs<edm::ParameterSet>("trigger")) {
782  presel.getParameter<edm::ParameterSet>("trigger");
783  // triggerTable_=trigger.getParameter<edm::InputTag>("src");
784  triggerTable_ = consumes<edm::TriggerResults>(
785  trigger.getParameter<edm::InputTag>("src"));
786  triggerPaths_ = trigger.getParameter<std::vector<std::string> >("select");
787  }
788  if (presel.existsAs<edm::ParameterSet>("vertex")) {
789  edm::ParameterSet vertex = presel.getParameter<edm::ParameterSet>("vertex");
790  vertex_ = consumes<std::vector<reco::Vertex> >(
791  vertex.getParameter<edm::InputTag>("src"));
793  vertex.getParameter<std::string>("select")));
794  }
795  if (presel.existsAs<edm::ParameterSet>("beamspot")) {
797  presel.getParameter<edm::ParameterSet>("beamspot");
798  beamspot_ =
799  consumes<reco::BeamSpot>(beamspot.getParameter<edm::InputTag>("src"));
801  beamspot.getParameter<std::string>("select")));
802  }
803 
804  // conifgure the selection
805  sel_ =
806  cfg.getParameter<std::vector<edm::ParameterSet> >("selection");
807  setup_ = cfg.getParameter<edm::ParameterSet>("setup");
808  for (unsigned int i = 0; i < sel_.size(); ++i) {
809  selectionOrder_.push_back(sel_.at(i).getParameter<std::string>("label"));
810  selection_[selectionStep(selectionOrder_.back())] = std::make_pair(
811  sel_.at(i),
812  std::unique_ptr<TopDiLeptonOffline::MonitorEnsemble>(
814  selectionStep(selectionOrder_.back()).c_str(),
815  setup_, consumesCollector())));
816  }
817  for (std::vector<std::string>::const_iterator selIt = selectionOrder_.begin();
818  selIt != selectionOrder_.end(); ++selIt) {
819  std::string key = selectionStep(*selIt), type = objectType(*selIt);
820  if (selection_.find(key) != selection_.end()) {
821  if (type == "muons") {
823  consumesCollector()));
824  }
825  if (type == "elecs") {
827  selection_[key].first, consumesCollector()));
828  }
829  if (type == "pvs") {
830  PvStep.reset(new SelectionStep<reco::Vertex>(selection_[key].first,
831  consumesCollector()));
832  }
833  if (type == "jets") {
834  JetSteps.push_back(std::unique_ptr<SelectionStep<reco::Jet>>(
835  new SelectionStep<reco::Jet>(selection_[key].first,
836  consumesCollector())));
837  }
838  if (type == "jets/pf") {
839  PFJetSteps.push_back(std::unique_ptr<SelectionStep<reco::PFJet>>(
841  selection_[key].first, consumesCollector())));
842  }
843  if (type == "jets/calo") {
844  CaloJetSteps.push_back(std::unique_ptr<SelectionStep<reco::CaloJet>>(
846  selection_[key].first, consumesCollector())));
847  }
848  if (type == "met") {
849  METStep.reset(new SelectionStep<reco::MET>(selection_[key].first,
850  consumesCollector()));
851  }
852  }
853  }
854 }
type
Definition: HCALResponse.h:21
T getParameter(std::string const &) const
std::string selectionStep(const std::string &label)
std::vector< std::string > selectionOrder_
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:161
std::unique_ptr< SelectionStep< reco::Vertex > > PvStep
std::vector< std::unique_ptr< SelectionStep< reco::CaloJet > > > CaloJetSteps
edm::EDGetTokenT< std::vector< reco::Vertex > > vertex_
primary vertex
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > vertexSelect_
string cut selector
std::vector< edm::ParameterSet > sel_
std::vector< std::unique_ptr< SelectionStep< reco::Jet > > > JetSteps
std::unique_ptr< SelectionStep< reco::PFCandidate > > MuonStep
std::unique_ptr< SelectionStep< reco::MET > > METStep
std::unique_ptr< SelectionStep< reco::PFCandidate > > ElectronStep
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< TopDiLeptonOffline::MonitorEnsemble > > > selection_
Templated helper class to allow a selection on a certain object collection.
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
std::vector< std::string > triggerPaths_
trigger paths
std::string objectType(const std::string &label)
edm::EDGetTokenT< reco::BeamSpot > beamspot_
beamspot
std::vector< std::unique_ptr< SelectionStep< reco::PFJet > > > PFJetSteps
TopDiLeptonOfflineDQM::~TopDiLeptonOfflineDQM ( )
inlineoverride

default destructor

Definition at line 328 of file TopDiLeptonOfflineDQM.h.

References analyze(), bookHistograms(), and GeneralSetup::setup().

328 {}

Member Function Documentation

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

do this during the event loop

Definition at line 863 of file TopDiLeptonOfflineDQM.cc.

References accept(), egammaObjectModificationsInMiniAOD_cff::beamspot, beamspot_, beamspotSelect_, CaloJetSteps, ElectronStep, edm::Event::getByToken(), edm::EDGetTokenT< T >::isUninitialized(), JetSteps, crabWrapper::key, METStep, MuonStep, objectType(), TriggerAnalyzer::passed, PFJetSteps, TauGenJetsDecayModeSelectorAllHadrons_cfi::select, selection_, selectionOrder_, selectionStep(), AlCaHLTBitMon_QueryRunRegistry::string, triggerPaths_, triggerTable_, and vertex_.

864  {
867  if (!event.getByToken(triggerTable_, triggerTable)) return;
868  if (!accept(event, *triggerTable, triggerPaths_)) return;
869  }
870  if (!vertex_.isUninitialized()) {
872  if (!event.getByToken(vertex_, vertex)) return;
873  if (vertex->empty() || !(*vertexSelect_)(vertex->front())) return;
874  }
875  if (!beamspot_.isUninitialized()) {
877  if (!event.getByToken(beamspot_, beamspot)) return;
878  if (!(*beamspotSelect_)(*beamspot)) return;
879  }
880  unsigned int passed = 0;
881 
882  unsigned int nJetSteps = -1;
883 
884  unsigned int nPFJetSteps = -1;
885 
886  unsigned int nCaloJetSteps = -1;
887  // apply selection steps
888  for (std::vector<std::string>::const_iterator selIt = selectionOrder_.begin();
889  selIt != selectionOrder_.end(); ++selIt) {
890  std::string key = selectionStep(*selIt), type = objectType(*selIt);
891  if (selection_.find(key) != selection_.end()) {
892  if (type == "empty") {
893  selection_[key].second->fill(event, setup);
894  }
895  if (type == "muons" && MuonStep != nullptr) {
896  if (MuonStep->select(event)) {
897  ++passed;
898  selection_[key].second->fill(event, setup);
899  } else
900  break;
901  }
902  if (type == "elecs" && ElectronStep != nullptr) {
903  if (ElectronStep->select(event, "electron")) {
904  ++passed;
905  selection_[key].second->fill(event, setup);
906  } else
907  break;
908  }
909  if (type == "jets" && !JetSteps.empty()) {
910  nJetSteps++;
911  if (JetSteps[nJetSteps] != nullptr) {
912  if (JetSteps[nJetSteps]->select(event, setup)) {
913  ++passed;
914  selection_[key].second->fill(event, setup);
915  } else
916  break;
917  }
918  }
919 
920  if (type == "jets/pf" && !PFJetSteps.empty()) {
921  nPFJetSteps++;
922  if (PFJetSteps[nPFJetSteps] != nullptr) {
923  if (PFJetSteps[nPFJetSteps]->select(event, setup)) {
924  ++passed;
925  selection_[key].second->fill(event, setup);
926  } else
927  break;
928  }
929  }
930 
931  if (type == "jets/calo" && !CaloJetSteps.empty()) {
932  nCaloJetSteps++;
933  if (CaloJetSteps[nCaloJetSteps] != nullptr) {
934  if (CaloJetSteps[nCaloJetSteps]->select(event, setup)) {
935  ++passed;
936  selection_[key].second->fill(event, setup);
937  } else
938  break;
939  }
940  }
941 
942  if (type == "met" && METStep != nullptr) {
943  ++passed;
944  if (METStep->select(event)) {
945  selection_[key].second->fill(event, setup);
946  } else
947  break;
948  }
949  }
950  }
951 }
type
Definition: HCALResponse.h:21
std::string selectionStep(const std::string &label)
std::vector< std::string > selectionOrder_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::vector< std::unique_ptr< SelectionStep< reco::CaloJet > > > CaloJetSteps
edm::EDGetTokenT< std::vector< reco::Vertex > > vertex_
primary vertex
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
std::vector< std::unique_ptr< SelectionStep< reco::Jet > > > JetSteps
std::unique_ptr< SelectionStep< reco::PFCandidate > > MuonStep
std::unique_ptr< SelectionStep< reco::MET > > METStep
std::unique_ptr< SelectionStep< reco::PFCandidate > > ElectronStep
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< TopDiLeptonOffline::MonitorEnsemble > > > selection_
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
std::vector< std::string > triggerPaths_
trigger paths
bool isUninitialized() const
Definition: EDGetToken.h:70
std::string objectType(const std::string &label)
edm::EDGetTokenT< reco::BeamSpot > beamspot_
beamspot
std::vector< std::unique_ptr< SelectionStep< reco::PFJet > > > PFJetSteps
void TopDiLeptonOfflineDQM::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotected

Definition at line 856 of file TopDiLeptonOfflineDQM.cc.

References selection_.

857  {
858 
859  for (auto selIt = selection_.begin(); selIt != selection_.end(); ++selIt) {
860  selIt->second.second->book(ibooker);
861  }
862 }
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< TopDiLeptonOffline::MonitorEnsemble > > > selection_
std::string TopDiLeptonOfflineDQM::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 341 of file TopDiLeptonOfflineDQM.h.

Referenced by analyze(), and TopDiLeptonOfflineDQM().

341  {
342  return label.substr(0, label.find(':'));
343  };
char const * label
std::string TopDiLeptonOfflineDQM::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 346 of file TopDiLeptonOfflineDQM.h.

Referenced by analyze(), and TopDiLeptonOfflineDQM().

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

Member Data Documentation

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

beamspot

Definition at line 360 of file TopDiLeptonOfflineDQM.h.

Referenced by analyze(), and TopDiLeptonOfflineDQM().

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

string cut selector

Definition at line 362 of file TopDiLeptonOfflineDQM.h.

Referenced by analyze(), and TopDiLeptonOfflineDQM().

std::vector<std::unique_ptr<SelectionStep<reco::CaloJet> > > TopDiLeptonOfflineDQM::CaloJetSteps
private

Definition at line 380 of file TopDiLeptonOfflineDQM.h.

Referenced by analyze(), and TopDiLeptonOfflineDQM().

std::unique_ptr<SelectionStep<reco::PFCandidate> > TopDiLeptonOfflineDQM::ElectronStep
private

Definition at line 376 of file TopDiLeptonOfflineDQM.h.

Referenced by analyze(), and TopDiLeptonOfflineDQM().

std::vector<std::unique_ptr<SelectionStep<reco::Jet> > > TopDiLeptonOfflineDQM::JetSteps
private

Definition at line 379 of file TopDiLeptonOfflineDQM.h.

Referenced by analyze(), and TopDiLeptonOfflineDQM().

std::unique_ptr<SelectionStep<reco::MET> > TopDiLeptonOfflineDQM::METStep
private

Definition at line 378 of file TopDiLeptonOfflineDQM.h.

Referenced by analyze(), and TopDiLeptonOfflineDQM().

std::unique_ptr<SelectionStep<reco::PFCandidate> > TopDiLeptonOfflineDQM::MuonStep
private

Definition at line 375 of file TopDiLeptonOfflineDQM.h.

Referenced by analyze(), and TopDiLeptonOfflineDQM().

std::vector<std::unique_ptr<SelectionStep<reco::PFJet> > > TopDiLeptonOfflineDQM::PFJetSteps
private

Definition at line 381 of file TopDiLeptonOfflineDQM.h.

Referenced by analyze(), and TopDiLeptonOfflineDQM().

std::unique_ptr<SelectionStep<reco::Vertex> > TopDiLeptonOfflineDQM::PvStep
private

Definition at line 377 of file TopDiLeptonOfflineDQM.h.

Referenced by TopDiLeptonOfflineDQM().

std::vector<edm::ParameterSet> TopDiLeptonOfflineDQM::sel_
private

Definition at line 383 of file TopDiLeptonOfflineDQM.h.

Referenced by TopDiLeptonOfflineDQM().

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

Definition at line 374 of file TopDiLeptonOfflineDQM.h.

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

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

Referenced by analyze(), and TopDiLeptonOfflineDQM().

edm::ParameterSet TopDiLeptonOfflineDQM::setup_
private

Definition at line 384 of file TopDiLeptonOfflineDQM.h.

Referenced by TopDiLeptonOfflineDQM().

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

trigger paths

Definition at line 354 of file TopDiLeptonOfflineDQM.h.

Referenced by analyze(), and TopDiLeptonOfflineDQM().

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

trigger table

Definition at line 348 of file TopDiLeptonOfflineDQM.h.

Referenced by analyze(), and TopDiLeptonOfflineDQM().

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

primary vertex

Definition at line 356 of file TopDiLeptonOfflineDQM.h.

Referenced by analyze(), and TopDiLeptonOfflineDQM().

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

string cut selector

Definition at line 358 of file TopDiLeptonOfflineDQM.h.

Referenced by TopDiLeptonOfflineDQM().