ATLAS Offline Software
Reconstruction
Jet
JetMonitoring
Root
HistoDefinitionTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
JetMonitoring/HistoDefinitionTool.h
"
6
7
#include "TH1.h"
8
#include "TH2.h"
9
#include "TProfile.h"
10
11
HistoDefinitionTool::HistoDefinitionTool
(
const
std::string&
n
) :
asg
::AsgTool(
n
)
12
, m_attname(
""
)
13
, m_htitle(
""
)
14
{
15
declareInterface<HistoDefinitionTool>(
this
);
16
17
// Kepp lower case property names so they match the ROOT variable names
18
// in TH1 constructors.
19
declareProperty
(
"hname"
,
m_attname
);
// can't use 'name' because of incompatilbility in python
20
declareProperty
(
"title"
,
m_htitle
);
21
22
declareProperty
(
"nbinsx"
,
m_nbinsx
);
23
declareProperty
(
"xlow"
,
m_xlow
);
24
declareProperty
(
"xup"
,
m_xup
);
25
26
declareProperty
(
"nbinsy"
,
m_nbinsy
);
27
declareProperty
(
"ylow"
,
m_ylow
);
28
declareProperty
(
"yup"
,
m_yup
);
29
30
}
31
32
StatusCode
HistoDefinitionTool::initialize
() {
33
34
// Use the name of the tool by default. Extract "Something.Var" -> "Var"
35
if
(
m_attname
.empty()) {
36
auto
found
=
name
().rfind(
'.'
);
37
if
(
found
!= std::string::npos)
m_attname
=
name
().substr(++
found
);
38
else
m_attname
=
name
();
39
ATH_MSG_INFO
(
"Built "
<<
name
() <<
" -> "
<<
m_attname
) ;
40
41
}
42
43
return
StatusCode::SUCCESS;
44
}
45
46
TH1F
*
HistoDefinitionTool::buildTH1F
(){
47
return
new
TH1F
(
m_attname
.c_str(),
m_htitle
.c_str(),
m_nbinsx
,
m_xlow
,
m_xup
);
48
}
49
50
TH2F
*
HistoDefinitionTool::buildTH2F
(){
51
return
new
TH2F
(
m_attname
.c_str(),
m_htitle
.c_str(),
m_nbinsx
,
m_xlow
,
m_xup
,
m_nbinsy
,
m_ylow
,
m_yup
);
52
}
53
54
TProfile
*
HistoDefinitionTool::buildTProfile
(
bool
useYLimits){
55
56
if
(useYLimits)
return
new
TProfile
(
m_attname
.c_str(),
m_htitle
.c_str(),
m_nbinsx
,
m_xlow
,
m_xup
,
m_ylow
,
m_yup
);
57
else
return
new
TProfile
(
m_attname
.c_str(),
m_htitle
.c_str(),
m_nbinsx
,
m_xlow
,
m_xup
);
58
}
59
60
61
template
<>
TH1F
* HistoDefinitionTool::build<TH1F>(){
return
buildTH1F
();}
62
template
<>
TH2F
* HistoDefinitionTool::build<TH2F>(){
return
buildTH2F
();}
63
template
<>
TProfile
* HistoDefinitionTool::build<TProfile>(){
return
buildTProfile
();}
HistoDefinitionTool.h
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition:
AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition:
AthCommonDataStore.h:145
HistoDefinitionTool::m_xup
float m_xup
Definition:
HistoDefinitionTool.h:66
asg
Definition:
DataHandleTestTool.h:28
HistoDefinitionTool::buildTProfile
TProfile * buildTProfile(bool useYLimits=false)
Definition:
HistoDefinitionTool.cxx:54
HistoDefinitionTool::initialize
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
Definition:
HistoDefinitionTool.cxx:32
python.TrigEgammaMonitorHelper.TH2F
def TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
Definition:
TrigEgammaMonitorHelper.py:45
HistoDefinitionTool::m_yup
float m_yup
Definition:
HistoDefinitionTool.h:70
python.TrigEgammaMonitorHelper.TProfile
def TProfile(*args, **kwargs)
Definition:
TrigEgammaMonitorHelper.py:81
beamspotman.n
n
Definition:
beamspotman.py:731
HistoDefinitionTool::m_ylow
float m_ylow
Definition:
HistoDefinitionTool.h:69
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
HistoDefinitionTool::HistoDefinitionTool
HistoDefinitionTool(const std::string &t)
Definition:
HistoDefinitionTool.cxx:11
HistoDefinitionTool::buildTH2F
TH2F * buildTH2F()
Definition:
HistoDefinitionTool.cxx:50
HistoDefinitionTool::m_xlow
float m_xlow
Definition:
HistoDefinitionTool.h:65
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:228
HistoDefinitionTool::m_htitle
std::string m_htitle
Definition:
HistoDefinitionTool.h:62
CondAlgsOpts.found
int found
Definition:
CondAlgsOpts.py:101
HistoDefinitionTool::m_nbinsx
int m_nbinsx
Definition:
HistoDefinitionTool.h:64
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition:
TrigEgammaMonitorHelper.py:24
HistoDefinitionTool::buildTH1F
TH1F * buildTH1F()
Build histos according to properties.
Definition:
HistoDefinitionTool.cxx:46
HistoDefinitionTool::m_attname
std::string m_attname
Definition:
HistoDefinitionTool.h:61
HistoDefinitionTool::m_nbinsy
int m_nbinsy
Definition:
HistoDefinitionTool.h:68
Generated on Sun Dec 22 2024 21:11:12 for ATLAS Offline Software by
1.8.18