]>
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 | // // |
fdfee371 | 28 | // Authors: // |
ec55623f | 29 | // R. Bailhache (R.Bailhache@gsi.de) // |
cd4fc278 | 30 | // W. Monange (w.monange@gsi.de) // |
fdfee371 | 31 | // F. Kramer (kramer@ikf.uni-frankfurt.de) // |
ec55623f | 32 | // // |
33 | //////////////////////////////////////////////////////////////////////////// | |
e5c60cc7 | 34 | |
e5c60cc7 | 35 | #include <TFile.h> |
36 | #include <TProfile2D.h> | |
e5c60cc7 | 37 | #include <TStopwatch.h> |
38 | #include <TObjString.h> | |
39 | #include <TString.h> | |
40 | #include <TList.h> | |
41 | #include <TCollection.h> | |
fdfee371 | 42 | #include <TSAXParser.h> |
6b36d985 | 43 | #include <fstream> |
e5c60cc7 | 44 | |
45 | #include "AliCDBMetaData.h" | |
e5c60cc7 | 46 | #include "AliLog.h" |
47 | ||
c8ab4518 | 48 | #include "AliTRDPreprocessor.h" |
3a0f6479 | 49 | #include "AliTRDSensorArray.h" |
67c25e8d | 50 | #include "AliTRDCalibraFit.h" |
51 | #include "AliTRDCalibraMode.h" | |
3a0f6479 | 52 | #include "AliTRDCalibPadStatus.h" |
fdfee371 | 53 | #include "AliTRDSaxHandler.h" |
3a0f6479 | 54 | #include "Cal/AliTRDCalDet.h" |
5029ad25 | 55 | #include "Cal/AliTRDCalPad.h" |
3a0f6479 | 56 | #include "Cal/AliTRDCalPadStatus.h" |
fdfee371 | 57 | #include "Cal/AliTRDCalDCS.h" |
5029ad25 | 58 | #include "Cal/AliTRDCalSingleChamberStatus.h" |
59 | #include "Cal/AliTRDCalROC.h" | |
60 | ||
e5c60cc7 | 61 | |
e5c60cc7 | 62 | ClassImp(AliTRDPreprocessor) |
63 | ||
64 | //______________________________________________________________________________________________ | |
ec55623f | 65 | AliTRDPreprocessor::AliTRDPreprocessor(AliShuttleInterface *shuttle) |
c8ab4518 | 66 | :AliPreprocessor("TRD", shuttle) |
67 | ,fVdriftHLT(0) | |
e5c60cc7 | 68 | { |
69 | // | |
70 | // Constructor | |
71 | // | |
72 | ||
f9ed5395 | 73 | AddRunType("PHYSICS"); |
74 | AddRunType("STANDALONE"); | |
75 | AddRunType("PEDESTAL"); | |
76 | AddRunType("DAQ"); | |
77 | ||
e5c60cc7 | 78 | } |
79 | ||
80 | //______________________________________________________________________________________________ | |
81 | AliTRDPreprocessor::~AliTRDPreprocessor() | |
82 | { | |
83 | // | |
84 | // Destructor | |
85 | // | |
86 | ||
87 | } | |
88 | ||
89 | //______________________________________________________________________________________________ | |
90 | void AliTRDPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime) | |
91 | { | |
92 | // | |
93 | // Initialization routine for the TRD preprocessor | |
94 | // | |
95 | ||
96 | AliPreprocessor::Initialize(run,startTime,endTime); | |
97 | ||
98 | } | |
99 | ||
100 | //______________________________________________________________________________________________ | |
a5e1169e | 101 | UInt_t AliTRDPreprocessor::Process(TMap* dcsAliasMap) |
e5c60cc7 | 102 | { |
a5e1169e | 103 | // |
104 | // Process DCS and calibration part for HLT | |
105 | // | |
106 | ||
8dd14606 | 107 | TString runType = GetRunType(); |
108 | Log(Form("runtype %s\n",runType.Data())); | |
65ffd646 | 109 | |
fdfee371 | 110 | // always process the configuration data |
f9ed5395 | 111 | /* Int_t resultDCSC = */ProcessDCSConfigData(); // for testing! |
112 | ||
b70c68da | 113 | if (runType=="PEDESTAL"){ |
8dd14606 | 114 | if(ExtractPedestals()) return 1; |
115 | return 0; | |
116 | } | |
a5e1169e | 117 | |
f9ed5395 | 118 | if ((runType=="PHYSICS") || (runType=="STANDALONE") || (runType=="DAQ")){ |
65ffd646 | 119 | // DCS |
f9ed5395 | 120 | /*if(*/ProcessDCS(dcsAliasMap)/*) return 1*/; // for testing! |
121 | if(runType=="PHYSICS"){ | |
122 | // HLT if On | |
123 | //TString runPar = GetRunParameter("HLTStatus"); | |
124 | //if(runPar=="1") { | |
125 | if(GetHLTStatus()) { | |
126 | /*if(*/ExtractHLT()/*) return 1*/; // for testing! | |
127 | } | |
128 | // DAQ if HLT failed | |
129 | if(!fVdriftHLT) { | |
130 | /*if(*/ExtractDriftVelocityDAQ()/*) return 1*/; // for testing! | |
131 | } | |
132 | } | |
6ace5fe2 | 133 | } |
8dd14606 | 134 | |
135 | return 0; | |
6ace5fe2 | 136 | |
f5bb5557 | 137 | } |
138 | //______________________________________________________________________________ | |
139 | Bool_t AliTRDPreprocessor::ProcessDCS() | |
140 | { | |
c8ab4518 | 141 | // |
142 | // Default process DCS method | |
143 | // | |
f5bb5557 | 144 | |
145 | TString runType = GetRunType(); | |
b70c68da | 146 | if ((runType == "PHYSICS") || (runType == "STANDALONE")) { |
c8ab4518 | 147 | return kTRUE; |
148 | } | |
f5bb5557 | 149 | return kFALSE; |
150 | ||
6ace5fe2 | 151 | } |
152 | ||
6ace5fe2 | 153 | //______________________________________________________________________________ |
c8ab4518 | 154 | Bool_t AliTRDPreprocessor::ProcessDCS(TMap *dcsAliasMap) |
6ace5fe2 | 155 | { |
c8ab4518 | 156 | // |
157 | // Process DCS method | |
158 | // | |
159 | ||
160 | Bool_t error = kFALSE; | |
6ace5fe2 | 161 | |
a5e1169e | 162 | AliCDBMetaData metaData; |
163 | metaData.SetBeamPeriod(0); | |
164 | metaData.SetResponsible("Wilfried Monange/Raphaelle Bailhache"); | |
165 | metaData.SetComment("TRD calib test"); | |
c8ab4518 | 166 | |
167 | Log("****** DCS ******\n"); | |
cd4fc278 | 168 | |
8dd14606 | 169 | TObjArray * list=AliTRDSensorArray::GetList (); |
cd4fc278 | 170 | |
171 | if (list == 0x0) { | |
6ace5fe2 | 172 | Log ("Error during AliTRDSensorArray::GetList"); |
173 | Log ("DCS will not be processing"); | |
8dd14606 | 174 | return kTRUE; |
6ace5fe2 | 175 | } |
176 | ||
177 | Int_t nEntries = list->GetEntries (); | |
178 | Log (Form ("%d alias loaded", nEntries)); | |
cd4fc278 | 179 | |
6ace5fe2 | 180 | Bool_t * results=new Bool_t [nEntries]; |
181 | Int_t * nGraph=new Int_t [nEntries]; | |
cd4fc278 | 182 | |
6ace5fe2 | 183 | for (Int_t iAlias = 0; iAlias < nEntries; iAlias++) { |
cd4fc278 | 184 | |
6ace5fe2 | 185 | AliTRDSensorArray * oneTRDDCS = (AliTRDSensorArray *)list->At (iAlias); |
cd4fc278 | 186 | |
6ace5fe2 | 187 | oneTRDDCS->SetStartTime (TTimeStamp (fStartTime)); |
188 | oneTRDDCS->SetEndTime (TTimeStamp (fEndTime)); | |
cd4fc278 | 189 | |
c8ab4518 | 190 | Log(Form("Processing DCS : \"%s\"", oneTRDDCS->GetStoreName ().Data ())); |
cd4fc278 | 191 | |
6ace5fe2 | 192 | TMap * map; |
193 | ||
194 | map=oneTRDDCS->ExtractDCS (dcsAliasMap); | |
cd4fc278 | 195 | |
6ace5fe2 | 196 | nGraph [iAlias] = map->GetEntries (); |
cd4fc278 | 197 | |
6ace5fe2 | 198 | if (nGraph [iAlias] == 0) { |
199 | Log("No TGraph for this dcsDatapointAlias : not stored"); | |
200 | results [iAlias] = kFALSE; | |
2ff01398 | 201 | error = kTRUE; |
6ace5fe2 | 202 | continue; |
203 | } | |
cd4fc278 | 204 | |
6ace5fe2 | 205 | oneTRDDCS->SetGraph(map); |
206 | results[iAlias]=Store("Calib", oneTRDDCS->GetStoreName().Data(), oneTRDDCS, &metaData, 0, kTRUE); | |
207 | delete map; | |
208 | ||
209 | //results [iAlias] = StoreReferenceData("Calib", oneTRDDCS->GetStoreName ().Data (), oneTRDDCS, &metaData); | |
210 | ||
6ace5fe2 | 211 | if (!results[iAlias]) { |
8dd14606 | 212 | AliError("Problem during StoreRef DCS"); |
213 | error=kTRUE; | |
6ace5fe2 | 214 | } |
215 | ||
6ace5fe2 | 216 | //BEGIN TEST (should not be removed ...) |
217 | /* | |
218 | oneTRDDCS->ClearGraph(); | |
219 | oneTRDDCS->ClearFit(); | |
220 | oneTRDDCS->SetDiffCut2 (0.1); | |
221 | map=oneTRDDCS->ExtractDCS (dcsAliasMap); | |
222 | oneTRDDCS->SetGraph (map); | |
223 | Store("Calib", ("cut_"+oneTRDDCS->GetStoreName()).Data(), oneTRDDCS, &metaData, 0, kTRUE); | |
224 | delete map; | |
225 | ||
226 | ||
227 | if(iAlias==1 || iAlias==19) continue; | |
228 | ||
229 | oneTRDDCS->ClearGraph(); | |
230 | oneTRDDCS->ClearFit(); | |
231 | oneTRDDCS->SetDiffCut2(0); | |
232 | map=oneTRDDCS->ExtractDCS(dcsAliasMap); | |
233 | oneTRDDCS->MakeSplineFit(map); | |
234 | Store("Calib", ("fit_"+oneTRDDCS->GetStoreName()).Data() , oneTRDDCS, &metaData, 0, kTRUE); | |
235 | delete map; | |
236 | ||
237 | ||
238 | oneTRDDCS->ClearGraph(); | |
239 | oneTRDDCS->ClearFit(); | |
240 | oneTRDDCS->SetDiffCut2 (0.1); | |
241 | map=oneTRDDCS->ExtractDCS (dcsAliasMap); | |
242 | oneTRDDCS->MakeSplineFit(map); | |
243 | Store("Calib", ("cutfit_"+oneTRDDCS->GetStoreName()).Data() , oneTRDDCS, &metaData, 0, kTRUE); | |
244 | delete map; | |
245 | */ | |
246 | //END TEST | |
247 | ||
6ace5fe2 | 248 | } |
cd4fc278 | 249 | |
6ace5fe2 | 250 | Log (" Summury of DCS :\n"); |
251 | Log (Form("%30s %10s %10s", "dcsDatapointAlias", "Stored ?", "# graph")); | |
252 | for (Int_t iAlias = 0; iAlias < nEntries; iAlias++) { | |
253 | AliTRDSensorArray * oneTRDDCS = (AliTRDSensorArray *)list->At (iAlias); | |
254 | Log (Form ("%30s %10s %4d", | |
255 | oneTRDDCS->GetStoreName ().Data (), | |
256 | results[iAlias] ? "ok" : "X", | |
257 | nGraph [iAlias])); | |
258 | } | |
259 | Log ("*********** End of DCS **********"); | |
260 | ||
261 | delete results; | |
262 | delete nGraph; | |
263 | ||
8dd14606 | 264 | return error; |
c8ab4518 | 265 | |
6ace5fe2 | 266 | } |
267 | ||
268 | //______________________________________________________________________________________________ | |
8dd14606 | 269 | Bool_t AliTRDPreprocessor::ExtractPedestals() |
6ace5fe2 | 270 | { |
271 | // | |
272 | // Pedestal running on LDCs at the DAQ | |
273 | // | |
54c85ef7 | 274 | |
275 | // | |
276 | // The reference data are stored in: | |
277 | // PadStatus1 for sm-00-01-02-09-10-11 | |
278 | // PadStatus2 for sm-03-04-05-12-13-14 | |
279 | // PadStatus3 for sm-06-07-08-15-16-17 | |
280 | // PadStatus0 if nothing found..means problems | |
281 | // | |
5029ad25 | 282 | |
8dd14606 | 283 | Bool_t error = kFALSE; |
6ace5fe2 | 284 | |
285 | // Init a AliTRDCalibPadStatus | |
286 | AliTRDCalibPadStatus calPedSum = AliTRDCalibPadStatus(); | |
287 | ||
288 | AliCDBMetaData metaData; | |
289 | metaData.SetBeamPeriod(0); | |
290 | metaData.SetResponsible("Raphaelle Bailhache"); | |
291 | metaData.SetComment("TRD calib test"); | |
292 | ||
293 | // Sum the contributions of the LDCs | |
294 | TList * listpad = GetFileSources(kDAQ,"PADSTATUS"); | |
8dd14606 | 295 | if (!listpad) { |
296 | Log("No list found for the PEDESTRAL Run"); | |
297 | return kTRUE; | |
298 | } | |
299 | ||
c8ab4518 | 300 | // loop through all files from LDCs |
8dd14606 | 301 | UInt_t index = 0; |
302 | while (listpad->At(index)!=NULL) { | |
303 | TObjString* fileNameEntry = (TObjString*) listpad->At(index); | |
304 | if (fileNameEntry != NULL) | |
305 | { | |
6ace5fe2 | 306 | TString fileName = GetFile(kDAQ, "PADSTATUS", |
307 | fileNameEntry->GetString().Data()); | |
8dd14606 | 308 | if(fileName.Length() ==0){ |
6ace5fe2 | 309 | Log(Form("Error by retrieving the file %d for the pedestal",(Int_t)index)); |
8dd14606 | 310 | delete listpad; |
311 | return kTRUE; | |
cd4fc278 | 312 | } |
8dd14606 | 313 | |
314 | TFile *f = TFile::Open(fileName); | |
315 | AliTRDCalibPadStatus *calPed; | |
316 | f->GetObject("calibpadstatus",calPed); | |
317 | ||
318 | if(calPed){ | |
319 | ||
54c85ef7 | 320 | Int_t ldc = 0; |
289cc637 | 321 | |
8dd14606 | 322 | // analyse |
289cc637 | 323 | //calPed->AnalyseHisto(); |
324 | ||
325 | // Add to the calPedSum | |
326 | for (Int_t idet=0; idet<540; idet++) { | |
327 | AliTRDCalROC *rocMean = calPed->GetCalRocMean(idet, kFALSE); | |
328 | if ( rocMean ) { | |
329 | calPedSum.SetCalRocMean(rocMean,idet); | |
54c85ef7 | 330 | ldc = (Int_t) (idet / 30); |
289cc637 | 331 | } |
332 | AliTRDCalROC *rocRMS = calPed->GetCalRocRMS(idet, kFALSE); | |
333 | if ( rocRMS ) { | |
334 | calPedSum.SetCalRocRMS(rocRMS,idet); | |
335 | } | |
e4db522f | 336 | AliTRDCalROC *rocMeand = calPed->GetCalRocMeand(idet, kFALSE); |
337 | if ( rocMeand ) { | |
338 | calPedSum.SetCalRocMeand(rocMeand,idet); | |
339 | } | |
340 | AliTRDCalROC *rocRMSd = calPed->GetCalRocRMSd(idet, kFALSE); | |
341 | if ( rocRMSd ) { | |
342 | calPedSum.SetCalRocRMSd(rocRMSd,idet); | |
343 | } | |
289cc637 | 344 | }// det loop |
345 | ||
54c85ef7 | 346 | if((ldc==0) || (ldc==1) || (ldc==2) || (ldc==9) || (ldc==10) || (ldc==11)) ldc = 1; |
347 | if((ldc==3) || (ldc==4) || (ldc==5) || (ldc==12) || (ldc==13) || (ldc==14)) ldc = 2; | |
348 | if((ldc==6) || (ldc==7) || (ldc==8) || (ldc==15) || (ldc==16) || (ldc==17)) ldc = 3; | |
349 | ||
8dd14606 | 350 | // store as reference data |
351 | TString name("PadStatus"); | |
54c85ef7 | 352 | name += ldc; |
8dd14606 | 353 | if(!StoreReferenceData("DAQData",(const char *)name,(TObject *) calPed,&metaData)){ |
354 | Log(Form("Error storing AliTRDCalibPadStatus object %d as reference data",(Int_t)index)); | |
355 | error = kTRUE; | |
356 | } | |
289cc637 | 357 | |
8dd14606 | 358 | } // calPed |
359 | } // fileNameEntry | |
360 | ++index; | |
361 | }// while (list) | |
c8ab4518 | 362 | |
8dd14606 | 363 | Log(Form("%d elements found in the list for the pedestal",(Int_t)index)); |
364 | if(index==0){ | |
6ace5fe2 | 365 | delete listpad; |
8dd14606 | 366 | return kTRUE; |
6ace5fe2 | 367 | } |
c8ab4518 | 368 | |
8dd14606 | 369 | // |
5029ad25 | 370 | // Create pedestal |
8dd14606 | 371 | // |
c8ab4518 | 372 | |
8dd14606 | 373 | // Create Pad Status |
374 | AliTRDCalPadStatus *calPadStatus = calPedSum.CreateCalPadStatus(); | |
5029ad25 | 375 | // Create Noise |
376 | //Make the AliTRDCalPad | |
377 | AliTRDCalPad *calPad2 = calPedSum.CreateCalPad(); | |
378 | //Make the AliTRDCalDet correspondant | |
379 | AliTRDCalDet *calDet = calPedSum.CreateCalDet(); | |
380 | ||
381 | // | |
382 | // Take the noise and Pad status from the previous OCDB | |
383 | // | |
384 | ||
385 | AliTRDCalPad *calPadPrevious=0; | |
386 | AliCDBEntry* entry = GetFromOCDB("Calib", "PadNoise"); | |
387 | if (entry) calPadPrevious = (AliTRDCalPad*)entry->GetObject(); | |
388 | if ( calPadPrevious==NULL ) { | |
389 | Log("AliTRDPreprocsessor: No previous TRD pad noise entry available.\n"); | |
390 | calPadPrevious = new AliTRDCalPad("PadNoise", "PadNoise"); | |
391 | } | |
392 | ||
393 | AliTRDCalPadStatus *calPadStatusPrevious=0; | |
394 | entry = GetFromOCDB("Calib", "PadStatus"); | |
395 | if (entry) calPadStatusPrevious = (AliTRDCalPadStatus*)entry->GetObject(); | |
396 | if ( calPadStatusPrevious==NULL ) { | |
397 | Log("AliTRDPreprocsessor: No previous TRD pad status entry available.\n"); | |
398 | calPadStatusPrevious = new AliTRDCalPadStatus("padstatus", "padstatus"); | |
399 | for (Int_t idet=0; idet<540; ++idet) | |
400 | { | |
401 | AliTRDCalSingleChamberStatus *calROC = calPadStatusPrevious->GetCalROC(idet); | |
402 | for(Int_t k = 0; k < calROC->GetNchannels(); k++){ | |
403 | calROC->SetStatus(k,AliTRDCalPadStatus::kMasked); | |
404 | } | |
405 | } | |
406 | } | |
407 | ||
408 | ||
409 | // Loop over detectors for check | |
410 | for (Int_t det=0; det<AliTRDgeometry::kNdet; ++det) { | |
411 | ||
412 | // noise | |
413 | AliTRDCalROC *calROCPreviousNoise = calPadPrevious->GetCalROC(det); | |
414 | AliTRDCalROC *calROCNoise = calPad2->GetCalROC(det); | |
415 | ||
416 | // padstatus | |
417 | AliTRDCalSingleChamberStatus *calROCPreviousStatus = calPadStatusPrevious->GetCalROC(det); | |
418 | AliTRDCalSingleChamberStatus *calROCStatus = calPadStatus->GetCalROC(det); | |
419 | ||
420 | ||
421 | // loop over first half and second half chamber | |
422 | for(Int_t half = 0; half < 2; half++){ | |
423 | ||
424 | Bool_t data = AreThereDataPedestal(calROCStatus,(Bool_t)half); | |
37b0cf5e | 425 | //printf("There are data for the detector %d the half %d: %d\n",det,half,data); |
5029ad25 | 426 | if(!data){ |
427 | // look if data in the OCDB | |
428 | Bool_t dataPrevious = AreThereDataPedestal(calROCPreviousStatus,(Bool_t)half); | |
429 | // if no data at all, set to default value | |
430 | if(!dataPrevious){ | |
431 | SetDefaultStatus(*calROCStatus,(Bool_t)half); | |
432 | SetDefaultNoise(*calROCNoise,(Bool_t)half); | |
433 | } | |
434 | else{ | |
435 | // if data, set to previous value | |
436 | SetStatus(*calROCStatus,calROCPreviousStatus,(Bool_t)half); | |
437 | SetNoise(*calROCNoise,calROCPreviousNoise,(Bool_t)half); | |
438 | } | |
439 | } | |
440 | } | |
441 | } | |
442 | ||
443 | // | |
444 | // Store | |
445 | // | |
446 | ||
8dd14606 | 447 | AliCDBMetaData md3; |
448 | md3.SetObjectClassName("AliTRDCalPadStatus"); | |
449 | md3.SetResponsible("Raphaelle Bailhache"); | |
450 | md3.SetBeamPeriod(1); | |
451 | md3.SetComment("TRD calib test"); | |
452 | if(!Store("Calib","PadStatus" ,(TObject *)calPadStatus, &md3, 0, kTRUE)){ | |
453 | Log("Error storing the pedestal"); | |
454 | delete listpad; | |
455 | return kTRUE; | |
a5e1169e | 456 | } |
289cc637 | 457 | |
289cc637 | 458 | AliCDBMetaData md4; |
459 | md4.SetObjectClassName("AliTRDCalPad"); | |
460 | md4.SetResponsible("Raphaelle Bailhache"); | |
461 | md4.SetBeamPeriod(1); | |
462 | md4.SetComment("TRD calib test"); | |
463 | if(!Store("Calib","PadNoise" ,(TObject *)calPad2, &md4, 0, kTRUE)){ | |
464 | Log("Error storing the pedestal"); | |
465 | delete listpad; | |
466 | return kTRUE; | |
467 | } | |
5029ad25 | 468 | |
289cc637 | 469 | AliCDBMetaData md5; |
470 | md5.SetObjectClassName("AliTRDCalDet"); | |
471 | md5.SetResponsible("Raphaelle Bailhache"); | |
472 | md5.SetBeamPeriod(1); | |
473 | md5.SetComment("TRD calib test"); | |
474 | if(!Store("Calib","DetNoise" ,(TObject *)calDet, &md5, 0, kTRUE)){ | |
475 | Log("Error storing the pedestal"); | |
476 | delete listpad; | |
477 | return kTRUE; | |
478 | } | |
479 | ||
8dd14606 | 480 | delete listpad; |
481 | return error; | |
5029ad25 | 482 | |
483 | } | |
484 | //__________________________________________________________________ | |
485 | Bool_t AliTRDPreprocessor::AreThereDataPedestal(AliTRDCalSingleChamberStatus *calROCStatus, Bool_t second){ | |
a5e1169e | 486 | |
5029ad25 | 487 | // |
488 | // Data for this half chamber | |
489 | // | |
490 | ||
491 | Bool_t data = kFALSE; | |
492 | Int_t nCols = calROCStatus->GetNcols(); | |
493 | Int_t nCol0 = 0; | |
494 | Int_t nColE = (Int_t) nCols/2 - 2; | |
495 | if(second) { | |
496 | nCol0 = nColE + 4; | |
497 | nColE = nCols; | |
498 | } | |
f2a468d7 | 499 | |
500 | Int_t totalnumberofpads = 0; | |
501 | Int_t totalnumberofdata = 0; | |
502 | ||
5029ad25 | 503 | for(Int_t col = nCol0; col < nColE; col++){ |
504 | for(Int_t row = 0; row < calROCStatus->GetNrows(); row++){ | |
f2a468d7 | 505 | totalnumberofpads++; |
5029ad25 | 506 | //printf("ismasked %d\n",(Int_t)calROCStatus->IsMasked(col,row)); |
37b0cf5e | 507 | if(!calROCStatus->GetStatus(col,row)) { |
5029ad25 | 508 | data = kTRUE; |
f2a468d7 | 509 | totalnumberofdata++; |
5029ad25 | 510 | } |
511 | } | |
5029ad25 | 512 | } |
f2a468d7 | 513 | if(totalnumberofdata < (Int_t)(totalnumberofpads/2)) data = kFALSE; |
5029ad25 | 514 | |
515 | return data; | |
516 | ||
517 | } | |
518 | //__________________________________________________________________ | |
519 | void AliTRDPreprocessor::SetDefaultStatus(AliTRDCalSingleChamberStatus &calROCStatus, Bool_t second){ | |
520 | ||
521 | // | |
522 | // default status for this half chamber | |
523 | // | |
524 | ||
525 | Int_t nCols = calROCStatus.GetNcols(); | |
526 | Int_t nCol0 = 0; | |
527 | Int_t nColE = (Int_t) nCols/2; | |
528 | if(second) { | |
529 | nCol0 = nColE; | |
530 | nColE = nCols; | |
531 | } | |
532 | for(Int_t col = nCol0; col < nColE; col++){ | |
533 | for(Int_t row = 0; row < calROCStatus.GetNrows(); row++){ | |
534 | calROCStatus.SetStatus(col,row,0); | |
535 | } | |
536 | } | |
537 | } | |
538 | //__________________________________________________________________ | |
539 | void AliTRDPreprocessor::SetStatus(AliTRDCalSingleChamberStatus &calROCStatus, AliTRDCalSingleChamberStatus *calROCStatusPrevious,Bool_t second){ | |
540 | ||
541 | // | |
542 | // previous status for this half chamber | |
543 | // | |
544 | ||
545 | Int_t nCols = calROCStatus.GetNcols(); | |
546 | Int_t nCol0 = 0; | |
547 | Int_t nColE = (Int_t) nCols/2; | |
548 | if(second) { | |
549 | nCol0 = nColE; | |
550 | nColE = nCols; | |
551 | } | |
552 | for(Int_t col = nCol0; col < nColE; col++){ | |
553 | for(Int_t row = 0; row < calROCStatus.GetNrows(); row++){ | |
554 | calROCStatus.SetStatus(col,row,calROCStatusPrevious->GetStatus(col,row)); | |
555 | } | |
556 | } | |
6ace5fe2 | 557 | } |
5029ad25 | 558 | //__________________________________________________________________ |
559 | void AliTRDPreprocessor::SetDefaultNoise(AliTRDCalROC &calROCNoise, Bool_t second){ | |
560 | ||
561 | // | |
562 | // default noise for this half chamber | |
563 | // | |
c8ab4518 | 564 | |
5029ad25 | 565 | Int_t nCols = calROCNoise.GetNcols(); |
566 | Int_t nCol0 = 0; | |
567 | Int_t nColE = (Int_t) nCols/2; | |
568 | if(second) { | |
569 | nCol0 = nColE; | |
570 | nColE = nCols; | |
571 | } | |
572 | for(Int_t col = nCol0; col < nColE; col++){ | |
573 | for(Int_t row = 0; row < calROCNoise.GetNrows(); row++){ | |
574 | calROCNoise.SetValue(col,row,0.12); | |
575 | } | |
576 | } | |
577 | } | |
578 | //__________________________________________________________________ | |
579 | void AliTRDPreprocessor::SetNoise(AliTRDCalROC &calROCNoise, AliTRDCalROC *calROCNoisePrevious, Bool_t second){ | |
580 | ||
581 | // | |
582 | // previous noise for this half chamber | |
583 | // | |
584 | ||
585 | Int_t nCols = calROCNoise.GetNcols(); | |
586 | Int_t nCol0 = 0; | |
587 | Int_t nColE = (Int_t) nCols/2; | |
588 | if(second) { | |
589 | nCol0 = nColE; | |
590 | nColE = nCols; | |
591 | } | |
592 | for(Int_t col = nCol0; col < nColE; col++){ | |
593 | for(Int_t row = 0; row < calROCNoise.GetNrows(); row++){ | |
594 | calROCNoise.SetValue(col,row,calROCNoisePrevious->GetValue(col,row)); | |
595 | } | |
596 | } | |
597 | } | |
6ace5fe2 | 598 | //______________________________________________________________________________________________ |
8dd14606 | 599 | Bool_t AliTRDPreprocessor::ExtractDriftVelocityDAQ() |
6ace5fe2 | 600 | { |
e5c60cc7 | 601 | // |
6ace5fe2 | 602 | // Drift velocity DA running on monitoring servers at the DAQ |
e5c60cc7 | 603 | // |
604 | ||
8dd14606 | 605 | Bool_t error = kFALSE; |
6ace5fe2 | 606 | |
607 | // Objects for HLT and DAQ zusammen | |
3a0f6479 | 608 | AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance(); |
6ace5fe2 | 609 | AliCDBMetaData metaData; |
610 | metaData.SetBeamPeriod(0); | |
611 | metaData.SetResponsible("Raphaelle Bailhache"); | |
612 | metaData.SetComment("TRD calib test"); | |
3a0f6479 | 613 | // Store the infos for the detector |
6ace5fe2 | 614 | AliCDBMetaData md1; |
615 | md1.SetObjectClassName("AliTRDCalDet"); | |
616 | md1.SetResponsible("Raphaelle Bailhache"); | |
617 | md1.SetBeamPeriod(0); | |
618 | md1.SetComment("TRD calib test"); | |
3a0f6479 | 619 | // Store the infos for the pads |
6ace5fe2 | 620 | AliCDBMetaData md2; |
621 | md2.SetObjectClassName("AliTRDCalPad"); | |
622 | md2.SetResponsible("Raphaelle Bailhache"); | |
623 | md2.SetBeamPeriod(0); | |
624 | md2.SetComment("TRD calib test"); | |
3a0f6479 | 625 | |
6ace5fe2 | 626 | // Take the file from the DAQ file exchange server |
627 | TList *listdaq = GetFileSources(kDAQ,"VDRIFT"); | |
8dd14606 | 628 | if (!listdaq) { |
6ace5fe2 | 629 | Log("No list found for vdrift (DAQ)"); |
8dd14606 | 630 | return kTRUE; |
631 | } | |
632 | ||
633 | if(listdaq->GetSize() !=1){ | |
634 | Log(Form("Problem on the size of the list: %d (DAQ)",listdaq->GetSize())); | |
635 | delete listdaq; | |
636 | return kTRUE; | |
6ace5fe2 | 637 | } |
8dd14606 | 638 | |
639 | TObjString* fileNameEntry = (TObjString*) listdaq->At(0); | |
640 | if(fileNameEntry != NULL){ | |
641 | TString fileName = GetFile(kDAQ, "VDRIFT", | |
642 | fileNameEntry->GetString().Data()); | |
643 | if(fileName.Length() ==0){ | |
644 | Log("Error retrieving the file vdrift (DAQ)"); | |
645 | delete listdaq; | |
646 | return kTRUE; | |
647 | } | |
648 | TFile *filedaq = TFile::Open(fileName); | |
649 | TProfile2D *histodriftvelocity = (TProfile2D *) filedaq->Get("PH2d"); | |
650 | if (histodriftvelocity) { | |
651 | ||
652 | // store as reference data | |
653 | if(!StoreReferenceData("DAQData","VdriftT0",(TObject *) histodriftvelocity,&metaData)){ | |
654 | Log("Error storing 2D Profile for vdrift from the DAQ"); | |
655 | error = kTRUE; | |
656 | } | |
657 | ||
658 | // analyse | |
659 | ||
660 | Log("Take the PH reference data. Now we will try to fit\n"); | |
661 | calibra->SetMinEntries(2000); // If there is less than 2000 | |
662 | calibra->AnalysePH(histodriftvelocity); | |
663 | ||
664 | Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(1)) | |
665 | + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(1)); | |
666 | Int_t nbfit = calibra->GetNumberFit(); | |
667 | Int_t nbE = calibra->GetNumberEnt(); | |
668 | ||
669 | // if enough statistics store the results | |
670 | if ((nbtg > 0) && | |
671 | (nbfit >= 0.95*nbE)) { | |
672 | // create the cal objects | |
673 | TObjArray object = calibra->GetVectorFit(); | |
674 | AliTRDCalDet *objdriftvelocitydet = calibra->CreateDetObjectVdrift(&object,kTRUE); | |
675 | TObject *objdriftvelocitypad = calibra->CreatePadObjectVdrift(); | |
676 | object = calibra->GetVectorFit2(); | |
677 | AliTRDCalDet *objtime0det = calibra->CreateDetObjectT0(&object,kTRUE); | |
678 | TObject *objtime0pad = calibra->CreatePadObjectT0(); | |
679 | calibra->ResetVectorFit(); | |
680 | // store | |
681 | if(!Store("Calib","ChamberVdrift" ,(TObject *) objdriftvelocitydet,&md1,0,kTRUE)){ | |
682 | Log("Error storing the calibration object for the chamber vdrift (DAQ)"); | |
683 | error = kTRUE; | |
684 | } | |
685 | if(!Store("Calib","ChamberT0" ,(TObject *) objtime0det ,&md1,0,kTRUE)){ | |
686 | Log("Error storing the calibration object for the chamber t0 (DAQ)"); | |
687 | error = kTRUE; | |
688 | } | |
689 | if(!Store("Calib","LocalVdrift" ,(TObject *) objdriftvelocitypad,&md2,0,kTRUE)){ | |
690 | Log("Error storing the calibration object for the local drift velocity (DAQ)"); | |
691 | error = kTRUE; | |
692 | } | |
693 | if(!Store("Calib","LocalT0" ,(TObject *) objtime0pad ,&md2,0,kTRUE)){ | |
694 | Log("Error storing the calibration object for the local time0 (DAQ)"); | |
695 | error = kTRUE; | |
696 | } | |
697 | } | |
698 | else{ | |
699 | Log("Not enough statistics for the average pulse height (DAQ)"); | |
700 | } | |
701 | } // histo here | |
702 | }// if fileNameEntry | |
703 | ||
704 | delete listdaq; | |
705 | return error; | |
706 | ||
6ace5fe2 | 707 | } |
c8ab4518 | 708 | |
6ace5fe2 | 709 | //______________________________________________________________________________________________ |
8dd14606 | 710 | Bool_t AliTRDPreprocessor::ExtractHLT() |
6ace5fe2 | 711 | { |
e5c60cc7 | 712 | // |
6ace5fe2 | 713 | // Gain, vdrift and PRF calibration running on HLT |
f5bb5557 | 714 | // return kTRUE if NULL pointer to the list |
e5c60cc7 | 715 | // |
3a0f6479 | 716 | |
8dd14606 | 717 | Bool_t error = kFALSE; |
718 | ||
6ace5fe2 | 719 | // Objects for HLT and DAQ zusammen |
720 | AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance(); | |
721 | AliCDBMetaData metaData; | |
722 | metaData.SetBeamPeriod(0); | |
723 | metaData.SetResponsible("Raphaelle Bailhache"); | |
724 | metaData.SetComment("TRD calib test"); | |
725 | // Store the infos for the detector | |
726 | AliCDBMetaData md1; | |
727 | md1.SetObjectClassName("AliTRDCalDet"); | |
728 | md1.SetResponsible("Raphaelle Bailhache"); | |
729 | md1.SetBeamPeriod(0); | |
730 | md1.SetComment("TRD calib test"); | |
731 | // Store the infos for the pads | |
732 | AliCDBMetaData md2; | |
733 | md2.SetObjectClassName("AliTRDCalPad"); | |
734 | md2.SetResponsible("Raphaelle Bailhache"); | |
735 | md2.SetBeamPeriod(0); | |
736 | md2.SetComment("TRD calib test"); | |
6ace5fe2 | 737 | |
738 | // Take the file from the HLT file exchange server | |
739 | TList *listhlt = GetFileSources(kHLT,"GAINDRIFTPRF"); | |
8dd14606 | 740 | if (!listhlt) { |
6ace5fe2 | 741 | Log("No list found for the HLT"); |
8dd14606 | 742 | return kTRUE; |
743 | } | |
744 | ||
745 | if(listhlt->GetSize() != 1) { | |
746 | Log(Form("Problem on the size of the list: %d (HLT)",listhlt->GetSize())); | |
747 | delete listhlt; | |
748 | return kTRUE; | |
6ace5fe2 | 749 | } |
3a0f6479 | 750 | |
8dd14606 | 751 | TObjString* fileNameEntry = (TObjString*) listhlt->At(0); |
752 | if(fileNameEntry != NULL){ | |
753 | TString fileName = GetFile(kHLT, "GAINDRIFTPRF", | |
754 | fileNameEntry->GetString().Data()); | |
755 | if(fileName.Length() ==0){ | |
756 | Log("Error retrieving the file (HLT)"); | |
757 | delete listhlt; | |
758 | return kTRUE; | |
759 | } | |
760 | // Take the file | |
761 | TFile *filehlt = TFile::Open(fileName); | |
762 | ||
8dd14606 | 763 | // gain |
764 | TH2I *histogain = (TH2I *) filehlt->Get("CH2d"); | |
765 | histogain->SetDirectory(0); | |
766 | if (histogain) { | |
767 | // store the reference data | |
768 | if(!StoreReferenceData("HLTData","Gain",(TObject *) histogain,&metaData)){ | |
769 | Log("Error storing 2D histos for gain"); | |
770 | error = kTRUE; | |
771 | } | |
772 | // analyse | |
773 | Log("Take the CH reference data. Now we will try to fit\n"); | |
774 | calibra->SetMinEntries(1000); // If there is less than 1000 entries in the histo: no fit | |
775 | calibra->AnalyseCH(histogain); | |
776 | Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(0)) | |
777 | + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(0)); | |
778 | Int_t nbfit = calibra->GetNumberFit(); | |
779 | Int_t nbE = calibra->GetNumberEnt(); | |
780 | // enough statistics | |
781 | if ((nbtg > 0) && | |
782 | (nbfit >= 0.95*nbE)) { | |
783 | // create the cal objects | |
784 | TObjArray object = calibra->GetVectorFit(); | |
413153cb | 785 | AliTRDCalDet *objgaindet = calibra->CreateDetObjectGain(&object); |
8dd14606 | 786 | TObject *objgainpad = calibra->CreatePadObjectGain(); |
787 | // store them | |
788 | if(!Store("Calib","ChamberGainFactor",(TObject *) objgaindet ,&md1,0,kTRUE)){ | |
789 | Log("Error storing the calibration object for the chamber gain"); | |
790 | error = kTRUE; | |
791 | } | |
792 | if(!Store("Calib","LocalGainFactor" ,(TObject *) objgainpad ,&md2,0,kTRUE)){ | |
793 | Log("Error storing the calibration object for the local gain factor"); | |
794 | error = kTRUE; | |
795 | } | |
796 | } | |
797 | calibra->ResetVectorFit(); | |
798 | }// if histogain | |
799 | ||
8dd14606 | 800 | // vdrift |
801 | fVdriftHLT = kFALSE; | |
802 | TProfile2D *histodriftvelocity = (TProfile2D *) filehlt->Get("PH2d"); | |
803 | histodriftvelocity->SetDirectory(0); | |
804 | if (histodriftvelocity) { | |
805 | // store the reference data | |
806 | if(!StoreReferenceData("HLTData","VdriftT0",(TObject *) histodriftvelocity,&metaData)){ | |
807 | Log("Error storing 2D Profile for average pulse height (HLT)"); | |
808 | error = kTRUE; | |
809 | } | |
810 | // analyse | |
811 | Log("Take the PH reference data. Now we will try to fit\n"); | |
812 | calibra->SetMinEntries(1000*20); // If there is less than 20000 | |
813 | calibra->AnalysePH(histodriftvelocity); | |
814 | Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(1)) | |
815 | + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(1)); | |
816 | Int_t nbfit = calibra->GetNumberFit(); | |
817 | Int_t nbE = calibra->GetNumberEnt(); | |
818 | // enough statistics | |
819 | if ((nbtg > 0) && | |
820 | (nbfit >= 0.95*nbE)) { | |
821 | // create the cal objects | |
822 | TObjArray object = calibra->GetVectorFit(); | |
823 | AliTRDCalDet *objdriftvelocitydet = calibra->CreateDetObjectVdrift(&object,kTRUE); | |
824 | TObject *objdriftvelocitypad = calibra->CreatePadObjectVdrift(); | |
825 | object = calibra->GetVectorFit2(); | |
826 | AliTRDCalDet *objtime0det = calibra->CreateDetObjectT0(&object,kTRUE); | |
827 | TObject *objtime0pad = calibra->CreatePadObjectT0(); | |
828 | // store them | |
829 | if(!Store("Calib","ChamberVdrift" ,(TObject *) objdriftvelocitydet,&md1,0,kTRUE)){ | |
830 | Log("Error storing the calibration object for the chamber vdrift (HLT)"); | |
831 | error = kTRUE; | |
832 | } | |
833 | if(!Store("Calib","ChamberT0" ,(TObject *) objtime0det ,&md1,0,kTRUE)){ | |
834 | Log("Error storing the calibration object for the chamber t0 (HLT)"); | |
835 | error = kTRUE; | |
836 | } | |
837 | if(!Store("Calib","LocalVdrift" ,(TObject *) objdriftvelocitypad,&md2,0,kTRUE)){ | |
838 | Log("Error storing the calibration object for the local drift velocity (HLT)"); | |
839 | error = kTRUE; | |
840 | } | |
841 | if(!Store("Calib","LocalT0" ,(TObject *) objtime0pad ,&md2,0,kTRUE)){ | |
842 | Log("Error storing the calibration object for the local time0 (HLT)"); | |
843 | error = kTRUE; | |
844 | } | |
845 | fVdriftHLT = kTRUE; | |
846 | } | |
847 | calibra->ResetVectorFit(); | |
848 | }// if TProfile2D | |
849 | ||
8dd14606 | 850 | // prf |
851 | TProfile2D *histoprf = (TProfile2D *) filehlt->Get("PRF2d"); | |
852 | histoprf->SetDirectory(0); | |
853 | if (histoprf) { | |
854 | // store reference data | |
855 | if(!StoreReferenceData("HLTData","PRF",(TObject *) histoprf,&metaData)){ | |
856 | Log("Error storing the 2D Profile for Pad Response Function"); | |
857 | error = kTRUE; | |
858 | } | |
859 | // analyse | |
860 | Log("Take the PRF reference data. Now we will try to fit\n"); | |
861 | calibra->SetMinEntries(600); // If there is less than 20000 | |
862 | calibra->AnalysePRFMarianFit(histoprf); | |
863 | Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(2)) | |
864 | + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(2)); | |
865 | Int_t nbfit = calibra->GetNumberFit(); | |
866 | Int_t nbE = calibra->GetNumberEnt(); | |
867 | // enough statistics | |
868 | if ((nbtg > 0) && | |
869 | (nbfit >= 0.95*nbE)) { | |
870 | // create cal pad objects | |
871 | TObjArray object = calibra->GetVectorFit(); | |
872 | TObject *objPRFpad = calibra->CreatePadObjectPRF(&object); | |
873 | // store them | |
874 | if(!Store("Calib","PRFWidth" ,(TObject *) objPRFpad ,&md2,0,kTRUE)){ | |
875 | Log("Error storing the calibration object for the Pad Response Function"); | |
876 | error = kTRUE; | |
877 | } | |
878 | } | |
879 | calibra->ResetVectorFit(); | |
880 | }// if PRF | |
881 | }// if fileNameEntry | |
882 | ||
883 | delete listhlt; | |
884 | return error; | |
885 | ||
e5c60cc7 | 886 | } |
fdfee371 | 887 | |
888 | //_____________________________________________________________________________ | |
889 | UInt_t AliTRDPreprocessor::ProcessDCSConfigData() | |
890 | { | |
891 | // | |
892 | // process the configuration of FEE, PTR and GTU | |
e74c968f | 893 | // reteive XML filei(s) from the DCS FXS |
894 | // parse it/them and store TObjArrays in the CDB | |
895 | // | |
fdfee371 | 896 | // return 0 for success, otherwise: |
e74c968f | 897 | // 5 : could not get the SOR file from the FXS |
898 | // 6 : could not get the EOR file from the FXS | |
899 | // 7 : | |
900 | // 8 : something wrong with the EOR file | |
901 | // 9 : | |
902 | // 10 : EOR XML is not well-formed | |
903 | // 11 : | |
904 | // 12 : ERROR in XML SAX validation of EOR: something wrong with the content | |
905 | // 13 : | |
906 | // 14 : ERROR while creating calibration objects in the handler | |
907 | // 15 : error while storing data in the CDB | |
fdfee371 | 908 | // |
909 | ||
910 | Log("Processing the DCS config summary file."); | |
911 | ||
e74c968f | 912 | // get the XML files |
913 | Log("Requesting the 2 summaryfiles from the FXS.."); | |
914 | const char * xmlFileS = GetFile(kDCS,"CONFIGSUMMARYSOR",""); | |
915 | const char * xmlFile = GetFile(kDCS,"CONFIGSUMMARYEOR",""); | |
916 | // for the time being just request BOTH files from the FXS | |
917 | // THEN it can be created online (otherwise the FXS would be messed up) | |
918 | // the next step is to actually read BOTH files and store their informations | |
919 | if (xmlFileS == NULL) { | |
920 | Log(Form("ERROR: SOR File %s not found!",xmlFileS)); | |
6b36d985 | 921 | return 5; |
922 | } else { | |
e74c968f | 923 | Log(Form("SOR File %s found.",xmlFileS)); |
924 | } | |
925 | if (xmlFile == NULL) { | |
926 | Log(Form("ERROR: EOR File %s not found!",xmlFile)); | |
927 | return 6; | |
928 | } else { | |
929 | Log(Form("EOR File %s found.",xmlFile)); | |
6b36d985 | 930 | } |
e74c968f | 931 | |
6b36d985 | 932 | // test the file |
933 | std::ifstream fileTest; | |
934 | fileTest.open(xmlFile, std::ios_base::binary | std::ios_base::in); | |
935 | if (!fileTest.good() || fileTest.eof() || !fileTest.is_open()) { | |
936 | Log(Form("ERROR: File %s not valid!",xmlFile)); | |
e74c968f | 937 | return 8; |
6b36d985 | 938 | } |
939 | fileTest.seekg(0, std::ios_base::end); | |
940 | if (static_cast<int>(fileTest.tellg()) < 2) { | |
941 | Log(Form("ERROR: File %s is empty!",xmlFile)); | |
e74c968f | 942 | return 8; |
fdfee371 | 943 | } |
6b36d985 | 944 | Log("File is tested valid."); |
fdfee371 | 945 | |
6b36d985 | 946 | // make a robust XML validation |
947 | TSAXParser testParser; | |
948 | if (testParser.ParseFile(xmlFile) < 0 ) { | |
949 | Log("ERROR: XML content is not well-formed."); | |
e74c968f | 950 | return 10; |
6b36d985 | 951 | } else { |
952 | Log("XML content is well-formed"); | |
953 | } | |
e74c968f | 954 | |
fdfee371 | 955 | // create parser and parse |
956 | TSAXParser saxParser; | |
957 | AliTRDSaxHandler saxHandler; | |
958 | saxParser.ConnectToHandler("AliTRDSaxHandler", &saxHandler); | |
959 | saxParser.ParseFile(xmlFile); | |
960 | ||
961 | // report errors if present | |
962 | if (saxParser.GetParseCode() == 0) { | |
963 | Log("XML file validation OK"); | |
964 | } else { | |
965 | Log(Form("ERROR in XML file validation. Parsecode: %s", saxParser.GetParseCode())); | |
e74c968f | 966 | return 12; |
fdfee371 | 967 | } |
6b36d985 | 968 | if (saxHandler.GetHandlerStatus() == 0) { |
969 | Log("SAX handler reports no errors."); | |
970 | } else { | |
fdfee371 | 971 | Log(Form("ERROR while creating calibration objects. Error code: %s", saxHandler.GetHandlerStatus())); |
e74c968f | 972 | return 14; |
fdfee371 | 973 | } |
974 | ||
975 | // get the calibration object storing the data from the handler | |
976 | AliTRDCalDCS* fCalDCSObj = saxHandler.GetCalDCSObj(); | |
6af58a56 | 977 | fCalDCSObj->EvaluateGlobalParameters(); |
978 | ||
fdfee371 | 979 | // store the DCS calib data in the CDB |
980 | AliCDBMetaData metaData1; | |
981 | metaData1.SetBeamPeriod(0); | |
982 | metaData1.SetResponsible("Frederick Kramer"); | |
983 | metaData1.SetComment("DCS configuration data in one AliTRDCalDCS object."); | |
6b36d985 | 984 | if (!Store("Calib", "DCS", fCalDCSObj, &metaData1, 0, kTRUE)) { |
fdfee371 | 985 | Log("problems while storing DCS config data object"); |
e74c968f | 986 | return 15; |
6b36d985 | 987 | } else { |
988 | Log("DCS config data object stored."); | |
fdfee371 | 989 | } |
990 | ||
6b36d985 | 991 | Log("Processing of the DCS config summary file DONE."); |
992 | ||
fdfee371 | 993 | return 0; |
994 | } | |
995 |