CMS 3D CMS Logo

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

#include <GEMEfficiencyHarvester.h>

Inheritance diagram for GEMEfficiencyHarvester:
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

Public Member Functions

void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
 GEMEfficiencyHarvester (const edm::ParameterSet &)
 
 ~GEMEfficiencyHarvester () override
 
- 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 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
 
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
 
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
 
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 &)
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

TProfile * computeEfficiency (const TH1F *, const TH1F *, const char *, const char *, const double confidence_level=0.683)
 
TH2F * computeEfficiency (const TH2F *, const TH2F *, const char *, const char *)
 
void doEfficiency (DQMStore::IBooker &, DQMStore::IGetter &)
 
void doResolution (DQMStore::IBooker &, DQMStore::IGetter &, const std::string)
 
template<typename T >
int findResolutionBin (const T &, const std::vector< T > &)
 
std::tuple< std::string, int, int > parseResidualName (std::string, const std::string)
 
std::vector< std::string > splitString (std::string, const std::string)
 

Private Attributes

std::string folder_
 
std::string log_category_
 

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
 
- 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 inherited from DQMEDHarvester
DQMStoredqmstore_
 
edm::GetterOfProducts< DQMTokenjobmegetter_
 
edm::EDPutTokenT< DQMTokenjobToken_
 
edm::GetterOfProducts< DQMTokenlumimegetter_
 
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::GetterOfProducts< DQMTokenrunmegetter_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 20 of file GEMEfficiencyHarvester.h.

Constructor & Destructor Documentation

◆ GEMEfficiencyHarvester()

GEMEfficiencyHarvester::GEMEfficiencyHarvester ( const edm::ParameterSet pset)

Definition at line 7 of file GEMEfficiencyHarvester.cc.

7  {
8  folder_ = pset.getUntrackedParameter<std::string>("folder");
9  log_category_ = "GEMEfficiencyHarvester";
10 }

References folder_, log_category_, muonDTDigis_cfi::pset, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~GEMEfficiencyHarvester()

GEMEfficiencyHarvester::~GEMEfficiencyHarvester ( )
override

Definition at line 12 of file GEMEfficiencyHarvester.cc.

12 {}

Member Function Documentation

◆ computeEfficiency() [1/2]

TProfile * GEMEfficiencyHarvester::computeEfficiency ( const TH1F *  passed,
const TH1F *  total,
const char *  name,
const char *  title,
const double  confidence_level = 0.683 
)
private

Definition at line 20 of file GEMEfficiencyHarvester.cc.

21  {
22  if (not TEfficiency::CheckConsistency(*passed, *total)) {
23  edm::LogError(log_category_) << "failed to pass TEfficiency::CheckConsistency. " << name << std::endl;
24  return nullptr;
25  }
26 
27  const TAxis* total_x = total->GetXaxis();
28 
29  TProfile* eff_profile = new TProfile(name, title, total_x->GetNbins(), total_x->GetXmin(), total_x->GetXmax());
30  eff_profile->GetXaxis()->SetTitle(total_x->GetTitle());
31  eff_profile->GetYaxis()->SetTitle("Efficiency");
32 
33  for (int bin = 1; bin <= total->GetNbinsX(); bin++) {
34  double num_passed = passed->GetBinContent(bin);
35  double num_total = total->GetBinContent(bin);
36 
37  if (num_total < 1) {
38  eff_profile->SetBinEntries(bin, 0);
39  continue;
40  }
41 
42  double efficiency = num_passed / num_total;
43 
44  double lower_bound = TEfficiency::ClopperPearson(num_total, num_passed, confidence_level, false);
45  double upper_bound = TEfficiency::ClopperPearson(num_total, num_passed, confidence_level, true);
46 
48  double error = std::hypot(efficiency, width);
49 
50  eff_profile->SetBinContent(bin, efficiency);
51  eff_profile->SetBinError(bin, error);
52  eff_profile->SetBinEntries(bin, 1);
53  }
54 
55  return eff_profile;
56 }

References newFWLiteAna::bin, L1TObjectsTimingClient_cff::efficiency, relativeConstraints::error, log_category_, 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 doEfficiency().

◆ computeEfficiency() [2/2]

TH2F * GEMEfficiencyHarvester::computeEfficiency ( const TH2F *  passed,
const TH2F *  total,
const char *  name,
const char *  title 
)
private

Definition at line 58 of file GEMEfficiencyHarvester.cc.

61  {
62  if (not TEfficiency::CheckConsistency(*passed, *total)) {
63  edm::LogError(log_category_) << "failed to pass TEfficiency::CheckConsistency. " << name << std::endl;
64  return nullptr;
65  }
66 
67  TEfficiency eff(*passed, *total);
68  TH2F* eff_hist = dynamic_cast<TH2F*>(eff.CreateHistogram());
69  eff_hist->SetName(name);
70  eff_hist->SetTitle(title);
71 
72  const TAxis* total_x = total->GetXaxis();
73  TAxis* eff_hist_x = eff_hist->GetXaxis();
74  eff_hist_x->SetTitle(total_x->GetTitle());
75  for (int bin = 1; bin <= total->GetNbinsX(); bin++) {
76  const char* label = total_x->GetBinLabel(bin);
77  eff_hist_x->SetBinLabel(bin, label);
78  }
79 
80  const TAxis* total_y = total->GetYaxis();
81  TAxis* eff_hist_y = eff_hist->GetYaxis();
82  eff_hist_y->SetTitle(total_y->GetTitle());
83  for (int bin = 1; bin <= total->GetNbinsY(); bin++) {
84  const char* label = total_y->GetBinLabel(bin);
85  eff_hist_y->SetBinLabel(bin, label);
86  }
87 
88  return eff_hist;
89 }

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

◆ doEfficiency()

void GEMEfficiencyHarvester::doEfficiency ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
private

Definition at line 91 of file GEMEfficiencyHarvester.cc.

91  {
92  const std::string efficiency_folder = folder_ + "/Efficiency/";
93  ibooker.setCurrentFolder(efficiency_folder);
94  igetter.setCurrentFolder(efficiency_folder);
95 
96  std::map<std::string, std::pair<const MonitorElement*, const MonitorElement*> > me_pairs;
97 
98  const std::string matched = "_matched";
99 
100  for (const std::string& name : igetter.getMEs()) {
101  const std::string fullpath = efficiency_folder + name;
102  const MonitorElement* me = igetter.get(fullpath);
103  if (me == nullptr) {
104  edm::LogError(log_category_) << "failed to get " << fullpath << std::endl;
105  continue;
106  }
107 
108  const bool is_matched = name.find(matched) != std::string::npos;
109 
110  std::string key = name;
111  if (is_matched)
112  key.erase(key.find(matched), matched.length());
113 
114  if (me_pairs.find(key) == me_pairs.end()) {
115  me_pairs[key] = {nullptr, nullptr};
116  }
117 
118  if (is_matched)
119  me_pairs[key].first = me;
120  else
121  me_pairs[key].second = me;
122  }
123 
124  for (auto&& [key, value] : me_pairs) {
125  const auto& [me_passed, me_total] = value;
126  if (me_passed == nullptr) {
127  edm::LogError(log_category_) << "numerator is missing. " << key << std::endl;
128  continue;
129  }
130 
131  if (me_total == nullptr) {
132  edm::LogError(log_category_) << "denominator is missing. " << key << std::endl;
133  continue;
134  }
135 
136  if (me_passed->kind() != me_total->kind()) {
137  edm::LogError(log_category_) << "inconsistency between kinds of passed and total" << key << std::endl;
138  continue;
139  }
140 
141  const std::string name = "eff_" + me_total->getName();
142  const std::string title = me_passed->getTitle();
143 
144  if (me_passed->kind() == MonitorElement::Kind::TH1F) {
145  TH1F* h_passed = me_passed->getTH1F();
146  if (h_passed == nullptr) {
147  edm::LogError(log_category_) << "failed to get TH1F from passed " << key << std::endl;
148  continue;
149  }
150  h_passed->Sumw2();
151 
152  TH1F* h_total = me_total->getTH1F();
153  if (h_total == nullptr) {
154  edm::LogError(log_category_) << "failed to get TH1F from total" << key << std::endl;
155  continue;
156  }
157  h_total->Sumw2();
158 
159  TProfile* eff = computeEfficiency(h_passed, h_total, name.c_str(), title.c_str());
160  if (eff == nullptr) {
161  edm::LogError(log_category_) << "failed to compute the efficiency " << key << std::endl;
162  continue;
163  }
164 
165  ibooker.bookProfile(name, eff);
166 
167  } else if (me_passed->kind() == MonitorElement::Kind::TH2F) {
168  TH2F* h_passed = me_passed->getTH2F();
169  if (h_passed == nullptr) {
170  edm::LogError(log_category_) << "failed to get TH1F from passed " << key << std::endl;
171  continue;
172  }
173  h_passed->Sumw2();
174 
175  TH2F* h_total = me_total->getTH2F();
176  if (h_total == nullptr) {
177  edm::LogError(log_category_) << "failed to get TH1F from total" << key << std::endl;
178  continue;
179  }
180  h_total->Sumw2();
181 
182  TH2F* eff = computeEfficiency(h_passed, h_total, name.c_str(), title.c_str());
183  if (eff == nullptr) {
184  edm::LogError(log_category_) << "failed to compute the efficiency " << key << std::endl;
185  continue;
186  }
187 
188  ibooker.book2D(name, eff);
189 
190  } else {
191  edm::LogError(log_category_) << "not implemented" << std::endl;
192  continue;
193  }
194  } // me_pairs
195 }

References dqm::implementation::IBooker::book2D(), dqm::implementation::IBooker::bookProfile(), computeEfficiency(), folder_, reco_skim_cfg_mod::fullpath, dqm::implementation::IGetter::get(), dqm::implementation::IGetter::getMEs(), dqm::legacy::MonitorElement::getTH2F(), crabWrapper::key, log_category_, muonTagProbeFilters_cff::matched, hlt_dqm_clientPB-live_cfg::me, Skims_PA_cff::name, dqm::implementation::NavigatorBase::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, MonitorElementData::TH1F, MonitorElementData::TH2F, runGCPTkAlMap::title, and relativeConstraints::value.

Referenced by dqmEndJob().

◆ doResolution()

void GEMEfficiencyHarvester::doResolution ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
const std::string  prefix 
)
private

Definition at line 241 of file GEMEfficiencyHarvester.cc.

243  {
244  const std::string resolution_folder = folder_ + "/Resolution/";
245 
246  igetter.setCurrentFolder(resolution_folder);
247  ibooker.setCurrentFolder(resolution_folder);
248 
249  // (histogram, (region_sign, station), ieta)
250  std::vector<std::tuple<const TH1F*, std::pair<std::string, int>, int> > hist_vector;
251  // (region_sign, station)
252  std::vector<std::pair<std::string, int> > re_st_vec;
253  // ieta
254  std::vector<int> ieta_vec;
255 
256  for (const std::string& name : igetter.getMEs()) {
257  if (name.find(prefix) == std::string::npos)
258  continue;
259 
260  const std::string fullpath = resolution_folder + name;
261  const MonitorElement* me = igetter.get(fullpath);
262  if (me == nullptr) {
263  edm::LogError(log_category_) << "failed to get " << fullpath << std::endl;
264  continue;
265  }
266 
267  const TH1F* hist = me->getTH1F();
268  if (hist == nullptr) {
269  edm::LogError(log_category_) << "failed to get TH1F" << std::endl;
270  continue;
271  }
272 
273  auto&& [region_sign, station, ieta] = parseResidualName(name, prefix);
274  if (region_sign.empty() or station < 0 or ieta < 0) {
275  edm::LogError(log_category_) << "failed to parse the name of the residual histogram: " << name << std::endl;
276  continue;
277  }
278  std::pair<std::string, int> region_station(region_sign, station);
279 
280  hist_vector.emplace_back(hist, region_station, ieta);
281  if (std::find(re_st_vec.begin(), re_st_vec.end(), region_station) == re_st_vec.end())
282  re_st_vec.push_back(region_station);
283  if (std::find(ieta_vec.begin(), ieta_vec.end(), ieta) == ieta_vec.end())
284  ieta_vec.push_back(ieta);
285  } // MonitorElement
286 
287  if (hist_vector.empty()) {
288  edm::LogError(log_category_) << "failed to find " << prefix << std::endl;
289  return;
290  }
291 
292  // NOTE
293  // GE-2/1, GE-1/1, GE-0/1, GE+0/1, GE+1/1, GE+2/1
294  auto f_sort = [](const std::pair<std::string, int>& lhs, const std::pair<std::string, int>& rhs) -> bool {
295  if (lhs.first == rhs.first) {
296  if (lhs.first == "-")
297  return lhs.second > rhs.second;
298  else
299  return lhs.second < rhs.second;
300 
301  } else {
302  return (lhs.first == "-");
303  }
304  };
305 
306  std::sort(re_st_vec.begin(), re_st_vec.end(), f_sort);
307  std::sort(ieta_vec.begin(), ieta_vec.end());
308 
309  const int num_st = re_st_vec.size();
310  const int num_ieta = ieta_vec.size();
311 
312  // NOTE
313  TString tmp_title{std::get<0>(hist_vector.front())->GetTitle()};
314 
315  const TObjArray* tokens = tmp_title.Tokenize(":");
316  const TString title_prefix = dynamic_cast<TObjString*>(tokens->At(0))->GetString();
317 
318  const TString h_mean_name = prefix + "_mean";
319  const TString h_stddev_name = prefix + "_stddev";
320  const TString h_skewness_name = prefix + "_skewness";
321 
322  const TString h_mean_title = title_prefix + " : Mean";
323  const TString h_stddev_title = title_prefix + " : Standard Deviation";
324  const TString h_skewness_title = title_prefix + " : Skewness";
325 
326  TH2F* h_mean = new TH2F(h_mean_name, h_mean_title, num_ieta, 0.5, num_ieta + 0.5, num_st, 0.5, num_st + 0.5);
327  // x-axis
328  h_mean->GetXaxis()->SetTitle("i#eta");
329  for (unsigned int idx = 0; idx < ieta_vec.size(); idx++) {
330  const int xbin = idx + 1;
331  const char* label = Form("%d", ieta_vec[idx]);
332  h_mean->GetXaxis()->SetBinLabel(xbin, label);
333  }
334  // y-axis
335  for (unsigned int idx = 0; idx < re_st_vec.size(); idx++) {
336  auto [region_sign, station] = re_st_vec[idx];
337  const char* label = Form("GE%s%d/1", region_sign.c_str(), station);
338  const int ybin = idx + 1;
339  h_mean->GetYaxis()->SetBinLabel(ybin, label);
340  }
341 
342  TH2F* h_stddev = dynamic_cast<TH2F*>(h_mean->Clone(h_stddev_name));
343  TH2F* h_skewness = dynamic_cast<TH2F*>(h_mean->Clone(h_skewness_name));
344 
345  h_stddev->SetTitle(h_stddev_title);
346  h_skewness->SetTitle(h_skewness_title);
347 
348  // NOTE
349  for (auto [hist, region_station, ieta] : hist_vector) {
350  const int xbin = findResolutionBin(ieta, ieta_vec);
351  if (xbin < 0) {
352  edm::LogError(log_category_) << "found a wrong x bin = " << xbin << std::endl;
353  continue;
354  }
355 
356  const int ybin = findResolutionBin(region_station, re_st_vec);
357  if (ybin < 0) {
358  edm::LogError(log_category_) << "found a wrong y bin = " << ybin << std::endl;
359  continue;
360  }
361 
362  h_mean->SetBinContent(xbin, ybin, hist->GetMean());
363  h_stddev->SetBinContent(xbin, ybin, hist->GetStdDev());
364 
365  // FIXME
366  // `GetSkewness` seems to returns nan when its histogram has no entry..
367  const double skewness = hist->GetSkewness();
368  if (not std::isnan(skewness))
369  h_skewness->SetBinContent(xbin, ybin, skewness);
370 
371  h_mean->SetBinError(xbin, ybin, hist->GetMeanError());
372  h_stddev->SetBinError(xbin, ybin, hist->GetStdDevError());
373  h_skewness->SetBinError(xbin, ybin, hist->GetSkewness(11));
374  }
375 
376  for (auto&& each : {h_mean, h_stddev, h_skewness}) {
377  ibooker.book2D(each->GetName(), each);
378  }
379 }

References dqm::implementation::IBooker::book2D(), spr::find(), findResolutionBin(), folder_, reco_skim_cfg_mod::fullpath, dqm::implementation::IGetter::get(), dqm::implementation::IGetter::getMEs(), gpuVertexFinder::hist, heavyIonCSV_trainingSettings::idx, LEDCalibrationChannels::ieta, CommonMethods::isnan(), label, log_category_, hlt_dqm_clientPB-live_cfg::me, Skims_PA_cff::name, or, parseResidualName(), hcallasereventfilter2012_cfi::prefix, dqm::implementation::NavigatorBase::setCurrentFolder(), jetUpdater_cfi::sort, relativeConstraints::station, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by dqmEndJob().

◆ dqmEndJob()

void GEMEfficiencyHarvester::dqmEndJob ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
overridevirtual

Implements DQMEDHarvester.

Definition at line 381 of file GEMEfficiencyHarvester.cc.

381  {
382  doEfficiency(ibooker, igetter);
383  doResolution(ibooker, igetter, "residual_rphi");
384 }

References doEfficiency(), and doResolution().

◆ fillDescriptions()

void GEMEfficiencyHarvester::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 14 of file GEMEfficiencyHarvester.cc.

14  {
16  desc.addUntracked<std::string>("folder", "GEM/Efficiency/type0");
17  descriptions.add("gemEfficiencyHarvesterDefault", desc);
18 }

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ findResolutionBin()

template<typename T >
int GEMEfficiencyHarvester::findResolutionBin ( const T elem,
const std::vector< T > &  vec 
)
private

Definition at line 43 of file GEMEfficiencyHarvester.h.

43  {
44  auto iter = std::find(vec.begin(), vec.end(), elem);
45  int bin = (iter != vec.end()) ? std::distance(vec.begin(), iter) + 1 : -1;
46  return bin;
47 }

References newFWLiteAna::bin, HLT_FULL_cff::distance, and spr::find().

Referenced by doResolution().

◆ parseResidualName()

std::tuple< std::string, int, int > GEMEfficiencyHarvester::parseResidualName ( std::string  org_name,
const std::string  prefix 
)
private

Definition at line 209 of file GEMEfficiencyHarvester.cc.

210  {
211  std::string name = org_name;
212 
213  // e.g. residual_rdphi_GE-11_R4 -> _GE-11_R4
214  name.erase(name.find(prefix), prefix.length());
215 
216  // _GE-11_R4 -> -11_R4
217  name.erase(name.find("_GE"), 3);
218 
219  // -11_R4 -> (-11, R4)
220  const std::vector<std::string>&& tokens = splitString(name, "_");
221  const size_t num_tokens = tokens.size();
222 
223  if (num_tokens != 2) {
224  return std::make_tuple("", -1, -1);
225  }
226 
227  // '-'11
228  std::string region_sign = tokens.front().substr(0, 1);
229  // -'1'1
230  TString station_str = tokens.front().substr(1, 1);
231 
232  // R'4' or R'16'
233  TString ieta_str = tokens.back().substr(1);
234 
235  const int station = station_str.IsDigit() ? station_str.Atoi() : -1;
236  const int ieta = ieta_str.IsDigit() ? ieta_str.Atoi() : -1;
237 
238  return std::make_tuple(region_sign, station, ieta);
239 }

References LEDCalibrationChannels::ieta, Skims_PA_cff::name, hcallasereventfilter2012_cfi::prefix, splitString(), relativeConstraints::station, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by doResolution().

◆ splitString()

std::vector< std::string > GEMEfficiencyHarvester::splitString ( std::string  name,
const std::string  delimiter 
)
private

Definition at line 197 of file GEMEfficiencyHarvester.cc.

197  {
198  std::vector<std::string> tokens;
199  size_t delimiter_pos;
200  size_t delimiter_len = delimiter.length();
201  while ((delimiter_pos = name.find('_')) != std::string::npos) {
202  tokens.push_back(name.substr(0, delimiter_pos));
203  name.erase(0, delimiter_pos + delimiter_len);
204  }
205  tokens.push_back(name);
206  return tokens;
207 }

References makeHLTPrescaleTable::delimiter, and Skims_PA_cff::name.

Referenced by parseResidualName().

Member Data Documentation

◆ folder_

std::string GEMEfficiencyHarvester::folder_
private

Definition at line 38 of file GEMEfficiencyHarvester.h.

Referenced by doEfficiency(), doResolution(), and GEMEfficiencyHarvester().

◆ log_category_

std::string GEMEfficiencyHarvester::log_category_
private
muonTagProbeFilters_cff.matched
matched
Definition: muonTagProbeFilters_cff.py:62
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
GEMEfficiencyHarvester::parseResidualName
std::tuple< std::string, int, int > parseResidualName(std::string, const std::string)
Definition: GEMEfficiencyHarvester.cc:209
reco_skim_cfg_mod.fullpath
fullpath
Definition: reco_skim_cfg_mod.py:202
GEMEfficiencyHarvester::findResolutionBin
int findResolutionBin(const T &, const std::vector< T > &)
Definition: GEMEfficiencyHarvester.h:43
GEMEfficiencyHarvester::folder_
std::string folder_
Definition: GEMEfficiencyHarvester.h:38
makeHLTPrescaleTable.delimiter
delimiter
Definition: makeHLTPrescaleTable.py:181
relativeConstraints.station
station
Definition: relativeConstraints.py:67
MonitorElementData::Kind::TH1F
dqm::implementation::IGetter::getMEs
virtual std::vector< std::string > getMEs() const
Definition: DQMStore.cc:698
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
L1TObjectsTimingClient_cff.efficiency
efficiency
Definition: L1TObjectsTimingClient_cff.py:10
GEMEfficiencyHarvester::log_category_
std::string log_category_
Definition: GEMEfficiencyHarvester.h:39
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
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
MonitorElementData::Kind::TH2F
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
dqm::implementation::IBooker::bookProfile
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:322
CommonMethods.isnan
def isnan(num)
Definition: CommonMethods.py:98
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
gpuVertexFinder::hist
__shared__ Hist hist
Definition: gpuClusterTracksDBSCAN.h:48
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
GEMEfficiencyHarvester::splitString
std::vector< std::string > splitString(std::string, const std::string)
Definition: GEMEfficiencyHarvester.cc:197
value
Definition: value.py:1
GEMEfficiencyHarvester::doResolution
void doResolution(DQMStore::IBooker &, DQMStore::IGetter &, const std::string)
Definition: GEMEfficiencyHarvester.cc:241
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
GEMEfficiencyHarvester::computeEfficiency
TProfile * computeEfficiency(const TH1F *, const TH1F *, const char *, const char *, const double confidence_level=0.683)
Definition: GEMEfficiencyHarvester.cc:20
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
relativeConstraints.value
value
Definition: relativeConstraints.py:53
dqm::implementation::IBooker::book2D
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
TriggerAnalyzer.passed
passed
Definition: TriggerAnalyzer.py:62
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:651
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
dqmMemoryStats.total
total
Definition: dqmMemoryStats.py:152
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:61
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7733
crabWrapper.key
key
Definition: crabWrapper.py:19
GEMEfficiencyHarvester::doEfficiency
void doEfficiency(DQMStore::IBooker &, DQMStore::IGetter &)
Definition: GEMEfficiencyHarvester.cc:91
label
const char * label
Definition: PFTauDecayModeTools.cc:11
hcallasereventfilter2012_cfi.prefix
prefix
Definition: hcallasereventfilter2012_cfi.py:10
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
dqm::legacy::MonitorElement::getTH2F
virtual TH2F * getTH2F() const
Definition: MonitorElement.h:491