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