]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Added class iostreamer funcionality and Print and Read functions. cleaned
authornilsen <nilsen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 9 Sep 2002 17:28:02 +0000 (17:28 +0000)
committernilsen <nilsen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 9 Sep 2002 17:28:02 +0000 (17:28 +0000)
up files.

ITS/AliITSRecPoint.cxx
ITS/AliITSRecPoint.h

index 99f7b8e099d50215c63c803aa6d760b5ea5ef331..e05eb4b274cb717e072488ae9b1320a8739b38d5 100644 (file)
@@ -1,3 +1,21 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/*
+$Log$
+*/
 ////////////////////////////////////////////////
 //  Reconstructed point class for set:ITS     //
 ////////////////////////////////////////////////
@@ -11,6 +29,63 @@ AliITSRecPoint::AliITSRecPoint() {
     fTracks[0]=fTracks[1]=fTracks[2]=-3; 
     fX=fZ=fQ=fdEdX=0.;
     fSigmaX2=fSigmaZ2=0.;
-   }
-   
+}
+//----------------------------------------------------------------------
+void AliITSRecPoint::Print(ostream *os){
+    ////////////////////////////////////////////////////////////////////////
+    // Standard output format for this class.
+    ////////////////////////////////////////////////////////////////////////
+#if defined __GNUC__
+#if __GNUC__ > 2
+    ios::fmtflags fmt;
+#else
+    Int_t fmt;
+#endif
+#else
+#if defined __ICC
+    ios::fmtflags fmt;
+#else
+    Int_t fmt;
+#endif
+#endif
+    fmt = os->setf(ios::fixed);  // set fixed floating point output
+    *os << fTracks[0]<< " " << fTracks[1] << " " << fTracks[2] << " ";
+    *os << fX << " " << fZ << " " << fQ << " ";
+    fmt = os->setf(ios::scientific); // set scientific for dEdX.
+    *os << fdEdX << " ";
+    fmt = os->setf(ios::fixed); // every fixed
+    *os << fSigmaX2 << " " << fSigmaZ2;
+    os->flags(fmt); // reset back to old formating.
+    return;
+}
+//----------------------------------------------------------------------
+void AliITSRecPoint::Read(istream *is){
+////////////////////////////////////////////////////////////////////////
+// Standard input format for this class.
+////////////////////////////////////////////////////////////////////////
 
+    *is >> fTracks[0] >> fTracks[1] >> fTracks[2] >> fX >> fZ >> fQ;
+    *is >> fdEdX >> fSigmaX2 >> fSigmaZ2;
+    return;
+}
+//----------------------------------------------------------------------
+ostream &operator<<(ostream &os,AliITSRecPoint &p){
+////////////////////////////////////////////////////////////////////////
+// Standard output streaming function.
+////////////////////////////////////////////////////////////////////////
+    p.Print(&os);
+    return os;
+}
+//----------------------------------------------------------------------
+istream &operator>>(istream &is,AliITSRecPoint &r){
+////////////////////////////////////////////////////////////////////////
+// Standard input streaming function.
+////////////////////////////////////////////////////////////////////////
+    r.Read(&is);
+    return is;
+}
+//----------------------------------------------------------------------
index 5a4c537378fdd54fbff5ee515c9c540c778ef15d..2e5c22c902d461b9a48f1dd2e48c914550f80e52 100644 (file)
@@ -1,45 +1,48 @@
 #ifndef ALIITSRECPOINT_H
 #define ALIITSRECPOINT_H 
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/*
+  $Id$
+*/
 
 ////////////////////////////////////////////////////
 //  Reconstructed space point class for set:ITS   //
 ////////////////////////////////////////////////////
 
 #include <TObject.h>
+#include <iostream.h>
 
 
 class AliITSRecPoint : public TObject {
-
-
  public:
-
-  AliITSRecPoint();
-  virtual ~AliITSRecPoint() {}; // distructor
-  Bool_t IsSortable() const {return kTRUE;} // allows for sorting
-  Int_t   GetLabel(Int_t i) {return fTracks[i];} // get track label
-  Float_t GetX(){return fX;} // gets fX
-  Float_t GetZ(){return fZ;} // gets fZ
-  Float_t GetQ(){return fQ;} // gets fQ
-  Float_t GetdEdX(){return fdEdX;} // gets fdEdX
-  Float_t GetSigmaX2(){return fSigmaX2;} // gets fSigmaX2
-  Float_t GetSigmaZ2(){return fSigmaZ2;} // gets fSigmaZ2
-  void SetLabel(Int_t i, Int_t lab){fTracks[i]=lab;} // sets track label
-  void SetX(Float_t x){fX=x;} // sets fX
-  void SetZ(Float_t z){fZ=z;} // sets fZ
-  void SetQ(Float_t q){fQ=q;} // sets fQ
-  void SetdEdX(Float_t dedx){fdEdX=dedx;} // sets fdEdX
-  void SetSigmaX2(Float_t sx2){fSigmaX2=sx2;} // sets fSigmaX2
-  void SetSigmaZ2(Float_t sz2){fSigmaZ2=sz2;} // sets fSigmaZ2
-  void  Use() {
-    //if fQ<0 cluster is already associated with a track
-    fQ=-fQ;
-  }
-  Int_t IsUsed() const {return (fQ<0) ? 1 : 0;} // checks Use condision
-  Int_t Compare(const TObject *o) const {
-    //to be defined
-    return 0;
-  } 
-
+    AliITSRecPoint();
+    virtual ~AliITSRecPoint() {}; // distructor
+    Bool_t IsSortable() const {return kTRUE;} // allows for sorting
+    Int_t   GetLabel(Int_t i) const {return fTracks[i];} // get track label
+    Float_t GetX() const {return fX;} // gets fX
+    Float_t GetZ() const {return fZ;} // gets fZ
+    Float_t GetQ() const {return fQ;} // gets fQ
+    Float_t GetdEdX() const {return fdEdX;} // gets fdEdX
+    Float_t GetSigmaX2() const {return fSigmaX2;} // gets fSigmaX2
+    Float_t GetSigmaZ2() const {return fSigmaZ2;} // gets fSigmaZ2
+    void SetLabel(Int_t i, Int_t lab){fTracks[i]=lab;} // sets track label
+    void SetX(Float_t x){fX=x;} // sets fX
+    void SetZ(Float_t z){fZ=z;} // sets fZ
+    void SetQ(Float_t q){fQ=q;} // sets fQ
+    void SetdEdX(Float_t dedx){fdEdX=dedx;} // sets fdEdX
+    void SetSigmaX2(Float_t sx2){fSigmaX2=sx2;} // sets fSigmaX2
+    void SetSigmaZ2(Float_t sz2){fSigmaZ2=sz2;} // sets fSigmaZ2
+    void  Use() { //if fQ<0 cluster is already associated with a track
+       fQ=-fQ;}
+    Int_t IsUsed() const {return (fQ<0) ? 1 : 0;} // checks Use condision
+    Int_t Compare(const TObject *o) const { //to be defined
+       return 0;}
+    // Prints out the content of this class in ASCII format.
+    void Print(ostream *os); 
+    // Reads in the content of this class in the format of Print
+    void Read(istream *is);
  public:
     Int_t     fTracks[3]; //labels of overlapped tracks
     Float_t   fX ;        //X of cluster
@@ -49,10 +52,9 @@ class AliITSRecPoint : public TObject {
     Float_t   fSigmaX2;   //Sigma X square of cluster
     Float_t   fSigmaZ2;   //Sigma Z square of cluster
 
-  ClassDef(AliITSRecPoint,1)  // AliITSRecPoint class
+    ClassDef(AliITSRecPoint,1)  // AliITSRecPoint class
 };
-
+// Input and output function for standard C++ input/output.
+ostream& operator<<(ostream &os,AliITSRecPoint &source);
+istream& operator>>(istream &is,AliITSRecPoint &source);
 #endif
-
-
-