CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Attributes | Private Member Functions | Friends
PhysicsTGraphPayload Class Reference

#include <PhysicsTGraphPayload.h>

Public Member Functions

 operator TGraph () const
 conversion to TGraph More...
 
 PhysicsTGraphPayload ()
 default constructor More...
 
 PhysicsTGraphPayload (const TGraph &graph)
 constructor from TGraph object More...
 
void print (std::ostream &stream) const
 print points of TGraph object More...
 

Protected Attributes

std::string name_
 
int numPoints_
 
std::vector< float > x_
 
std::vector< float > y_
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Definition at line 22 of file PhysicsTGraphPayload.h.

Constructor & Destructor Documentation

PhysicsTGraphPayload::PhysicsTGraphPayload ( )

default constructor

Definition at line 7 of file PhysicsTGraphPayload.cc.

PhysicsTGraphPayload::PhysicsTGraphPayload ( const TGraph &  graph)

constructor from TGraph object

Definition at line 11 of file PhysicsTGraphPayload.cc.

References name_, numPoints_, x_, and y_.

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 }
std::vector< float > y_
std::vector< float > x_
Definition: adjgraph.h:12

Member Function Documentation

PhysicsTGraphPayload::operator TGraph ( ) const

conversion to TGraph

Definition at line 28 of file PhysicsTGraphPayload.cc.

References Exception.

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 }
std::vector< float > y_
std::vector< float > x_
Definition: adjgraph.h:12
void PhysicsTGraphPayload::print ( std::ostream &  stream) const

print points of TGraph object

Definition at line 43 of file PhysicsTGraphPayload.cc.

References name_, numPoints_, x_, and y_.

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 }
std::vector< float > y_
std::vector< float > x_
template<class Archive >
void PhysicsTGraphPayload::serialize ( Archive &  ar,
const unsigned int  version 
)
private

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 43 of file PhysicsTGraphPayload.h.

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 43 of file PhysicsTGraphPayload.h.

Member Data Documentation

std::string PhysicsTGraphPayload::name_
protected

Definition at line 38 of file PhysicsTGraphPayload.h.

Referenced by PhysicsTGraphPayload(), and print().

int PhysicsTGraphPayload::numPoints_
protected

Definition at line 39 of file PhysicsTGraphPayload.h.

Referenced by PhysicsTGraphPayload(), and print().

std::vector<float> PhysicsTGraphPayload::x_
protected

Definition at line 40 of file PhysicsTGraphPayload.h.

Referenced by PhysicsTGraphPayload(), and print().

std::vector<float> PhysicsTGraphPayload::y_
protected

Definition at line 41 of file PhysicsTGraphPayload.h.

Referenced by PhysicsTGraphPayload(), and print().