/*
$Log$
+Revision 1.5 2002/02/26 09:48:14 morsch
+Extra argument in constructor for l3 map choice.
+
+Revision 1.4 2002/02/22 14:00:20 morsch
+Protection against replication of fieldmap data in gAlice.
+
+Revision 1.3 2002/02/21 09:23:41 morsch
+Create dummy field map for L3 in case no detailed map is needed.
+
+Revision 1.2 2002/02/19 16:14:35 morsch
+Reading of 0.2 T solenoid field map enabled.
+
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.
//________________________________________
AliMagFMaps::AliMagFMaps(const char *name, const char *title, const Int_t integ,
- const Float_t factor, const Float_t fmax, const Int_t map)
+ const Float_t factor, const Float_t fmax, const Int_t map,
+ const Int_t l3)
: AliMagF(name,title,integ,factor,fmax)
{
//
//
fType = kConMesh;
fFieldMap[0] = 0;
- char* fname;
-
- fMap = map;
- TFile* file = 0;
- if(fDebug>-1) printf("%s: Constant Mesh Field %s created: map= %d, factor= %f, file= %s\n",
- ClassName(),fName.Data(), fMap, factor,fTitle.Data());
- if (fMap == k2kG) {
- fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B02.root");
- file = new TFile(fname);
- fFieldMap[0] = (AliFieldMap*) file->Get("L3B02");
- file->Close();
- delete file;
+ fMap = map;
+ fL3Option = l3;
+
+ ReadField();
+ fFieldRead = 1;
+//
+// Don't replicate field information in gAlice
+ for (Int_t i = 0; i < 3; i++) fFieldMap[i]->SetWriteEnable(0);
+//
+}
+
+//________________________________________
+AliMagFMaps::AliMagFMaps(const AliMagFMaps &magf)
+{
+ //
+ // Copy constructor
+ //
+ magf.Copy(*this);
+}
+
+AliMagFMaps::~AliMagFMaps()
+{
+//
+// Destructor
+//
+ delete fFieldMap[0];
+ delete fFieldMap[1];
+ delete fFieldMap[2];
+}
+
+void AliMagFMaps::ReadField()
+{
+// Read Field Map from file
+//
+// don't read twice
+//
+ if (fFieldRead) return;
+//
+ char* fname;
+ TFile* file = 0;
+ if (fMap == k2kG) {
+ if (fL3Option) {
+ fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B02.root");
+ file = new TFile(fname);
+ fFieldMap[0] = (AliFieldMap*) file->Get("L3B02");
+ file->Close();
+ delete file;
+ }
fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB02.root");
file = new TFile(fname);
fFieldMap[1] = (AliFieldMap*) file->Get("DipB02");
file->Close();
delete file;;
-
+
fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB02.root");
file = new TFile(fname);
fFieldMap[2] = (AliFieldMap*) file->Get("ExtB02");
file->Close();
delete file;
-
fSolenoid = 2.;
} else if (fMap == k4kG) {
- fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B04.root");
- file = new TFile(fname);
- fFieldMap[0] = (AliFieldMap*) file->Get("L3B04");
- file->Close();
- delete file;
-
+ if (fL3Option) {
+ fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B04.root");
+ file = new TFile(fname);
+ fFieldMap[0] = (AliFieldMap*) file->Get("L3B04");
+ file->Close();
+ delete file;
+ }
+
fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB04.root");
file = new TFile(fname);
fFieldMap[1] = (AliFieldMap*) file->Get("DipB04");
file->Close();
delete file;;
-
+
fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB04.root");
file = new TFile(fname);
fFieldMap[2] = (AliFieldMap*) file->Get("ExtB04");
delete file;
fSolenoid = 4.;
} else if (fMap == k5kG) {
- fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B05.root");
- file = new TFile(fname);
- fFieldMap[0] = (AliFieldMap*) file->Get("L3B05");
- file->Close();
- delete file;
-
+ if (fL3Option) {
+ fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B05.root");
+ file = new TFile(fname);
+ fFieldMap[0] = (AliFieldMap*) file->Get("L3B05");
+ file->Close();
+ delete file;
+ }
+
fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB05.root");
file = new TFile(fname);
fFieldMap[1] = (AliFieldMap*) file->Get("DipB05");
file->Close();
delete file;;
-
+
fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB05.root");
file = new TFile(fname);
fFieldMap[2] = (AliFieldMap*) file->Get("ExtB05");
file->Close();
delete file;
-
+
fSolenoid = 5.;
}
- SetL3ConstField(0);
-}
-
-//________________________________________
-AliMagFMaps::AliMagFMaps(const AliMagFMaps &magf)
-{
- //
- // Copy constructor
- //
- magf.Copy(*this);
-}
-AliMagFMaps::~AliMagFMaps()
-{
+ if (!fL3Option) {
//
-// Destructor
-//
- delete fFieldMap[0];
- delete fFieldMap[1];
- delete fFieldMap[2];
+// Dummy L3 map
+ fFieldMap[0] = new AliFieldMap();
+ fFieldMap[0] -> SetLimits(-800., 800., -800., 800., -700., 700.);
+ }
}
//
// Method to calculate the magnetic field
//
- 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;
-
// --- find the position in the grid ---
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) {
+ if (!fL3Option) {
//
// Constant L3 field, if this option was selected
//
b[1]*=fFactor;
b[2]*=fFactor;
}
+ b[0]*=1.1;
+
}
//________________________________________