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