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