]>
Commit | Line | Data |
---|---|---|
ec55623f | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | //////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // This class is a first implementation for the TRD. // | |
21 | // It takes data from HLT and computes the parameters // | |
22 | // and stores both reference data and online calibration // | |
23 | // parameters in the CDB // | |
a5e1169e | 24 | // It alsotakes DCS data, does spline fits // |
25 | // and stores both reference data and spline fits results // | |
26 | // in the CDB // | |
ec55623f | 27 | // // |
28 | // Author: // | |
29 | // R. Bailhache (R.Bailhache@gsi.de) // | |
cd4fc278 | 30 | // W. Monange (w.monange@gsi.de) // |
ec55623f | 31 | // // |
32 | //////////////////////////////////////////////////////////////////////////// | |
e5c60cc7 | 33 | |
34 | #include "AliTRDPreprocessor.h" | |
35 | ||
e5c60cc7 | 36 | #include <TFile.h> |
37 | #include <TProfile2D.h> | |
e5c60cc7 | 38 | #include <TStopwatch.h> |
39 | #include <TObjString.h> | |
40 | #include <TString.h> | |
41 | #include <TList.h> | |
42 | #include <TCollection.h> | |
43 | ||
44 | #include "AliCDBMetaData.h" | |
e5c60cc7 | 45 | #include "AliLog.h" |
46 | ||
3a0f6479 | 47 | #include "AliTRDSensorArray.h" |
67c25e8d | 48 | #include "AliTRDCalibraFit.h" |
49 | #include "AliTRDCalibraMode.h" | |
3a0f6479 | 50 | #include "AliTRDCalibPadStatus.h" |
51 | #include "Cal/AliTRDCalDet.h" | |
52 | #include "Cal/AliTRDCalPadStatus.h" | |
e5c60cc7 | 53 | |
e5c60cc7 | 54 | ClassImp(AliTRDPreprocessor) |
55 | ||
56 | //______________________________________________________________________________________________ | |
ec55623f | 57 | AliTRDPreprocessor::AliTRDPreprocessor(AliShuttleInterface *shuttle) |
6ace5fe2 | 58 | :AliPreprocessor("TRD", shuttle), |
8dd14606 | 59 | fVdriftHLT(0) |
e5c60cc7 | 60 | { |
61 | // | |
62 | // Constructor | |
63 | // | |
64 | ||
65 | } | |
66 | ||
67 | //______________________________________________________________________________________________ | |
68 | AliTRDPreprocessor::~AliTRDPreprocessor() | |
69 | { | |
70 | // | |
71 | // Destructor | |
72 | // | |
73 | ||
74 | } | |
75 | ||
76 | //______________________________________________________________________________________________ | |
77 | void AliTRDPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime) | |
78 | { | |
79 | // | |
80 | // Initialization routine for the TRD preprocessor | |
81 | // | |
82 | ||
83 | AliPreprocessor::Initialize(run,startTime,endTime); | |
84 | ||
85 | } | |
86 | ||
87 | //______________________________________________________________________________________________ | |
a5e1169e | 88 | UInt_t AliTRDPreprocessor::Process(TMap* dcsAliasMap) |
e5c60cc7 | 89 | { |
a5e1169e | 90 | // |
91 | // Process DCS and calibration part for HLT | |
92 | // | |
93 | ||
8dd14606 | 94 | TString runType = GetRunType(); |
95 | Log(Form("runtype %s\n",runType.Data())); | |
96 | ||
97 | if (runType=="PEDESTAL_RUN"){ | |
98 | if(ExtractPedestals()) return 1; | |
99 | return 0; | |
100 | } | |
a5e1169e | 101 | |
102 | // | |
103 | // DCS | |
104 | // | |
cd4fc278 | 105 | |
8dd14606 | 106 | if(ProcessDCS(dcsAliasMap)) return 1; |
6ace5fe2 | 107 | |
108 | // | |
109 | // Process the calibration data for the HLT and DAQ part | |
110 | // | |
6ace5fe2 | 111 | |
8dd14606 | 112 | if (runType=="PHYSICS"){ |
113 | //TString runPar = GetRunParameter("HLTStatus") | |
114 | //if(runPar=="1") { | |
115 | if(ExtractHLT()) return 1; | |
116 | //if (fResult > 0) return fResult; | |
117 | //} | |
118 | if(!fVdriftHLT) { | |
119 | if(ExtractDriftVelocityDAQ()) return 1; | |
120 | } | |
6ace5fe2 | 121 | } |
8dd14606 | 122 | |
123 | return 0; | |
6ace5fe2 | 124 | |
125 | } | |
126 | ||
6ace5fe2 | 127 | //______________________________________________________________________________ |
8dd14606 | 128 | Bool_t AliTRDPreprocessor::ProcessDCS(TMap * dcsAliasMap) |
6ace5fe2 | 129 | { |
8dd14606 | 130 | Bool_t error=kFALSE; |
6ace5fe2 | 131 | |
a5e1169e | 132 | AliCDBMetaData metaData; |
133 | metaData.SetBeamPeriod(0); | |
134 | metaData.SetResponsible("Wilfried Monange/Raphaelle Bailhache"); | |
135 | metaData.SetComment("TRD calib test"); | |
cd4fc278 | 136 | |
137 | ||
138 | Log ("****** DCS ******\n"); | |
139 | ||
8dd14606 | 140 | TObjArray * list=AliTRDSensorArray::GetList (); |
cd4fc278 | 141 | |
142 | if (list == 0x0) { | |
6ace5fe2 | 143 | Log ("Error during AliTRDSensorArray::GetList"); |
144 | Log ("DCS will not be processing"); | |
8dd14606 | 145 | return kTRUE; |
6ace5fe2 | 146 | } |
147 | ||
148 | Int_t nEntries = list->GetEntries (); | |
149 | Log (Form ("%d alias loaded", nEntries)); | |
cd4fc278 | 150 | |
6ace5fe2 | 151 | Bool_t * results=new Bool_t [nEntries]; |
152 | Int_t * nGraph=new Int_t [nEntries]; | |
cd4fc278 | 153 | |
6ace5fe2 | 154 | for (Int_t iAlias = 0; iAlias < nEntries; iAlias++) { |
cd4fc278 | 155 | |
6ace5fe2 | 156 | AliTRDSensorArray * oneTRDDCS = (AliTRDSensorArray *)list->At (iAlias); |
cd4fc278 | 157 | |
6ace5fe2 | 158 | oneTRDDCS->SetStartTime (TTimeStamp (fStartTime)); |
159 | oneTRDDCS->SetEndTime (TTimeStamp (fEndTime)); | |
cd4fc278 | 160 | |
6ace5fe2 | 161 | Log (Form("Processing DCS : \"%s\"", oneTRDDCS->GetStoreName ().Data ())); |
cd4fc278 | 162 | |
6ace5fe2 | 163 | TMap * map; |
164 | ||
165 | map=oneTRDDCS->ExtractDCS (dcsAliasMap); | |
cd4fc278 | 166 | |
6ace5fe2 | 167 | nGraph [iAlias] = map->GetEntries (); |
cd4fc278 | 168 | |
6ace5fe2 | 169 | if (nGraph [iAlias] == 0) { |
170 | Log("No TGraph for this dcsDatapointAlias : not stored"); | |
171 | results [iAlias] = kFALSE; | |
172 | continue; | |
173 | } | |
cd4fc278 | 174 | |
6ace5fe2 | 175 | oneTRDDCS->SetGraph(map); |
176 | results[iAlias]=Store("Calib", oneTRDDCS->GetStoreName().Data(), oneTRDDCS, &metaData, 0, kTRUE); | |
177 | delete map; | |
178 | ||
179 | //results [iAlias] = StoreReferenceData("Calib", oneTRDDCS->GetStoreName ().Data (), oneTRDDCS, &metaData); | |
180 | ||
181 | ||
182 | if (!results[iAlias]) { | |
8dd14606 | 183 | AliError("Problem during StoreRef DCS"); |
184 | error=kTRUE; | |
6ace5fe2 | 185 | } |
186 | ||
187 | ||
188 | //BEGIN TEST (should not be removed ...) | |
189 | /* | |
190 | oneTRDDCS->ClearGraph(); | |
191 | oneTRDDCS->ClearFit(); | |
192 | oneTRDDCS->SetDiffCut2 (0.1); | |
193 | map=oneTRDDCS->ExtractDCS (dcsAliasMap); | |
194 | oneTRDDCS->SetGraph (map); | |
195 | Store("Calib", ("cut_"+oneTRDDCS->GetStoreName()).Data(), oneTRDDCS, &metaData, 0, kTRUE); | |
196 | delete map; | |
197 | ||
198 | ||
199 | if(iAlias==1 || iAlias==19) continue; | |
200 | ||
201 | oneTRDDCS->ClearGraph(); | |
202 | oneTRDDCS->ClearFit(); | |
203 | oneTRDDCS->SetDiffCut2(0); | |
204 | map=oneTRDDCS->ExtractDCS(dcsAliasMap); | |
205 | oneTRDDCS->MakeSplineFit(map); | |
206 | Store("Calib", ("fit_"+oneTRDDCS->GetStoreName()).Data() , oneTRDDCS, &metaData, 0, kTRUE); | |
207 | delete map; | |
208 | ||
209 | ||
210 | oneTRDDCS->ClearGraph(); | |
211 | oneTRDDCS->ClearFit(); | |
212 | oneTRDDCS->SetDiffCut2 (0.1); | |
213 | map=oneTRDDCS->ExtractDCS (dcsAliasMap); | |
214 | oneTRDDCS->MakeSplineFit(map); | |
215 | Store("Calib", ("cutfit_"+oneTRDDCS->GetStoreName()).Data() , oneTRDDCS, &metaData, 0, kTRUE); | |
216 | delete map; | |
217 | */ | |
218 | //END TEST | |
219 | ||
220 | ||
221 | ||
222 | } | |
cd4fc278 | 223 | |
6ace5fe2 | 224 | Log (" Summury of DCS :\n"); |
225 | Log (Form("%30s %10s %10s", "dcsDatapointAlias", "Stored ?", "# graph")); | |
226 | for (Int_t iAlias = 0; iAlias < nEntries; iAlias++) { | |
227 | AliTRDSensorArray * oneTRDDCS = (AliTRDSensorArray *)list->At (iAlias); | |
228 | Log (Form ("%30s %10s %4d", | |
229 | oneTRDDCS->GetStoreName ().Data (), | |
230 | results[iAlias] ? "ok" : "X", | |
231 | nGraph [iAlias])); | |
232 | } | |
233 | Log ("*********** End of DCS **********"); | |
234 | ||
235 | delete results; | |
236 | delete nGraph; | |
237 | ||
8dd14606 | 238 | return error; |
6ace5fe2 | 239 | } |
240 | ||
241 | //______________________________________________________________________________________________ | |
8dd14606 | 242 | Bool_t AliTRDPreprocessor::ExtractPedestals() |
6ace5fe2 | 243 | { |
244 | // | |
245 | // Pedestal running on LDCs at the DAQ | |
246 | // | |
8dd14606 | 247 | |
248 | Bool_t error = kFALSE; | |
6ace5fe2 | 249 | |
250 | // Init a AliTRDCalibPadStatus | |
251 | AliTRDCalibPadStatus calPedSum = AliTRDCalibPadStatus(); | |
252 | ||
253 | AliCDBMetaData metaData; | |
254 | metaData.SetBeamPeriod(0); | |
255 | metaData.SetResponsible("Raphaelle Bailhache"); | |
256 | metaData.SetComment("TRD calib test"); | |
257 | ||
258 | // Sum the contributions of the LDCs | |
259 | TList * listpad = GetFileSources(kDAQ,"PADSTATUS"); | |
8dd14606 | 260 | if (!listpad) { |
261 | Log("No list found for the PEDESTRAL Run"); | |
262 | return kTRUE; | |
263 | } | |
264 | ||
265 | // loop through all files from LDCs | |
266 | ||
267 | UInt_t index = 0; | |
268 | while (listpad->At(index)!=NULL) { | |
269 | TObjString* fileNameEntry = (TObjString*) listpad->At(index); | |
270 | if (fileNameEntry != NULL) | |
271 | { | |
6ace5fe2 | 272 | TString fileName = GetFile(kDAQ, "PADSTATUS", |
273 | fileNameEntry->GetString().Data()); | |
8dd14606 | 274 | if(fileName.Length() ==0){ |
6ace5fe2 | 275 | Log(Form("Error by retrieving the file %d for the pedestal",(Int_t)index)); |
8dd14606 | 276 | delete listpad; |
277 | return kTRUE; | |
cd4fc278 | 278 | } |
8dd14606 | 279 | |
280 | TFile *f = TFile::Open(fileName); | |
281 | AliTRDCalibPadStatus *calPed; | |
282 | f->GetObject("calibpadstatus",calPed); | |
283 | ||
284 | if(calPed){ | |
285 | ||
289cc637 | 286 | Int_t sm = -1; |
287 | ||
8dd14606 | 288 | // analyse |
289cc637 | 289 | //calPed->AnalyseHisto(); |
290 | ||
291 | // Add to the calPedSum | |
292 | for (Int_t idet=0; idet<540; idet++) { | |
293 | AliTRDCalROC *rocMean = calPed->GetCalRocMean(idet, kFALSE); | |
294 | if ( rocMean ) { | |
295 | calPedSum.SetCalRocMean(rocMean,idet); | |
296 | sm = (Int_t) (idet / 30); | |
297 | } | |
298 | AliTRDCalROC *rocRMS = calPed->GetCalRocRMS(idet, kFALSE); | |
299 | if ( rocRMS ) { | |
300 | calPedSum.SetCalRocRMS(rocRMS,idet); | |
301 | } | |
302 | }// det loop | |
303 | ||
8dd14606 | 304 | // store as reference data |
305 | TString name("PadStatus"); | |
289cc637 | 306 | name += sm; |
8dd14606 | 307 | if(!StoreReferenceData("DAQData",(const char *)name,(TObject *) calPed,&metaData)){ |
308 | Log(Form("Error storing AliTRDCalibPadStatus object %d as reference data",(Int_t)index)); | |
309 | error = kTRUE; | |
310 | } | |
289cc637 | 311 | |
8dd14606 | 312 | } // calPed |
313 | } // fileNameEntry | |
314 | ++index; | |
315 | }// while (list) | |
316 | Log(Form("%d elements found in the list for the pedestal",(Int_t)index)); | |
317 | if(index==0){ | |
6ace5fe2 | 318 | delete listpad; |
8dd14606 | 319 | return kTRUE; |
6ace5fe2 | 320 | } |
8dd14606 | 321 | // |
322 | // Store pedestal entry to OCDB | |
323 | // | |
324 | ||
325 | ||
326 | // Create Pad Status | |
327 | AliTRDCalPadStatus *calPadStatus = calPedSum.CreateCalPadStatus(); | |
328 | AliCDBMetaData md3; | |
329 | md3.SetObjectClassName("AliTRDCalPadStatus"); | |
330 | md3.SetResponsible("Raphaelle Bailhache"); | |
331 | md3.SetBeamPeriod(1); | |
332 | md3.SetComment("TRD calib test"); | |
333 | if(!Store("Calib","PadStatus" ,(TObject *)calPadStatus, &md3, 0, kTRUE)){ | |
334 | Log("Error storing the pedestal"); | |
335 | delete listpad; | |
336 | return kTRUE; | |
a5e1169e | 337 | } |
289cc637 | 338 | |
339 | // Create Noise | |
340 | //Make the AliTRDCalPad | |
341 | AliTRDCalPad *calPad2 = calPedSum.CreateCalPad(); | |
342 | AliCDBMetaData md4; | |
343 | md4.SetObjectClassName("AliTRDCalPad"); | |
344 | md4.SetResponsible("Raphaelle Bailhache"); | |
345 | md4.SetBeamPeriod(1); | |
346 | md4.SetComment("TRD calib test"); | |
347 | if(!Store("Calib","PadNoise" ,(TObject *)calPad2, &md4, 0, kTRUE)){ | |
348 | Log("Error storing the pedestal"); | |
349 | delete listpad; | |
350 | return kTRUE; | |
351 | } | |
352 | //Make the AliTRDCalDet correspondant | |
353 | AliTRDCalDet *calDet = calPedSum.CreateCalDet(); | |
354 | AliCDBMetaData md5; | |
355 | md5.SetObjectClassName("AliTRDCalDet"); | |
356 | md5.SetResponsible("Raphaelle Bailhache"); | |
357 | md5.SetBeamPeriod(1); | |
358 | md5.SetComment("TRD calib test"); | |
359 | if(!Store("Calib","DetNoise" ,(TObject *)calDet, &md5, 0, kTRUE)){ | |
360 | Log("Error storing the pedestal"); | |
361 | delete listpad; | |
362 | return kTRUE; | |
363 | } | |
364 | ||
8dd14606 | 365 | delete listpad; |
366 | return error; | |
a5e1169e | 367 | |
6ace5fe2 | 368 | } |
369 | //______________________________________________________________________________________________ | |
8dd14606 | 370 | Bool_t AliTRDPreprocessor::ExtractDriftVelocityDAQ() |
6ace5fe2 | 371 | { |
e5c60cc7 | 372 | // |
6ace5fe2 | 373 | // Drift velocity DA running on monitoring servers at the DAQ |
e5c60cc7 | 374 | // |
375 | ||
8dd14606 | 376 | Bool_t error = kFALSE; |
6ace5fe2 | 377 | |
378 | // Objects for HLT and DAQ zusammen | |
3a0f6479 | 379 | AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance(); |
6ace5fe2 | 380 | AliCDBMetaData metaData; |
381 | metaData.SetBeamPeriod(0); | |
382 | metaData.SetResponsible("Raphaelle Bailhache"); | |
383 | metaData.SetComment("TRD calib test"); | |
3a0f6479 | 384 | // Store the infos for the detector |
6ace5fe2 | 385 | AliCDBMetaData md1; |
386 | md1.SetObjectClassName("AliTRDCalDet"); | |
387 | md1.SetResponsible("Raphaelle Bailhache"); | |
388 | md1.SetBeamPeriod(0); | |
389 | md1.SetComment("TRD calib test"); | |
3a0f6479 | 390 | // Store the infos for the pads |
6ace5fe2 | 391 | AliCDBMetaData md2; |
392 | md2.SetObjectClassName("AliTRDCalPad"); | |
393 | md2.SetResponsible("Raphaelle Bailhache"); | |
394 | md2.SetBeamPeriod(0); | |
395 | md2.SetComment("TRD calib test"); | |
3a0f6479 | 396 | |
e5c60cc7 | 397 | |
e5c60cc7 | 398 | |
6ace5fe2 | 399 | |
400 | // Take the file from the DAQ file exchange server | |
401 | TList *listdaq = GetFileSources(kDAQ,"VDRIFT"); | |
8dd14606 | 402 | if (!listdaq) { |
6ace5fe2 | 403 | Log("No list found for vdrift (DAQ)"); |
8dd14606 | 404 | return kTRUE; |
405 | } | |
406 | ||
407 | if(listdaq->GetSize() !=1){ | |
408 | Log(Form("Problem on the size of the list: %d (DAQ)",listdaq->GetSize())); | |
409 | delete listdaq; | |
410 | return kTRUE; | |
6ace5fe2 | 411 | } |
8dd14606 | 412 | |
413 | TObjString* fileNameEntry = (TObjString*) listdaq->At(0); | |
414 | if(fileNameEntry != NULL){ | |
415 | TString fileName = GetFile(kDAQ, "VDRIFT", | |
416 | fileNameEntry->GetString().Data()); | |
417 | if(fileName.Length() ==0){ | |
418 | Log("Error retrieving the file vdrift (DAQ)"); | |
419 | delete listdaq; | |
420 | return kTRUE; | |
421 | } | |
422 | TFile *filedaq = TFile::Open(fileName); | |
423 | TProfile2D *histodriftvelocity = (TProfile2D *) filedaq->Get("PH2d"); | |
424 | if (histodriftvelocity) { | |
425 | ||
426 | // store as reference data | |
427 | if(!StoreReferenceData("DAQData","VdriftT0",(TObject *) histodriftvelocity,&metaData)){ | |
428 | Log("Error storing 2D Profile for vdrift from the DAQ"); | |
429 | error = kTRUE; | |
430 | } | |
431 | ||
432 | // analyse | |
433 | ||
434 | Log("Take the PH reference data. Now we will try to fit\n"); | |
435 | calibra->SetMinEntries(2000); // If there is less than 2000 | |
436 | calibra->AnalysePH(histodriftvelocity); | |
437 | ||
438 | Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(1)) | |
439 | + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(1)); | |
440 | Int_t nbfit = calibra->GetNumberFit(); | |
441 | Int_t nbE = calibra->GetNumberEnt(); | |
442 | ||
443 | // if enough statistics store the results | |
444 | if ((nbtg > 0) && | |
445 | (nbfit >= 0.95*nbE)) { | |
446 | // create the cal objects | |
447 | TObjArray object = calibra->GetVectorFit(); | |
448 | AliTRDCalDet *objdriftvelocitydet = calibra->CreateDetObjectVdrift(&object,kTRUE); | |
449 | TObject *objdriftvelocitypad = calibra->CreatePadObjectVdrift(); | |
450 | object = calibra->GetVectorFit2(); | |
451 | AliTRDCalDet *objtime0det = calibra->CreateDetObjectT0(&object,kTRUE); | |
452 | TObject *objtime0pad = calibra->CreatePadObjectT0(); | |
453 | calibra->ResetVectorFit(); | |
454 | // store | |
455 | if(!Store("Calib","ChamberVdrift" ,(TObject *) objdriftvelocitydet,&md1,0,kTRUE)){ | |
456 | Log("Error storing the calibration object for the chamber vdrift (DAQ)"); | |
457 | error = kTRUE; | |
458 | } | |
459 | if(!Store("Calib","ChamberT0" ,(TObject *) objtime0det ,&md1,0,kTRUE)){ | |
460 | Log("Error storing the calibration object for the chamber t0 (DAQ)"); | |
461 | error = kTRUE; | |
462 | } | |
463 | if(!Store("Calib","LocalVdrift" ,(TObject *) objdriftvelocitypad,&md2,0,kTRUE)){ | |
464 | Log("Error storing the calibration object for the local drift velocity (DAQ)"); | |
465 | error = kTRUE; | |
466 | } | |
467 | if(!Store("Calib","LocalT0" ,(TObject *) objtime0pad ,&md2,0,kTRUE)){ | |
468 | Log("Error storing the calibration object for the local time0 (DAQ)"); | |
469 | error = kTRUE; | |
470 | } | |
471 | } | |
472 | else{ | |
473 | Log("Not enough statistics for the average pulse height (DAQ)"); | |
474 | } | |
475 | } // histo here | |
476 | }// if fileNameEntry | |
477 | ||
478 | delete listdaq; | |
479 | return error; | |
480 | ||
6ace5fe2 | 481 | } |
482 | //______________________________________________________________________________________________ | |
8dd14606 | 483 | Bool_t AliTRDPreprocessor::ExtractHLT() |
6ace5fe2 | 484 | { |
e5c60cc7 | 485 | // |
6ace5fe2 | 486 | // Gain, vdrift and PRF calibration running on HLT |
487 | // return kFALSE if NULL pointer to the list | |
e5c60cc7 | 488 | // |
3a0f6479 | 489 | |
8dd14606 | 490 | Bool_t error = kFALSE; |
491 | ||
6ace5fe2 | 492 | // Objects for HLT and DAQ zusammen |
493 | AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance(); | |
494 | AliCDBMetaData metaData; | |
495 | metaData.SetBeamPeriod(0); | |
496 | metaData.SetResponsible("Raphaelle Bailhache"); | |
497 | metaData.SetComment("TRD calib test"); | |
498 | // Store the infos for the detector | |
499 | AliCDBMetaData md1; | |
500 | md1.SetObjectClassName("AliTRDCalDet"); | |
501 | md1.SetResponsible("Raphaelle Bailhache"); | |
502 | md1.SetBeamPeriod(0); | |
503 | md1.SetComment("TRD calib test"); | |
504 | // Store the infos for the pads | |
505 | AliCDBMetaData md2; | |
506 | md2.SetObjectClassName("AliTRDCalPad"); | |
507 | md2.SetResponsible("Raphaelle Bailhache"); | |
508 | md2.SetBeamPeriod(0); | |
509 | md2.SetComment("TRD calib test"); | |
3a0f6479 | 510 | |
6ace5fe2 | 511 | |
512 | // Take the file from the HLT file exchange server | |
513 | TList *listhlt = GetFileSources(kHLT,"GAINDRIFTPRF"); | |
8dd14606 | 514 | if (!listhlt) { |
6ace5fe2 | 515 | Log("No list found for the HLT"); |
8dd14606 | 516 | return kTRUE; |
517 | } | |
518 | ||
519 | if(listhlt->GetSize() != 1) { | |
520 | Log(Form("Problem on the size of the list: %d (HLT)",listhlt->GetSize())); | |
521 | delete listhlt; | |
522 | return kTRUE; | |
6ace5fe2 | 523 | } |
3a0f6479 | 524 | |
8dd14606 | 525 | TObjString* fileNameEntry = (TObjString*) listhlt->At(0); |
526 | if(fileNameEntry != NULL){ | |
527 | TString fileName = GetFile(kHLT, "GAINDRIFTPRF", | |
528 | fileNameEntry->GetString().Data()); | |
529 | if(fileName.Length() ==0){ | |
530 | Log("Error retrieving the file (HLT)"); | |
531 | delete listhlt; | |
532 | return kTRUE; | |
533 | } | |
534 | // Take the file | |
535 | TFile *filehlt = TFile::Open(fileName); | |
536 | ||
537 | ||
538 | // gain | |
539 | TH2I *histogain = (TH2I *) filehlt->Get("CH2d"); | |
540 | histogain->SetDirectory(0); | |
541 | if (histogain) { | |
542 | // store the reference data | |
543 | if(!StoreReferenceData("HLTData","Gain",(TObject *) histogain,&metaData)){ | |
544 | Log("Error storing 2D histos for gain"); | |
545 | error = kTRUE; | |
546 | } | |
547 | // analyse | |
548 | Log("Take the CH reference data. Now we will try to fit\n"); | |
549 | calibra->SetMinEntries(1000); // If there is less than 1000 entries in the histo: no fit | |
550 | calibra->AnalyseCH(histogain); | |
551 | Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(0)) | |
552 | + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(0)); | |
553 | Int_t nbfit = calibra->GetNumberFit(); | |
554 | Int_t nbE = calibra->GetNumberEnt(); | |
555 | // enough statistics | |
556 | if ((nbtg > 0) && | |
557 | (nbfit >= 0.95*nbE)) { | |
558 | // create the cal objects | |
559 | TObjArray object = calibra->GetVectorFit(); | |
560 | AliTRDCalDet *objgaindet = calibra->CreateDetObjectGain(&object,calibra->GetScaleFitFactor(),kTRUE); | |
561 | TObject *objgainpad = calibra->CreatePadObjectGain(); | |
562 | // store them | |
563 | if(!Store("Calib","ChamberGainFactor",(TObject *) objgaindet ,&md1,0,kTRUE)){ | |
564 | Log("Error storing the calibration object for the chamber gain"); | |
565 | error = kTRUE; | |
566 | } | |
567 | if(!Store("Calib","LocalGainFactor" ,(TObject *) objgainpad ,&md2,0,kTRUE)){ | |
568 | Log("Error storing the calibration object for the local gain factor"); | |
569 | error = kTRUE; | |
570 | } | |
571 | } | |
572 | calibra->ResetVectorFit(); | |
573 | }// if histogain | |
574 | ||
575 | ||
576 | ||
577 | // vdrift | |
578 | fVdriftHLT = kFALSE; | |
579 | TProfile2D *histodriftvelocity = (TProfile2D *) filehlt->Get("PH2d"); | |
580 | histodriftvelocity->SetDirectory(0); | |
581 | if (histodriftvelocity) { | |
582 | // store the reference data | |
583 | if(!StoreReferenceData("HLTData","VdriftT0",(TObject *) histodriftvelocity,&metaData)){ | |
584 | Log("Error storing 2D Profile for average pulse height (HLT)"); | |
585 | error = kTRUE; | |
586 | } | |
587 | // analyse | |
588 | Log("Take the PH reference data. Now we will try to fit\n"); | |
589 | calibra->SetMinEntries(1000*20); // If there is less than 20000 | |
590 | calibra->AnalysePH(histodriftvelocity); | |
591 | Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(1)) | |
592 | + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(1)); | |
593 | Int_t nbfit = calibra->GetNumberFit(); | |
594 | Int_t nbE = calibra->GetNumberEnt(); | |
595 | // enough statistics | |
596 | if ((nbtg > 0) && | |
597 | (nbfit >= 0.95*nbE)) { | |
598 | // create the cal objects | |
599 | TObjArray object = calibra->GetVectorFit(); | |
600 | AliTRDCalDet *objdriftvelocitydet = calibra->CreateDetObjectVdrift(&object,kTRUE); | |
601 | TObject *objdriftvelocitypad = calibra->CreatePadObjectVdrift(); | |
602 | object = calibra->GetVectorFit2(); | |
603 | AliTRDCalDet *objtime0det = calibra->CreateDetObjectT0(&object,kTRUE); | |
604 | TObject *objtime0pad = calibra->CreatePadObjectT0(); | |
605 | // store them | |
606 | if(!Store("Calib","ChamberVdrift" ,(TObject *) objdriftvelocitydet,&md1,0,kTRUE)){ | |
607 | Log("Error storing the calibration object for the chamber vdrift (HLT)"); | |
608 | error = kTRUE; | |
609 | } | |
610 | if(!Store("Calib","ChamberT0" ,(TObject *) objtime0det ,&md1,0,kTRUE)){ | |
611 | Log("Error storing the calibration object for the chamber t0 (HLT)"); | |
612 | error = kTRUE; | |
613 | } | |
614 | if(!Store("Calib","LocalVdrift" ,(TObject *) objdriftvelocitypad,&md2,0,kTRUE)){ | |
615 | Log("Error storing the calibration object for the local drift velocity (HLT)"); | |
616 | error = kTRUE; | |
617 | } | |
618 | if(!Store("Calib","LocalT0" ,(TObject *) objtime0pad ,&md2,0,kTRUE)){ | |
619 | Log("Error storing the calibration object for the local time0 (HLT)"); | |
620 | error = kTRUE; | |
621 | } | |
622 | fVdriftHLT = kTRUE; | |
623 | } | |
624 | calibra->ResetVectorFit(); | |
625 | }// if TProfile2D | |
626 | ||
627 | ||
628 | // prf | |
629 | TProfile2D *histoprf = (TProfile2D *) filehlt->Get("PRF2d"); | |
630 | histoprf->SetDirectory(0); | |
631 | if (histoprf) { | |
632 | // store reference data | |
633 | if(!StoreReferenceData("HLTData","PRF",(TObject *) histoprf,&metaData)){ | |
634 | Log("Error storing the 2D Profile for Pad Response Function"); | |
635 | error = kTRUE; | |
636 | } | |
637 | // analyse | |
638 | Log("Take the PRF reference data. Now we will try to fit\n"); | |
639 | calibra->SetMinEntries(600); // If there is less than 20000 | |
640 | calibra->AnalysePRFMarianFit(histoprf); | |
641 | Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(2)) | |
642 | + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(2)); | |
643 | Int_t nbfit = calibra->GetNumberFit(); | |
644 | Int_t nbE = calibra->GetNumberEnt(); | |
645 | // enough statistics | |
646 | if ((nbtg > 0) && | |
647 | (nbfit >= 0.95*nbE)) { | |
648 | // create cal pad objects | |
649 | TObjArray object = calibra->GetVectorFit(); | |
650 | TObject *objPRFpad = calibra->CreatePadObjectPRF(&object); | |
651 | // store them | |
652 | if(!Store("Calib","PRFWidth" ,(TObject *) objPRFpad ,&md2,0,kTRUE)){ | |
653 | Log("Error storing the calibration object for the Pad Response Function"); | |
654 | error = kTRUE; | |
655 | } | |
656 | } | |
657 | calibra->ResetVectorFit(); | |
658 | }// if PRF | |
659 | }// if fileNameEntry | |
660 | ||
661 | delete listhlt; | |
662 | return error; | |
663 | ||
e5c60cc7 | 664 | } |