ATLAS Offline Software
Loading...
Searching...
No Matches
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
();}
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
HistoDefinitionTool.h
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
HistoDefinitionTool::build
T * build()
Definition
HistoDefinitionTool.h:54
HistoDefinitionTool::m_xup
float m_xup
Definition
HistoDefinitionTool.h:66
HistoDefinitionTool::buildTH2F
TH2F * buildTH2F()
Definition
HistoDefinitionTool.cxx:50
HistoDefinitionTool::m_attname
std::string m_attname
Definition
HistoDefinitionTool.h:61
HistoDefinitionTool::m_xlow
float m_xlow
Definition
HistoDefinitionTool.h:65
HistoDefinitionTool::HistoDefinitionTool
HistoDefinitionTool(const std::string &t)
Definition
HistoDefinitionTool.cxx:11
HistoDefinitionTool::buildTH1F
TH1F * buildTH1F()
Build histos according to properties.
Definition
HistoDefinitionTool.cxx:46
HistoDefinitionTool::m_yup
float m_yup
Definition
HistoDefinitionTool.h:70
HistoDefinitionTool::initialize
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
Definition
HistoDefinitionTool.cxx:32
HistoDefinitionTool::m_ylow
float m_ylow
Definition
HistoDefinitionTool.h:69
HistoDefinitionTool::m_nbinsx
int m_nbinsx
Definition
HistoDefinitionTool.h:64
HistoDefinitionTool::m_nbinsy
int m_nbinsy
Definition
HistoDefinitionTool.h:68
HistoDefinitionTool::buildTProfile
TProfile * buildTProfile(bool useYLimits=false)
Definition
HistoDefinitionTool.cxx:54
HistoDefinitionTool::m_htitle
std::string m_htitle
Definition
HistoDefinitionTool.h:62
asg::AsgTool::AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition
AsgTool.cxx:58
asg
Definition
DataHandleTestTool.h:28
Generated on
for ATLAS Offline Software by
1.14.0