]>
Commit | Line | Data |
---|---|---|
27eb9bff | 1 | /* |
2 | ||
3 | This macros setup the TPC calibration task AddTaskTPCCalib | |
4c8432c7 | 4 | for CPass0. |
27eb9bff | 5 | - the run number is required to config TPC OCDB |
6 | ||
7 | The following calibration components are added to the AliTPCAnalysisTaskcalib task: | |
8 | 1. AliTPCcalibCalib - redo reconstruction with current calibration | |
9 | 2. AliTPCcalibTimeGain - TPC time dependent gain calibration | |
10 | 3. AliTPCcalibTime - TPC time dependent drift time calibration | |
11 | ||
12 | */ | |
13 | ||
14 | // function to set TPC OCDB parameters | |
15 | void ConfigOCDB(Int_t crun); | |
16 | ||
17 | Int_t debugLevel=0; | |
18 | Int_t streamLevel=0; | |
19 | ||
20 | //_____________________________________________________________________________ | |
21 | AliAnalysisTask *AddTaskTPCCalib(Int_t runNumber) | |
22 | { | |
23 | // | |
24 | // add calibration task | |
25 | // | |
26 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
27 | if (!mgr) { | |
28 | ::Error("AddTaskTPCCalib", "No analysis manager to connect to."); | |
29 | return NULL; | |
30 | } | |
31 | ||
32 | // check the input handler | |
33 | if (!mgr->GetInputEventHandler()) { | |
34 | ::Error("AddTaskTPCCalib", "This task requires an input event handler"); | |
35 | return NULL; | |
36 | } | |
37 | ||
38 | // set TPC OCDB parameters | |
39 | ConfigOCDB(runNumber); | |
40 | ||
41 | // setup task | |
42 | AliTPCAnalysisTaskcalib *task1=new AliTPCAnalysisTaskcalib("CalibObjectsTrain1"); | |
43 | SetupCalibTaskTrain1(task1); | |
44 | mgr->AddTask(task1); | |
45 | ||
46 | AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer(); | |
47 | if (!cinput1) cinput1 = mgr->CreateContainer("cchain",TChain::Class(), | |
48 | AliAnalysisManager::kInputContainer); | |
49 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("TPCCalib",TObjArray::Class(), AliAnalysisManager::kOutputContainer, "AliESDfriends_v1.root"); | |
50 | ||
51 | mgr->ConnectInput(task1,0,cinput1); | |
52 | mgr->ConnectOutput(task1,0,coutput1); | |
53 | return task1; | |
54 | } | |
55 | ||
56 | //_____________________________________________________________________________ | |
57 | void AddCalibCalib(TObject* task){ | |
58 | // | |
59 | // Responsible: Marian Ivanov | |
60 | // Description: | |
61 | // calibCalib is a prefilter | |
62 | // The current OCDB entries transformation are applied on cluster, tracks are refitted | |
63 | // | |
64 | AliTPCAnalysisTaskcalib* myTask = (AliTPCAnalysisTaskcalib*) task; | |
65 | AliTPCcalibCalib *calibCalib = new AliTPCcalibCalib("calibTPC","calibTPC"); | |
66 | calibCalib->SetDebugLevel(0); | |
67 | calibCalib->SetStreamLevel(0); | |
68 | calibCalib->SetTriggerMask(-1,-1,kFALSE); //accept everything | |
69 | myTask->AddJob(calibCalib); | |
70 | } | |
71 | ||
72 | //_____________________________________________________________________________ | |
73 | void AddCalibTimeGain(TObject* task, Bool_t isCosmic = kFALSE, char * name = "calibTimeGain"){ | |
74 | // | |
75 | // Responsible: Alexander Kalweit | |
76 | // Description: Time Gain calibration | |
77 | // | |
78 | ||
79 | // Set run time ranges (time stamps) | |
80 | AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/GRP/Data"); | |
81 | if(!entry) { | |
82 | ::Error("AddCalibTimeGain","Cannot get AliCDBEntry"); | |
83 | return; | |
84 | } | |
85 | const AliGRPObject* grpData = dynamic_cast<AliGRPObject*>(entry->GetObject()); | |
86 | if(!grpData) { | |
87 | ::Error("AddCalibTimeGain","Cannot get AliGRPObject"); | |
88 | return; | |
89 | } | |
90 | time_t sTime = grpData->GetTimeStart(); | |
91 | time_t eTime = grpData->GetTimeEnd(); | |
92 | TTimeStamp startRunTime(sTime); | |
93 | TTimeStamp stopRunTime(eTime); | |
94 | ||
95 | UInt_t year; | |
96 | startRunTime.GetDate(kTRUE,0,&year); | |
97 | TTimeStamp startTime(year,1,1,0,0,0); | |
98 | TTimeStamp stopTime(year,12,31,23,59,59); | |
99 | ||
100 | // | |
101 | // setup calibration component | |
102 | // | |
1611b277 | 103 | |
104 | Bool_t useQmax = (grpData->GetBeamType()).Contains("Pb-Pb"); | |
105 | ||
27eb9bff | 106 | AliTPCAnalysisTaskcalib* myTask = (AliTPCAnalysisTaskcalib*) task; |
107 | AliTPCcalibTimeGain *calibTimeGain = new AliTPCcalibTimeGain(name,"calibTimeGain", startTime.GetSec(), stopTime.GetSec(), 10*60); | |
108 | calibTimeGain->SetIsCosmic(isCosmic); | |
109 | calibTimeGain->SetUseCookAnalytical(kTRUE); | |
1611b277 | 110 | calibTimeGain->SetUseMax(useQmax); |
27eb9bff | 111 | calibTimeGain->SetDebugLevel(0); |
112 | calibTimeGain->SetStreamLevel(0); | |
113 | calibTimeGain->SetTriggerMask(-1,-1,kTRUE); //reject laser | |
114 | calibTimeGain->SetLowerTrunc(0.02); | |
115 | calibTimeGain->SetUpperTrunc(0.6); | |
116 | ||
117 | myTask->AddJob(calibTimeGain); | |
118 | ||
119 | AliTPCcalibGainMult *calibGainMult = new AliTPCcalibGainMult("calibGainMult","calibGainMult"); | |
1611b277 | 120 | calibGainMult->SetUseMax(useQmax); |
27eb9bff | 121 | calibGainMult->SetDebugLevel(0); |
122 | calibGainMult->SetStreamLevel(0); | |
123 | calibGainMult->SetTriggerMask(-1,-1,kTRUE); //reject laser | |
124 | calibGainMult->SetLowerTrunc(0.02); | |
125 | calibGainMult->SetUpperTrunc(0.6); | |
126 | ||
7a569197 | 127 | //myTask->AddJob(calibGainMult); |
27eb9bff | 128 | |
129 | } | |
130 | ||
131 | //_____________________________________________________________________________ | |
132 | void AddCalibTime(TObject* task){ | |
133 | // | |
134 | // Responsible: Dag Larsen | |
135 | // Description: Time V drift calibration | |
136 | // | |
137 | ||
138 | // Set run time ranges (time stamps) | |
139 | AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/GRP/Data"); | |
140 | if(!entry) { | |
141 | ::Error("AddCalibTime","Cannot get AliCDBEntry"); | |
142 | return; | |
143 | } | |
144 | const AliGRPObject* grpData = dynamic_cast<AliGRPObject*>(entry->GetObject()); | |
145 | if(!grpData) { | |
146 | ::Error("AddCalibTime","Cannot get AliGRPObject"); | |
147 | return; | |
148 | } | |
149 | time_t sTime = grpData->GetTimeStart(); | |
150 | time_t eTime = grpData->GetTimeEnd(); | |
151 | ||
152 | TTimeStamp startRunTime(sTime); | |
153 | TTimeStamp stopRunTime(eTime); | |
154 | ||
155 | UInt_t year; | |
156 | startRunTime.GetDate(kTRUE,0,&year); | |
157 | TTimeStamp startTime(year,1,1,0,0,0); | |
158 | TTimeStamp stopTime(year,12,31,23,59,59); | |
159 | ||
160 | // | |
161 | // setup calibration component | |
162 | // | |
163 | AliTPCAnalysisTaskcalib* myTask = (AliTPCAnalysisTaskcalib*) task; | |
164 | AliTPCcalibTime *calibTime = new AliTPCcalibTime("calibTime","calibTime", startTime.GetSec(), stopTime.GetSec(), 10*60, 2); | |
165 | calibTime->SetDebugLevel(0); | |
166 | calibTime->SetStreamLevel(0); | |
167 | calibTime->SetTriggerMask(-1,-1,kFALSE); //accept everything | |
168 | ||
169 | // max 600 tracks per event | |
170 | calibTime->SetCutTracks(600); | |
171 | ||
172 | myTask->AddJob(calibTime); | |
173 | } | |
174 | ||
175 | ||
176 | void AddCalibTracks(TObject* task){ | |
177 | // | |
178 | // Responsible: Marian Ivanov | |
179 | // Description: | |
180 | // Histogram residuals and pulls of the track parameters in bins of track parameters | |
181 | // | |
182 | AliTPCAnalysisTaskcalib* myTask = (AliTPCAnalysisTaskcalib*) task; | |
183 | AliTPCClusterParam * clusterParam = AliTPCcalibDB::Instance()->GetClusterParam(); | |
184 | ||
185 | AliTPCcalibTracksCuts *cuts = new AliTPCcalibTracksCuts(30, 0.4, 5, 0.13, 0.018); | |
186 | // | |
187 | AliTPCcalibTracks *calibTracks = new AliTPCcalibTracks("calibTracks", "Resolution calibration object for tracks", clusterParam, cuts); | |
188 | calibTracks->SetDebugLevel(debugLevel); | |
189 | calibTracks->SetStreamLevel(streamLevel); | |
190 | calibTracks->SetTriggerMask(-1,-1,kTRUE); | |
191 | myTask->AddJob(calibTracks); | |
192 | } | |
193 | ||
194 | ||
195 | //_____________________________________________________________________________ | |
196 | void SetupCalibTaskTrain1(TObject* task){ | |
197 | // | |
198 | // Setup tasks for calibration train | |
199 | // | |
200 | AddCalibCalib(task); | |
201 | AddCalibTimeGain(task); | |
202 | AddCalibTime(task); | |
203 | //AddCalibTracks(task); | |
204 | } | |
205 | ||
206 | //_____________________________________________________________________________ | |
207 | void ConfigOCDB(Int_t run){ | |
208 | // | |
209 | // Configure TPC OCDB | |
210 | // | |
211 | printf("SETUP OCBD for TPC\n"); | |
212 | printf("SETUP OCBD for TPC\n"); | |
213 | printf("SETUP OCBD for TPC Run =%d\n", run); | |
214 | // | |
215 | // | |
216 | AliTPCParam *param= AliTPCcalibDB::Instance()->GetParameters(); | |
217 | param->ReadGeoMatrices(); | |
218 | // | |
219 | AliMagF* magF= TGeoGlobalMagField::Instance()->GetField(); | |
220 | printf("\n\nSET EXB FIELD\t\n\n"); | |
221 | AliTPCcalibDB::Instance()->SetExBField(magF); | |
222 | // | |
223 | // | |
224 | // | |
225 | AliTPCTransform *transform = AliTPCcalibDB::Instance()->GetTransform() ; | |
226 | // | |
227 | //AliTPCRecoParam * tpcRecoParam = AliTPCRecoParam::GetCosmicTestParam(kTRUE); | |
228 | // | |
229 | AliCDBEntry* entry = AliCDBManager::Instance()->Get("TPC/Calib/RecoParam"); | |
230 | if (!entry){ | |
231 | printf("TPC reco param not available"); | |
232 | } | |
233 | TObjArray * array = (TObjArray*)entry->GetObject(); | |
234 | if (!array){ | |
235 | printf("TPC reco param not available"); | |
236 | } | |
237 | // 0 - Low Flux (pp), 1- High Flux (Pb-Pb) | |
238 | AliTPCRecoParam * tpcRecoParam = (AliTPCRecoParam*)array->At(1); | |
239 | ||
240 | transform->SetCurrentRecoParam(tpcRecoParam); | |
241 | tpcRecoParam->SetUseGainCorrectionTime(0); | |
242 | tpcRecoParam->SetUseRPHICorrection(kFALSE); | |
243 | tpcRecoParam->SetUseTOFCorrection(kFALSE); | |
244 | // | |
245 | tpcRecoParam->SetUseDriftCorrectionTime(0); | |
246 | tpcRecoParam->SetUseDriftCorrectionGY(0); | |
247 | // | |
248 | tpcRecoParam->SetUseRadialCorrection(kFALSE); | |
249 | tpcRecoParam->SetUseQuadrantAlignment(kFALSE); | |
250 | // | |
251 | tpcRecoParam->SetUseSectorAlignment(kFALSE); | |
252 | tpcRecoParam->SetUseFieldCorrection(kFALSE); | |
253 | tpcRecoParam->SetUseExBCorrection(kFALSE); | |
254 | // | |
255 | tpcRecoParam->SetUseMultiplicityCorrectionDedx(kFALSE); | |
256 | tpcRecoParam->SetUseAlignmentTime(kFALSE); | |
257 | tpcRecoParam->SetUseComposedCorrection(kTRUE); | |
258 | ||
259 | AliTPCcalibDB::Instance()->SetRun(run); | |
260 | } |