]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/macros/ConfigOCDBAlien.C
Extra header added to the list
[u/mrichter/AliRoot.git] / TPC / macros / ConfigOCDBAlien.C
1 /// \file ConfigOCDBAlien.C
2 ///
3 /// Macro to Setup OCDB
4 /// This is just example macro - using the alien OCDB
5 /// \author marian.ivanov@cern.ch
6 /// To be used:
7 /// 1. Before invocation of the calibration - in the calibration trains
8 /// 2. To setup calibration viewer.
9 ///
10 /// ConfigOCDB  - setup default and specific data storage
11 /// SetupCustom - user sepcific configuration
12 ///             - Values in local cache of OCDB are overwritten
13
14
15
16 void SetupCustom(Int_t run);
17
18 void ConfigOCDBAlien(Int_t crun=-1){
19   ///
20
21   TGrid * alien =     TGrid::Connect("alien://",0,0,"t"); 
22   printf("SETUP OCBD for TPC\n");
23   //
24   AliCDBManager::Instance()->SetDefaultStorage("raw://");
25    
26   Int_t run =crun;
27   if (run<0) run =0;
28   AliCDBManager::Instance()->SetRun(run);
29   AliTPCcalibDB::Instance()->SetRun(run);
30   SetupCustom(run);
31 }
32
33
34 void SetupCustom(Int_t run){
35   /// Custom part - to be empty once we are happy with the calibration
36   ///
37   /// Setup magnetic field - In future this should be part of GRP functionality
38
39   AliGRPObject *grp = AliTPCcalibDB::GetGRP(run);
40   Float_t current = 0;
41   Float_t bz      = 0;
42   if (grp){
43     current = grp->GetL3Current((AliGRPObject::Stats)0);
44     bz = 5*current/30000.;
45     printf("Run%d\tL3 current%f\tBz\t%f\n",run,current,bz);
46   }
47   else{
48     printf("Run%d\tL3 current%f\tBz\t%f\n",run,current,bz);
49   }
50   AliMagF::BMap_t smag = AliMagF::k5kG;
51   Double_t bzfac = bz/5;
52   Double_t bzfacOrig=bzfac;
53   if (TMath::Abs(bzfac)<0.01) {  // force default magnetic field if 0 field used
54     bzfac=1;
55     bz=5;
56   }
57   AliMagF * magF = new AliMagF("Maps","Maps", 2, bzfac, 1., smag);
58   TGeoGlobalMagField::Instance()->SetField(magF);
59   printf("\n\nSET EXB FIELD\t\n\n");
60   AliTPCcalibDB::Instance()->SetExBField(magF);
61   
62   AliTPCClusterParam * paramCl = AliTPCcalibDB::Instance()->GetClusterParam(); 
63   AliTPCParam   * paramTPC = AliTPCcalibDB::Instance()->GetParameters();
64   paramCl->SetInstance(paramCl);
65
66    if (TMath::Abs(bzfacOrig)<0.05){
67     tpcRecoParam->SetUseExBCorrection(kFALSE);
68   }
69   //
70   //
71   //
72    printf("END of SETUP OCBD for TPC\n");
73 }
74
75