From 1dd3d90e95e8e7d54865e6dff8617058a5615982 Mon Sep 17 00:00:00 2001 From: shahoian Date: Wed, 26 Aug 2009 17:36:35 +0000 Subject: [PATCH] Added to AliMagF the definition (const) of the polarities conventions. The GRP manager will read the recorded current signs and reject the combinations which do not satisfy to the convention used in AliMagF. The convention flag is set to LHC convention: L3 : pos. current -> negative Bz Dipole: neg. current -> negative Bz --- STEER/AliGRPManager.cxx | 8 +++-- STEER/AliMagF.cxx | 62 +++++++++++++++++++++++++++++++++++++ STEER/AliMagF.h | 13 +++++--- STEER/AliReconstruction.cxx | 9 ++++-- 4 files changed, 83 insertions(+), 9 deletions(-) diff --git a/STEER/AliGRPManager.cxx b/STEER/AliGRPManager.cxx index c191ea966ca..b8b9fc3bfad 100644 --- a/STEER/AliGRPManager.cxx +++ b/STEER/AliGRPManager.cxx @@ -253,8 +253,12 @@ Bool_t AliGRPManager::SetFieldMap(Float_t l3Cur, Float_t diCur, Float_t l3Pol, return kFALSE; } // - if (l3Pol!=diPol && (map==AliMagF::k5kG || map==AliMagF::k2kG) && fcDip!=0) { - AliError("L3 and Dipole polarities must be the same"); + if (fcDip!=0 && (map==AliMagF::k5kG || map==AliMagF::k2kG) && + ((AliMagF::GetPolarityConvention()==AliMagF::kConvMap2005 && l3Pol!=diPol) || + (AliMagF::GetPolarityConvention()==AliMagF::kConvDCS2008 && l3Pol==diPol) || + (AliMagF::GetPolarityConvention()==AliMagF::kConvLHC && l3Pol!=diPol)) ) { + AliError(Form("Wrong combination for L3/Dipole polarities (%c/%c) for convention %d", + l3Pol>0?'+':'-',diPol>0?'+':'-',AliMagF::GetPolarityConvention())); return kFALSE; } // diff --git a/STEER/AliMagF.cxx b/STEER/AliMagF.cxx index c99e898fd16..61b050a15f2 100644 --- a/STEER/AliMagF.cxx +++ b/STEER/AliMagF.cxx @@ -25,7 +25,25 @@ ClassImp(AliMagF) const Double_t AliMagF::fgkSol2DipZ = -700.; +const UShort_t AliMagF::fgkPolarityConvention = kConvLHC; +/* + Explanation for polarity conventions: these are the mapping between the + current signs and main field components in L3 (Bz) and Dipole (Bx) (in Alice frame) + 1) kConvMap2005: used for the field mapping in 2005 + positive L3 current -> negative Bz + positive Dip current -> positive Bx + 2) kConvMapDCS2008: defined by the microswitches/cabling of power converters as of 2008 - 1st half 2009 + positive L3 current -> positive Bz + positive Dip current -> positive Bx + 3) kConvLHC : defined by LHC + positive L3 current -> negative Bz + positive Dip current -> negative Bx + + Note: only "negative Bz(L3) with postive Bx(Dipole)" and its inverse was mapped in 2005. Hence + the GRP Manager will reject the runs with the current combinations (in the convention defined by the + static Int_t AliMagF::GetPolarityConvention()) which do not lead to such field polarities. +*/ //_______________________________________________________________________ AliMagF::AliMagF(): TVirtualMagField(), @@ -349,3 +367,47 @@ void AliMagF::GetTPCIntCyl(const Double_t *rphiz, Double_t *b) const for (int i=3;i--;) b[i] *= fFactorSol; } } + +//_______________________________________________________________________ +void AliMagF::SetFactorSol(Float_t fc) +{ + // set the sign/scale of the current in the L3 according to fgkPolarityConvention + switch (fgkPolarityConvention) { + case kConvDCS2008: fFactorSol = -fc; break; + case kConvLHC : fFactorSol = -fc; break; + default : fFactorSol = fc; break; // case kConvMap2005: fFactorSol = fc; break; + } +} + +//_______________________________________________________________________ +void AliMagF::SetFactorDip(Float_t fc) +{ + // set the sign*scale of the current in the Dipole according to fgkPolarityConvention + switch (fgkPolarityConvention) { + case kConvDCS2008: fFactorDip = fc; break; + case kConvLHC : fFactorDip = -fc; break; + default : fFactorDip = fc; break; // case kConvMap2005: fFactorDip = fc; break; + } +} + +//_______________________________________________________________________ +Double_t AliMagF::GetFactorSol() const +{ + // return the sign*scale of the current in the Dipole according to fgkPolarityConventionthe + switch (fgkPolarityConvention) { + case kConvDCS2008: return -fFactorSol; + case kConvLHC : return -fFactorSol; + default : return fFactorSol; // case kConvMap2005: return fFactorSol; + } +} + +//_______________________________________________________________________ +Double_t AliMagF::GetFactorDip() const +{ + // return the sign*scale of the current in the Dipole according to fgkPolarityConventionthe + switch (fgkPolarityConvention) { + case kConvDCS2008: return fFactorDip; + case kConvLHC : return -fFactorDip; + default : return fFactorDip; // case kConvMap2005: return fFactorDip; + } +} diff --git a/STEER/AliMagF.h b/STEER/AliMagF.h index b7694b3fdf7..b875756ce73 100644 --- a/STEER/AliMagF.h +++ b/STEER/AliMagF.h @@ -20,6 +20,7 @@ class AliMagF : public TVirtualMagField public: enum BMap_t {k2kG, k5kG, k5kGUniform}; enum BeamType_t {kBeamTypeAA, kBeamTypepp, kNoBeamField}; + enum PolarityConvention_t {kConvMap2005,kConvDCS2008,kConvLHC}; // AliMagF(); AliMagF(const char *name, const char* title, Int_t integ, @@ -39,10 +40,10 @@ class AliMagF : public TVirtualMagField AliMagWrapCheb* GetMeasuredMap() const {return fMeasuredMap;} // // former AliMagF methods or their aliases - void SetFactorSol(Float_t fc=1.) {fFactorSol = fc;} - void SetFactorDip(Float_t fc=1.) {fFactorDip = fc;} - Double_t GetFactorSol() const {return fFactorSol;} - Double_t GetFactorDip() const {return fFactorSol;} + void SetFactorSol(Float_t fc=1.); + void SetFactorDip(Float_t fc=1.); + Double_t GetFactorSol() const; + Double_t GetFactorDip() const; Double_t Factor() const {return GetFactorSol();} Bool_t IsUniform() const {return fMapType == k5kGUniform;} // @@ -61,6 +62,7 @@ class AliMagF : public TVirtualMagField void SetParamName(const Char_t* nm) {fParNames.SetTitle(nm);} // Bool_t LoadParameterization(); + static Int_t GetPolarityConvention() {return Int_t(fgkPolarityConvention);} // protected: // not supposed to be changed during the run, set only at the initialization via constructor @@ -90,7 +92,8 @@ class AliMagF : public TVirtualMagField // TNamed fParNames; // file and parameterization loadad // - static const Double_t fgkSol2DipZ; // conventional Z of transition from L3 to Dipole field + static const Double_t fgkSol2DipZ; // conventional Z of transition from L3 to Dipole field + static const UShort_t fgkPolarityConvention; // convention for the mapping of the curr.sign on main component sign // ClassDef(AliMagF, 2) // Class for all Alice MagField wrapper for measured data + Tosca parameterization }; diff --git a/STEER/AliReconstruction.cxx b/STEER/AliReconstruction.cxx index e8b44461256..ba6a391289d 100644 --- a/STEER/AliReconstruction.cxx +++ b/STEER/AliReconstruction.cxx @@ -961,8 +961,13 @@ Bool_t AliReconstruction::SetFieldMap(Float_t l3Cur, Float_t diCur, Float_t l3Po return kFALSE; } // - if (l3Pol!=diPol && (map==AliMagF::k5kG || map==AliMagF::k2kG) && fcDip!=0) { - AliError("L3 and Dipole polarities must be the same"); + // + if (fcDip!=0 && (map==AliMagF::k5kG || map==AliMagF::k2kG) && + ((AliMagF::GetPolarityConvention()==AliMagF::kConvMap2005 && l3Pol!=diPol) || + (AliMagF::GetPolarityConvention()==AliMagF::kConvDCS2008 && l3Pol==diPol) || + (AliMagF::GetPolarityConvention()==AliMagF::kConvLHC && l3Pol!=diPol)) ) { + AliError(Form("Wrong combination for L3/Dipole polarities (%c/%c) for convention %d", + l3Pol>0?'+':'-',diPol>0?'+':'-',AliMagF::GetPolarityConvention())); return kFALSE; } // -- 2.31.1