Default OCDB path as an argument for the macro
[u/mrichter/AliRoot.git] / PWGPP / CalibMacros / CPass0 / makeOCDB.C
CommitLineData
27eb9bff 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:
4c8432c7 8 .L $ALICE_ROOT/PWGPP/CalibMacros/CPass0/makeOCDB.C
27eb9bff 9 makeOCDB("105160");
10
11*/
12
7a569197 13void PrintDetectorStatus();
aa5ee6d0 14
15
16
e32aadf3 17void makeOCDB(TString runNumberString, TString ocdbStorage="", TString defaultOCDBstorage="raw://")
27eb9bff 18{
19 //
20 // extract TPC OCDB entries
21 //
cd9dc5c7 22 gROOT->Macro("$ALICE_ROOT/PWGPP/CalibMacros/CPass0/LoadLibraries.C");
23 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/CalibMacros/CPass0/ConfigCalibTrain.C");
27eb9bff 24
25 // switch off log info
26 AliLog::SetClassDebugLevel("AliESDEvent",0);
27
28 // config GRP
29 Int_t runNumber = runNumberString.Atoi();
30 printf("runNumber from runCalibTrain = %d\n",runNumber);
e32aadf3 31 ConfigCalibTrain(runNumber, defaultOCDBstorage.Data());
27eb9bff 32
33 // Steering Tasks - set output storage
34 // DefaultStorage set already before - in ConfigCalibTrain.C
35//ocdbStorage+="?se=ALICE::CERN::SE";
36
37 AliCDBManager::Instance()->SetSpecificStorage("*/*/*",ocdbStorage.Data());
9dec4b98 38AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/Correction","local://");
27eb9bff 39
40 // set OCDB storage
41 if (ocdbStorage.Length()==0) ocdbStorage+="local://"+gSystem->GetFromPipe("pwd")+"/OCDB";
42
43 // TPC part
44 TFile fcalib("CalibObjects.root");
aa5ee6d0 45 AliTPCPreprocessorOffline procesTPC;
27eb9bff 46
47 // switch on parameter validation
aa5ee6d0 48 procesTPC.SetTimeGainRange(0.5,3.0);
49 procesTPC.SwitchOnValidation();
27eb9bff 50
51 // Make timegain calibration
52 //proces.CalibTimeGain("CalibObjects.root", runNumber,AliCDBRunRange::Infinity(),ocdbStorage);
aa5ee6d0 53 procesTPC.CalibTimeGain("CalibObjects.root", runNumber,runNumber,ocdbStorage);
27eb9bff 54
55 // Make vdrift calibration
56 //proces.CalibTimeVdrift("CalibObjects.root",runNumber,AliCDBRunRange::Infinity(),ocdbStorage);
aa5ee6d0 57 procesTPC.CalibTimeVdrift("CalibObjects.root",runNumber,runNumber,ocdbStorage);
27eb9bff 58 //
59 // TOF part
60 //
61 AliTOFAnalysisTaskCalibPass0 calibTask;
62 Printf("Calibrating TOF");
63 calibTask.ProcessOutput("CalibObjects.root", ocdbStorage);
64//
65//
66
67// T0 part
68 AliT0PreprocessorOffline procesT0;
69 // Make calibration of channels offset
670bfb76 70 procesT0.setDArun(179000);
27eb9bff 71 procesT0.Process("CalibObjects.root",runNumber, runNumber, ocdbStorage);
72
73
74
75 //TRD part
76 AliTRDPreprocessorOffline procestrd;
77 procestrd.SetLinearFitForVdrift(kTRUE);
78 procestrd.SetMinStatsVdriftT0PH(600*10);
79 procestrd.SetMinStatsVdriftLinear(50);
80 procestrd.SetMinStatsGain(600);
a678fee7 81 procestrd.SetLimitValidateNoData(60);
82 procestrd.SetLimitValidateBadCalib(60);
27eb9bff 83 procestrd.SetAlternativeDriftVelocityFit(kTRUE);
84 procestrd.Init("CalibObjects.root");
85 Int_t versionVdriftUsed = procestrd.GetVersionVdriftUsed();
86 Int_t subversionVdriftUsed = procestrd.GetSubVersionVdriftUsed();
87 Int_t versionGainUsed = procestrd.GetVersionGainUsed();
88 Int_t subversionGainUsed = procestrd.GetSubVersionGainUsed();
89 Int_t versionExBUsed = procestrd.GetVersionExBUsed();
90 Int_t subversionExBUsed = procestrd.GetSubVersionExBUsed();
91 printf("version and subversion vdrift %d and %d\n",versionVdriftUsed,subversionVdriftUsed);
92 printf("version and subversion gain %d and %d\n",versionGainUsed,subversionGainUsed);
93 printf("version and subversion exb %d and %d\n",versionExBUsed,subversionExBUsed);
94 procestrd.Process("CalibObjects.root",runNumber,runNumber,ocdbStorage);
27eb9bff 95
96
aa5ee6d0 97 //Mean Vertex
98 AliMeanVertexPreprocessorOffline procesMeanVtx;
99 procesMeanVtx.ProcessOutput("CalibObjects.root", ocdbStorage, runNumber);
100
101 //
102 // Print calibration status into the stdout
103 //
104 Int_t trdStatus = procestrd.GetStatus();
105 Int_t tofStatus = calibTask.GetStatus();
33b4e178 106 Int_t t0Status = procesT0.GetStatus();
7a569197 107 Int_t tpcStatus = ((procesTPC.ValidateTimeDrift() || procesTPC.ValidateTimeGain())==kFALSE);
aa5ee6d0 108 //
109 printf("\n\n\n\n");
110 printf("CPass0 calibration status\n");
111 printf("TRD calibration status=%d\n",trdStatus);
112 printf("TOF calibration status=%d\n",tofStatus);
113 printf("TPC calibration status=%d\n",tpcStatus);
33b4e178 114 printf("T0 calibration status=%d\n",t0Status);
aa5ee6d0 115 PrintDetectorStatus();
116 return;
117}
118
119
120
121
7a569197 122void PrintDetectorStatus(){
aa5ee6d0 123 //
124 // GetStatus for the detector which did not implement GetStatus function:
125 //
126 // AliTOFAnalysisTaskCalibPass0 calibTask; // GetStatus implemented
127 // AliTRDPreprocessorOffline procestrd; // GetStatus implemented
128 // AliTPCPreprocessorOffline proces; // GetStatus not implemented (next release)
129 // // Logical or of the Validation function used instead
130 //
131 // AliMeanVertexPreprocessorOffline procesMeanVtx; // GetStatus not implemented
132 // AliT0PreprocessorOffline procesT0; // GetStatus not implemented
133 // SDDcalib // Not automatic update - Not needed
134 //
135 // CODE TO BE WRITTEN HERE FOR DETECTOT WITHOUT STATUS
27eb9bff 136}