CMS 3D CMS Logo

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

#include <MuonGEMBaseHarvestor.h>

Inheritance diagram for MuonGEMBaseHarvestor:
DQMEDHarvester edm::one::EDProducer< edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::EndProcessBlockProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper MuonCSCDigisHarvestor MuonGEMDigisHarvestor MuonGEMHitsHarvestor MuonGEMRecHitsHarvestor

Public Member Functions

 MuonGEMBaseHarvestor (const edm::ParameterSet &, std::string)
 
- Public Member Functions inherited from DQMEDHarvester
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
void beginJob () override
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &) override
 
virtual void dqmAnalyze (DQMStore::IBooker &, DQMStore::IGetter &, edm::Event const &, edm::EventSetup const &)
 
 DQMEDHarvester (edm::ParameterSet const &iConfig)
 
 DQMEDHarvester ()
 
virtual void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &)=0
 
virtual void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (DQMStore::IBooker &, DQMStore::IGetter &, edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &es) final
 
void endProcessBlockProduce (edm::ProcessBlock &) final
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &es) final
 
 ~DQMEDHarvester () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::EndProcessBlockProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void bookEff1D (DQMStore::IBooker &ibooker, DQMStore::IGetter &getter, const TString &passed_path, const TString &total_path, const TString &folder, const TString &eff_name, const TString &eff_title="Efficiency")
 
void bookEff2D (DQMStore::IBooker &ibooker, DQMStore::IGetter &getter, const TString &passed_path, const TString &total_path, const TString &folder, const TString &eff_name, const TString &eff_title="Efficiency")
 
TProfile * computeEfficiency (const TH1F &passed, const TH1F &total, const char *name, const char *title, Double_t confidence_level=0.683)
 
TH2F * computeEfficiency (const TH2F &passed, const TH2F &total, const char *name, const char *title)
 
template<typename T >
TgetElement (DQMStore::IGetter &getter, const TString &path)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Protected Attributes

const std::string kLogCategory_
 
- Protected Attributes inherited from DQMEDHarvester
DQMStoredqmstore_
 
edm::GetterOfProducts< DQMTokenjobmegetter_
 
edm::EDPutTokenT< DQMTokenjobToken_
 
edm::GetterOfProducts< DQMTokenlumimegetter_
 
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::GetterOfProducts< DQMTokenrunmegetter_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Additional Inherited Members

- Public Types inherited from DQMEDHarvester
typedef dqm::harvesting::DQMStore DQMStore
 
typedef dqm::harvesting::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Detailed Description

Definition at line 14 of file MuonGEMBaseHarvestor.h.

Constructor & Destructor Documentation

◆ MuonGEMBaseHarvestor()

MuonGEMBaseHarvestor::MuonGEMBaseHarvestor ( const edm::ParameterSet pset,
std::string  log_category 
)
explicit

Definition at line 5 of file MuonGEMBaseHarvestor.cc.

6  : kLogCategory_(log_category) {}
const std::string kLogCategory_

Member Function Documentation

◆ bookEff1D()

void MuonGEMBaseHarvestor::bookEff1D ( DQMStore::IBooker ibooker,
DQMStore::IGetter getter,
const TString &  passed_path,
const TString &  total_path,
const TString &  folder,
const TString &  eff_name,
const TString &  eff_title = "Efficiency" 
)
protected

Definition at line 75 of file MuonGEMBaseHarvestor.cc.

References dqm::implementation::IBooker::bookProfile(), computeEfficiency(), printsummarytable::folder, kLogCategory_, TriggerAnalyzer::passed, dqm::implementation::NavigatorBase::setCurrentFolder(), and dqmMemoryStats::total.

Referenced by MuonGEMRecHitsHarvestor::dqmEndJob(), MuonGEMDigisHarvestor::dqmEndJob(), and MuonCSCDigisHarvestor::dqmEndJob().

81  {
82  TH1F* passed = getElement<TH1F>(getter, passed_path);
83  if (passed == nullptr) {
84  edm::LogError(kLogCategory_) << "failed to get " << passed_path << std::endl;
85  return;
86  }
87 
88  TH1F* total = getElement<TH1F>(getter, total_path);
89  if (total == nullptr) {
90  edm::LogError(kLogCategory_) << "failed to get " << total_path << std::endl;
91  return;
92  }
93 
94  TProfile* eff = computeEfficiency(*passed, *total, eff_name, eff_title);
95 
96  booker.setCurrentFolder(folder.Data());
97  booker.bookProfile(eff_name, eff);
98 }
const std::string kLogCategory_
Log< level::Error, false > LogError
TProfile * computeEfficiency(const TH1F &passed, const TH1F &total, const char *name, const char *title, Double_t confidence_level=0.683)

◆ bookEff2D()

void MuonGEMBaseHarvestor::bookEff2D ( DQMStore::IBooker ibooker,
DQMStore::IGetter getter,
const TString &  passed_path,
const TString &  total_path,
const TString &  folder,
const TString &  eff_name,
const TString &  eff_title = "Efficiency" 
)
protected

Definition at line 100 of file MuonGEMBaseHarvestor.cc.

References dqm::implementation::IBooker::book2D(), computeEfficiency(), printsummarytable::folder, kLogCategory_, TriggerAnalyzer::passed, dqm::implementation::NavigatorBase::setCurrentFolder(), and dqmMemoryStats::total.

Referenced by MuonGEMRecHitsHarvestor::dqmEndJob(), and MuonGEMDigisHarvestor::dqmEndJob().

106  {
107  TH2F* passed = getElement<TH2F>(getter, passed_path);
108  if (passed == nullptr) {
109  edm::LogError(kLogCategory_) << "failed to get " << passed_path << std::endl;
110  return;
111  }
112 
113  TH2F* total = getElement<TH2F>(getter, total_path);
114  if (total == nullptr) {
115  edm::LogError(kLogCategory_) << "failed to get " << total_path << std::endl;
116  return;
117  }
118 
119  TH2F* eff = computeEfficiency(*passed, *total, eff_name, eff_title);
120  booker.setCurrentFolder(folder.Data());
121  booker.book2D(eff_name, eff);
122 }
const std::string kLogCategory_
Log< level::Error, false > LogError
TProfile * computeEfficiency(const TH1F &passed, const TH1F &total, const char *name, const char *title, Double_t confidence_level=0.683)

◆ computeEfficiency() [1/2]

TProfile * MuonGEMBaseHarvestor::computeEfficiency ( const TH1F &  passed,
const TH1F &  total,
const char *  name,
const char *  title,
Double_t  confidence_level = 0.683 
)
protected

Definition at line 8 of file MuonGEMBaseHarvestor.cc.

References newFWLiteAna::bin, L1TObjectsTimingClient_cff::efficiency, relativeConstraints::error, Matriplex::hypot(), kLogCategory_, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, WZElectronSkims53X_cff::max, mergeVDriftHistosByStation::name, TriggerAnalyzer::passed, runGCPTkAlMap::title, dqmMemoryStats::total, pfDeepBoostedJetPreprocessParams_cfi::upper_bound, and ApeEstimator_cff::width.

Referenced by bookEff1D(), and bookEff2D().

9  {
10  const TAxis* total_x = total.GetXaxis();
11 
12  TProfile* eff_profile = new TProfile(name, title, total_x->GetNbins(), total_x->GetXmin(), total_x->GetXmax());
13  eff_profile->GetXaxis()->SetTitle(total_x->GetTitle());
14  eff_profile->GetYaxis()->SetTitle("#epsilon");
15 
16  for (Int_t bin = 1; bin <= total.GetXaxis()->GetNbins(); bin++) {
17  Double_t num_passed = passed.GetBinContent(bin);
18  Double_t num_total = total.GetBinContent(bin);
19 
20  if (num_passed > num_total) {
21  edm::LogError(kLogCategory_) << "# of passed events > # of total events. "
22  << "These numbers are not consistent." << std::endl;
23  continue;
24  }
25 
26  if (num_total < 1) {
27  eff_profile->SetBinEntries(bin, 0);
28  continue;
29  }
30 
31  Double_t efficiency = num_passed / num_total;
32 
33  Double_t lower_bound = TEfficiency::ClopperPearson(num_total, num_passed, confidence_level, false);
34  Double_t upper_bound = TEfficiency::ClopperPearson(num_total, num_passed, confidence_level, true);
35 
37  Double_t error = std::hypot(efficiency, width);
38 
39  eff_profile->SetBinContent(bin, efficiency);
40  eff_profile->SetBinError(bin, error);
41  eff_profile->SetBinEntries(bin, 1);
42  }
43 
44  return eff_profile;
45 }
const std::string kLogCategory_
MPlex< T, D1, D2, N > hypot(const MPlex< T, D1, D2, N > &a, const MPlex< T, D1, D2, N > &b)
Definition: Matriplex.h:616
Log< level::Error, false > LogError

◆ computeEfficiency() [2/2]

TH2F * MuonGEMBaseHarvestor::computeEfficiency ( const TH2F &  passed,
const TH2F &  total,
const char *  name,
const char *  title 
)
protected

Definition at line 47 of file MuonGEMBaseHarvestor.cc.

References newFWLiteAna::bin, label, mergeVDriftHistosByStation::name, TriggerAnalyzer::passed, runGCPTkAlMap::title, and dqmMemoryStats::total.

50  {
51  TEfficiency eff(passed, total);
52  TH2F* eff_hist = dynamic_cast<TH2F*>(eff.CreateHistogram());
53  eff_hist->SetName(name);
54  eff_hist->SetTitle(title);
55 
56  const TAxis* total_x = total.GetXaxis();
57  TAxis* eff_hist_x = eff_hist->GetXaxis();
58  eff_hist_x->SetTitle(total_x->GetTitle());
59  for (Int_t bin = 1; bin <= total.GetNbinsX(); bin++) {
60  const char* label = total_x->GetBinLabel(bin);
61  eff_hist_x->SetBinLabel(bin, label);
62  }
63 
64  const TAxis* total_y = total.GetYaxis();
65  TAxis* eff_hist_y = eff_hist->GetYaxis();
66  eff_hist_y->SetTitle(total_y->GetTitle());
67  for (Int_t bin = 1; bin <= total.GetNbinsY(); bin++) {
68  const char* label = total_y->GetBinLabel(bin);
69  eff_hist_y->SetBinLabel(bin, label);
70  }
71 
72  return eff_hist;
73 }
char const * label

◆ getElement()

template<typename T >
T * MuonGEMBaseHarvestor::getElement ( DQMStore::IGetter getter,
const TString &  path 
)
protected

Definition at line 52 of file MuonGEMBaseHarvestor.h.

References spr::find(), printsummarytable::folder, dqm::implementation::IGetter::get(), dqm::implementation::IGetter::getMEs(), compareTotals::hist, kLogCategory_, mergeVDriftHistosByStation::name, EnsembleCalibrationLA_cfg::path, dqm::implementation::NavigatorBase::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

52  {
53  std::string folder = gSystem->DirName(path);
54  std::string name = gSystem->BaseName(path);
55 
56  getter.setCurrentFolder(folder);
57  std::vector<std::string> mes = getter.getMEs();
58 
59  if (std::find(mes.begin(), mes.end(), name) == mes.end()) {
60  edm::LogInfo(kLogCategory_) << "doesn't contain " << path << std::endl;
61  return nullptr;
62  }
63 
64  T* hist = nullptr;
65  if (auto tmp_me = getter.get(path.Data())) {
66  if (auto tmp_hist = dynamic_cast<T*>(tmp_me->getRootObject()->Clone())) {
67  hist = tmp_hist;
68  hist->Sumw2();
69  } else {
70  edm::LogError(kLogCategory_) << "failed to getRootObject " << path << std::endl;
71  }
72 
73  } else {
74  edm::LogError(kLogCategory_) << "failed to get " << path << std::endl;
75  }
76 
77  return hist;
78 }
const std::string kLogCategory_
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
virtual std::vector< std::string > getMEs() const
Definition: DQMStore.cc:759
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
Log< level::Info, false > LogInfo
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:712
long double T

Member Data Documentation

◆ kLogCategory_

const std::string MuonGEMBaseHarvestor::kLogCategory_
protected

Definition at line 46 of file MuonGEMBaseHarvestor.h.

Referenced by bookEff1D(), bookEff2D(), computeEfficiency(), and getElement().