]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliFieldMap.cxx
Merging the VirtualMC branch to the main development branch (HEAD)
[u/mrichter/AliRoot.git] / STEER / AliFieldMap.cxx
index 0e54c4a8105ea45c4bef350ab8a332e570070be2..db1b606538255236e222f77ba4ef46bd3b9a9d8a 100644 (file)
 
 /*
 $Log$
+Revision 1.3.6.1  2002/07/24 10:08:13  alibrary
+Updating VirtualMC
+
+Revision 1.4  2002/07/10 15:06:22  morsch
+Initialize TVector* save.
+
+Revision 1.3  2002/02/26 16:13:07  morsch
+Correction in streamer.
+
+Revision 1.2  2002/02/22 14:00:20  morsch
+Protection against replication of fieldmap data in gAlice.
+
+Revision 1.1  2002/02/14 11:41:28  morsch
+Magnetic field map for ALICE for L3+muon spectrometer stored in 3 seperate
+root files.
+
 */
 
 //
@@ -34,6 +50,7 @@ AliFieldMap::AliFieldMap()
   // Standard constructor
   //
   fB = 0;
+  SetWriteEnable();
 }
 
 AliFieldMap::AliFieldMap(const char *name, const char *title)
@@ -44,6 +61,7 @@ AliFieldMap::AliFieldMap(const char *name, const char *title)
   //
   fB = 0;
   ReadField();
+  SetWriteEnable();
 }
 
 AliFieldMap::~AliFieldMap()
@@ -70,8 +88,8 @@ void AliFieldMap::ReadField()
   // Method to read the magnetic field map from file
   //
   FILE* magfile;
-  FILE* endf = fopen("end.table", "r");
-  FILE* out  = fopen("out", "w");
+//  FILE* endf = fopen("end.table", "r");
+//  FILE* out  = fopen("out", "w");
   
   Int_t   ix, iy, iz, ipx, ipy, ipz;
   Float_t bx, by, bz;
@@ -106,13 +124,14 @@ void AliFieldMap::ReadField()
              for (iz = 0; iz < fZn; iz++) {
                  ipz=ipy+iz*3;
 
-                 if (iz == -1) 
-                     fscanf(endf,"%f %f %f", &bx,&by,&bz);
-                 else if (iz > -1)
+                 if (iz == -1) {
+//                   fscanf(endf,"%f %f %f", &bx,&by,&bz);
+                 } else if (iz > -1) {
                      fscanf(magfile," %f %f %f", &bx, &by, &bz);
-                 else 
+                 } else {
                      continue;
-
+                 }
+                 
 //               fscanf(magfile,"%f %f %f %f %f %f %f ",
 //                      &x, &y, &z, &bx,&by,&bz, &b);
 //               fprintf(out, "%15.8e %15.8e %15.8e \n", bx, by, bz);
@@ -220,3 +239,20 @@ AliFieldMap & AliFieldMap::operator =(const AliFieldMap &magf)
   magf.Copy(*this);
   return *this;
 }
+
+void AliFieldMap::Streamer(TBuffer &R__b)
+{
+   // Stream an object of class AliFieldMap.
+    TVector* save = 0;
+    
+    if (R__b.IsReading()) {
+       AliFieldMap::Class()->ReadBuffer(R__b, this);
+    } else {
+       if (!fWriteEnable) {
+           save = fB;
+           fB = 0;
+       }
+       AliFieldMap::Class()->WriteBuffer(R__b, this);
+       if (!fWriteEnable) fB = save;
+    }
+}