CMS 3D CMS Logo

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

#include <DQMCorrelationClient.h>

Inheritance diagram for DQMCorrelationClient:
DQMEDHarvester edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 DQMCorrelationClient (const edm::ParameterSet &ps)
 
 ~DQMCorrelationClient () override=default
 
- Public Member Functions inherited from DQMEDHarvester
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
 DQMEDHarvester ()
 
void endJob () final
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &, edm::EventSetup const &) final
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) override
 
 ~DQMEDHarvester () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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
 
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::vector< ModuleDescription const * > &modules, 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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
static void fillMePSetDescription (edm::ParameterSetDescription &pset)
 
static void fillOutputMePSetDescription (edm::ParameterSetDescription &pset)
 
- 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 Member Functions

void beginJob () override
 
void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

Private Member Functions

TH1 * getTH1 (MonitorElement *me, bool profileX)
 
void setAxisTitle (MonitorElement *meX, MonitorElement *meY)
 

Static Private Member Functions

static MEPSet getHistoPSet (edm::ParameterSet pset)
 
static OutputMEPSet getOutputHistoPSet (edm::ParameterSet pset)
 

Private Attributes

MonitorElementcorrelation_
 
bool me1onX_
 
OutputMEPSet mepset_
 
MEPSet meXpset_
 
MEPSet meYpset_
 

Additional Inherited Members

- 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 Attributes inherited from DQMEDHarvester
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 37 of file DQMCorrelationClient.h.

Constructor & Destructor Documentation

DQMCorrelationClient::DQMCorrelationClient ( const edm::ParameterSet ps)

Definition at line 8 of file DQMCorrelationClient.cc.

References correlation_.

8  :
9  me1onX_ ( iConfig.getParameter<bool>("me1onX") )
10  , meXpset_ ( me1onX_ ? getHistoPSet(iConfig.getParameter<edm::ParameterSet>("me1") ) : getHistoPSet(iConfig.getParameter<edm::ParameterSet>("me2") ) )
11  , meYpset_ ( me1onX_ ? getHistoPSet(iConfig.getParameter<edm::ParameterSet>("me2") ) : getHistoPSet(iConfig.getParameter<edm::ParameterSet>("me1") ) )
12  , mepset_ ( getOutputHistoPSet (iConfig.getParameter<edm::ParameterSet>("me") ) )
13 {
14  edm::LogInfo("DQMCorrelationClient") << "Constructor DQMCorrelationClient::DQMCorrelationClient " << std::endl;
15 
16  correlation_ = nullptr;
17 
18 }
MonitorElement * correlation_
static OutputMEPSet getOutputHistoPSet(edm::ParameterSet pset)
static MEPSet getHistoPSet(edm::ParameterSet pset)
DQMCorrelationClient::~DQMCorrelationClient ( )
overridedefault

Member Function Documentation

void DQMCorrelationClient::beginJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 48 of file DQMCorrelationClient.cc.

49 {
50  edm::LogInfo("DQMCorrelationClient") << "DQMCorrelationClient::beginJob " << std::endl;
51 }
void DQMCorrelationClient::dqmEndJob ( DQMStore::IBooker ibooker_,
DQMStore::IGetter igetter_ 
)
overrideprotectedvirtual

Implements DQMEDHarvester.

Definition at line 99 of file DQMCorrelationClient.cc.

References DQMStore::IBooker::book2D(), correlation_, OutputMEPSet::doXaxis, OutputMEPSet::doYaxis, MonitorElement::Fill(), MEPSet::folder, OutputMEPSet::folder, DQMStore::IGetter::get(), MonitorElement::getNbinsY(), getTH1(), MonitorElement::getTH1(), mps_fire::i, mepset_, meXpset_, meYpset_, MEPSet::name, OutputMEPSet::name, OutputMEPSet::nbinsX, OutputMEPSet::nbinsY, MEPSet::profileX, setAxisTitle(), DQMStore::IBooker::setCurrentFolder(), findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, x, OutputMEPSet::xmaxX, OutputMEPSet::xmaxY, OutputMEPSet::xminX, OutputMEPSet::xminY, and y.

100 {
101  std::string hname = "";
102 
103  //get available histograms
104  hname = meXpset_.folder + "/" + meXpset_.name;
105  MonitorElement* meX = igetter_.get( hname );
106  hname = meYpset_.folder + "/" + meYpset_.name;
107  MonitorElement* meY = igetter_.get( hname );
108 
109  if (!meX || !meY) {
110  edm::LogError("DQMCorrelationClient") << "MEs not found! "
111  << ( !meX ? meXpset_.folder + "/" + meXpset_.name + " not found " : "" )
112  << ( !meY ? meYpset_.folder + "/" + meYpset_.name + " not found " : "" )
113  << std::endl;
114  return;
115  }
116 
117  // get range and binning for new MEs
118  int nbinsX = ( mepset_.doXaxis ? mepset_.nbinsX : meX->getNbinsY() );
119  double xminX = ( mepset_.doXaxis ? mepset_.xminX : meX->getTH1()->GetYaxis()->GetXmin() );
120  double xmaxX = ( mepset_.doXaxis ? mepset_.xmaxX : meX->getTH1()->GetYaxis()->GetXmax() );
121  int nbinsY = ( mepset_.doYaxis ? mepset_.nbinsY : meY->getNbinsY() );
122  double xminY = ( mepset_.doYaxis ? mepset_.xminY : meY->getTH1()->GetYaxis()->GetXmin() );
123  double xmaxY = ( mepset_.doYaxis ? mepset_.xmaxY : meY->getTH1()->GetYaxis()->GetXmax() );
124 
125  // create and cd into new folder
126  std::string currentFolder = mepset_.folder;
127  ibooker_.setCurrentFolder(currentFolder);
128 
129  //book new histogram
130  hname = mepset_.name;
131  correlation_ = ibooker_.book2D(hname,hname,nbinsX,xminX,xmaxX,nbinsY,xminY,xmaxY);
132  setAxisTitle(meX, meY);
133 
134  // handle mes
135  TH1* x = nullptr;
136  TH1* y = nullptr;
137  x = getTH1(meX,meXpset_.profileX);
138  y = getTH1(meY,meYpset_.profileX);
139 
140  size_t size = x->GetXaxis()->GetNbins();
141 
142  std::vector<double> xvalue;
143  std::vector<int> xbinvalue;
144  for ( size_t ibin=1; ibin <= size; ++ibin ) {
145  // avoid to store points w/ no info
146  if ( x->GetBinContent(ibin) == 0. ) continue;
147  xvalue.push_back ( x->GetBinContent(ibin) );
148  xbinvalue.push_back ( x->GetXaxis()->GetBinCenter(ibin) );
149  }
150 
151  for ( size_t i=0; i < xbinvalue.size(); ++i ) {
152  int ybin = y->GetXaxis()->FindBin(xbinvalue[i]);
153  double yvalue = y->GetBinContent(ybin);
154  correlation_->Fill(xvalue[i],yvalue);
155  }
156 
157 }
size
Write out results.
MonitorElement * correlation_
void setAxisTitle(MonitorElement *meX, MonitorElement *meY)
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:302
std::string folder
TH1 * getTH1() const
TH1 * getTH1(MonitorElement *me, bool profileX)
void Fill(long long x)
std::string folder
std::string name
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:136
int getNbinsY() const
get # of bins in Y-axis
void DQMCorrelationClient::dqmEndLuminosityBlock ( DQMStore::IBooker ibooker_,
DQMStore::IGetter igetter_,
edm::LuminosityBlock const &  iLumi,
edm::EventSetup const &  iSetup 
)
overrideprotectedvirtual

Reimplemented from DQMEDHarvester.

Definition at line 162 of file DQMCorrelationClient.cc.

163 {
164  edm::LogInfo("DQMCorrelationClient") << "DQMCorrelationClient::endLumi " << std::endl;
165 }
void DQMCorrelationClient::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 189 of file DQMCorrelationClient.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), DEFINE_FWK_MODULE, fillMePSetDescription(), and fillOutputMePSetDescription().

190 {
191 
193  desc.add<bool>("me1onX",true);
194 
197  desc.add<edm::ParameterSetDescription>("me", mePSet);
198 
200  fillMePSetDescription(me1PSet);
201  desc.add<edm::ParameterSetDescription>("me1", me1PSet);
202 
204  fillMePSetDescription(me2PSet);
205  desc.add<edm::ParameterSetDescription>("me2", me2PSet);
206 
207  descriptions.add("dqmCorrelationClient", desc);
208 
209 }
static void fillMePSetDescription(edm::ParameterSetDescription &pset)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillOutputMePSetDescription(edm::ParameterSetDescription &pset)
void DQMCorrelationClient::fillMePSetDescription ( edm::ParameterSetDescription pset)
static

Definition at line 167 of file DQMCorrelationClient.cc.

References edm::ParameterSetDescription::add(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by fillDescriptions().

168 {
169  pset.add<std::string>("folder","");
170  pset.add<std::string>("name","");
171  pset.add<bool>("profileX",true);
172 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void DQMCorrelationClient::fillOutputMePSetDescription ( edm::ParameterSetDescription pset)
static

Definition at line 174 of file DQMCorrelationClient.cc.

References edm::ParameterSetDescription::add(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by fillDescriptions().

175 {
176  // fillMePSetDescription(pset);
177  pset.add<std::string>("folder");
178  pset.add<std::string>("name");
179  pset.add<bool>("doXaxis", true);
180  pset.add<int>("nbinsX", 2500);
181  pset.add<double>("xminX", 0.);
182  pset.add<double>("xmaxX",2500.);
183  pset.add<bool>("doYaxis", true);
184  pset.add<int>("nbinsY", 2500);
185  pset.add<double>("xminY", 0.);
186  pset.add<double>("xmaxY",2500.);
187 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
MEPSet DQMCorrelationClient::getHistoPSet ( edm::ParameterSet  pset)
staticprivate

Definition at line 20 of file DQMCorrelationClient.cc.

References edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

21 {
22  return MEPSet{
23  pset.getParameter<std::string>("name"),
24  pset.getParameter<std::string>("folder"),
25  pset.getParameter<bool>("profileX"),
26  };
27 }
T getParameter(std::string const &) const
OutputMEPSet DQMCorrelationClient::getOutputHistoPSet ( edm::ParameterSet  pset)
staticprivate

Definition at line 29 of file DQMCorrelationClient.cc.

References edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

30 {
31  return OutputMEPSet{
32  pset.getParameter<std::string>("name"),
33  pset.getParameter<std::string>("folder"),
34  pset.getParameter<bool>("doXaxis"),
35  pset.getParameter<int>("nbinsX"),
36  pset.getParameter<double>("xminX"),
37  pset.getParameter<double>("xmaxX"),
38  pset.getParameter<bool>("doYaxis"),
39  pset.getParameter<int>("nbinsY"),
40  pset.getParameter<double>("xminY"),
41  pset.getParameter<double>("xmaxY"),
42  };
43 }
T getParameter(std::string const &) const
TH1 * DQMCorrelationClient::getTH1 ( MonitorElement me,
bool  profileX = true 
)
private

Definition at line 53 of file DQMCorrelationClient.cc.

References MonitorElement::DQM_KIND_TH2D, MonitorElement::DQM_KIND_TH2F, MonitorElement::DQM_KIND_TH2S, MonitorElement::DQM_KIND_TPROFILE, MonitorElement::getTH1(), MonitorElement::getTH2D(), MonitorElement::getTH2F(), MonitorElement::getTH2S(), callgraph::kind, MonitorElement::kind(), and trackingPlots::profileX.

Referenced by dqmEndJob().

53  {
54 
55  TH1* th1 = nullptr;
56 
58  switch(kind) {
60  th1 = ( profileX ? me->getTH2D()->ProfileX() : me->getTH2D()->ProfileY() );
61  break;
63  th1 = ( profileX ? me->getTH2F()->ProfileX() : me->getTH2F()->ProfileY() );
64  break;
66  th1 = ( profileX ? me->getTH2S()->ProfileX() : me->getTH2S()->ProfileY() );
67  break;
69  th1 = me->getTH1();
70  break;
71  default:
72  break;
73  }
74 
75  return th1;
76 }
TH2S * getTH2S() const
TH1 * getTH1() const
TH2D * getTH2D() const
TH2F * getTH2F() const
Kind kind() const
Get the type of the monitor element.
void DQMCorrelationClient::setAxisTitle ( MonitorElement meX,
MonitorElement meY 
)
private

Definition at line 77 of file DQMCorrelationClient.cc.

References correlation_, OutputMEPSet::doXaxis, OutputMEPSet::doYaxis, MonitorElement::getTH1(), mps_fire::i, mepset_, and MonitorElement::setAxisTitle().

Referenced by dqmEndJob().

78 {
79  if (correlation_ == nullptr) return;
80  correlation_->setAxisTitle(meX->getTH1()->GetYaxis()->GetTitle(),1);
81  correlation_->setAxisTitle(meY->getTH1()->GetYaxis()->GetTitle(),2);
82 
83  if ( !mepset_.doXaxis ) {
84  TAxis* axis = (meX->getTH1()->GetYaxis());
85  for ( int i=1; i<=axis->GetNbins(); ++i )
86  correlation_->getTH1()->GetXaxis()->SetBinLabel(i,axis->GetBinLabel(i));
87  }
88 
89  if ( !mepset_.doYaxis ) {
90  TAxis* axis = (meY->getTH1()->GetYaxis());
91  for ( int i=1; i<=axis->GetNbins(); ++i )
92  correlation_->getTH1()->GetYaxis()->SetBinLabel(i,axis->GetBinLabel(i));
93  }
94 }
MonitorElement * correlation_
TH1 * getTH1() const
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)

Member Data Documentation

MonitorElement* DQMCorrelationClient::correlation_
private

Definition at line 67 of file DQMCorrelationClient.h.

Referenced by DQMCorrelationClient(), dqmEndJob(), and setAxisTitle().

bool DQMCorrelationClient::me1onX_
private

Definition at line 64 of file DQMCorrelationClient.h.

OutputMEPSet DQMCorrelationClient::mepset_
private

Definition at line 71 of file DQMCorrelationClient.h.

Referenced by dqmEndJob(), and setAxisTitle().

MEPSet DQMCorrelationClient::meXpset_
private

Definition at line 69 of file DQMCorrelationClient.h.

Referenced by dqmEndJob().

MEPSet DQMCorrelationClient::meYpset_
private

Definition at line 70 of file DQMCorrelationClient.h.

Referenced by dqmEndJob().