Belle II Software development
Factory Class Reference

This class is used for creating TH1F and TH2F objects. More...

#include <HistogramFactory.h>

Public Member Functions

 Factory (DQMHistoModuleBase *histoModule)
 Constructor.
 
FactoryxAxis (const Axis &axis)
 Temporarily copies parameters for x axis from given Axis.
 
FactoryyAxis (const Axis &axis)
 Temporarily copies parameters for y axis from given Axis.
 
FactoryxAxisDefault (const Axis &axis)
 Permanently copies parameters for x axis from given Axis.
 
FactoryyAxisDefault (const Axis &axis)
 Permanently copies parameters for y axis from given Axis.
 
TH1F * CreateTH1F (std::string name, std::string title)
 Create TH1F with given name and title.
 
TH2F * CreateTH2F (std::string name, std::string title)
 Create TH2F with given name and title.
 
TH1F ** CreateLayersTH1F (boost::format nameTemplate, boost::format titleTemplate)
 Create TH1F array for layers from given name template and title template.
 
TH2F ** CreateLayersTH2F (boost::format nameTemplate, boost::format titleTemplate)
 Create TH2F array for layers from given name template and title template.
 
TH1F ** CreateSensorsTH1F (boost::format nameTemplate, boost::format titleTemplate)
 Create TH1F array for sensors from given name template and title template.
 
TH2F ** CreateSensorsTH2F (boost::format nameTemplate, boost::format titleTemplate)
 Create TH2F array for sensors from given name template and title template.
 
-Default functions

All the following functions permanently set the value of given parameter.

They also return this instance so they can be chained.

FactorynbinsxDefault (int nbinsx)
 Sets nbinsx permanently.
 
FactoryxlowDefault (double xlow)
 Sets xlow permanently.
 
FactoryxupDefault (double xup)
 Sets xup permanently.
 
FactorynbinsyDefault (int nbinsy)
 Sets nbinsy permanently.
 
FactoryylowDefault (double ylow)
 Sets ylow permanently.
 
FactoryyupDefault (double yup)
 Sets yup permanently.
 
FactoryxTitleDefault (std::string xTitle)
 Sets xTitle permanently.
 
FactoryyTitleDefault (std::string yTitle)
 Sets yTitle permanently.
 
FactoryzTitleDefault (std::string zTitle)
 Sets zTitle permanently.
 
Named parameters

All the following functions temporarily set the value of given parameter.

This means that its value is invalidated after its first use in the Create- functions. They also return this instance so they can be chained.

Factorynbinsx (int nbinsx)
 Sets nbinsx temporarily.
 
Factoryxlow (double xlow)
 Sets xlow temporarily.
 
Factoryxup (double xup)
 Sets xup temporarily.
 
Factorynbinsy (int nbinsy)
 Sets nbinsy temporarily.
 
Factoryylow (double ylow)
 Sets ylow temporarily.
 
Factoryyup (double yup)
 Sets yup temporarily.
 
FactoryxTitle (std::string xTitle)
 Sets xTitle temporarily.
 
FactoryyTitle (std::string yTitle)
 Sets yTitle temporarily.
 
FactoryzTitle (std::string zTitle)
 Sets zTitle temporarily.
 

Private Attributes

DQMHistoModuleBasem_histoModule
 DQM histogram module on which the Create- functions are called to create histograms.
 
Parameter< int > m_nbinsx = Parameter(0)
 number of bins along the x axis
 
Parameter< double > m_xlow = Parameter(.0)
 lower boundary of x axis range
 
Parameter< double > m_xup = Parameter(.0)
 upper boundary of x axis range
 
Parameter< std::string > m_xTitle = Parameter(std::string())
 title of the x axis
 
Parameter< std::string > m_yTitle = Parameter(std::string())
 title of the y axis
 
Parameter< int > m_nbinsy = Parameter(0)
 number of bins along the y axis
 
Parameter< double > m_ylow = Parameter(.0)
 lower boundary of y axis range
 
Parameter< double > m_yup = Parameter(.0)
 upper boundary of y axis range
 
Parameter< std::string > m_zTitle = Parameter(std::string())
 title of the z axis
 

Detailed Description

This class is used for creating TH1F and TH2F objects.

Its main advantage is that parameters can be set individually and also permanently so they can be reused again.

This class uses named parameters idiom via temporarily set values.

Most of the methods return this object so they can be chained consecutively.

Definition at line 151 of file HistogramFactory.h.

Constructor & Destructor Documentation

◆ Factory()

Factory ( DQMHistoModuleBase histoModule)
inlineexplicit

Constructor.

Parameters
histoModule- pointer on histogram module is needed because this class actually doesn't create histograms by itself, but it calls functions on the module instead.

Definition at line 155 of file HistogramFactory.h.

156 {
157 m_histoModule = histoModule;
158 }
DQMHistoModuleBase * m_histoModule
DQM histogram module on which the Create- functions are called to create histograms.

Member Function Documentation

◆ CreateLayersTH1F()

TH1F ** CreateLayersTH1F ( boost::format  nameTemplate,
boost::format  titleTemplate 
)

Create TH1F array for layers from given name template and title template.

Definition at line 24 of file HistogramFactory.cc.

25{
26 return m_histoModule->CreateLayers(nameTemplate, titleTemplate, m_nbinsx.Get(), m_xlow.Get(), m_xup.Get(), m_xTitle.Get(),
27 m_yTitle.Get());
28}
virtual TH1F ** CreateLayers(boost::format nameTemplate, boost::format titleTemplate, int nbinsx, double xlow, double xup, std::string xTitle, std::string yTitle)
Function to create array of TH1F histograms, one for each layer.
Parameter< double > m_xup
upper boundary of x axis range
Parameter< std::string > m_yTitle
title of the y axis
Parameter< int > m_nbinsx
number of bins along the x axis
Parameter< std::string > m_xTitle
title of the x axis
Parameter< double > m_xlow
lower boundary of x axis range
AType Get()
Returns value of the inner quantity.

◆ CreateLayersTH2F()

TH2F ** CreateLayersTH2F ( boost::format  nameTemplate,
boost::format  titleTemplate 
)

Create TH2F array for layers from given name template and title template.

Definition at line 30 of file HistogramFactory.cc.

31{
32 return m_histoModule->CreateLayers(nameTemplate, titleTemplate, m_nbinsx.Get(), m_xlow.Get(), m_xup.Get(), m_nbinsy.Get(),
34}
Parameter< std::string > m_zTitle
title of the z axis
Parameter< int > m_nbinsy
number of bins along the y axis
Parameter< double > m_ylow
lower boundary of y axis range
Parameter< double > m_yup
upper boundary of y axis range

◆ CreateSensorsTH1F()

TH1F ** CreateSensorsTH1F ( boost::format  nameTemplate,
boost::format  titleTemplate 
)

Create TH1F array for sensors from given name template and title template.

Definition at line 36 of file HistogramFactory.cc.

37{
38 return m_histoModule->CreateSensors(nameTemplate, titleTemplate, m_nbinsx.Get(), m_xlow.Get(), m_xup.Get(), m_xTitle.Get(),
39 m_yTitle.Get());
40}
virtual TH1F ** CreateSensors(boost::format nameTemplate, boost::format titleTemplate, int nbinsx, double xlow, double xup, std::string xTitle, std::string yTitle)
Function to create array of TH1F histograms, one for each sensor.

◆ CreateSensorsTH2F()

TH2F ** CreateSensorsTH2F ( boost::format  nameTemplate,
boost::format  titleTemplate 
)

Create TH2F array for sensors from given name template and title template.

Definition at line 42 of file HistogramFactory.cc.

43{
44 return m_histoModule->CreateSensors(nameTemplate, titleTemplate, m_nbinsx.Get(), m_xlow.Get(), m_xup.Get(), m_nbinsy.Get(),
46}

◆ CreateTH1F()

TH1F * CreateTH1F ( std::string  name,
std::string  title 
)

Create TH1F with given name and title.

All temporarily set parameters needed to create the TH1F become invalidated. This is common for all following Create- functions.

Definition at line 13 of file HistogramFactory.cc.

14{
15 return m_histoModule->Create(name, title, m_nbinsx.Get(), m_xlow.Get(), m_xup.Get(), m_xTitle.Get(), m_yTitle.Get());
16}
virtual TH1F * Create(std::string name, std::string title, int nbinsx, double xlow, double xup, std::string xTitle, std::string yTitle)
Function to create TH1F and add it to the vector of histograms (m_histograms).

◆ CreateTH2F()

TH2F * CreateTH2F ( std::string  name,
std::string  title 
)

Create TH2F with given name and title.

Definition at line 18 of file HistogramFactory.cc.

19{
20 return m_histoModule->Create(name, title, m_nbinsx.Get(), m_xlow.Get(), m_xup.Get(), m_nbinsy.Get(), m_ylow.Get(), m_yup.Get(),
22}

◆ nbinsx()

Factory & nbinsx ( int  nbinsx)
inline

Sets nbinsx temporarily.

Definition at line 238 of file HistogramFactory.h.

◆ nbinsxDefault()

Factory & nbinsxDefault ( int  nbinsx)
inline

Sets nbinsx permanently.

Definition at line 223 of file HistogramFactory.h.

◆ nbinsy()

Factory & nbinsy ( int  nbinsy)
inline

Sets nbinsy temporarily.

Definition at line 241 of file HistogramFactory.h.

◆ nbinsyDefault()

Factory & nbinsyDefault ( int  nbinsy)
inline

Sets nbinsy permanently.

Definition at line 226 of file HistogramFactory.h.

◆ xAxis()

Factory & xAxis ( const Axis axis)
inline

Temporarily copies parameters for x axis from given Axis.

Definition at line 161 of file HistogramFactory.h.

162 {
163 m_nbinsx.SetTemporarily(axis.m_nbins);
164 m_xlow.SetTemporarily(axis.m_low);
165 m_xup.SetTemporarily(axis.m_up);
166 m_xTitle.SetTemporarily(axis.m_title);
167
168 return *this;
169 }
void SetTemporarily(const AType &value)
Temporarily sets inner quantity to given value.

◆ xAxisDefault()

Factory & xAxisDefault ( const Axis axis)
inline

Permanently copies parameters for x axis from given Axis.

Definition at line 183 of file HistogramFactory.h.

184 {
185 m_nbinsx.Set(axis.m_nbins);
186 m_xlow.Set(axis.m_low);
187 m_xup.Set(axis.m_up);
188 m_xTitle.Set(axis.m_title);
189
190 return *this;
191 }
void Set(const AType &value)
Permanently sets inner quantity to given value.

◆ xlow()

Factory & xlow ( double  xlow)
inline

Sets xlow temporarily.

Definition at line 239 of file HistogramFactory.h.

◆ xlowDefault()

Factory & xlowDefault ( double  xlow)
inline

Sets xlow permanently.

Definition at line 224 of file HistogramFactory.h.

◆ xTitle()

Factory & xTitle ( std::string  xTitle)
inline

Sets xTitle temporarily.

Definition at line 244 of file HistogramFactory.h.

◆ xTitleDefault()

Factory & xTitleDefault ( std::string  xTitle)
inline

Sets xTitle permanently.

Definition at line 229 of file HistogramFactory.h.

◆ xup()

Factory & xup ( double  xup)
inline

Sets xup temporarily.

Definition at line 240 of file HistogramFactory.h.

◆ xupDefault()

Factory & xupDefault ( double  xup)
inline

Sets xup permanently.

Definition at line 225 of file HistogramFactory.h.

◆ yAxis()

Factory & yAxis ( const Axis axis)
inline

Temporarily copies parameters for y axis from given Axis.

Definition at line 172 of file HistogramFactory.h.

173 {
174 m_nbinsy.SetTemporarily(axis.m_nbins);
175 m_ylow.SetTemporarily(axis.m_low);
176 m_yup.SetTemporarily(axis.m_up);
177 m_yTitle.SetTemporarily(axis.m_title);
178
179 return *this;
180 }

◆ yAxisDefault()

Factory & yAxisDefault ( const Axis axis)
inline

Permanently copies parameters for y axis from given Axis.

Definition at line 194 of file HistogramFactory.h.

195 {
196 m_nbinsy.Set(axis.m_nbins);
197 m_ylow.Set(axis.m_low);
198 m_yup.Set(axis.m_up);
199 m_yTitle.Set(axis.m_title);
200
201 return *this;
202 }

◆ ylow()

Factory & ylow ( double  ylow)
inline

Sets ylow temporarily.

Definition at line 242 of file HistogramFactory.h.

◆ ylowDefault()

Factory & ylowDefault ( double  ylow)
inline

Sets ylow permanently.

Definition at line 227 of file HistogramFactory.h.

◆ yTitle()

Factory & yTitle ( std::string  yTitle)
inline

Sets yTitle temporarily.

Definition at line 245 of file HistogramFactory.h.

◆ yTitleDefault()

Factory & yTitleDefault ( std::string  yTitle)
inline

Sets yTitle permanently.

Definition at line 230 of file HistogramFactory.h.

◆ yup()

Factory & yup ( double  yup)
inline

Sets yup temporarily.

Definition at line 243 of file HistogramFactory.h.

◆ yupDefault()

Factory & yupDefault ( double  yup)
inline

Sets yup permanently.

Definition at line 228 of file HistogramFactory.h.

◆ zTitle()

Factory & zTitle ( std::string  zTitle)
inline

Sets zTitle temporarily.

Definition at line 246 of file HistogramFactory.h.

◆ zTitleDefault()

Factory & zTitleDefault ( std::string  zTitle)
inline

Sets zTitle permanently.

Definition at line 231 of file HistogramFactory.h.

Member Data Documentation

◆ m_histoModule

DQMHistoModuleBase* m_histoModule
private

DQM histogram module on which the Create- functions are called to create histograms.

Definition at line 251 of file HistogramFactory.h.

◆ m_nbinsx

Parameter<int> m_nbinsx = Parameter(0)
private

number of bins along the x axis

Definition at line 253 of file HistogramFactory.h.

◆ m_nbinsy

Parameter<int> m_nbinsy = Parameter(0)
private

number of bins along the y axis

Definition at line 258 of file HistogramFactory.h.

◆ m_xlow

Parameter<double> m_xlow = Parameter(.0)
private

lower boundary of x axis range

Definition at line 254 of file HistogramFactory.h.

◆ m_xTitle

Parameter<std::string> m_xTitle = Parameter(std::string())
private

title of the x axis

Definition at line 256 of file HistogramFactory.h.

◆ m_xup

Parameter<double> m_xup = Parameter(.0)
private

upper boundary of x axis range

Definition at line 255 of file HistogramFactory.h.

◆ m_ylow

Parameter<double> m_ylow = Parameter(.0)
private

lower boundary of y axis range

Definition at line 259 of file HistogramFactory.h.

◆ m_yTitle

Parameter<std::string> m_yTitle = Parameter(std::string())
private

title of the y axis

Definition at line 257 of file HistogramFactory.h.

◆ m_yup

Parameter<double> m_yup = Parameter(.0)
private

upper boundary of y axis range

Definition at line 260 of file HistogramFactory.h.

◆ m_zTitle

Parameter<std::string> m_zTitle = Parameter(std::string())
private

title of the z axis

Definition at line 261 of file HistogramFactory.h.


The documentation for this class was generated from the following files: