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