CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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< T > 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< T >
 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
 
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
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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
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< B > consumes (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 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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
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...
 
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
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 ( 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

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(), kLogCategory_, 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)
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(), kLogCategory_, 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)
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, postValidation_cfi::efficiency, relativeConstraints::error, kLogCategory_, cuda_std::lower_bound(), SiStripPI::max, and cuda_std::upper_bound().

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 
36  Double_t width = std::max(efficiency - lower_bound, upper_bound - efficiency);
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_
__host__ __device__ constexpr RandomIt upper_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
Log< level::Error, false > LogError
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
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, and label.

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
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(), gpuVertexFinder::hist, kLogCategory_, mergeVDriftHistosByStation::name, 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:32
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
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:673
__shared__ Hist hist
Log< level::Info, false > LogInfo
virtual std::vector< std::string > getMEs() const
Definition: DQMStore.cc:720
long double T

Member Data Documentation

const std::string MuonGEMBaseHarvestor::kLogCategory_
protected

Definition at line 46 of file MuonGEMBaseHarvestor.h.

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