CMS 3D CMS Logo

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

define MonitorEnsembple to be used More...

#include <SingleTopTChannelLeptonDQM.h>

Inheritance diagram for SingleTopTChannelLeptonDQM:
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...
 
 SingleTopTChannelLeptonDQM (const edm::ParameterSet &cfg)
 default constructor More...
 
 ~SingleTopTChannelLeptonDQM () 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::InputTag beamspot_
 beamspot More...
 
edm::EDGetTokenT< reco::BeamSpotbeamspot__
 
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::GsfElectron > > ElectronStep
 
std::vector< std::unique_ptr< SelectionStep< reco::Jet > > > JetSteps
 
std::unique_ptr< SelectionStep< reco::MET > > METStep
 
std::unique_ptr< SelectionStep< reco::Muon > > MuonStep
 
std::unique_ptr< SelectionStep< reco::PFCandidate > > PFElectronStep
 
std::vector< std::unique_ptr< SelectionStep< reco::PFJet > > > PFJetSteps
 
std::unique_ptr< SelectionStep< reco::PFCandidate > > PFMuonStep
 
std::unique_ptr< SelectionStep< reco::Vertex > > PvStep
 
std::vector< edm::ParameterSetsel
 
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< SingleTopTChannelLepton::MonitorEnsemble > > > selection_
 
std::vector< std::string > selectionOrder_
 
std::vector< std::string > triggerPaths_
 trigger paths More...
 
edm::EDGetTokenT< edm::TriggerResultstriggerTable__
 trigger table More...
 
edm::InputTag vertex_
 primary vertex More...
 
edm::EDGetTokenT< reco::Vertexvertex__
 
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 semi-leptonic channel.

"DQM/Physics/plugins/SingleTopTChannelLeptonDQM.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 299 of file SingleTopTChannelLeptonDQM.h.

Constructor & Destructor Documentation

SingleTopTChannelLeptonDQM::SingleTopTChannelLeptonDQM ( const edm::ParameterSet cfg)

default constructor

Definition at line 727 of file SingleTopTChannelLeptonDQM.cc.

References beamspot_, beamspot__, beamspotSelect_, CaloJetSteps, ElectronStep, edm::ParameterSet::existsAs(), plotBeamSpotDB::first, edm::ParameterSet::getParameter(), mps_fire::i, JetSteps, crabWrapper::key, METStep, MuonStep, objectType(), PFElectronStep, PFJetSteps, PFMuonStep, PvStep, sel, selection_, selectionOrder_, selectionStep(), AlCaHLTBitMon_QueryRunRegistry::string, triggerPaths_, and triggerTable__.

729  : vertexSelect_(nullptr),
730  beamspot_(""),
731  beamspotSelect_(nullptr),
732  MuonStep(nullptr),
733  PFMuonStep(nullptr),
734  ElectronStep(nullptr),
735  PFElectronStep(nullptr),
736  PvStep(nullptr),
737  METStep(nullptr) {
738  JetSteps.clear();
739  CaloJetSteps.clear();
740  PFJetSteps.clear();
741  // configure preselection
742  edm::ParameterSet presel =
743  cfg.getParameter<edm::ParameterSet>("preselection");
744  if (presel.existsAs<edm::ParameterSet>("trigger")) {
746  presel.getParameter<edm::ParameterSet>("trigger");
747  triggerTable__ = consumes<edm::TriggerResults>(
748  trigger.getParameter<edm::InputTag>("src"));
749  triggerPaths_ = trigger.getParameter<std::vector<std::string>>("select");
750  }
751  if (presel.existsAs<edm::ParameterSet>("beamspot")) {
753  presel.getParameter<edm::ParameterSet>("beamspot");
754  beamspot_ = beamspot.getParameter<edm::InputTag>("src");
755  beamspot__ =
756  consumes<reco::BeamSpot>(beamspot.getParameter<edm::InputTag>("src"));
758  beamspot.getParameter<std::string>("select")));
759  }
760  // configure the selection
761  std::vector<edm::ParameterSet> sel =
762  cfg.getParameter<std::vector<edm::ParameterSet>>("selection");
763 
764  for (unsigned int i = 0; i < sel.size(); ++i) {
765  selectionOrder_.push_back(sel.at(i).getParameter<std::string>("label"));
766  selection_[selectionStep(selectionOrder_.back())] = std::make_pair(
767  sel.at(i),
768  std::unique_ptr<SingleTopTChannelLepton::MonitorEnsemble>(
770  selectionStep(selectionOrder_.back()).c_str(),
771  cfg.getParameter<edm::ParameterSet>("setup"),
772  cfg.getParameter<std::vector<edm::ParameterSet>>("selection"),
773  consumesCollector())));
774  }
775  for (std::vector<std::string>::const_iterator selIt = selectionOrder_.begin();
776  selIt != selectionOrder_.end(); ++selIt) {
777  std::string key = selectionStep(*selIt), type = objectType(*selIt);
778  if (selection_.find(key) != selection_.end()) {
779  using std::unique_ptr;
780 
781  if (type == "muons") {
783  consumesCollector()));
784  }
785  if (type == "muons/pf") {
787  selection_[key].first, consumesCollector()));
788  }
789  if (type == "elecs") {
791  selection_[key].first, consumesCollector()));
792  }
793  if (type == "elecs/pf") {
795  selection_[key].first, consumesCollector()));
796  }
797  if (type == "pvs") {
798  PvStep.reset(new SelectionStep<reco::Vertex>(selection_[key].first,
799  consumesCollector()));
800  }
801  if (type == "jets") {
802  JetSteps.push_back(std::unique_ptr<SelectionStep<reco::Jet>>(
803  new SelectionStep<reco::Jet>(selection_[key].first,
804  consumesCollector())));
805  }
806  if (type == "jets/pf") {
807  PFJetSteps.push_back(std::unique_ptr<SelectionStep<reco::PFJet>>(
808  new SelectionStep<reco::PFJet>(selection_[key].first,
809  consumesCollector())));
810  }
811  if (type == "jets/calo") {
812  CaloJetSteps.push_back(std::unique_ptr<SelectionStep<reco::CaloJet>>(
814  consumesCollector())));
815  }
816  if (type == "met") {
817  METStep.reset(new SelectionStep<reco::MET>(selection_[key].first,
818  consumesCollector()));
819  }
820  }
821  }
822 }
std::vector< std::string > selectionOrder_
type
Definition: HCALResponse.h:21
std::string objectType(const std::string &label)
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::vector< std::string > triggerPaths_
trigger paths
std::unique_ptr< SelectionStep< reco::Vertex > > PvStep
std::vector< std::unique_ptr< SelectionStep< reco::CaloJet > > > CaloJetSteps
std::vector< std::unique_ptr< SelectionStep< reco::Jet > > > JetSteps
edm::EDGetTokenT< edm::TriggerResults > triggerTable__
trigger table
std::vector< edm::ParameterSet > sel
std::unique_ptr< SelectionStep< reco::PFCandidate > > PFElectronStep
std::string selectionStep(const std::string &label)
std::unique_ptr< SelectionStep< reco::GsfElectron > > ElectronStep
std::unique_ptr< SelectionStep< reco::MET > > METStep
Templated helper class to allow a selection on a certain object collection.
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > vertexSelect_
string cut selector
edm::EDGetTokenT< reco::BeamSpot > beamspot__
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< SingleTopTChannelLepton::MonitorEnsemble > > > selection_
std::vector< std::unique_ptr< SelectionStep< reco::PFJet > > > PFJetSteps
std::unique_ptr< SelectionStep< reco::Muon > > MuonStep
std::unique_ptr< SelectionStep< reco::PFCandidate > > PFMuonStep
SingleTopTChannelLeptonDQM::~SingleTopTChannelLeptonDQM ( )
inlineoverride

default destructor

Definition at line 304 of file SingleTopTChannelLeptonDQM.h.

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

304 {};

Member Function Documentation

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

do this during the event loop

Definition at line 829 of file SingleTopTChannelLeptonDQM.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, PFElectronStep, PFJetSteps, PFMuonStep, TauGenJetsDecayModeSelectorAllHadrons_cfi::select, selection_, selectionOrder_, selectionStep(), AlCaHLTBitMon_QueryRunRegistry::string, triggerPaths_, and triggerTable__.

830  {
833  if (!event.getByToken(triggerTable__, triggerTable)) return;
834  if (!accept(event, *triggerTable, triggerPaths_)) return;
835  }
836  if (!beamspot__.isUninitialized()) {
838  if (!event.getByToken(beamspot__, beamspot)) return;
839  if (!(*beamspotSelect_)(*beamspot)) return;
840  }
841  // apply selection steps
842  unsigned int passed = 0;
843  unsigned int nJetSteps = -1;
844  unsigned int nPFJetSteps = -1;
845  unsigned int nCaloJetSteps = -1;
846  for (std::vector<std::string>::const_iterator selIt = selectionOrder_.begin();
847  selIt != selectionOrder_.end(); ++selIt) {
848  std::string key = selectionStep(*selIt), type = objectType(*selIt);
849  if (selection_.find(key) != selection_.end()) {
850  if (type == "empty") {
851  selection_[key].second->fill(event, setup);
852  }
853  if (type == "presel") {
854  selection_[key].second->fill(event, setup);
855  }
856  if (type == "elecs" && ElectronStep != nullptr) {
857  if (ElectronStep->select(event)) {
858  ++passed;
859  selection_[key].second->fill(event, setup);
860  } else
861  break;
862  }
863  if (type == "elecs/pf" && PFElectronStep != nullptr) {
864 
865  if (PFElectronStep->select(event, "electron")) {
866  ++passed;
867 
868  selection_[key].second->fill(event, setup);
869 
870  } else
871  break;
872  }
873  if (type == "muons" && MuonStep != nullptr) {
874  if (MuonStep->select(event)) {
875  ++passed;
876  selection_[key].second->fill(event, setup);
877  } else
878  break;
879  }
880  if (type == "muons/pf" && PFMuonStep != nullptr) {
881  if (PFMuonStep->select(event, "muon")) {
882  ++passed;
883  selection_[key].second->fill(event, setup);
884  } else
885  break;
886  }
887  if (type == "jets") {
888  nJetSteps++;
889  if (JetSteps[nJetSteps]) {
890  if (JetSteps[nJetSteps]->select(event, setup)) {
891  ++passed;
892  selection_[key].second->fill(event, setup);
893  } else
894  break;
895  }
896  }
897  if (type == "jets/pf") {
898  nPFJetSteps++;
899  if (PFJetSteps[nPFJetSteps]) {
900  if (PFJetSteps[nPFJetSteps]->select(event, setup)) {
901  ++passed;
902  selection_[key].second->fill(event, setup);
903  } else
904  break;
905  }
906  }
907  if (type == "jets/calo") {
908  nCaloJetSteps++;
909  if (CaloJetSteps[nCaloJetSteps]) {
910  if (CaloJetSteps[nCaloJetSteps]->select(event, setup)) {
911  ++passed;
912  selection_[key].second->fill(event, setup);
913  } else
914  break;
915  }
916  }
917  if (type == "met" && METStep != nullptr) {
918  if (METStep->select(event)) {
919  ++passed;
920  selection_[key].second->fill(event, setup);
921  } else
922  break;
923  }
924  }
925  }
926 }
std::vector< std::string > selectionOrder_
type
Definition: HCALResponse.h:21
std::string objectType(const std::string &label)
std::vector< std::string > triggerPaths_
trigger paths
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::vector< std::unique_ptr< SelectionStep< reco::CaloJet > > > CaloJetSteps
std::vector< std::unique_ptr< SelectionStep< reco::Jet > > > JetSteps
edm::EDGetTokenT< edm::TriggerResults > triggerTable__
trigger table
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
std::unique_ptr< SelectionStep< reco::PFCandidate > > PFElectronStep
std::string selectionStep(const std::string &label)
std::unique_ptr< SelectionStep< reco::GsfElectron > > ElectronStep
std::unique_ptr< SelectionStep< reco::MET > > METStep
edm::EDGetTokenT< reco::BeamSpot > beamspot__
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< SingleTopTChannelLepton::MonitorEnsemble > > > selection_
bool isUninitialized() const
Definition: EDGetToken.h:70
std::vector< std::unique_ptr< SelectionStep< reco::PFJet > > > PFJetSteps
std::unique_ptr< SelectionStep< reco::Muon > > MuonStep
std::unique_ptr< SelectionStep< reco::PFCandidate > > PFMuonStep
void SingleTopTChannelLeptonDQM::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotected

Definition at line 823 of file SingleTopTChannelLeptonDQM.cc.

References selection_.

824  {
825  for (auto selIt = selection_.begin(); selIt != selection_.end(); ++selIt) {
826  selIt->second.second->book(ibooker);
827  }
828 }
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< SingleTopTChannelLepton::MonitorEnsemble > > > selection_
std::string SingleTopTChannelLeptonDQM::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 317 of file SingleTopTChannelLeptonDQM.h.

Referenced by analyze(), and SingleTopTChannelLeptonDQM().

317  {
318  return label.substr(0, label.find(':'));
319  };
char const * label
std::string SingleTopTChannelLeptonDQM::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 322 of file SingleTopTChannelLeptonDQM.h.

Referenced by analyze(), and SingleTopTChannelLeptonDQM().

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

Member Data Documentation

edm::InputTag SingleTopTChannelLeptonDQM::beamspot_
private

beamspot

Definition at line 339 of file SingleTopTChannelLeptonDQM.h.

Referenced by SingleTopTChannelLeptonDQM().

edm::EDGetTokenT<reco::BeamSpot> SingleTopTChannelLeptonDQM::beamspot__
private

Definition at line 340 of file SingleTopTChannelLeptonDQM.h.

Referenced by analyze(), and SingleTopTChannelLeptonDQM().

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

string cut selector

Definition at line 342 of file SingleTopTChannelLeptonDQM.h.

Referenced by analyze(), and SingleTopTChannelLeptonDQM().

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

Definition at line 365 of file SingleTopTChannelLeptonDQM.h.

Referenced by analyze(), and SingleTopTChannelLeptonDQM().

std::unique_ptr<SelectionStep<reco::GsfElectron> > SingleTopTChannelLeptonDQM::ElectronStep
private

Definition at line 360 of file SingleTopTChannelLeptonDQM.h.

Referenced by analyze(), and SingleTopTChannelLeptonDQM().

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

Definition at line 364 of file SingleTopTChannelLeptonDQM.h.

Referenced by analyze(), and SingleTopTChannelLeptonDQM().

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

Definition at line 368 of file SingleTopTChannelLeptonDQM.h.

Referenced by analyze(), and SingleTopTChannelLeptonDQM().

std::unique_ptr<SelectionStep<reco::Muon> > SingleTopTChannelLeptonDQM::MuonStep
private

Definition at line 358 of file SingleTopTChannelLeptonDQM.h.

Referenced by analyze(), and SingleTopTChannelLeptonDQM().

std::unique_ptr<SelectionStep<reco::PFCandidate> > SingleTopTChannelLeptonDQM::PFElectronStep
private

Definition at line 361 of file SingleTopTChannelLeptonDQM.h.

Referenced by analyze(), and SingleTopTChannelLeptonDQM().

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

Definition at line 366 of file SingleTopTChannelLeptonDQM.h.

Referenced by analyze(), and SingleTopTChannelLeptonDQM().

std::unique_ptr<SelectionStep<reco::PFCandidate> > SingleTopTChannelLeptonDQM::PFMuonStep
private

Definition at line 359 of file SingleTopTChannelLeptonDQM.h.

Referenced by analyze(), and SingleTopTChannelLeptonDQM().

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

Definition at line 362 of file SingleTopTChannelLeptonDQM.h.

Referenced by SingleTopTChannelLeptonDQM().

std::vector<edm::ParameterSet> SingleTopTChannelLeptonDQM::sel
private

Definition at line 369 of file SingleTopTChannelLeptonDQM.h.

Referenced by SingleTopTChannelLeptonDQM().

std::map< std::string, std::pair<edm::ParameterSet, std::unique_ptr<SingleTopTChannelLepton::MonitorEnsemble> > > SingleTopTChannelLeptonDQM::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 356 of file SingleTopTChannelLeptonDQM.h.

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

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

Referenced by analyze(), and SingleTopTChannelLeptonDQM().

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

trigger paths

Definition at line 331 of file SingleTopTChannelLeptonDQM.h.

Referenced by analyze(), and SingleTopTChannelLeptonDQM().

edm::EDGetTokenT<edm::TriggerResults> SingleTopTChannelLeptonDQM::triggerTable__
private

trigger table

Definition at line 324 of file SingleTopTChannelLeptonDQM.h.

Referenced by analyze(), and SingleTopTChannelLeptonDQM().

edm::InputTag SingleTopTChannelLeptonDQM::vertex_
private

primary vertex

Definition at line 333 of file SingleTopTChannelLeptonDQM.h.

edm::EDGetTokenT<reco::Vertex> SingleTopTChannelLeptonDQM::vertex__
private

Definition at line 334 of file SingleTopTChannelLeptonDQM.h.

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

string cut selector

Definition at line 336 of file SingleTopTChannelLeptonDQM.h.