From 5a004fb4c2b0ae1f73174d4aa48ebb0957c9a70f Mon Sep 17 00:00:00 2001 From: shahoian Date: Mon, 21 Sep 2009 09:46:17 +0000 Subject: [PATCH] SetMagField and InitGRP will recreate the mag field according to GRP object, overriding existing/locked field. In a special expert mode one can enforce an external field by locking it and setting a special bit: AliMagF::SetBit(AliMagF::kOverrideGRP) --- STEER/AliGRPManager.cxx | 128 +++++++++++++++++++----------------- STEER/AliMagF.h | 1 + STEER/AliReconstruction.cxx | 13 +++- 3 files changed, 79 insertions(+), 63 deletions(-) diff --git a/STEER/AliGRPManager.cxx b/STEER/AliGRPManager.cxx index 386e3888979..5d1d26e4632 100644 --- a/STEER/AliGRPManager.cxx +++ b/STEER/AliGRPManager.cxx @@ -107,72 +107,78 @@ Bool_t AliGRPManager::SetMagField() // Set the global mag field instance if ( TGeoGlobalMagField::Instance()->IsLocked() ) { - AliInfo("Running with the externally locked B field !"); - } - else { - // Construct the field map out of the information retrieved from GRP. - Bool_t ok = kTRUE; - // L3 - Float_t l3Current = fGRPData->GetL3Current((AliGRPObject::Stats)0); - if (l3Current == AliGRPObject::GetInvalidFloat()) { - AliError("GRP/GRP/Data entry: missing value for the L3 current !"); - ok = kFALSE; - } - - Char_t l3Polarity = fGRPData->GetL3Polarity(); - if (l3Polarity == AliGRPObject::GetInvalidChar()) { - AliError("GRP/GRP/Data entry: missing value for the L3 polarity !"); - ok = kFALSE; - } - - // Dipole - Float_t diCurrent = fGRPData->GetDipoleCurrent((AliGRPObject::Stats)0); - if (diCurrent == AliGRPObject::GetInvalidFloat()) { - AliError("GRP/GRP/Data entry: missing value for the dipole current !"); - ok = kFALSE; - } - - Char_t diPolarity = fGRPData->GetDipolePolarity(); - if (diPolarity == AliGRPObject::GetInvalidChar()) { - AliError("GRP/GRP/Data entry: missing value for the dipole polarity !"); - ok = kFALSE; + if (TGeoGlobalMagField::Instance()->GetField()->TestBit(AliMagF::kOverrideGRP)) { + AliInfo("ExpertMode!!! GRP information will be ignored !"); + AliInfo("ExpertMode!!! Running with the externally locked B field !"); + return kTRUE; } - - TString beamType = fGRPData->GetBeamType(); - if (beamType==AliGRPObject::GetInvalidString()) { - AliError("GRP/GRP/Data entry: missing value for the beam type ! Using UNKNOWN"); - beamType = "UNKNOWN"; - //ok = kFALSE; // temprorary suppressed to make read cosmics data - } - - Float_t beamEnergy = fGRPData->GetBeamEnergy(); - if (beamEnergy==AliGRPObject::GetInvalidFloat()) { - AliError("GRP/GRP/Data entry: missing value for the beam energy ! Using 0"); - beamEnergy = 0; - //ok = kFALSE; // temprorary suppressed to make read cosmics data + else { + AliInfo("Destroying existing B field instance!"); + delete TGeoGlobalMagField::Instance(); } - // LHC: "multiply by 120 to get the energy in MeV" - beamEnergy *= 0.120; + } + // + // Construct the field map out of the information retrieved from GRP. + Bool_t ok = kTRUE; + // L3 + Float_t l3Current = fGRPData->GetL3Current((AliGRPObject::Stats)0); + if (l3Current == AliGRPObject::GetInvalidFloat()) { + AliError("GRP/GRP/Data entry: missing value for the L3 current !"); + ok = kFALSE; + } - // read special bits for the polarity convention and map type - Int_t polConvention = fGRPData->IsPolarityConventionLHC() ? AliMagF::kConvLHC : AliMagF::kConvDCS2008; - Bool_t uniformB = fGRPData->IsUniformBMap(); - - if (ok) { - if ( !SetFieldMap(l3Current, diCurrent, l3Polarity ? -1:1, diPolarity ? -1:1, - polConvention,uniformB,beamEnergy, beamType.Data())) { - AliError("Failed to create a B field map !"); - ok = kFALSE; - } - AliInfo("Running with the B field constructed out of GRP !"); - } - else { - AliError("B field is neither set nor constructed from GRP ! Exitig..."); + Char_t l3Polarity = fGRPData->GetL3Polarity(); + if (l3Polarity == AliGRPObject::GetInvalidChar()) { + AliError("GRP/GRP/Data entry: missing value for the L3 polarity !"); + ok = kFALSE; + } + + // Dipole + Float_t diCurrent = fGRPData->GetDipoleCurrent((AliGRPObject::Stats)0); + if (diCurrent == AliGRPObject::GetInvalidFloat()) { + AliError("GRP/GRP/Data entry: missing value for the dipole current !"); + ok = kFALSE; + } + + Char_t diPolarity = fGRPData->GetDipolePolarity(); + if (diPolarity == AliGRPObject::GetInvalidChar()) { + AliError("GRP/GRP/Data entry: missing value for the dipole polarity !"); + ok = kFALSE; + } + + TString beamType = fGRPData->GetBeamType(); + if (beamType==AliGRPObject::GetInvalidString()) { + AliError("GRP/GRP/Data entry: missing value for the beam type ! Using UNKNOWN"); + beamType = "UNKNOWN"; + //ok = kFALSE; // temprorary suppressed to make read cosmics data + } + + Float_t beamEnergy = fGRPData->GetBeamEnergy(); + if (beamEnergy==AliGRPObject::GetInvalidFloat()) { + AliError("GRP/GRP/Data entry: missing value for the beam energy ! Using 0"); + beamEnergy = 0; + //ok = kFALSE; // temprorary suppressed to make read cosmics data + } + // LHC: "multiply by 120 to get the energy in MeV" + beamEnergy *= 0.120; + + // read special bits for the polarity convention and map type + Int_t polConvention = fGRPData->IsPolarityConventionLHC() ? AliMagF::kConvLHC : AliMagF::kConvDCS2008; + Bool_t uniformB = fGRPData->IsUniformBMap(); + + if (ok) { + if ( !SetFieldMap(l3Current, diCurrent, l3Polarity ? -1:1, diPolarity ? -1:1, + polConvention,uniformB,beamEnergy, beamType.Data())) { + AliError("Failed to create a B field map !"); + ok = kFALSE; } - return ok; + else AliInfo("Running with the B field constructed out of GRP !"); } - - return kTRUE; + else { + AliError("B field is neither set nor constructed from GRP ! Exitig..."); + } + + return ok; } //_____________________________________________________________________________ diff --git a/STEER/AliMagF.h b/STEER/AliMagF.h index 1085a3498ba..ecea50f5e20 100644 --- a/STEER/AliMagF.h +++ b/STEER/AliMagF.h @@ -21,6 +21,7 @@ class AliMagF : public TVirtualMagField enum BMap_t {k2kG, k5kG, k5kGUniform}; enum BeamType_t {kBeamTypeAA, kBeamTypepp, kNoBeamField}; enum PolarityConvention_t {kConvLHC,kConvDCS2008,kConvMap2005}; + enum {kOverrideGRP=BIT(14)}; // don't recreate from GRP if set // AliMagF(); AliMagF(const char *name, const char* title, Int_t integ, diff --git a/STEER/AliReconstruction.cxx b/STEER/AliReconstruction.cxx index 3a1f7845c39..f360cc3deb3 100644 --- a/STEER/AliReconstruction.cxx +++ b/STEER/AliReconstruction.cxx @@ -1097,8 +1097,17 @@ Bool_t AliReconstruction::InitGRP() { AliInfo("==================================================================================="); //*** Dealing with the magnetic field map - if ( TGeoGlobalMagField::Instance()->IsLocked() ) {AliInfo("Running with the externally locked B field !");} - else { + if ( TGeoGlobalMagField::Instance()->IsLocked() ) { + if (TGeoGlobalMagField::Instance()->GetField()->TestBit(AliMagF::kOverrideGRP)) { + AliInfo("ExpertMode!!! GRP information will be ignored !"); + AliInfo("ExpertMode!!! Running with the externally locked B field !"); + } + else { + AliInfo("Destroying existing B field instance!"); + delete TGeoGlobalMagField::Instance(); + } + } + if ( !TGeoGlobalMagField::Instance()->IsLocked() ) { // Construct the field map out of the information retrieved from GRP. Bool_t ok = kTRUE; // L3 -- 2.43.0