X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=STEER%2FAliFieldMap.cxx;h=58a3ad6945cd48a45faffa320757d741a392f4c8;hb=62741b41ca9a389bc9e3f6f650f6bf8df5bfb125;hp=b3b6d45deb8a75e7b13f4fbdb5414632463e495b;hpb=7b6cddfa0032215933b9781ae6df2abd7a7c8907;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/AliFieldMap.cxx b/STEER/AliFieldMap.cxx index b3b6d45deb8..58a3ad6945c 100644 --- a/STEER/AliFieldMap.cxx +++ b/STEER/AliFieldMap.cxx @@ -15,6 +15,21 @@ /* $Log$ +Revision 1.5 2002/10/14 14:57:32 hristov +Merging the VirtualMC branch to the main development branch (HEAD) + +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. @@ -31,37 +46,89 @@ root files. ClassImp(AliFieldMap) -//________________________________________ -AliFieldMap::AliFieldMap() +//_______________________________________________________________________ +AliFieldMap::AliFieldMap(): + fXbeg(0), + fYbeg(0), + fZbeg(0), + fXend(0), + fYend(0), + fZend(0), + fXdel(0), + fYdel(0), + fZdel(0), + fXdeli(0), + fYdeli(0), + fZdeli(0), + fXn(0), + fYn(0), + fZn(0), + fWriteEnable(0), + fB(0) { // // Standard constructor // - fB = 0; SetWriteEnable(); } -AliFieldMap::AliFieldMap(const char *name, const char *title) - : TNamed(name,title) +//_______________________________________________________________________ +AliFieldMap::AliFieldMap(const char *name, const char *title): + TNamed(name,title), + fXbeg(0), + fYbeg(0), + fZbeg(0), + fXend(0), + fYend(0), + fZend(0), + fXdel(0), + fYdel(0), + fZdel(0), + fXdeli(0), + fYdeli(0), + fZdeli(0), + fXn(0), + fYn(0), + fZn(0), + fWriteEnable(0), + fB(0) { // // Standard constructor // - fB = 0; ReadField(); SetWriteEnable(); } +//_______________________________________________________________________ AliFieldMap::~AliFieldMap() { -// -// Destructor -// + // + // Destructor + // delete fB; } -//________________________________________ -AliFieldMap::AliFieldMap(const AliFieldMap &map) +//_______________________________________________________________________ +AliFieldMap::AliFieldMap(const AliFieldMap &map): + TNamed(map), + fXbeg(0), + fYbeg(0), + fZbeg(0), + fXend(0), + fYend(0), + fZend(0), + fXdel(0), + fYdel(0), + fZdel(0), + fXdeli(0), + fYdeli(0), + fZdeli(0), + fXn(0), + fYn(0), + fZn(0), + fWriteEnable(0), + fB(0) { // // Copy constructor @@ -69,15 +136,15 @@ AliFieldMap::AliFieldMap(const AliFieldMap &map) map.Copy(*this); } -//________________________________________ +//_______________________________________________________________________ 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; @@ -101,7 +168,7 @@ void AliFieldMap::ReadField() Int_t nDim = fXn*fYn*fZn; -// Float_t x,y,z,b; + // Float_t x,y,z,b; fB = new TVector(3*nDim); if (magfile) { @@ -155,17 +222,18 @@ void AliFieldMap::ReadField() } // if mafile } +//_______________________________________________________________________ void AliFieldMap::Field(Float_t *x, Float_t *b) { -// -// Use simple interpolation to obtain field at point x -// + // + // Use simple interpolation to obtain field at point x + // Double_t ratx, raty, ratz, hix, hiy, hiz, ratx1, raty1, ratz1, bhyhz, bhylz, blyhz, blylz, bhz, blz, xl[3]; const Double_t kone=1; Int_t ix, iy, iz; b[0]=b[1]=b[2]=0; -// + // xl[0]=TMath::Abs(x[0])-fXbeg; xl[1]=TMath::Abs(x[1])-fYbeg; @@ -212,7 +280,7 @@ void AliFieldMap::Field(Float_t *x, Float_t *b) b[2] = blz *ratz1+bhz *ratz; } -//________________________________________ +//_______________________________________________________________________ void AliFieldMap::Copy(AliFieldMap & /* magf */) const { // @@ -221,23 +289,27 @@ void AliFieldMap::Copy(AliFieldMap & /* magf */) const Fatal("Copy","Not implemented!\n"); } -//________________________________________ +//_______________________________________________________________________ AliFieldMap & AliFieldMap::operator =(const AliFieldMap &magf) { magf.Copy(*this); return *this; } +//_______________________________________________________________________ void AliFieldMap::Streamer(TBuffer &R__b) { // Stream an object of class AliFieldMap. - if (R__b.IsReading()) { - AliFieldMap::Class()->ReadBuffer(R__b, this); - } else { - if (!fWriteEnable) { - delete fB; - fB = 0; - } - AliFieldMap::Class()->WriteBuffer(R__b, this); - } + 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; + } }