Option for 0 solenoid field added.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 2 Apr 2003 13:56:00 +0000 (13:56 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 2 Apr 2003 13:56:00 +0000 (13:56 +0000)
STEER/AliMagFMaps.cxx
STEER/AliMagFMaps.h

index e0ec5ca..46055aa 100644 (file)
@@ -106,75 +106,90 @@ void AliMagFMaps::ReadField()
   char* fname;
   TFile* file = 0;
   if (fMap == k2kG) {
-       if (fL3Option) {
-      fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B02.root");
+      if (fL3Option) {
+         fSolenoid = 2.;
+         fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B02.root");
+         file = new TFile(fname);
+         fFieldMap[0] = dynamic_cast<AliFieldMap*>(file->Get("L3B02"));
+         file->Close();
+         delete file;
+      }
+      fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB02.root");
       file = new TFile(fname);
-      fFieldMap[0] = dynamic_cast<AliFieldMap*>(file->Get("L3B02"));
+      fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB02"));
+      file->Close();
+      delete file;;
+      
+      fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB02.root");
+      file = new TFile(fname);
+      fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB02"));
       file->Close();
       delete file;
-       }
-       fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB02.root");
-       file = new TFile(fname);
-       fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB02"));
-       file->Close();
-       delete file;;
-       
-       fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB02.root");
-       file = new TFile(fname);
-       fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB02"));
-       file->Close();
-       delete file;
-       fSolenoid = 2.;
+
   } else if (fMap == k4kG) {
-       if (fL3Option) {
-      fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B04.root");
+      if (fL3Option) {
+         fSolenoid = 4.;
+         fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B04.root");
+         file = new TFile(fname);
+         fFieldMap[0] = dynamic_cast<AliFieldMap*>(file->Get("L3B04"));
+         file->Close();
+         delete file;
+      }
+      
+      fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB04.root");
       file = new TFile(fname);
-      fFieldMap[0] = dynamic_cast<AliFieldMap*>(file->Get("L3B04"));
+      fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB04"));
+      file->Close();
+      delete file;
+      
+      fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB04.root");
+      file = new TFile(fname);
+      fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB04"));
       file->Close();
       delete file;
-       }
-       
-       fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB04.root");
-       file = new TFile(fname);
-       fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB04"));
-       file->Close();
-       delete file;
-       
-       fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB04.root");
-       file = new TFile(fname);
-       fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB04"));
-       file->Close();
-       delete file;
-       fSolenoid = 4.;
   } else if (fMap == k5kG) {
-       if (fL3Option) {
-      fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B05.root");
+      if (fL3Option) {
+         fSolenoid = 5.;
+         fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B05.root");
+         file = new TFile(fname);
+         fFieldMap[0] = dynamic_cast<AliFieldMap*>(file->Get("L3B05"));
+         file->Close();
+         delete file;
+      }
+      
+      fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB05.root");
       file = new TFile(fname);
-      fFieldMap[0] = dynamic_cast<AliFieldMap*>(file->Get("L3B05"));
+      fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB05"));
       file->Close();
       delete file;
-       }
-       
-       fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB05.root");
-       file = new TFile(fname);
-       fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB05"));
-       file->Close();
-       delete file;
-       
-       fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB05.root");
-       file = new TFile(fname);
-       fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB05"));
-       file->Close();
-       delete file;
-       
-       fSolenoid = 5.;
+      
+      fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB05.root");
+      file = new TFile(fname);
+      fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB05"));
+      file->Close();
+      delete file;
+      
   }
   
   if (!fL3Option) {
-    //
-    // Dummy L3 map
-       fFieldMap[0] = new AliFieldMap();
-       fFieldMap[0] -> SetLimits(-800., 800., -800., 800., -700., 700.);
+      //
+      // Dummy L3 map
+      fFieldMap[0] = new AliFieldMap();
+      fFieldMap[0] -> SetLimits(-800., 800., -800., 800., -700., 700.);
+      switch(fMap) {
+      case k2kG:
+         fSolenoid = 2.;
+         break;
+      case k4kG:
+         fSolenoid = 4.;
+         break;
+      case k5kG:
+         fSolenoid = 5.;
+         break;
+      case k0kG:
+         fSolenoid = 0.;
+         break;
+      }
   }
 }
 
@@ -201,8 +216,8 @@ void AliMagFMaps::Field(Float_t *x, Float_t *b)
   b[0]=b[1]=b[2]=0;
   AliFieldMap* map = 0;
   if (fFieldMap[0]->Inside(x[0], x[1], x[2])) {
-    map = fFieldMap[0];
-    if (!fL3Option) {
+      map = fFieldMap[0];
+      if (!fL3Option) {
       //
       //     Constant L3 field, if this option was selected
       //
@@ -210,9 +225,9 @@ void AliMagFMaps::Field(Float_t *x, Float_t *b)
          return;
     }
   } else if (fFieldMap[1]->Inside(x[0], x[1], x[2])) {
-    map = fFieldMap[1];
+      map = fFieldMap[1];
   } else if (fFieldMap[2]->Inside(x[0], x[1], x[2])) {
-    map = fFieldMap[2];
+      map = fFieldMap[2];
   }
   
   if(map){
@@ -221,44 +236,42 @@ void AliMagFMaps::Field(Float_t *x, Float_t *b)
     //This is the ZDC part
     Float_t rad2=x[0]*x[0]+x[1]*x[1];
     if(x[2]>kCORBEG2 && x[2]<kCOREND2){
-         if(rad2<kCOR2RA2){
-        b[0] = kFCORN2;
-         }
-    }
-    else if(x[2]>kZ1BEG && x[2]<kZ1END){  
-         if(rad2<kZ1RA2){
-        b[0] = -kG1*x[1];
-        b[1] = -kG1*x[0];
-         }
-    }
-    else if(x[2]>kZ2BEG && x[2]<kZ2END){  
-         if(rad2<kZ2RA2){
-        b[0] = kG1*x[1];
-        b[1] = kG1*x[0];
-         }
+       if(rad2<kCOR2RA2){
+           b[0] = kFCORN2;
+       }
+    } else if(x[2]>kZ1BEG && x[2]<kZ1END){  
+       if(rad2<kZ1RA2){
+           b[0] = -kG1*x[1];
+           b[1] = -kG1*x[0];
+       }
+    } else if(x[2]>kZ2BEG && x[2]<kZ2END){
+       if(rad2<kZ2RA2){
+           b[0] = kG1*x[1];
+           b[1] = kG1*x[0];
+       }
     }
-    else if(x[2]>kZ3BEG && x[2]<kZ3END){  
-         if(rad2<kZ3RA2){
-        b[0] = kG1*x[1];
-        b[1] = kG1*x[0];
-         }
+    else if(x[2]>kZ3BEG && x[2]<kZ3END){
+       if(rad2<kZ3RA2){
+           b[0] = kG1*x[1];
+           b[1] = kG1*x[0];
+       }
     }
-    else if(x[2]>kZ4BEG && x[2]<kZ4END){  
-         if(rad2<kZ4RA2){
-        b[0] = -kG1*x[1];
-        b[1] = -kG1*x[0];
-         }
+    else if(x[2]>kZ4BEG && x[2]<kZ4END){
+       if(rad2<kZ4RA2){
+           b[0] = -kG1*x[1];
+           b[1] = -kG1*x[0];
+       }
     }
     else if(x[2]>kD1BEG && x[2]<kD1END){ 
-         if(rad2<kD1RA2){
-        b[1] = -kFDIP;
-         }
+       if(rad2<kD1RA2){
+           b[1] = -kFDIP;
+       }
     }
     else if(x[2]>kD2BEG && x[2]<kD2END){
-         if(((x[0]-kXCEN1D2)*(x[0]-kXCEN1D2)+(x[1]-kYCEN1D2)*(x[1]-kYCEN1D2))<kD2RA2
-            || ((x[0]-kXCEN2D2)*(x[0]-kXCEN2D2)+(x[1]-kYCEN2D2)*(x[1]-kYCEN2D2))<kD2RA2){
-        b[1] = kFDIP;
-         }
+       if(((x[0]-kXCEN1D2)*(x[0]-kXCEN1D2)+(x[1]-kYCEN1D2)*(x[1]-kYCEN1D2))<kD2RA2
+          || ((x[0]-kXCEN2D2)*(x[0]-kXCEN2D2)+(x[1]-kYCEN2D2)*(x[1]-kYCEN2D2))<kD2RA2){
+           b[1] = kFDIP;
+       }
     }
   }
   if(fFactor!=1) {
index d1cddb3..dc66898 100644 (file)
@@ -17,7 +17,7 @@ class AliMagFMaps : public AliMagF
   //Alice Magnetic Field with constant mesh
 
 public:
-    enum constants {k2kG, k4kG, k5kG};
+    enum constants {k2kG, k4kG, k5kG, k0kG};
     AliMagFMaps();
     AliMagFMaps(const char *name, const char *title, const Int_t integ,
                const Float_t factor, const Float_t fmax, const Int_t map = k2kG,