From 0a6c54a10fce86a62cb6f8f8f36b8ecdd8ffa811 Mon Sep 17 00:00:00 2001 From: marian Date: Fri, 30 Apr 2010 08:54:55 +0000 Subject: [PATCH] Example/standard macro to initialize TPC OCDB entries from AliEn OCDB Marian --- TPC/macros/ConfigOCDBAlien.C | 76 ++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 TPC/macros/ConfigOCDBAlien.C diff --git a/TPC/macros/ConfigOCDBAlien.C b/TPC/macros/ConfigOCDBAlien.C new file mode 100644 index 00000000000..3502b9216b3 --- /dev/null +++ b/TPC/macros/ConfigOCDBAlien.C @@ -0,0 +1,76 @@ +// +// Macro to Setup OCDB +// This is just example macro - using the alien OCDB +// Responsible: marian.ivanov@cern.ch +// To be used: +// 1. Before invocation of the calibration - in the calibration trains +// 2. To setup calibration viewer. +// +// ConfigOCDB - setup default and specific data storage +// SetupCustom - user sepcific configuration +// - Values in local cache of OCDB are overwritten + + + +void SetupCustom(Int_t run); + +void ConfigOCDBAlien(Int_t crun=-1){ + // + TGrid * alien = TGrid::Connect("alien://",0,0,"t"); + printf("SETUP OCBD for TPC\n"); + // + AliCDBManager::Instance()->SetDefaultStorage("raw://"); + + Int_t run =crun; + if (run<0) run =0; + AliCDBManager::Instance()->SetRun(run); + AliTPCcalibDB::Instance()->SetRun(run); + SetupCustom(run); +} + + +void SetupCustom(Int_t run){ + // + // + // Custom part - to be empty once we are happy with the calibration + // + // + // Setup magnetic field - In future this should be part of GRP functionality + // + AliGRPObject *grp = AliTPCcalibDB::GetGRP(run); + Float_t current = 0; + Float_t bz = 0; + if (grp){ + current = grp->GetL3Current((AliGRPObject::Stats)0); + bz = 5*current/30000.; + printf("Run%d\tL3 current%f\tBz\t%f\n",run,current,bz); + } + else{ + printf("Run%d\tL3 current%f\tBz\t%f\n",run,current,bz); + } + AliMagF::BMap_t smag = AliMagF::k5kG; + Double_t bzfac = bz/5; + Double_t bzfacOrig=bzfac; + if (TMath::Abs(bzfac)<0.01) { // force default magnetic field if 0 field used + bzfac=1; + bz=5; + } + AliMagF * magF = new AliMagF("Maps","Maps", 2, bzfac, 1., smag); + TGeoGlobalMagField::Instance()->SetField(magF); + printf("\n\nSET EXB FIELD\t\n\n"); + AliTPCcalibDB::Instance()->SetExBField(magF); + + AliTPCClusterParam * paramCl = AliTPCcalibDB::Instance()->GetClusterParam(); + AliTPCParam * paramTPC = AliTPCcalibDB::Instance()->GetParameters(); + paramCl->SetInstance(paramCl); + + if (TMath::Abs(bzfacOrig)<0.05){ + tpcRecoParam->SetUseExBCorrection(kFALSE); + } + // + // + // + printf("END of SETUP OCBD for TPC\n"); +} + + -- 2.43.0