Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

CLHEPStreams.h

Go to the documentation of this file.
00001 // $Header: /nfs/slac/g/glast/ground/cvs/GlastEvent/GlastEvent/Utilities/CLHEPStreams.h,v 1.2 2001/04/18 19:07:26 igable Exp $
00002 #ifndef LHCBEVENT_CLHEPSTREAMS_H
00003 #define LHCBEVENT_CLHEPSTREAMS_H 1
00004 
00005 
00006 // Include files
00007 #include "GaudiKernel/StreamBuffer.h"
00008 #include "GlastEvent/TopLevel/Definitions.h"
00009 
00010 
00011 //------------------------------------------------------------------------------
00012 //
00013 // Description: Streams operators of CLHEP classes used in GlastEvent
00014 //              (used in serialize() methods)
00015 //
00016 // CLHEPStreams.h defines additional oprators to used classes from
00017 // <A HREF="http://wwwinfo.cern.ch/asd/lhc++/clhep/manual/RefGuide/index.html">CLHEP</A>
00018 //              
00019 // Author:      Pavel Binko
00020 //
00021 //------------------------------------------------------------------------------
00022 
00023 
00024 //------------------------------------------------------------------------------
00025 // <A HREF="http://wwwinfo.cern.ch/asd/lhc++/clhep/manual/RefGuide/Geometry/HepPoint3D.html">class HepPoint3D</A>
00026 #include "CLHEP/Geometry/Point3D.h"
00027 //------------------------------------------------------------------------------
00028 // Output operator
00029 inline StreamBuffer& operator<< ( StreamBuffer& s, const HepPoint3D& value)    {
00030   return s  << value.x() << value.y() << value.z();
00031 }
00032 // Input operator
00033 inline StreamBuffer& operator>> ( StreamBuffer& s, HepPoint3D& value )         {
00034   HepDouble   x, y, z;
00035   s >> x >> y >> z;
00036   value.setX(x);
00037   value.setY(y);
00038   value.setZ(z);
00039   return s;
00040 }
00041 
00042 
00043 //------------------------------------------------------------------------------
00044 // <A HREF="http://wwwinfo.cern.ch/asd/lhc++/clhep/manual/RefGuide/Geometry/HepVector3D.html">class HepVector3D</A>
00045 #include "CLHEP/Geometry/Vector3D.h"
00046 //------------------------------------------------------------------------------
00047 // Output operator
00048 inline StreamBuffer& operator<< ( StreamBuffer& s, const HepVector3D& value)   {
00049   return s  << value.x() << value.y() << value.z();
00050 }
00051 // Input operator
00052 inline StreamBuffer& operator>> ( StreamBuffer& s, HepVector3D& value )        {
00053   HepDouble   x, y, z;
00054   s  >> x >> y >> z;
00055   value.setX(x);
00056   value.setY(y);
00057   value.setZ(z);
00058   return s;
00059 }
00060 
00061 
00062 //------------------------------------------------------------------------------
00063 // <A HREF="http://wwwinfo.cern.ch/asd/lhc++/clhep/manual/RefGuide/Vector/HepLorentzVector.html">class HepLorentzVector</A>
00064 #include "CLHEP/Vector/LorentzVector.h"
00065 //------------------------------------------------------------------------------
00066 // Output operator
00067 inline StreamBuffer& operator<< ( StreamBuffer& s, const HepLorentzVector& value) {
00068   return s  << HepDouble(value.px()) 
00069             << HepDouble(value.py())
00070             << HepDouble(value.pz())
00071             << HepDouble(value.e());
00072 }
00073 // Input operator
00074 inline StreamBuffer& operator>> ( StreamBuffer& s, HepLorentzVector& value )   {
00075   HepDouble   px, py, pz, E;
00076   s  >> px >> py >> pz >> E;
00077   value.setPx(px);
00078   value.setPy(py);
00079   value.setPz(pz);
00080   value.setE(E);
00081   return s;
00082 }
00083 
00084 
00085 //------------------------------------------------------------------------------
00086 // <A HREF="http://wwwinfo.cern.ch/asd/lhc++/clhep/manual/RefGuide/Matrix/HepSymMatrix.html">class SymMatrix</A>
00087 #include "CLHEP/Matrix/SymMatrix.h"
00088 //------------------------------------------------------------------------------
00089 // Output operator
00090 inline StreamBuffer& operator<< ( StreamBuffer& s, const HepSymMatrix& value ) {
00091   int   nrow = value.num_row();
00092   for( int i=1; i<=nrow; i++ ) {
00093     for( int j=1; j<=i; j++ ) {
00094       s << value(i,j);
00095     }
00096   }
00097   return s;
00098 }
00099 // Input operator
00100 inline StreamBuffer& operator>> ( StreamBuffer& s, HepSymMatrix& value )       {
00101   int   nrow = value.num_row();
00102   for( int i=1; i<=nrow; i++ ) {
00103     for( int j=1; j<=i; j++ ) {
00104       s >> value(i,j);
00105     }
00106   }
00107   return s;
00108 }
00109 
00110 
00111 #endif    // LHCBEVENT_CLHEPSTREAMS_H

Generated at Wed Nov 21 12:22:49 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000