CMS 3D CMS Logo

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

#include <L1TStage2RatioClient.h>

Inheritance diagram for L1TStage2RatioClient:
DQMEDHarvester edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 L1TStage2RatioClient (const edm::ParameterSet &)
 
 ~L1TStage2RatioClient () override
 
- Public Member Functions inherited from DQMEDHarvester
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
 DQMEDHarvester ()
 
virtual void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 
void endJob () final
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &, edm::EventSetup const &) final
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) override
 
 ~DQMEDHarvester () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Protected Member Functions

void dqmEndJob (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter) override
 
void dqmEndLuminosityBlock (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Member Functions

void book (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
 
void processHistograms (DQMStore::IGetter &igetter)
 

Private Attributes

bool binomialErr_
 
std::vector< int > ignoreBin_
 
std::string inputDen_
 
std::string inputNum_
 
std::string monitorDir_
 
MonitorElementratioME_
 
std::string ratioName_
 
std::string ratioTitle_
 
std::string yAxisTitle_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Attributes inherited from DQMEDHarvester
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 10 of file L1TStage2RatioClient.h.

Constructor & Destructor Documentation

L1TStage2RatioClient::L1TStage2RatioClient ( const edm::ParameterSet ps)

Definition at line 3 of file L1TStage2RatioClient.cc.

3  :
10  binomialErr_(ps.getUntrackedParameter<bool>("binomialErr")),
11  ignoreBin_(ps.getUntrackedParameter<std::vector<int>>("ignoreBin")),
12  ratioME_(nullptr)
13 {
14 }
T getUntrackedParameter(std::string const &, T const &) const
std::vector< int > ignoreBin_
MonitorElement * ratioME_
L1TStage2RatioClient::~L1TStage2RatioClient ( )
override

Definition at line 16 of file L1TStage2RatioClient.cc.

16 {}

Member Function Documentation

void L1TStage2RatioClient::book ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
private

Definition at line 38 of file L1TStage2RatioClient.cc.

References DQMStore::IBooker::book1D(), DQMStore::IGetter::get(), MonitorElement::getTH1F(), inputNum_, monitorDir_, ratioME_, ratioName_, ratioTitle_, MonitorElement::Reset(), MonitorElement::setAxisTitle(), DQMStore::IBooker::setCurrentFolder(), MonitorElement::setEfficiencyFlag(), and yAxisTitle_.

Referenced by dqmEndJob(), and dqmEndLuminosityBlock().

39 {
40  // Book when called the first time. Otherwise reset the ratio histogram.
41  if (ratioME_ == nullptr) {
43 
44  // get the axis range from the numerator histogram
45  const MonitorElement* numME_ = igetter.get(inputNum_);
46  if (numME_) {
47  TH1F *hNum = numME_->getTH1F();
48 
49  ratioME_ = ibooker.book1D(ratioName_, ratioTitle_, hNum->GetNbinsX(), hNum->GetXaxis()->GetXmin(), hNum->GetXaxis()->GetXmax());
52  }
53  } else {
54  ratioME_->Reset();
55  }
56 }
TH1F * getTH1F() const
void setEfficiencyFlag()
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
void Reset()
reset ME (ie. contents, errors, etc)
MonitorElement * get(std::string const &path)
Definition: DQMStore.cc:303
MonitorElement * ratioME_
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void L1TStage2RatioClient::dqmEndJob ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
overrideprotectedvirtual

Implements DQMEDHarvester.

Definition at line 96 of file L1TStage2RatioClient.cc.

References book(), and processHistograms().

96  {
97  book(ibooker, igetter);
98  processHistograms(igetter);
99 }
void book(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
void processHistograms(DQMStore::IGetter &igetter)
void L1TStage2RatioClient::dqmEndLuminosityBlock ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
const edm::LuminosityBlock lumiSeg,
const edm::EventSetup c 
)
overrideprotected

Definition at line 32 of file L1TStage2RatioClient.cc.

References book(), and processHistograms().

33 {
34  book(ibooker, igetter);
35  processHistograms(igetter);
36 }
void book(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
void processHistograms(DQMStore::IGetter &igetter)
void L1TStage2RatioClient::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 18 of file L1TStage2RatioClient.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addUntracked(), edm::ParameterDescriptionNode::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

19 {
21  desc.addUntracked<std::string>("monitorDir", "")->setComment("Target directory in the DQM file. Will be created if not existing.");
22  desc.addUntracked<std::string>("inputNum", "")->setComment("Path to numerator histogram.");
23  desc.addUntracked<std::string>("inputDen", "")->setComment("Path to denominator histogram.");
24  desc.addUntracked<std::string>("ratioName", "ratio")->setComment("Ratio plot name.");
25  desc.addUntracked<std::string>("ratioTitle", "ratio")->setComment("Ratio plot title.");
26  desc.addUntracked<std::string>("yAxisTitle", "")->setComment("Title of y axis.");
27  desc.addUntracked<bool>("binomialErr", "true")->setComment("Compute binomial errors.");
28  desc.addUntracked<std::vector<int>>("ignoreBin", std::vector<int>())->setComment("List of bins to ignore. Will set their ratio to 0.");
29  descriptions.add("l1TStage2RatioClient", desc);
30 }
void setComment(std::string const &value)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void L1TStage2RatioClient::processHistograms ( DQMStore::IGetter igetter)
private

Definition at line 58 of file L1TStage2RatioClient.cc.

References stringResolutionProvider_cfi::bin, binomialErr_, DQMStore::IGetter::get(), MonitorElement::getTH1F(), mps_fire::i, ignoreBin_, inputDen_, inputNum_, ratioME_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by dqmEndJob(), and dqmEndLuminosityBlock().

59 {
60  const MonitorElement* numME_ = igetter.get(inputNum_);
61  const MonitorElement* denME_ = igetter.get(inputDen_);
62 
63  if (numME_ && denME_) {
64  TH1F *hNum = numME_->getTH1F();
65  TH1F *hDen = dynamic_cast<TH1F *>(denME_->getTH1F()->Clone("den"));
66 
67  TH1F *hRatio = ratioME_->getTH1F();
68 
69  // Set the axis labels the same as the numerator histogram to be able to divide
70  if (hNum->GetXaxis()->IsAlphanumeric()) {
71  for (int i = 1; i <= hNum->GetNbinsX(); ++i) {
72  hDen->GetXaxis()->SetBinLabel(i, hNum->GetXaxis()->GetBinLabel(i));
73  hRatio->GetXaxis()->SetBinLabel(i, hNum->GetXaxis()->GetBinLabel(i));
74  }
75  }
76 
77  std::string errOption;
78  if (binomialErr_) {
79  errOption = "B";
80  }
81 
82  hRatio->Divide(hNum, hDen, 1, 1, errOption.c_str());
83 
84  // Set the ratio to 0 for those bins that need to be ignored
85  for (const int & bin : ignoreBin_) {
86  if (bin > 0 && bin <= hRatio->GetNbinsX()) {
87  hRatio->SetBinContent(bin, 0.0);
88  hRatio->GetXaxis()->SetBinLabel(bin, "Ignored");
89  }
90  }
91 
92  delete hDen;
93  }
94 }
std::vector< int > ignoreBin_
TH1F * getTH1F() const
MonitorElement * get(std::string const &path)
Definition: DQMStore.cc:303
bin
set the eta bin as selection string.
MonitorElement * ratioME_

Member Data Documentation

bool L1TStage2RatioClient::binomialErr_
private

Definition at line 34 of file L1TStage2RatioClient.h.

Referenced by processHistograms().

std::vector<int> L1TStage2RatioClient::ignoreBin_
private

Definition at line 35 of file L1TStage2RatioClient.h.

Referenced by processHistograms().

std::string L1TStage2RatioClient::inputDen_
private

Definition at line 30 of file L1TStage2RatioClient.h.

Referenced by processHistograms().

std::string L1TStage2RatioClient::inputNum_
private

Definition at line 29 of file L1TStage2RatioClient.h.

Referenced by book(), and processHistograms().

std::string L1TStage2RatioClient::monitorDir_
private

Definition at line 28 of file L1TStage2RatioClient.h.

Referenced by book().

MonitorElement* L1TStage2RatioClient::ratioME_
private

Definition at line 37 of file L1TStage2RatioClient.h.

Referenced by book(), and processHistograms().

std::string L1TStage2RatioClient::ratioName_
private

Definition at line 31 of file L1TStage2RatioClient.h.

Referenced by book().

std::string L1TStage2RatioClient::ratioTitle_
private

Definition at line 32 of file L1TStage2RatioClient.h.

Referenced by book().

std::string L1TStage2RatioClient::yAxisTitle_
private

Definition at line 33 of file L1TStage2RatioClient.h.

Referenced by book().