2 macro to extract the OCDB entries
4 input: CalibObjects.root
5 ouput: TimeGain and TimeVdrift calibration objects for TPC and TRD
8 .L $ALICE_ROOT/PWGPP/CalibMacros/CPass1/makeOCDB.C
13 //__________________________________________________________________
15 void makeOCDB(TString runNumberString, TString ocdbStorage = "")
17 makeOCDB("CalibObjects.root", "ALL", runNumberString, ocdbStorage);
20 //___________________________________________________________________
22 void makeOCDB(const Char_t *filename, TString component, TString runNumberString, TString ocdbStorage = "")
25 // extract TPC OCDB entries
27 gROOT->Macro("$ALICE_ROOT/PWGPP/CalibMacros/CPass1/LoadLibraries.C");
28 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/CalibMacros/CPass1/ConfigCalibTrain.C");
30 // switch off log info
31 AliLog::SetClassDebugLevel("AliESDEvent",0);
34 Int_t runNumber = runNumberString.Atoi();
35 printf("runNumber from runCalibTrain = %d\n",runNumber);
37 /* configCalibTrain only if needed */
38 if (component == "TPC" || component == "TRD" || component == "ALL")
39 ConfigCalibTrain(runNumber, "raw://");
41 AliCDBManager::Instance()->SetDefaultStorage("raw://");
43 // Steering Tasks - set output storage
44 // DefaultStorage set already before - in ConfigCalibTrain.C
45 //ocdbStorage+="?se=ALICE::CERN::SE";
47 AliCDBManager::Instance()->SetSpecificStorage("*/*/*",ocdbStorage.Data());
50 if (ocdbStorage.Length()==0) ocdbStorage+="local://"+gSystem->GetFromPipe("pwd")+"/OCDB";
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);
65 gSystem->Exec(Form("touch %s_ocdb_done", component.Data()));
69 //___________________________________________________________________
71 void makeOCDB_TPC(const Char_t *filename, Int_t runNumber, TString ocdbStorage)
75 TFile fcalib(filename);
76 AliTPCPreprocessorOffline proces;
78 // switch on parameter validation
79 proces.SetTimeGainRange(0.5,3.0);
80 proces.SwitchOnValidation();
82 // Make timegain calibration
83 //proces.CalibTimeGain(filename, runNumber,AliCDBRunRange::Infinity(),ocdbStorage);
84 proces.CalibTimeGain(filename, runNumber,runNumber,ocdbStorage);
86 // Make vdrift calibration
87 //proces.CalibTimeVdrift(filename,runNumber,AliCDBRunRange::Infinity(),ocdbStorage);
88 proces.CalibTimeVdrift(filename,runNumber,runNumber,ocdbStorage);
92 //___________________________________________________________________
94 void makeOCDB_TOF(const Char_t *filename, Int_t runNumber, TString ocdbStorage)
96 AliTOFAnalysisTaskCalibPass0 calibTask;
97 Printf("Calibrating TOF");
98 calibTask.ProcessOutput(filename, ocdbStorage);
101 //___________________________________________________________________
103 void makeOCDB_T0(const Char_t *filename, Int_t runNumber, TString ocdbStorage)
106 AliT0PreprocessorOffline procesT0;
107 // Make calibration of channels offset
108 procesT0.Process(filename,runNumber, runNumber, ocdbStorage);
111 //___________________________________________________________________
113 void makeOCDB_TRD(const Char_t *filename, Int_t runNumber, TString ocdbStorage)
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();
136 //___________________________________________________________________
138 void makeOCDB_MeanVertex(const Char_t *filename, Int_t runNumber, TString ocdbStorage)
141 AliMeanVertexPreprocessorOffline procesMeanVtx;
142 procesMeanVtx.ProcessOutput(filename, ocdbStorage, runNumber);
145 //___________________________________________________________________