]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/macros/ConfigOCDB.C
doxy: all TPC/Cal converted
[u/mrichter/AliRoot.git] / TPC / macros / ConfigOCDB.C
index 829885f3fbb10bab2f5ce7f6b86991a1b2ff3530..5d5b81dc6a34a841f57366d3e8d0113afb1bc6a1 100644 (file)
 //
-// Macro to be invoked before analysis 
-// Setup TPC OCDB entries
-//
-// To be used on the proof
-//
+// Macro to Setup OCDB  
+// This is just example macro
+// 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 ConfigOCDB(){
+void ConfigOCDB(Int_t crun=-1){
   // 
+  printf("SETUP OCBD for TPC\n");
   //
-  // import geometry
-  //
+  AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+  AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/Parameters","local://$ALICE_ROOT/OCDB");
+  AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/ClusterParam","local:///u/miranov/OCDB/TPCcosmic2/");
+  AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/PadTime0","local://$ALICE_ROOT/OCDB");
+  AliCDBManager::Instance()->SetSpecificStorage("GRP/GRP/Data","local:///lustre/alice/alien/alice/data/2009/OCDB/");
+  AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/Temperature","local:///lustre/alice/alien/alice/data/2009/OCDB/");
+  AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/Goofie","local:///lustre/alice/alien/alice/data/2009/OCDB/");
+  AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/HighVoltage","local:///lustre/alice/alien/alice/data/2009/OCDB/");
+  Int_t run =crun;
+  if (run<0) run =0;
+  AliCDBManager::Instance()->SetRun(run);
+  SetupCustom(run);
+}
 
-  printf("SETUP OCBD for PROOF\n");
-  TGeoManager::Import("/u/miranov/proof/geometry.root");
-  AliGeomManager::LoadGeometry("/u/miranov/proof/geometry.root");
+
+void SetupCustom(Int_t run){
+  //
+  //
+  // Custom part - to be empty once we are happy with the calibration
   //
   //
   // Setup magnetic field
   //
-  AliMagF* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., AliMagFMaps::k5kG);
-  AliTracker::SetFieldMap(field,0);
+  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;
+  if (bzfac==0) {  // force default magnetic field if 0 field used
+    bzfac=1;
+    bz=5;
+  }
+  TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", bzfac, 1., smag));
+
+  printf("\n\nSET EXB FIELD\t%f\n\n", -bz);
+  AliTPCcalibDB::Instance()->SetExBField(-bz);
   //
   //
+  // import geometry
   //
-  AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-  AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/Parameters","local://$ALICE_ROOT");
-  AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/ClusterParam","local://$ALICE_ROOT");
-  AliCDBManager::Instance()->SetSpecificStorage("GRP/GRP/Data","local:///lustre_alpha/alice/alien/alice/data/2008/LHC08d/OCDB/");
-  AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/Temperature","local:///lustre_alpha/alice/alien/alice/data/2008/LHC08d/OCDB/");
-  AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/Goofie","local:///lustre_alpha/alice/alien/alice/data/2008/LHC08d/OCDB/");
-
-  AliCDBManager::Instance()->SetRun(1);
+  //
+  TGeoManager::Import("/u/miranov/proof/geometry.root");
+  AliGeomManager::LoadGeometry("/u/miranov/proof/geometry.root");
 
   AliTPCClusterParam * paramCl = AliTPCcalibDB::Instance()->GetClusterParam(); 
   AliTPCParam   * paramTPC = AliTPCcalibDB::Instance()->GetParameters();
-  AliTPCClusterParam::SetInstance(paramCl);
-  //paramTPC->Dump();
-  
-  AliTPCcalibDB::Instance()->SetExBField(0);
+  paramCl->SetInstance(paramCl);
+
   //
+  // Setup reco param
   //
+  AliTPCTransform *transform     = AliTPCcalibDB::Instance()->GetTransform() ;
+  AliTPCRecoParam * tpcRecoParam = AliTPCRecoParam::GetCosmicTestParam(kTRUE);
+  transform->SetCurrentRecoParam(tpcRecoParam);
+  tpcRecoParam->SetUseRPHICorrection(kTRUE);
   //
-  printf("END of SETUP OCBD for PROOF\n");
-}
-
-
-void ConfigAlien(){
+  tpcRecoParam->SetUseRadialCorrection(kFALSE);
+  tpcRecoParam->SetUseQuadrantAlignment(kTRUE);
   //
-  // Setup-activate alien
+  tpcRecoParam->SetUseSectorAlignment(kFALSE);
+  tpcRecoParam->SetUseDriftCorrectionTime(kFALSE);
+  tpcRecoParam->SetUseDriftCorrectionGY(kTRUE);
+  tpcRecoParam->SetUseGainCorrectionTime(kFALSE);
+  tpcRecoParam->SetUseFieldCorrection(kFALSE);
+  tpcRecoParam->SetUseExBCorrection(kTRUE);
   //
-
-  //myvar=342
-  //while [ $myvar -ne 360 ] ; do  echo enable alien on lxb$myvar; lsrun -m lxb$myvar  /u/miranov/.aliensetup;  myvar=$(( $myvar + 1 )) ; echo $myvar ; done 
-  gSystem->Exec("/u/miranov/.aliensetup >setup.log"); 
-  //ifstream in;
-  //in.open("path.txt");
-  
-  TString envString;
-  
-  gSystem->Setenv("LD_LIBRARY_PATH",envString.Data());
-  gSystem->Setenv("GBBOX_ENVFILE","/tmp/xxxxxxx");
-  printf("LOAD LIBRARIES start\n\n\n");
-  gSystem->Load("libANALYSIS.so");
-  gSystem->Load("libSTAT.so");
-  gSystem->Load("libTPCcalib.so");
-  //
-  gSystem->Load("libXrdClient.so");
-  gSystem->Load("libNetx.so");
-  printf("LOAD LIBRARIES end\n\n\n");
-  TGrid * alien = TGrid::Connect("alien://",0,0,"t");
-  if (alien) {
-    printf("Alien activated\n");
-  }else{
-    printf("Alien not activated\n");
-  }
+  //
+  //
+  TFile fposcor("~/OCDB/calibUnlin.root");
+  AliTPCPointCorrection *pcorr = fposcor.Get("correction");
+  if (pcorr) pcorr->SetInstance(pcorr); 
+  //
+  //
+  //
+  printf("END of SETUP OCBD for TPC\n");
 }
+
+