]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | ||
3 | This macros setup the TPC calibration task AddTaskTPCCalib | |
4 | for CPass1. | |
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 | ||
54 | AliTPCAnalysisTaskcalib *taskAlign=new AliTPCAnalysisTaskcalib("CalibObjectsTrain1"); | |
55 | SetupCalibTaskTrainAlign(taskAlign); | |
56 | mgr->AddTask(taskAlign); | |
57 | ||
58 | AliAnalysisDataContainer *cinputAlign = mgr->GetCommonInputContainer(); | |
59 | if (!cinputAlign) cinputAlign = mgr->CreateContainer("cchain",TChain::Class(), | |
60 | AliAnalysisManager::kInputContainer); | |
61 | AliAnalysisDataContainer *coutputAlign = mgr->CreateContainer("TPCAlign",TObjArray::Class(), AliAnalysisManager::kOutputContainer, "AliESDfriends_v1.root"); | |
62 | ||
63 | mgr->ConnectInput(taskAlign,0,cinputAlign); | |
64 | mgr->ConnectOutput(taskAlign,0,coutputAlign); | |
65 | ||
66 | AliTPCAnalysisTaskcalib *taskCluster=new AliTPCAnalysisTaskcalib("CalibObjectsTrain1"); | |
67 | SetupCalibTaskTrainCluster(taskCluster); | |
68 | mgr->AddTask(taskCluster); | |
69 | AliAnalysisDataContainer *coutputAlign = mgr->CreateContainer("TPCCluster",TObjArray::Class(), AliAnalysisManager::kOutputContainer, "AliESDfriends_v1.root"); | |
70 | mgr->ConnectInput(taskCluster,0,cinput1); | |
71 | mgr->ConnectOutput(taskCluster,0,coutputAlign); | |
72 | ||
73 | return task1; | |
74 | } | |
75 | ||
76 | //_____________________________________________________________________________ | |
77 | void AddCalibCalib(TObject* task){ | |
78 | // | |
79 | // Responsible: Marian Ivanov | |
80 | // Description: | |
81 | // calibCalib is a prefilter | |
82 | // The current OCDB entries transformation are applied on cluster, tracks are refitted | |
83 | // | |
84 | AliTPCAnalysisTaskcalib* myTask = (AliTPCAnalysisTaskcalib*) task; | |
85 | AliTPCcalibCalib *calibCalib = new AliTPCcalibCalib("calibTPC","calibTPC"); | |
86 | calibCalib->SetDebugLevel(0); | |
87 | calibCalib->SetStreamLevel(0); | |
88 | calibCalib->SetTriggerMask(-1,-1,kFALSE); //accept everything | |
89 | myTask->AddJob(calibCalib); | |
90 | } | |
91 | ||
92 | //_____________________________________________________________________________ | |
93 | void AddCalibTimeGain(TObject* task, Bool_t isCosmic = kFALSE, char * name = "calibTimeGain"){ | |
94 | // | |
95 | // Responsible: Alexander Kalweit | |
96 | // Description: Time Gain calibration | |
97 | // | |
98 | ||
99 | // Set run time ranges (time stamps) | |
100 | AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/GRP/Data"); | |
101 | if(!entry) { | |
102 | ::Error("AddCalibTimeGain","Cannot get AliCDBEntry"); | |
103 | return; | |
104 | } | |
105 | const AliGRPObject* grpData = dynamic_cast<AliGRPObject*>(entry->GetObject()); | |
106 | if(!grpData) { | |
107 | ::Error("AddCalibTimeGain","Cannot get AliGRPObject"); | |
108 | return; | |
109 | } | |
110 | time_t sTime = grpData->GetTimeStart(); | |
111 | time_t eTime = grpData->GetTimeEnd(); | |
112 | TTimeStamp startRunTime(sTime); | |
113 | TTimeStamp stopRunTime(eTime); | |
114 | ||
115 | UInt_t year; | |
116 | startRunTime.GetDate(kTRUE,0,&year); | |
117 | TTimeStamp startTime(year,1,1,0,0,0); | |
118 | TTimeStamp stopTime(year,12,31,23,59,59); | |
119 | ||
120 | // | |
121 | // setup calibration component | |
122 | // | |
123 | ||
124 | Bool_t useQmax = (grpData->GetBeamType()).Contains("Pb-Pb"); | |
125 | ||
126 | AliTPCAnalysisTaskcalib* myTask = (AliTPCAnalysisTaskcalib*) task; | |
127 | AliTPCcalibTimeGain *calibTimeGain = new AliTPCcalibTimeGain(name,"calibTimeGain", startTime.GetSec(), stopTime.GetSec(), 10*60); | |
128 | calibTimeGain->SetIsCosmic(isCosmic); | |
129 | calibTimeGain->SetUseCookAnalytical(kTRUE); | |
130 | calibTimeGain->SetUseMax(useQmax); | |
131 | calibTimeGain->SetDebugLevel(0); | |
132 | calibTimeGain->SetStreamLevel(0); | |
133 | calibTimeGain->SetTriggerMask(-1,-1,kTRUE); //reject laser | |
134 | calibTimeGain->SetLowerTrunc(0.02); | |
135 | calibTimeGain->SetUpperTrunc(0.6); | |
136 | ||
137 | myTask->AddJob(calibTimeGain); | |
138 | ||
139 | AliTPCcalibGainMult *calibGainMult = new AliTPCcalibGainMult("calibGainMult","calibGainMult"); | |
140 | calibGainMult->SetUseMax(useQmax); | |
141 | calibGainMult->SetDebugLevel(0); | |
142 | calibGainMult->SetStreamLevel(0); | |
143 | calibGainMult->SetTriggerMask(-1,-1,kTRUE); //reject laser | |
144 | calibGainMult->SetLowerTrunc(0.02); | |
145 | calibGainMult->SetUpperTrunc(0.6); | |
146 | ||
147 | myTask->AddJob(calibGainMult); | |
148 | ||
149 | } | |
150 | ||
151 | //_____________________________________________________________________________ | |
152 | void AddCalibTime(TObject* task){ | |
153 | // | |
154 | // Responsible: Dag Larsen | |
155 | // Description: Time V drift calibration | |
156 | // | |
157 | ||
158 | // Set run time ranges (time stamps) | |
159 | AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/GRP/Data"); | |
160 | if(!entry) { | |
161 | ::Error("AddCalibTime","Cannot get AliCDBEntry"); | |
162 | return; | |
163 | } | |
164 | const AliGRPObject* grpData = dynamic_cast<AliGRPObject*>(entry->GetObject()); | |
165 | if(!grpData) { | |
166 | ::Error("AddCalibTime","Cannot get AliGRPObject"); | |
167 | return; | |
168 | } | |
169 | time_t sTime = grpData->GetTimeStart(); | |
170 | time_t eTime = grpData->GetTimeEnd(); | |
171 | ||
172 | TTimeStamp startRunTime(sTime); | |
173 | TTimeStamp stopRunTime(eTime); | |
174 | ||
175 | UInt_t year; | |
176 | startRunTime.GetDate(kTRUE,0,&year); | |
177 | TTimeStamp startTime(year,1,1,0,0,0); | |
178 | TTimeStamp stopTime(year,12,31,23,59,59); | |
179 | ||
180 | // | |
181 | // setup calibration component | |
182 | // | |
183 | AliTPCAnalysisTaskcalib* myTask = (AliTPCAnalysisTaskcalib*) task; | |
184 | AliTPCcalibTime *calibTime = new AliTPCcalibTime("calibTime","calibTime", startTime.GetSec(), stopTime.GetSec(), 10*60, 2); | |
185 | calibTime->SetDebugLevel(0); | |
186 | calibTime->SetStreamLevel(0); | |
187 | calibTime->SetTriggerMask(-1,-1,kFALSE); //accept everything | |
188 | ||
189 | // max 5000 tracks per event | |
190 | calibTime->SetCutTracks(5000); | |
191 | ||
192 | myTask->AddJob(calibTime); | |
193 | } | |
194 | ||
195 | ||
196 | void AddCalibTracks(TObject* task){ | |
197 | // | |
198 | // Responsible: Marian Ivanov | |
199 | // Description: | |
200 | // Histogram residuals and pulls of the track parameters in bins of track parameters | |
201 | // | |
202 | AliTPCAnalysisTaskcalib* myTask = (AliTPCAnalysisTaskcalib*) task; | |
203 | AliTPCClusterParam * clusterParam = AliTPCcalibDB::Instance()->GetClusterParam(); | |
204 | ||
205 | AliTPCcalibTracksCuts *cuts = new AliTPCcalibTracksCuts(30, 0.4, 5, 0.13, 0.018); | |
206 | // | |
207 | AliTPCcalibTracks *calibTracks = new AliTPCcalibTracks("calibTracks", "Resolution calibration object for tracks", clusterParam, cuts); | |
208 | calibTracks->SetDebugLevel(debugLevel); | |
209 | calibTracks->SetStreamLevel(streamLevel); | |
210 | calibTracks->SetTriggerMask(-1,-1,kTRUE); | |
211 | myTask->AddJob(calibTracks); | |
212 | } | |
213 | ||
214 | ||
215 | void AddCalibAlign(TObject* task){ | |
216 | // | |
217 | // Responsible: Marian Ivanov | |
218 | // Description: | |
219 | // | |
220 | AliTPCAnalysisTaskcalib* myTask = (AliTPCAnalysisTaskcalib*) task; | |
221 | AliTPCcalibAlign *calibAlign = new AliTPCcalibAlign("alignTPC","Alignment of the TPC sectors"); | |
222 | calibAlign->SetDebugLevel(debugLevel); | |
223 | calibAlign->SetStreamLevel(streamLevel); | |
224 | calibAlign->SetTriggerMask(-1,-1,kTRUE); //accept everything | |
225 | myTask->AddJob(calibAlign); | |
226 | } | |
227 | ||
228 | ||
229 | void AddCalibLaser(TObject* task){ | |
230 | // | |
231 | // Responsible: Marian Ivanov | |
232 | // Description: | |
233 | // | |
234 | AliTPCAnalysisTaskcalib* myTask = (AliTPCAnalysisTaskcalib*) task; | |
235 | AliTPCcalibLaser *calibLaser = new AliTPCcalibLaser("laserTPC","laserTPC"); | |
236 | calibLaser->SetDebugLevel(debugLevel); | |
237 | calibLaser->SetStreamLevel(streamLevel); | |
238 | calibLaser->SetTriggerMask(-1,-1,kFALSE); //accept everything | |
239 | myTask->AddJob(calibLaser); | |
240 | } | |
241 | ||
242 | ||
243 | void AddCalibCosmic(TObject* task){ | |
244 | // | |
245 | // Responsible: Marian Ivanov | |
246 | // Description: | |
247 | // Histogram residuals and pulls of the track parameters in bins of track parameters | |
248 | // Dump cosmic tracks to the tree | |
249 | // | |
250 | AliTPCAnalysisTaskcalib* myTask = (AliTPCAnalysisTaskcalib*) task; | |
251 | AliTPCcalibCosmic *calibCosmic = new AliTPCcalibCosmic("cosmicTPC","cosmicTPC"); | |
252 | calibCosmic->SetDebugLevel(debugLevel); | |
253 | calibCosmic->SetStreamLevel(1); | |
254 | calibCosmic->SetTriggerMask(-1,-1,kTRUE); //accept everything | |
255 | myTask->AddJob(calibCosmic); | |
256 | } | |
257 | ||
258 | ||
259 | ||
260 | //_____________________________________________________________________________ | |
261 | void SetupCalibTaskTrain1(TObject* task){ | |
262 | // | |
263 | // Setup tasks for calibration train | |
264 | // | |
265 | // AddCalibCalib(task); - disable refitting | |
266 | AddCalibTimeGain(task); | |
267 | AddCalibTime(task); | |
268 | //AddCalibCosmic(task); | |
269 | } | |
270 | ||
271 | ||
272 | void SetupCalibTaskTrainAlign(TObject* task){ | |
273 | // | |
274 | // Setup tasks for calibration train | |
275 | // | |
276 | AddCalibAlign(task); | |
277 | AddCalibLaser(task); | |
278 | } | |
279 | ||
280 | ||
281 | void SetupCalibTaskTrainCluster(TObject* task){ | |
282 | // | |
283 | // Setup tasks for calibration train | |
284 | // | |
285 | AddCalibTracks(task); | |
286 | } | |
287 | ||
288 | ||
289 | //_____________________________________________________________________________ | |
290 | void ConfigOCDB(Int_t run){ | |
291 | // | |
292 | // Configure TPC OCDB | |
293 | // | |
294 | printf("SETUP OCBD for TPC\n"); | |
295 | printf("SETUP OCBD for TPC\n"); | |
296 | printf("SETUP OCBD for TPC Run =%d\n", run); | |
297 | // | |
298 | // | |
299 | AliTPCParam *param= AliTPCcalibDB::Instance()->GetParameters(); | |
300 | param->ReadGeoMatrices(); | |
301 | // | |
302 | AliMagF* magF= TGeoGlobalMagField::Instance()->GetField(); | |
303 | printf("\n\nSET EXB FIELD\t\n\n"); | |
304 | AliTPCcalibDB::Instance()->SetExBField(magF); | |
305 | // | |
306 | // | |
307 | // | |
308 | AliTPCTransform *transform = AliTPCcalibDB::Instance()->GetTransform() ; | |
309 | // | |
310 | //AliTPCRecoParam * tpcRecoParam = AliTPCRecoParam::GetCosmicTestParam(kTRUE); | |
311 | // | |
312 | AliCDBEntry* entry = AliCDBManager::Instance()->Get("TPC/Calib/RecoParam"); | |
313 | if (!entry){ | |
314 | printf("TPC reco param not available"); | |
315 | } | |
316 | TObjArray * array = (TObjArray*)entry->GetObject(); | |
317 | if (!array){ | |
318 | printf("TPC reco param not available"); | |
319 | } | |
320 | // 0 - Low Flux (pp), 1- High Flux (Pb-Pb) | |
321 | AliTPCRecoParam * tpcRecoParam = (AliTPCRecoParam*)array->At(1); | |
322 | ||
323 | transform->SetCurrentRecoParam(tpcRecoParam); | |
324 | // in CPass1 use a default setting | |
325 | // tpcRecoParam->SetUseGainCorrectionTime(0); | |
326 | // tpcRecoParam->SetUseRPHICorrection(kFALSE); | |
327 | // tpcRecoParam->SetUseTOFCorrection(kFALSE); | |
328 | // // | |
329 | // tpcRecoParam->SetUseDriftCorrectionTime(0); | |
330 | // tpcRecoParam->SetUseDriftCorrectionGY(0); | |
331 | // // | |
332 | // tpcRecoParam->SetUseRadialCorrection(kFALSE); | |
333 | // tpcRecoParam->SetUseQuadrantAlignment(kFALSE); | |
334 | // // | |
335 | // tpcRecoParam->SetUseSectorAlignment(kFALSE); | |
336 | // tpcRecoParam->SetUseFieldCorrection(kFALSE); | |
337 | // tpcRecoParam->SetUseExBCorrection(kFALSE); | |
338 | // // | |
339 | // tpcRecoParam->SetUseMultiplicityCorrectionDedx(kFALSE); | |
340 | // tpcRecoParam->SetUseAlignmentTime(kFALSE); | |
341 | // tpcRecoParam->SetUseComposedCorrection(kTRUE); | |
342 | ||
343 | AliTPCcalibDB::Instance()->SetRun(run); | |
344 | } |