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