]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGPP/CalibMacros/CPass0/makeOCDB.byComponent.C
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGPP / CalibMacros / CPass0 / makeOCDB.byComponent.C
1 /*
2   macro to extract the OCDB entries
3
4   input: CalibObjects.root
5   ouput: TimeGain and TimeVdrift calibration objects for TPC and TRD
6
7   Example:
8   .L $ALICE_ROOT/PWGPP/CalibMacros/CPass0/makeOCDB.C
9   makeOCDB("105160");
10
11 */
12
13 //__________________________________________________________________
14
15 void makeOCDB(Int_t runNumber, TString ocdbStorage = "")
16 {
17   makeOCDB("CalibObjects.root", "ALL", runNumber, ocdbStorage);
18 }
19
20 //___________________________________________________________________
21
22 void makeOCDB(const Char_t *filename, TString component, Int_t runNumber, TString ocdbStorage = "")
23 {
24   //
25   // extract TPC OCDB entries
26   //
27   gROOT->Macro("$ALICE_ROOT/PWGPP/CalibMacros/CPass0/LoadLibraries.C");
28   gROOT->LoadMacro("$ALICE_ROOT/PWGPP/CalibMacros/CPass0/ConfigCalibTrain.C");
29
30   // switch off log info
31   AliLog::SetClassDebugLevel("AliESDEvent",0);
32
33   // config GRP
34   printf("runNumber from runCalibTrain = %d\n",runNumber);
35
36   /* configCalibTrain only if needed */
37   if (component == "TPC" || component == "TRD" || component == "ALL")
38     ConfigCalibTrain(runNumber, "raw://");
39   else
40     AliCDBManager::Instance()->SetDefaultStorage("raw://");
41   
42   // Steering Tasks - set output storage
43   // DefaultStorage set already before - in ConfigCalibTrain.C
44 //ocdbStorage+="?se=ALICE::CERN::SE";
45
46   AliCDBManager::Instance()->SetSpecificStorage("*/*/*",ocdbStorage.Data());
47
48   // set OCDB storage
49   if (ocdbStorage.Length()==0) ocdbStorage+="local://"+gSystem->GetFromPipe("pwd")+"/OCDB";
50
51   
52   /* makeOCDB for selected component */
53   if (component == "TPC" || component == "ALL")
54     makeOCDB_TPC(filename, runNumber, ocdbStorage);
55   if (component == "TOF" || component == "ALL")
56     makeOCDB_TOF(filename, runNumber, ocdbStorage);
57   if (component == "T0" || component == "ALL")
58     makeOCDB_T0(filename, runNumber, ocdbStorage);
59   if (component == "TRD" || component == "ALL")
60     makeOCDB_TRD(filename, runNumber, ocdbStorage);
61   if (component == "MeanVertex" || component == "ALL")
62     makeOCDB_MeanVertex(filename, runNumber, ocdbStorage);
63   
64   gSystem->Exec(Form("touch %s_ocdb_done", component.Data()));
65   return;
66 }
67
68 //___________________________________________________________________
69
70 void makeOCDB_TPC(const Char_t *filename, Int_t runNumber, TString ocdbStorage)
71 {
72
73   // TPC part
74   TFile fcalib(filename);
75   AliTPCPreprocessorOffline proces;
76
77   // switch on parameter validation
78   proces.SetTimeGainRange(0.5,3.0);
79   proces.SwitchOnValidation();
80
81   // Make timegain calibration
82   //proces.CalibTimeGain(filename, runNumber,AliCDBRunRange::Infinity(),ocdbStorage);
83   proces.CalibTimeGain(filename, runNumber,runNumber,ocdbStorage);
84
85   // Make vdrift calibration
86   //proces.CalibTimeVdrift(filename,runNumber,AliCDBRunRange::Infinity(),ocdbStorage);
87   proces.CalibTimeVdrift(filename,runNumber,runNumber,ocdbStorage);
88
89 }
90
91 //___________________________________________________________________
92
93 void makeOCDB_TOF(const Char_t *filename, Int_t runNumber, TString ocdbStorage)
94 {
95   AliTOFAnalysisTaskCalibPass0 calibTask;
96   Printf("Calibrating TOF");
97   calibTask.ProcessOutput(filename, ocdbStorage);
98 }
99
100 //___________________________________________________________________
101
102 void makeOCDB_T0(const Char_t *filename, Int_t runNumber, TString ocdbStorage)
103 {
104   // T0 part
105   AliT0PreprocessorOffline procesT0;
106   // Make  calibration of channels offset
107   procesT0.Process(filename,runNumber, runNumber, ocdbStorage);
108 }
109
110 //___________________________________________________________________
111
112 void makeOCDB_TRD(const Char_t *filename, Int_t runNumber, TString ocdbStorage)
113 {
114    //TRD part
115    AliTRDPreprocessorOffline procestrd;
116    procestrd.SetLinearFitForVdrift(kTRUE);
117    procestrd.SetMinStatsVdriftT0PH(600*10);
118    procestrd.SetMinStatsVdriftLinear(50);
119    procestrd.SetMinStatsGain(600);
120    procestrd.Init(filename);
121    Int_t versionVdriftUsed = procestrd.GetVersionVdriftUsed();
122    Int_t subversionVdriftUsed = procestrd.GetSubVersionVdriftUsed();
123    Int_t versionGainUsed = procestrd.GetVersionGainUsed();
124    Int_t subversionGainUsed = procestrd.GetSubVersionGainUsed();
125    Int_t versionExBUsed = procestrd.GetVersionExBUsed();
126    Int_t subversionExBUsed = procestrd.GetSubVersionExBUsed();
127    printf("version and subversion vdrift %d and %d\n",versionVdriftUsed,subversionVdriftUsed);
128    printf("version and subversion gain %d and %d\n",versionGainUsed,subversionGainUsed);
129    printf("version and subversion exb %d and %d\n",versionExBUsed,subversionExBUsed);
130    procestrd.Process(filename,runNumber,runNumber,ocdbStorage);
131    Int_t trdstatus = procestrd.GetStatus();
132
133 }
134
135 //___________________________________________________________________
136
137 void makeOCDB_MeanVertex(const Char_t *filename, Int_t runNumber, TString ocdbStorage)
138 {
139   //Mean Vertex
140   AliMeanVertexPreprocessorOffline procesMeanVtx;
141   procesMeanVtx.ProcessOutput(filename, ocdbStorage, runNumber);
142 }
143
144 //___________________________________________________________________
145