Main Page
Namespaces
Classes
Package Documentation
CondFormats
PhysicsToolsObjects
src
PhysicsTGraphPayload.cc
Go to the documentation of this file.
1
#include "
CondFormats/PhysicsToolsObjects/interface/PhysicsTGraphPayload.h
"
2
3
#include "
FWCore/Utilities/interface/Exception.h
"
4
5
#include <iomanip>
6
7
PhysicsTGraphPayload::PhysicsTGraphPayload
()
8
: numPoints_(0)
9
{}
10
11
PhysicsTGraphPayload::PhysicsTGraphPayload
(
const
TGraph& graph)
12
:
numPoints_
(0)
13
{
14
if
( graph.GetN() >= 1 ) {
15
name_
= graph.GetName();
16
numPoints_
= graph.GetN();
17
x_
.resize(
numPoints_
);
18
y_
.resize(
numPoints_
);
19
for
(
int
iPoint = 0; iPoint <
numPoints_
; ++iPoint ) {
20
Double_t xPoint, yPoint;
21
graph.GetPoint(iPoint, xPoint, yPoint);
22
x_
[iPoint] = xPoint;
23
y_
[iPoint] = yPoint;
24
}
25
}
26
}
27
28
PhysicsTGraphPayload::operator
TGraph()
const
29
{
30
if
(
numPoints_
>= 1 ) {
31
TGraph graph(
numPoints_
);
32
graph.SetName(
name_
.data());
33
for
(
int
iPoint = 0; iPoint <
numPoints_
; ++iPoint ) {
34
graph.SetPoint(iPoint,
x_
[iPoint],
y_
[iPoint]);
35
}
36
return
graph;
37
}
else
{
38
throw
cms::Exception
(
"PhysicsTGraphPayload"
)
39
<<
"Invalid TGraph object !!\n"
;
40
}
41
}
42
43
void
PhysicsTGraphPayload::print
(std::ostream& stream)
const
44
{
45
stream <<
"<PhysicsTGraphPayload::print (name = "
<<
name_
<<
")>:"
<< std::endl;
46
for
(
int
iPoint = 0; iPoint <
numPoints_
; ++iPoint ) {
47
stream <<
"point #"
<< iPoint <<
": x = "
<<
x_
[iPoint] <<
", y = "
<<
y_
[iPoint] << std::endl;
48
}
49
}
PhysicsTGraphPayload::y_
std::vector< float > y_
Definition:
PhysicsTGraphPayload.h:41
PhysicsTGraphPayload::PhysicsTGraphPayload
PhysicsTGraphPayload()
default constructor
Definition:
PhysicsTGraphPayload.cc:7
PhysicsTGraphPayload.h
Exception
Definition:
hltDiff.cc:292
PhysicsTGraphPayload::numPoints_
int numPoints_
Definition:
PhysicsTGraphPayload.h:39
PhysicsTGraphPayload::print
void print(std::ostream &stream) const
print points of TGraph object
Definition:
PhysicsTGraphPayload.cc:43
Utilities.operator
operator
Definition:
Utilities.py:24
PhysicsTGraphPayload::x_
std::vector< float > x_
Definition:
PhysicsTGraphPayload.h:40
Exception.h
PhysicsTGraphPayload::name_
std::string name_
Definition:
PhysicsTGraphPayload.h:38
Generated for CMSSW Reference Manual by
1.8.11