CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
TnPEfficiencyClient Class Reference
Inheritance diagram for TnPEfficiencyClient:
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

 TnPEfficiencyClient (const edm::ParameterSet &pSet)
 
 ~TnPEfficiencyClient () 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 (edm::ParameterSet const &iConfig)
 
 DQMEDHarvester ()
 
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 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 beginRun (const edm::Run &, const edm::EventSetup &) override
 
void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
 
std::string topFolder () const
 Return the top folder. More...
 
- 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)
 

Private Attributes

std::map< std::string, MonitorElement * > effHistos
 
std::vector< std::string > passNfailHistoNames
 
std::string subsystem
 

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)
 
- 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 19 of file TnPEfficiencyClient.cc.

Constructor & Destructor Documentation

◆ TnPEfficiencyClient()

TnPEfficiencyClient::TnPEfficiencyClient ( const edm::ParameterSet pSet)

Definition at line 42 of file TnPEfficiencyClient.cc.

43  : passNfailHistoNames(pSet.getUntrackedParameter<std::vector<std::string>>("histoNames")),
44  subsystem(pSet.getUntrackedParameter<std::string>("subsystem")) {
45  edm::LogVerbatim("DQMOffline|MuonDPG|TnPEfficiencyClient") << "TnPEfficiencyClient: Constructor called";
46 };
Log< level::Info, true > LogVerbatim
T getUntrackedParameter(std::string const &, T const &) const
std::vector< std::string > passNfailHistoNames

◆ ~TnPEfficiencyClient()

TnPEfficiencyClient::~TnPEfficiencyClient ( )
override

Definition at line 48 of file TnPEfficiencyClient.cc.

48  {
49  edm::LogVerbatim("DQMOffline|MuonDPG|TnPEfficiencyClient") << "TnPEfficiencyClient: Constructor called";
50 };
Log< level::Info, true > LogVerbatim

Member Function Documentation

◆ beginRun()

void TnPEfficiencyClient::beginRun ( const edm::Run run,
const edm::EventSetup setup 
)
overrideprotected

Definition at line 52 of file TnPEfficiencyClient.cc.

52 {}

◆ dqmEndJob()

void TnPEfficiencyClient::dqmEndJob ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
overrideprotectedvirtual

Implements DQMEDHarvester.

Definition at line 61 of file TnPEfficiencyClient.cc.

References muonIdDQM_cfi::baseFolder, dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), DQMNet::DQM_PROP_TYPE_TH1F, DQMNet::DQM_PROP_TYPE_TH2F, effHistos, dqm::implementation::IGetter::get(), dqm::legacy::MonitorElement::getTH1F(), dqm::legacy::MonitorElement::getTH2F(), createfilelist::int, dqm::impl::MonitorElement::kind(), passNfailHistoNames, alignCSCRings::s, fileinputsource_cfi::sec, dqm::implementation::NavigatorBase::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and topFolder().

61  {
62  edm::LogVerbatim("DQMOffline|MuonDPG|TnPEfficiencyClient") << "TnPEfficiencyClient: endRun";
63 
64  std::string outFolder = "Task";
65 
66  ibooker.setCurrentFolder(topFolder() + outFolder + "/");
67  std::string baseFolder = topFolder() + outFolder + "/";
68 
69  TH1::SetDefaultSumw2(kTRUE);
70 
71  for (const auto& s : passNfailHistoNames) {
72  TH1::SetDefaultSumw2(kTRUE);
73 
74  std::string passHistoName = s.substr(0, s.find(':'));
75  std::string failHistoName = s.substr(s.find(':') + 1, s.length());
76 
77  std::string histoName_pass = baseFolder + passHistoName;
78  std::string histoName_fail = baseFolder + failHistoName;
79 
80  MonitorElement* me_pass = igetter.get(histoName_pass);
81  MonitorElement* me_fail = igetter.get(histoName_fail);
82 
83  int fir = passHistoName.find('_');
84  int sec = passHistoName.find('_', fir + 1);
85  std::string chName = passHistoName.substr(0, fir);
86  std::string specifier = passHistoName.substr(sec + 1);
87  std::string effHistoName = chName + "_chamberEff_" + specifier;
88 
89  if (!me_pass || !me_fail) {
90  edm::LogWarning("TnPEfficiencyClient") << "Monitor Element not available" << std::endl;
91  return;
92  }
93 
94  //1D histos
95  if ((int)me_pass->kind() == DQMNet::DQM_PROP_TYPE_TH1F && (int)me_fail->kind() == DQMNet::DQM_PROP_TYPE_TH1F) {
96  if (!(me_pass->getTH1F()) || !(me_fail->getTH1F())) {
97  edm::LogWarning("TnPEfficiencyClient") << "Monitor Element not available" << std::endl;
98  return;
99  }
100 
101  TH1F* h1_pass = me_pass->getTH1F();
102  TH1F* h1_fail = me_fail->getTH1F();
103 
104  const int nBinX_pass = h1_pass->GetNbinsX();
105  const int nBinX_fail = h1_fail->GetNbinsX();
106 
107  if (nBinX_pass != nBinX_fail) {
108  edm::LogWarning("TnPEfficiencyClient")
109  << "Histograms with different number of bins: unable to compute the ratio" << std::endl;
110  return;
111  }
112 
113  TH1F* h1_den = (TH1F*)h1_pass->Clone();
114  TH1F* h1_num = (TH1F*)h1_pass->Clone();
115  h1_den->Sumw2();
116  h1_num->Sumw2();
117  h1_den->Add(h1_fail);
118 
119  h1_num->Divide(h1_den);
120  TH1F* h1_ratio = (TH1F*)h1_num->Clone();
121 
122  effHistos[effHistoName] = ibooker.book1D(effHistoName, h1_ratio);
123  effHistos[effHistoName]->setTitle(effHistoName);
124  effHistos[effHistoName]->setAxisTitle("Efficiency", 2);
125  }
126 
127  //2D histos
128  if ((int)me_pass->kind() == DQMNet::DQM_PROP_TYPE_TH2F && (int)me_fail->kind() == DQMNet::DQM_PROP_TYPE_TH2F) {
129  if (!(me_pass->getTH2F()) || !(me_fail->getTH2F())) {
130  edm::LogWarning("TnPEfficiencyClient")
131  << "Monitor Element not available: unable to compute the ratio" << std::endl;
132  return;
133  }
134 
135  TH2F* h2_pass = me_pass->getTH2F();
136  TH2F* h2_fail = me_fail->getTH2F();
137 
138  const int nBinX_pass = h2_pass->GetNbinsX();
139  const int nBinX_fail = h2_fail->GetNbinsX();
140  const int nBinY_pass = h2_pass->GetNbinsY();
141  const int nBinY_fail = h2_fail->GetNbinsY();
142 
143  if ((nBinX_pass != nBinX_fail) || (nBinY_pass != nBinY_fail)) {
144  edm::LogWarning("TnPEfficiencyClient")
145  << "Histograms with different number of bins: unable to compute the ratio" << std::endl;
146  return;
147  }
148 
149  TH2F* h2_den = (TH2F*)h2_pass->Clone();
150  TH2F* h2_num = (TH2F*)h2_pass->Clone();
151  h2_den->Sumw2();
152  h2_num->Sumw2();
153  h2_den->Add(h2_fail);
154 
155  h2_num->Divide(h2_den);
156  TH2F* h2_ratio = (TH2F*)h2_num->Clone();
157 
158  effHistos[effHistoName] = ibooker.book2D(effHistoName, h2_ratio);
159  effHistos[effHistoName]->setTitle(effHistoName);
160  effHistos[effHistoName]->setAxisTitle("Efficiency", 3);
161  }
162  }
163 
164  return;
165 }
Log< level::Info, true > LogVerbatim
std::map< std::string, MonitorElement * > effHistos
std::string topFolder() const
Return the top folder.
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
Kind kind() const
Get the type of the monitor element.
static const uint32_t DQM_PROP_TYPE_TH1F
Definition: DQMNet.h:34
virtual TH2F * getTH2F() const
std::vector< std::string > passNfailHistoNames
virtual TH1F * getTH1F() const
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:212
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:712
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
static const uint32_t DQM_PROP_TYPE_TH2F
Definition: DQMNet.h:38

◆ dqmEndLuminosityBlock()

void TnPEfficiencyClient::dqmEndLuminosityBlock ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  setup 
)
overrideprotectedvirtual

Reimplemented from DQMEDHarvester.

Definition at line 54 of file TnPEfficiencyClient.cc.

57  {
58  edm::LogVerbatim("DQMOffline|MuonDPG|TnPEfficiencyClient") << "TnPEfficiencyClient: endluminosityBlock";
59 }
Log< level::Info, true > LogVerbatim

◆ topFolder()

std::string TnPEfficiencyClient::topFolder ( ) const
inlineprotected

Return the top folder.

Definition at line 34 of file TnPEfficiencyClient.cc.

References subsystem.

Referenced by dqmEndJob().

34 { return subsystem + "/Segment_TnP/"; };

Member Data Documentation

◆ effHistos

std::map<std::string, MonitorElement*> TnPEfficiencyClient::effHistos
private

Definition at line 34 of file TnPEfficiencyClient.cc.

Referenced by dqmEndJob().

◆ passNfailHistoNames

std::vector<std::string> TnPEfficiencyClient::passNfailHistoNames
private

Definition at line 38 of file TnPEfficiencyClient.cc.

Referenced by dqmEndJob().

◆ subsystem

std::string TnPEfficiencyClient::subsystem
private

Definition at line 39 of file TnPEfficiencyClient.cc.

Referenced by topFolder().