From 61807e094c3a4cef4132f7c7a57fde91fb66f6e3 Mon Sep 17 00:00:00 2001 From: belikov Date: Wed, 25 Jun 2008 11:26:41 +0000 Subject: [PATCH] Creating the magnetic field map out of the information stored in GRP. --- STEER/AliReconstruction.cxx | 227 +++++++++++++++++++++++------------- STEER/AliReconstruction.h | 22 +++- 2 files changed, 163 insertions(+), 86 deletions(-) diff --git a/STEER/AliReconstruction.cxx b/STEER/AliReconstruction.cxx index f95c7be23b2..bb0bbf1d95e 100644 --- a/STEER/AliReconstruction.cxx +++ b/STEER/AliReconstruction.cxx @@ -202,6 +202,7 @@ AliReconstruction::AliReconstruction(const char* gAliceFilename, TNamed(name, title), fUniformField(kFALSE), + fForcedFieldMap(0x0), fRunVertexFinder(kTRUE), fRunVertexFinderTracks(kTRUE), fRunHLTTracking(kFALSE), @@ -293,6 +294,7 @@ AliReconstruction::AliReconstruction(const AliReconstruction& rec) : TNamed(rec), fUniformField(rec.fUniformField), + fForcedFieldMap(0x0), fRunVertexFinder(rec.fRunVertexFinder), fRunVertexFinderTracks(rec.fRunVertexFinderTracks), fRunHLTTracking(rec.fRunHLTTracking), @@ -381,6 +383,8 @@ AliReconstruction::AliReconstruction(const AliReconstruction& rec) : for (Int_t i = 0; i < rec.fSpecCDBUri.GetEntriesFast(); i++) { if (rec.fSpecCDBUri[i]) fSpecCDBUri.Add(rec.fSpecCDBUri[i]->Clone()); } + + fForcedFieldMap=new AliMagWrapCheb(*((AliMagWrapCheb*)rec.fForcedFieldMap)); } //_____________________________________________________________________________ @@ -401,6 +405,7 @@ AliReconstruction::~AliReconstruction() CleanUp(); fOptions.Delete(); fSpecCDBUri.Delete(); + delete fForcedFieldMap; AliCodeTimer::Instance()->Print(); } @@ -643,6 +648,146 @@ void AliReconstruction::SetOption(const char* detector, const char* option) fOptions.Add(new TNamed(detector, option)); } +//_____________________________________________________________________________ +Bool_t AliReconstruction::ForceFieldMap(Float_t l3Current, Float_t diCurrent, Float_t factor, Char_t *path) { + //------------------------------------------------ + // The magnetic field map, defined externally... + // L3 current 30000 A -> 0.5 T + // L3 current 12000 A -> 0.2 T + // dipole current 6000 A + // The polarities must be the same + //------------------------------------------------ + const Float_t l3NominalCurrent1=30000.; // (A) + const Float_t l3NominalCurrent2=12000.; // (A) + const Float_t diNominalCurrent =6000. ; // (A) + + const Float_t tolerance=0.03; // relative current tolerance + const Float_t zero=77.; // "zero" current (A) + + Int_t map=0; + Bool_t dipoleON=kFALSE; + + TString s=(l3Current < 0) ? "L3: -" : "L3: +"; + + if (TMath::Abs(l3Current-l3NominalCurrent1)/l3NominalCurrent1 < tolerance) { + map=AliMagWrapCheb::k5kG; + s+="0.5 T; "; + } else + if (TMath::Abs(l3Current-l3NominalCurrent2)/l3NominalCurrent2 < tolerance) { + map=AliMagWrapCheb::k2kG; + s+="0.2 T; "; + } else + if (TMath::Abs(l3Current) < zero) { + map=AliMagWrapCheb::k2kG; + s+="0.0 T; "; + factor=0.; // in fact, this is a global factor... + } else { + AliError("Wrong L3 current !"); + return kFALSE; + } + + if (TMath::Abs(diCurrent-diNominalCurrent)/diNominalCurrent < tolerance) { + // 3% current tolerance... + dipoleON=kTRUE; + s+="Dipole ON"; + } else + if (TMath::Abs(diCurrent) < zero) { // some small current.. + dipoleON=kFALSE; + s+="Dipole OFF"; + } else { + AliError("Wrong dipole current !"); + return kFALSE; + } + + delete fForcedFieldMap; + fForcedFieldMap= + new AliMagWrapCheb("B field map ",s,2,factor,10.,map,dipoleON,path); + + fForcedFieldMap->Print(); + + AliTracker::SetFieldMap(fForcedFieldMap,fUniformField); + + return kTRUE; +} + + +Bool_t AliReconstruction::InitGRP() { + //------------------------------------ + // Initialization of the GRP entry + //------------------------------------ + AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/GRP/Data"); + + if (entry) fGRPData = dynamic_cast(entry->GetObject()); + + if (!fGRPData) { + AliError("No GRP entry found in OCDB!"); + return kFALSE; + } + + + //*** Dealing with the magnetic field map + if (AliTracker::GetFieldMap()) { + AliInfo("Running with the externally set B field !"); + } else { + // Construct the field map out of the information retrieved from GRP. + + // L3 + TObjString *l3Current= + dynamic_cast(fGRPData->GetValue("fL3Current")); + if (!l3Current) { + AliError("GRP/GRP/Data entry: missing value for the L3 current !"); + return kFALSE; + } + TObjString *l3Polarity= + dynamic_cast(fGRPData->GetValue("fL3Polarity")); + if (!l3Polarity) { + AliError("GRP/GRP/Data entry: missing value for the L3 polarity !"); + return kFALSE; + } + + // Dipole + TObjString *diCurrent= + dynamic_cast(fGRPData->GetValue("fDipoleCurrent")); + if (!diCurrent) { + AliError("GRP/GRP/Data entry: missing value for the dipole current !"); + return kFALSE; + } + TObjString *diPolarity= + dynamic_cast(fGRPData->GetValue("fDipolePolarity")); + if (!diPolarity) { + AliError("GRP/GRP/Data entry: missing value for the dipole polarity !"); + return kFALSE; + } + + Float_t l3Cur=atof(l3Current->GetName()); + Float_t diCur=atof(diCurrent->GetName()); + + if (!ForceFieldMap(l3Cur, diCur)) { + AliFatal("Failed to creat a B field map ! Crashing..."); + } + + AliInfo("Running with the B field constructed out of GRP !"); + } + + + //*** Get the diamond profile from OCDB + entry = AliCDBManager::Instance()->Get("GRP/Calib/MeanVertex"); + if (entry) { + fDiamondProfile = dynamic_cast (entry->GetObject()); + } else { + AliError("No diamond profile found in OCDB!"); + } + + entry = AliCDBManager::Instance()->Get("GRP/Calib/MeanVertexTPC"); + if (entry) { + fDiamondProfileTPC = dynamic_cast (entry->GetObject()); + } else { + AliError("No diamond profile found in OCDB!"); + } + + return kTRUE; +} + //_____________________________________________________________________________ Bool_t AliReconstruction::Run(const char* input) { @@ -728,88 +873,8 @@ Bool_t AliReconstruction::InitRun(const char* input) AliSysInfo::AddStamp("LoadGeom"); - // Get the GRP CDB entry - AliCDBEntry* entryGRP = AliCDBManager::Instance()->Get("GRP/GRP/Data"); - - if (entryGRP) - fGRPData = dynamic_cast(entryGRP->GetObject()); - - if (!fGRPData) { - AliError("No GRP entry found in OCDB!"); - return kFALSE; - } - + if (!InitGRP()) return kFALSE; - // Magnetic field map - if (!AliTracker::GetFieldMap()) { - // Construct the field map out of the information retrieved from GRP. - // - // For the moment, this is a dummy piece of code. - // The actual map is expected to be already created in rec.C ! - // - - Float_t factor=1.; - Int_t map=AliMagWrapCheb::k5kG; - Bool_t dipoleON=kTRUE; - - // L3 - TObjString *l3Current= - dynamic_cast(fGRPData->GetValue("fL3Current")); - if (!l3Current) { - AliError("GRP/GRP/Data entry: missing value for the L3 current !"); - return kFALSE; - } - TObjString *l3Polarity= - dynamic_cast(fGRPData->GetValue("fL3Polarity")); - if (!l3Polarity) { - AliError("GRP/GRP/Data entry: missing value for the L3 polarity !"); - return kFALSE; - } - - // Dipole - TObjString *diCurrent= - dynamic_cast(fGRPData->GetValue("fDipoleCurrent")); - if (!diCurrent) { - AliError("GRP/GRP/Data entry: missing value for the dipole current !"); - return kFALSE; - } - TObjString *diPolarity= - dynamic_cast(fGRPData->GetValue("fDipolePolarity")); - if (!diPolarity) { - AliError("GRP/GRP/Data entry: missing value for the dipole polarity !"); - return kFALSE; - } - - - AliMagF *field= - new AliMagWrapCheb("Maps","Maps",2,factor,10.,map,dipoleON); - AliTracker::SetFieldMap(field,fUniformField); - - //Temporary measure - AliFatal("Please, provide the field map ! Crashing deliberately..."); - - } - - - // Get the diamond profile from OCDB - AliCDBEntry* entry = AliCDBManager::Instance() - ->Get("GRP/Calib/MeanVertex"); - - if(entry) { - fDiamondProfile = dynamic_cast (entry->GetObject()); - } else { - AliError("No diamond profile found in OCDB!"); - } - - entry = 0; - entry = AliCDBManager::Instance() - ->Get("GRP/Calib/MeanVertexTPC"); - - if(entry) { - fDiamondProfileTPC = dynamic_cast (entry->GetObject()); - } else { - AliError("No diamond profile found in OCDB!"); - } ftVertexer = new AliVertexerTracks(AliTracker::GetBz()); if(fDiamondProfile && fMeanVertexConstraint) ftVertexer->SetVtxStart(fDiamondProfile); diff --git a/STEER/AliReconstruction.h b/STEER/AliReconstruction.h index 2bac1c962f7..66fc9eea7b6 100644 --- a/STEER/AliReconstruction.h +++ b/STEER/AliReconstruction.h @@ -26,6 +26,7 @@ class AliRunLoader; class AliRawReader; class AliLoader; class AliTracker; +class AliMagF; class AliVertexer; class AliESDVertex; class AliESDEvent; @@ -42,8 +43,6 @@ public: AliReconstruction(const char* gAliceFilename = "galice.root", const char* name = "AliReconstruction", const char* title = "reconstruction"); - AliReconstruction(const AliReconstruction& rec); - AliReconstruction& operator = (const AliReconstruction& rec); virtual ~AliReconstruction(); void SetGAliceFile(const char* fileName); @@ -74,8 +73,14 @@ public: TNamed *CopyFileToTNamed(TString fPath,TString fName); void TNamedToFile(TTree* fTree, TString fName); - //*** Global reconstruction flag setters + //*** Magnetic field setters void SetUniformFieldTracking(Bool_t flag=kTRUE){fUniformField=flag;} + Bool_t + ForceFieldMap(Float_t l3Current=30000., Float_t diCurrent=6000., + Float_t factor=1., + Char_t *path="$(ALICE_ROOT)/data/maps/mfchebKGI_meas.root"); + + //*** Global reconstruction flag setters void SetRunVertexFinder(Bool_t flag=kTRUE) {fRunVertexFinder=flag;}; void SetRunVertexFinderTracks(Bool_t flag=kTRUE) {fRunVertexFinderTracks=flag;}; void SetRunHLTTracking(Bool_t flag=kTRUE) {fRunHLTTracking=flag;}; @@ -135,7 +140,11 @@ public: void SetRunPlaneEff(Bool_t flag=kFALSE) {fRunPlaneEff = flag;} private: + AliReconstruction(const AliReconstruction& rec); + AliReconstruction& operator = (const AliReconstruction& rec); + void InitCDB(); + Bool_t InitGRP(); void SetCDBLock(); Bool_t SetRunNumberFromData(); Bool_t RunLocalReconstruction(const TString& detectors); @@ -176,8 +185,11 @@ private: Bool_t InitAliEVE(); void RunAliEVE(); - //*** Global reconstruction flags ******************* + //*** Magnetic field map settings ******************* Bool_t fUniformField; // uniform field tracking flag + AliMagF *fForcedFieldMap; // independent, not GRP, field map + + //*** Global reconstruction flags ******************* Bool_t fRunVertexFinder; // run the vertex finder Bool_t fRunVertexFinderTracks; // run the vertex finder with tracks Bool_t fRunHLTTracking; // run the HLT tracking @@ -264,7 +276,7 @@ private: Bool_t fIsNewRunLoader; // galice.root created from scratch (real raw data case) Bool_t fRunAliEVE; // Run AliEVE or not - ClassDef(AliReconstruction, 23) // class for running the reconstruction + ClassDef(AliReconstruction, 24) // class for running the reconstruction }; #endif -- 2.39.3