]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/macros/ConfigOCDB.C
doxy: TPC/macros root converted
[u/mrichter/AliRoot.git] / TPC / macros / ConfigOCDB.C
1 /// \file ConfigOCDB.C
2 ///
3 /// Macro to Setup OCDB
4 /// This is just example macro
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 ConfigOCDB(Int_t crun=-1){
19   ///
20
21   printf("SETUP OCBD for TPC\n");
22   //
23   AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
24   AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/Parameters","local://$ALICE_ROOT/OCDB");
25   AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/ClusterParam","local:///u/miranov/OCDB/TPCcosmic2/");
26   AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/PadTime0","local://$ALICE_ROOT/OCDB");
27   AliCDBManager::Instance()->SetSpecificStorage("GRP/GRP/Data","local:///lustre/alice/alien/alice/data/2009/OCDB/");
28   AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/Temperature","local:///lustre/alice/alien/alice/data/2009/OCDB/");
29   AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/Goofie","local:///lustre/alice/alien/alice/data/2009/OCDB/");
30   AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/HighVoltage","local:///lustre/alice/alien/alice/data/2009/OCDB/");
31   Int_t run =crun;
32   if (run<0) run =0;
33   AliCDBManager::Instance()->SetRun(run);
34   SetupCustom(run);
35 }
36
37
38 void SetupCustom(Int_t run){
39   /// Custom part - to be empty once we are happy with the calibration
40   ///
41   /// Setup magnetic field
42
43   AliGRPObject *grp = AliTPCcalibDB::GetGRP(run);
44   Float_t current = 0;
45   Float_t bz      = 0;
46   if (grp){
47     current = grp->GetL3Current((AliGRPObject::Stats)0);
48     bz = 5*current/30000.;
49     printf("Run%d\tL3 current%f\tBz\t%f\n",run,current,bz);
50   }
51   else{
52     printf("Run%d\tL3 current%f\tBz\t%f\n",run,current,bz);
53   }
54   AliMagF::BMap_t smag = AliMagF::k5kG;
55   Double_t bzfac = bz/5;
56   if (bzfac==0) {  // force default magnetic field if 0 field used
57     bzfac=1;
58     bz=5;
59   }
60   TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", bzfac, 1., smag));
61
62   printf("\n\nSET EXB FIELD\t%f\n\n", -bz);
63   AliTPCcalibDB::Instance()->SetExBField(-bz);
64   //
65   //
66   // import geometry
67   //
68   //
69   TGeoManager::Import("/u/miranov/proof/geometry.root");
70   AliGeomManager::LoadGeometry("/u/miranov/proof/geometry.root");
71
72   AliTPCClusterParam * paramCl = AliTPCcalibDB::Instance()->GetClusterParam(); 
73   AliTPCParam   * paramTPC = AliTPCcalibDB::Instance()->GetParameters();
74   paramCl->SetInstance(paramCl);
75
76   //
77   // Setup reco param
78   //
79   AliTPCTransform *transform     = AliTPCcalibDB::Instance()->GetTransform() ;
80   AliTPCRecoParam * tpcRecoParam = AliTPCRecoParam::GetCosmicTestParam(kTRUE);
81   transform->SetCurrentRecoParam(tpcRecoParam);
82   tpcRecoParam->SetUseRPHICorrection(kTRUE);
83   //
84   tpcRecoParam->SetUseRadialCorrection(kFALSE);
85   tpcRecoParam->SetUseQuadrantAlignment(kTRUE);
86   //
87   tpcRecoParam->SetUseSectorAlignment(kFALSE);
88   tpcRecoParam->SetUseDriftCorrectionTime(kFALSE);
89   tpcRecoParam->SetUseDriftCorrectionGY(kTRUE);
90   tpcRecoParam->SetUseGainCorrectionTime(kFALSE);
91   tpcRecoParam->SetUseFieldCorrection(kFALSE);
92   tpcRecoParam->SetUseExBCorrection(kTRUE);
93   //
94   //
95   //
96   TFile fposcor("~/OCDB/calibUnlin.root");
97   AliTPCPointCorrection *pcorr = fposcor.Get("correction");
98   if (pcorr) pcorr->SetInstance(pcorr); 
99   //
100   //
101   //
102   printf("END of SETUP OCBD for TPC\n");
103 }
104
105