THIS IS EXAMPLE MACRO:
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 1 Oct 2009 10:04:14 +0000 (10:04 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 1 Oct 2009 10:04:14 +0000 (10:04 +0000)
Changes:
Dividing of the ConfigOCDB.C setup to the two setups

1. Standard (only SetDefault and SetSpecific storage)
2. Custom - Setup addtional parameters e.g RecoParam
            to swich ON/OFF different correction

(Marian)

TPC/macros/ConfigOCDB.C

index 1a9edd2..c68730b 100644 (file)
 //
-// Macro to be invoked before Calibration analysis 
-// Setup TPC OCDB entries
-// 
-// This is just example macro  - some path are hardwired
-//  TO BE MODIFIED BY USERS 
+// 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 ConfigOCDB(Float_t bfield){
+void SetupCustom(Int_t run);
+
+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
   //
-  TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 2, 1., 1., 10., AliMagF::k5kG));
+  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;
+  TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 2, bzfac, 1., 10., smag));
+
+  printf("\n\nSET EXB FIELD\t%f\n\n", -bz);
+  AliTPCcalibDB::Instance()->SetExBField(-bz);
   //
   //
+  // 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://$ALICE_ROOT/OCDB");
-  //  AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/PadTime0","local://$ALICE_ROOT/OCDB");
-  AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/PadTime0","local:///u/miranov/OCDB0");
-
-  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();
   paramCl->SetInstance(paramCl);
-  //paramTPC->Dump();
-  printf("\n\nSET EXB FIELD\t%f\n\n", bfield);
-  AliTPCcalibDB::Instance()->SetExBField(bfield);
+
   //
+  // 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");
 }
+
+