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 ()
 
 DQMEDHarvester (edm::ParameterSet const &iConfig)
 
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 final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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
 
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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices 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<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
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)
 
template<Transition B>
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 (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

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
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) {}

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.

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 }

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().

◆ 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.

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 }

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().

◆ 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.

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 }

References newFWLiteAna::bin, L1TObjectsTimingClient_cff::efficiency, relativeConstraints::error, kLogCategory_, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, SiStripPI::max, Skims_PA_cff::name, TriggerAnalyzer::passed, runGCPTkAlMap::title, dqmMemoryStats::total, pfDeepBoostedJetPreprocessParams_cfi::upper_bound, and ApeEstimator_cff::width.

Referenced by bookEff1D(), and bookEff2D().

◆ 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.

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 }

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

◆ getElement()

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

Definition at line 52 of file MuonGEMBaseHarvestor.h.

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 }

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

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().

pfDeepBoostedJetPreprocessParams_cfi.upper_bound
upper_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:16
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
printsummarytable.folder
folder
Definition: printsummarytable.py:7
dqm::implementation::IGetter::getMEs
virtual std::vector< std::string > getMEs() const
Definition: DQMStore.cc:720
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
L1TObjectsTimingClient_cff.efficiency
efficiency
Definition: L1TObjectsTimingClient_cff.py:10
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
relativeConstraints.error
error
Definition: relativeConstraints.py:53
MuonGEMBaseHarvestor::computeEfficiency
TProfile * computeEfficiency(const TH1F &passed, const TH1F &total, const char *name, const char *title, Double_t confidence_level=0.683)
Definition: MuonGEMBaseHarvestor.cc:8
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
gpuVertexFinder::hist
__shared__ Hist hist
Definition: gpuClusterTracksDBSCAN.h:48
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
T
long double T
Definition: Basic3DVectorLD.h:48
TriggerAnalyzer.passed
passed
Definition: TriggerAnalyzer.py:62
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:673
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
dqmMemoryStats.total
total
Definition: dqmMemoryStats.py:152
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
label
const char * label
Definition: PFTauDecayModeTools.cc:11
MuonGEMBaseHarvestor::kLogCategory_
const std::string kLogCategory_
Definition: MuonGEMBaseHarvestor.h:46