ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigMonitoring
TrigIDR4Monitoring
src
IPlotBase.cxx
Go to the documentation of this file.
1
12
13
#include "
IPlotBase.h
"
14
#include "
MsgMacros.h
"
15
16
#include "
Resplot/Resplot.h
"
17
18
19
20
void
IDTPM2::IPlotBase::copyHist
( TH1* hsrc, TH1* hdest,
bool
copyoverflow )
const
{
21
22
if
( hsrc->GetNbinsX()!=hdest->GetNbinsX() )
return
;
// do we want to give an error message ?? throw and exception ??
23
24
int
imin = 0;
25
int
imax
= hsrc->GetNbinsX()+1;
26
27
if
( !copyoverflow ) {
28
imin = 1;
29
imax
= hsrc->GetNbinsX();
30
}
31
32
for
(
int
i=imin ; i<=
imax
; i++ ) {
33
hdest->SetBinContent( i, hsrc->GetBinContent(i) );
34
hdest->SetBinError( i, hsrc->GetBinError(i) );
35
}
36
37
hdest->SetEntries( hsrc->GetEntries() );
38
}
39
40
41
42
void
IDTPM2::IPlotBase::getHist
(
ServiceHandle<ITHistSvc>
& histsvc,
const
std::string& hname, TH1* hsrc )
const
{
43
TH1*
h
= 0;
44
if
( histsvc->getHist( hname,
h
).isFailure() )
MY_MSG_WARNING
<<
"Could not retieve histogram: "
<< hname <<
endmsg
;
45
else
copyHist
( hsrc,
h
);
46
}
47
48
49
void
IDTPM2::IPlotBase::processResolution
(
ServiceHandle<ITHistSvc>
& histsvc,
const
std::string& path,
bool
writeflag )
const
{
50
51
TH2* hist2d = 0;
52
53
if
( histsvc->getHist( path+
"2D"
, hist2d ).isFailure() )
MY_MSG_WARNING
<<
"Could not retieve 2D: "
<< (path+
"2D"
) <<
endmsg
;
54
else
{
55
60
61
Resplot::Resplot
rp
( path, hist2d );
62
63
rp
.Finalise(
Resplot::FitNull95
);
64
65
if
( !writeflag ) {
68
// if ( histsvc->regHist( path+"1D", rp.H1D() ).isFailure() ) MY_MSG_WARNING << "Unable to register histogram: 1D: " << name() << endmsg;
69
// if ( histsvc->regHist( path+"mean", rp.Mean() ).isFailure() ) MY_MSG_WARNING << "Unable to register histogram: mean: " << name() << endmsg;
70
// if ( histsvc->regHist( path+"sigma", rp.Sigma() ).isFailure() ) MY_MSG_WARNING << "Unable to register histogram: sigma: " << name() << endmsg;
71
// }
72
// else {
74
getHist
( histsvc, path+
"1D"
,
rp
.H1D() );
75
getHist
( histsvc, path+
"mean"
,
rp
.Mean() );
76
getHist
( histsvc, path+
"sigma"
,
rp
.Sigma() );
77
}
78
}
79
80
}
81
82
86
std::string
IDTPM2::IPlotBase::realPath
(
const
std::string& tag ) {
87
88
std::string dir = (*
monTool
())->getPath();
89
91
std::string stub = dir.substr( dir.find(
'/'
, 1) + 1 ) + tag;
92
93
const
std::vector<std::string>&
allhists
=
histSvc
()->getHists();
94
95
std::string basestr =
""
;
96
97
for
(
size_t
i=0 ; i<
allhists
.size() ; i++ ) {
98
if
(
allhists
[i].
find
(stub)!=std::string::npos ) {
99
std::string s =
allhists
[i];
100
basestr = s.substr(0,s.find(
"/"
+stub)+1);
101
break
;
102
}
103
}
104
105
return
basestr + stub;
106
107
}
108
109
110
111
112
113
#if 0
114
115
void
IDTPM2::IPlotBase::binWidthNormalise(
ServiceHandle<ITHistSvc>
& histsvc,
const
std::string& hname )
const
{
116
TH1*
h
= 0;
117
if
( histsvc->getHist( hname,
h
).isFailure() )
MY_MSG_WARNING
<<
"Could not retieve histogram: "
<< hname <<
endmsg
;
118
else
binWidthNormalise(
h
);
119
}
120
121
122
void
IDTPM2::IPlotBase::binWidthNormalize( TH1*
h
)
const
{
123
124
if
( !
h
)
return
;
125
126
int
nbins =
h
->GetNbinsX();
127
double
width
=
h
->GetBinWidth(1);
128
129
double
eps = 1e-12;
130
131
bool
variable =
false
;
132
133
for
(
int
i=2 ; i<=nbins ; i++ ) {
134
if
( std::fabs(
h
->GetBinWidth(i)-
width
)>eps ) {
135
variable =
true
;
136
break
;
137
}
138
}
139
140
if
( !variable )
return
;
141
142
for
(
int
i=1 ;
i
<=
h
->GetNbinsX() ;
i
++ ) {
143
double
w
=
h
->GetBinWidth(i);
144
h
->SetBinContent( i,
h
->GetBinContent(i)/w );
145
h
->SetBinError( i,
h
->GetBinError(i)/w );
146
}
147
148
}
149
150
#endif
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
IPlotBase.h
rp
ReadCards * rp
Definition
IReadCards.cxx:26
MsgMacros.h
emacs: this is -*- c++ -*-
MY_MSG_WARNING
#define MY_MSG_WARNING
Definition
MsgMacros.h:23
Resplot.h
width
const double width
Definition
TTileTripReader.cxx:24
imax
int imax(int i, int j)
Definition
TileLaserTimingTool.cxx:33
h
Header file for AthHistogramAlgorithm.
IDTPM2::IPlotBase::copyHist
void copyHist(TH1 *hsrc, TH1 *hdest, bool copyoverflow=true) const
resolution porocessing stuff these don't really even need to be class functions, they could be simply...
Definition
IPlotBase.cxx:20
IDTPM2::IPlotBase::getHist
void getHist(const std::string &hname, TH1 *hsrc)
Definition
IPlotBase.h:88
IDTPM2::IPlotBase::processResolution
void processResolution(const std::string &path, bool writeflag=false)
Definition
IPlotBase.h:89
IDTPM2::IPlotBase::monTool
ToolHandle< GenericMonitoringTool > * monTool()
mon tool
Definition
IPlotBase.h:71
IDTPM2::IPlotBase::realPath
std::string realPath(const std::string &tag="")
This is a horrific function, has to get ALL the histograms, just to be able to work out how to get th...
Definition
IPlotBase.cxx:86
IDTPM2::IPlotBase::histSvc
virtual ServiceHandle< ITHistSvc > & histSvc()
we may well need these at some point ...
Definition
IPlotBase.h:105
Resplot::Resplot
Definition
Resplot.h:50
ServiceHandle
Definition
ClusterMakerTool.h:36
allhists
bool allhists
Definition
hcg.cxx:81
find
std::string find(const std::string &s)
return a remapped string
Definition
hcg.cxx:140
Resplot::FitNull95
TF1 * FitNull95(TH1D *s, double a=0, double b=0)
Definition
Resplot.cxx:1472
extractSporadic.h
list h
Definition
extractSporadic.py:96
lumiFormat.i
int i
Definition
lumiFormat.py:85
python.IoTestsLib.w
w
Definition
IoTestsLib.py:198
Generated on
for ATLAS Offline Software by
1.17.0