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
() : numPoints_(0) {}
8
9
PhysicsTGraphPayload::PhysicsTGraphPayload
(
const
TGraph& graph) :
numPoints_
(0) {
10
if
(graph.GetN() >= 1) {
11
name_
= graph.GetName();
12
numPoints_
= graph.GetN();
13
x_
.resize(
numPoints_
);
14
y_
.resize(
numPoints_
);
15
for
(
int
iPoint = 0; iPoint <
numPoints_
; ++iPoint) {
16
Double_t xPoint, yPoint;
17
graph.GetPoint(iPoint, xPoint, yPoint);
18
x_
[iPoint] = xPoint;
19
y_
[iPoint] = yPoint;
20
}
21
}
22
}
23
24
PhysicsTGraphPayload::operator
TGraph()
const
{
25
if
(
numPoints_
>= 1) {
26
TGraph graph(
numPoints_
);
27
graph.SetName(
name_
.data());
28
for
(
int
iPoint = 0; iPoint <
numPoints_
; ++iPoint) {
29
graph.SetPoint(iPoint,
x_
[iPoint],
y_
[iPoint]);
30
}
31
return
graph;
32
}
else
{
33
throw
cms::Exception
(
"PhysicsTGraphPayload"
) <<
"Invalid TGraph object !!\n"
;
34
}
35
}
36
37
void
PhysicsTGraphPayload::print
(std::ostream& stream)
const
{
38
stream <<
"<PhysicsTGraphPayload::print (name = "
<<
name_
<<
")>:"
<< std::endl;
39
for
(
int
iPoint = 0; iPoint <
numPoints_
; ++iPoint) {
40
stream <<
"point #"
<< iPoint <<
": x = "
<<
x_
[iPoint] <<
", y = "
<<
y_
[iPoint] << std::endl;
41
}
42
}
PhysicsTGraphPayload::y_
std::vector< float > y_
Definition:
PhysicsTGraphPayload.h:40
PhysicsTGraphPayload::PhysicsTGraphPayload
PhysicsTGraphPayload()
default constructor
Definition:
PhysicsTGraphPayload.cc:7
PhysicsTGraphPayload.h
Exception
Definition:
hltDiff.cc:246
PhysicsTGraphPayload::numPoints_
int numPoints_
Definition:
PhysicsTGraphPayload.h:38
PhysicsTGraphPayload::print
void print(std::ostream &stream) const
print points of TGraph object
Definition:
PhysicsTGraphPayload.cc:37
Utilities.operator
operator
Definition:
Utilities.py:24
PhysicsTGraphPayload::x_
std::vector< float > x_
Definition:
PhysicsTGraphPayload.h:39
Exception.h
PhysicsTGraphPayload::name_
std::string name_
Definition:
PhysicsTGraphPayload.h:37
Generated for CMSSW Reference Manual by
1.8.11