Fixing code so that components use the new standard DDL_RAW data type.
[u/mrichter/AliRoot.git] / TPC / AliTPCPreprocessor.cxx
CommitLineData
54472e4f 1/**************************************************************************
2 * Copyright(c) 2007, 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
72df5829 16
54472e4f 17#include "AliTPCPreprocessor.h"
a7dce0bc 18#include "AliShuttleInterface.h"
54472e4f 19
20#include "AliCDBMetaData.h"
21#include "AliDCSValue.h"
22#include "AliLog.h"
23#include "AliTPCSensorTempArray.h"
a7dce0bc 24#include "AliTPCROC.h"
25#include "AliTPCCalROC.h"
26#include "AliTPCCalPad.h"
27#include "AliTPCCalibPedestal.h"
9f016d99 28#include "AliTPCCalibPulser.h"
29#include "AliTPCCalibCE.h"
9e66a8dd 30#include "TFile.h"
7b54c8e9 31#include "TTree.h"
32#include "TEnv.h"
54472e4f 33
34#include <TTimeStamp.h>
35
a7dce0bc 36const Int_t kValCutTemp = 100; // discard temperatures > 100 degrees
37const Int_t kDiffCutTemp = 5; // discard temperature differences > 5 degrees
38const TString kPedestalRunType = "PEDESTAL_RUN"; // pedestal run identifier
9f016d99 39const TString kPulserRunType = "PULSER_RUN"; // pulser run identifier
bdffc5fb 40const TString kPhysicsRunType = "PHYSICS"; // physics run identifier
9c754ce7 41const TString kStandAloneRunType = "STANDALONE"; // standalone run identifier
42const TString kDaqRunType = "DAQ"; // DAQ run identifier
67a165ed 43const TString kAmandaTemp = "tpc_PT_%d.Temperature"; // Amanda string for temperature entries
bee89eeb 44//const Double_t kFitFraction = 0.7; // Fraction of DCS sensor fits required
68b512ca 45const Double_t kFitFraction = -1.0; // Don't require minimum number of fits in commissioning run
72df5829 46
54472e4f 47//
48// This class is the SHUTTLE preprocessor for the TPC detector.
54472e4f 49//
50
51ClassImp(AliTPCPreprocessor)
52
53//______________________________________________________________________________________________
6d07bf74 54AliTPCPreprocessor::AliTPCPreprocessor(AliShuttleInterface* shuttle) :
55 AliPreprocessor("TPC",shuttle),
bdffc5fb 56 fConfEnv(0), fTemp(0), fHighVoltage(0), fConfigOK(kTRUE), fROC(0)
54472e4f 57{
58 // constructor
a7dce0bc 59 fROC = AliTPCROC::Instance();
54472e4f 60}
72df5829 61//______________________________________________________________________________________________
62// AliTPCPreprocessor::AliTPCPreprocessor(const AliTPCPreprocessor& org) :
63// AliPreprocessor(org),
bdffc5fb 64// fConfEnv(0), fTemp(0), fHighVoltage(0), fConfigOK(kTRUE)
72df5829 65// {
66// // copy constructor not implemented
f7f602cc 67// // -- missing underlying copy constructor in AliPreprocessor
68//
72df5829 69// Fatal("AliTPCPreprocessor", "copy constructor not implemented");
f7f602cc 70//
71// // fTemp = new AliTPCSensorTempArray(*(org.fTemp));
72df5829 72// }
54472e4f 73
74//______________________________________________________________________________________________
75AliTPCPreprocessor::~AliTPCPreprocessor()
76{
77 // destructor
a7dce0bc 78
54472e4f 79 delete fTemp;
bdffc5fb 80 delete fHighVoltage;
54472e4f 81}
72df5829 82//______________________________________________________________________________________________
83AliTPCPreprocessor& AliTPCPreprocessor::operator = (const AliTPCPreprocessor& )
84{
85 Fatal("operator =", "assignment operator not implemented");
86 return *this;
87}
88
54472e4f 89
90//______________________________________________________________________________________________
91void AliTPCPreprocessor::Initialize(Int_t run, UInt_t startTime,
92 UInt_t endTime)
93{
94 // Creates AliTestDataDCS object
95
96 AliPreprocessor::Initialize(run, startTime, endTime);
97
98 AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
99 TTimeStamp(startTime).AsString(),
100 TTimeStamp(endTime).AsString()));
101
7b54c8e9 102 // Preprocessor configuration
103
37092b2b 104 AliCDBEntry* entry = GetFromOCDB("Config", "Preprocessor");
7b54c8e9 105 if (entry) fConfEnv = (TEnv*) entry->GetObject();
106 if ( fConfEnv==0 ) {
7b54c8e9 107 Log("AliTPCPreprocsessor: Preprocessor Config OCDB entry missing.\n");
37092b2b 108 fConfigOK = kFALSE;
109 return;
7b54c8e9 110 }
111
18eade96 112 // Temperature sensors
113
f7f602cc 114 TTree *confTree = 0;
7b54c8e9 115 entry = GetFromOCDB("Config", "Temperature");
f7f602cc 116 if (entry) confTree = (TTree*) entry->GetObject();
18eade96 117 if ( confTree==0 ) {
18eade96 118 Log("AliTPCPreprocsessor: Temperature Config OCDB entry missing.\n");
119 fConfigOK = kFALSE;
f7f602cc 120 return;
18eade96 121 }
67a165ed 122 fTemp = new AliTPCSensorTempArray(fStartTime, fEndTime, confTree, kAmandaTemp);
18eade96 123 fTemp->SetValCut(kValCutTemp);
124 fTemp->SetDiffCut(kDiffCutTemp);
f7f602cc 125
18eade96 126
bdffc5fb 127 // High voltage measurements
128
129 if (false) { // high voltage maps not yet implemented...
130 confTree=0;
131 entry=0;
132 entry = GetFromOCDB("Config", "HighVoltage");
133 if (entry) confTree = (TTree*) entry->GetObject();
134 if ( confTree==0 ) {
135 Log("AliTPCPreprocsessor: High Voltage Config OCDB entry missing.\n");
136 fConfigOK = kFALSE;
137 return;
138 }
139 fHighVoltage = new AliDCSSensorArray(fStartTime, fEndTime, confTree);
140 }
54472e4f 141}
142
143//______________________________________________________________________________________________
144UInt_t AliTPCPreprocessor::Process(TMap* dcsAliasMap)
145{
146 // Fills data into TPC calibrations objects
147
54472e4f 148 // Amanda servers provide information directly through dcsAliasMap
149
a7dce0bc 150 if (!dcsAliasMap) return 9;
7b54c8e9 151 if (dcsAliasMap->GetEntries() == 0 ) return 9;
a7dce0bc 152 if (!fConfigOK) return 9;
153
154 TString runType = GetRunType();
155
54472e4f 156 // Temperature sensors are processed by AliTPCCalTemp
72df5829 157
18eade96 158
54472e4f 159 UInt_t tempResult = MapTemperature(dcsAliasMap);
160 UInt_t result=tempResult;
18eade96 161
bdffc5fb 162 // High Voltage recordings
163
164
165 if (false) { // High Voltage maps not yet implemented..
166
167 UInt_t hvResult = MapHighVoltage(dcsAliasMap);
168 result+=hvResult;
169
170 }
f7f602cc 171
54472e4f 172 // Other calibration information will be retrieved through FXS files
a7dce0bc 173 // examples:
54472e4f 174 // TList* fileSourcesDAQ = GetFile(AliShuttleInterface::kDAQ, "pedestals");
175 // const char* fileNamePed = GetFile(AliShuttleInterface::kDAQ, "pedestals", "LDC1");
176 //
177 // TList* fileSourcesHLT = GetFile(AliShuttleInterface::kHLT, "calib");
178 // const char* fileNameHLT = GetFile(AliShuttleInterface::kHLT, "calib", "LDC1");
179
9f016d99 180 // pedestal entries
54472e4f 181
a7dce0bc 182 if(runType == kPedestalRunType) {
68b512ca 183 Int_t numSources = 1;
184 Int_t pedestalSource[2] = {AliShuttleInterface::kDAQ,AliShuttleInterface::kHLT} ;
7b54c8e9 185 TString source = fConfEnv->GetValue("Pedestal","DAQ");
186 source.ToUpper();
68b512ca 187 if ( source == "HLT") pedestalSource[0] = AliShuttleInterface::kHLT;
188 if (!GetHLTStatus()) pedestalSource[0] = AliShuttleInterface::kDAQ;
189 if (source == "HLTDAQ" ) {
190 numSources=2;
191 pedestalSource[0] = AliShuttleInterface::kHLT;
192 pedestalSource[1] = AliShuttleInterface::kDAQ;
193 }
194 if (source == "DAQHLT" ) numSources=2;
195 UInt_t pedestalResult=0;
196 for (Int_t i=0; i<numSources; i++ ) {
197 UInt_t pedestalResult = ExtractPedestals(pedestalSource[i]);
198 if ( pedestalResult == 0 ) break;
199 }
a7dce0bc 200 result += pedestalResult;
7b54c8e9 201
a7dce0bc 202 }
203
9f016d99 204 // pulser trigger processing
205
68b512ca 206 if(runType == kPulserRunType) {
207 Int_t numSources = 1;
208 Int_t pulserSource[2] = {AliShuttleInterface::kDAQ,AliShuttleInterface::kHLT} ;
9f016d99 209 TString source = fConfEnv->GetValue("Pulser","DAQ");
210 source.ToUpper();
68b512ca 211 if ( source == "HLT") pulserSource[0] = AliShuttleInterface::kHLT;
212 if (!GetHLTStatus()) pulserSource[0] = AliShuttleInterface::kDAQ;
213 if (source == "HLTDAQ" ) {
214 numSources=2;
215 pulserSource[0] = AliShuttleInterface::kHLT;
216 pulserSource[1] = AliShuttleInterface::kDAQ;
217 }
218 if (source == "DAQHLT" ) numSources=2;
219 UInt_t pulserResult=0;
220 for (Int_t i=0; i<numSources; i++ ) {
221 pulserResult = ExtractPulser(pulserSource[i]);
222 if ( pulserResult == 0 ) break;
223 }
9f016d99 224 result += pulserResult;
225
226 }
227
68b512ca 228
229
9f016d99 230 // Central Electrode processing
231
9c754ce7 232 if( runType == kPhysicsRunType || runType == kStandAloneRunType ||
233 runType == kDaqRunType ) {
68b512ca 234
235 Int_t numSources = 1;
236 Int_t ceSource[2] = {AliShuttleInterface::kDAQ,AliShuttleInterface::kHLT} ;
9f016d99 237 TString source = fConfEnv->GetValue("CE","DAQ");
238 source.ToUpper();
68b512ca 239 if ( source == "HLT") ceSource[0] = AliShuttleInterface::kHLT;
240 if (!GetHLTStatus()) ceSource[0] = AliShuttleInterface::kDAQ;
241 if (source == "HLTDAQ" ) {
242 numSources=2;
243 ceSource[0] = AliShuttleInterface::kHLT;
244 ceSource[1] = AliShuttleInterface::kDAQ;
245 }
246 if (source == "DAQHLT" ) numSources=2;
247 UInt_t ceResult=0;
248 for (Int_t i=0; i<numSources; i++ ) {
249 ceResult = ExtractCE(ceSource[i]);
250 if ( ceResult == 0 ) break;
251 }
9f016d99 252 result += ceResult;
253
254 }
a7dce0bc 255
c9a7c1da 256// return result;
257 return 0; // Don't produce error codes during December tests
54472e4f 258}
259//______________________________________________________________________________________________
260UInt_t AliTPCPreprocessor::MapTemperature(TMap* dcsAliasMap)
261{
262
263 // extract DCS temperature maps. Perform fits to save space
264
72df5829 265 UInt_t result=0;
54472e4f 266 TMap *map = fTemp->ExtractDCS(dcsAliasMap);
267 if (map) {
268 fTemp->MakeSplineFit(map);
68b512ca 269 Double_t fitFraction = 1.0*fTemp->NumFits()/fTemp->NumSensors();
67a165ed 270 if (fitFraction > kFitFraction ) {
271 AliInfo(Form("Temperature values extracted, fits performed.\n"));
272 } else {
273 Log ("Too few temperature maps fitted. \n");
274 result = 9;
275 }
54472e4f 276 } else {
67a165ed 277 Log("No temperature map extracted. \n");
72df5829 278 result=9;
54472e4f 279 }
280 delete map;
281 // Now store the final CDB file
a7dce0bc 282
283 if ( result == 0 ) {
72df5829 284 AliCDBMetaData metaData;
54472e4f 285 metaData.SetBeamPeriod(0);
286 metaData.SetResponsible("Haavard Helstrup");
287 metaData.SetComment("Preprocessor AliTPC data base entries.");
288
a7dce0bc 289 Bool_t storeOK = Store("Calib", "Temperature", fTemp, &metaData, 0, kFALSE);
290 if ( !storeOK ) result=1;
291
72df5829 292 }
54472e4f 293
294 return result;
7b54c8e9 295
54472e4f 296}
7b54c8e9 297
bdffc5fb 298//______________________________________________________________________________________________
299UInt_t AliTPCPreprocessor::MapHighVoltage(TMap* dcsAliasMap)
300{
301
302 // extract DCS HV maps. Perform fits to save space
303
304 UInt_t result=0;
305 TMap *map = fHighVoltage->ExtractDCS(dcsAliasMap);
306 if (map) {
307 fHighVoltage->MakeSplineFit(map);
68b512ca 308 Double_t fitFraction = 1.0*fHighVoltage->NumFits()/fHighVoltage->NumSensors();
bdffc5fb 309 if (fitFraction > kFitFraction ) {
310 AliInfo(Form("High volatge recordings extracted, fits performed.\n"));
311 } else {
312 Log ("Too few high voltage recordings fitted. \n");
313 result = 9;
314 }
315 } else {
316 Log("No high voltage recordings extracted. \n");
317 result=9;
318 }
319 delete map;
320 // Now store the final CDB file
321
322 if ( result == 0 ) {
323 AliCDBMetaData metaData;
324 metaData.SetBeamPeriod(0);
325 metaData.SetResponsible("Haavard Helstrup");
326 metaData.SetComment("Preprocessor AliTPC data base entries.");
327
328 Bool_t storeOK = Store("Calib", "HighVoltage", fHighVoltage, &metaData, 0, kFALSE);
329 if ( !storeOK ) result=1;
330
331 }
332
333 return result;
334
335}
336
7b54c8e9 337
a7dce0bc 338//______________________________________________________________________________________________
7b54c8e9 339
340UInt_t AliTPCPreprocessor::ExtractPedestals(Int_t sourceFXS)
a7dce0bc 341{
342 //
343 // Read pedestal file from file exchage server
344 // Keep original entry from OCDB in case no new pedestals are available
345 //
346 AliTPCCalPad *calPadPed=0;
347 AliCDBEntry* entry = GetFromOCDB("Calib", "Pedestals");
348 if (entry) calPadPed = (AliTPCCalPad*)entry->GetObject();
349 if ( calPadPed==NULL ) {
a7dce0bc 350 Log("AliTPCPreprocsessor: No previous TPC pedestal entry available.\n");
7b54c8e9 351 calPadPed = new AliTPCCalPad("PedestalsMean","PedestalsMean");
352 }
353
354 AliTPCCalPad *calPadRMS=0;
355 entry = GetFromOCDB("Calib", "Noise");
356 if (entry) calPadRMS = (AliTPCCalPad*)entry->GetObject();
357 if ( calPadRMS==NULL ) {
7b54c8e9 358 Log("AliTPCPreprocsessor: No previous TPC noise entry available.\n");
359 calPadRMS = new AliTPCCalPad("PedestalsRMS","PedestalsRMS");
a7dce0bc 360 }
361
7b54c8e9 362
a7dce0bc 363 UInt_t result=0;
364
365 Int_t nSectors = fROC->GetNSectors();
7b54c8e9 366 TList* list = GetFileSources(sourceFXS,"pedestals");
9f016d99 367
368 if (list && list->GetEntries()>0) {
a7dce0bc 369
370// loop through all files from LDCs
371
bdffc5fb 372 Bool_t changed=false;
a7dce0bc 373 UInt_t index = 0;
374 while (list->At(index)!=NULL) {
375 TObjString* fileNameEntry = (TObjString*) list->At(index);
376 if (fileNameEntry!=NULL) {
7b54c8e9 377 TString fileName = GetFile(sourceFXS, "pedestals",
a7dce0bc 378 fileNameEntry->GetString().Data());
379 TFile *f = TFile::Open(fileName);
9f016d99 380 if (!f) {
381 Log ("Error opening pedestal file.");
382 result =2;
383 break;
384 }
a7dce0bc 385 AliTPCCalibPedestal *calPed;
386 f->GetObject("AliTPCCalibPedestal",calPed);
67a165ed 387 if ( !calPed ) {
388 Log ("No pedestal calibration object in file.");
389 result = 2;
390 break;
391 }
a7dce0bc 392
393 // replace entries for the sectors available in the present file
394
bdffc5fb 395 changed=true;
c9c23d80 396 for (Int_t sector=0; sector<nSectors; sector++) {
7b54c8e9 397 AliTPCCalROC *rocPed=calPed->GetCalRocPedestal(sector, kFALSE);
398 if ( rocPed ) calPadPed->SetCalROC(rocPed,sector);
399 AliTPCCalROC *rocRMS=calPed->GetCalRocRMS(sector, kFALSE);
400 if ( rocRMS ) calPadRMS->SetCalROC(rocRMS,sector);
a7dce0bc 401 }
402 }
403 ++index;
404 } // while(list)
405//
406// Store updated pedestal entry to OCDB
407//
bdffc5fb 408 if (changed) {
409 AliCDBMetaData metaData;
410 metaData.SetBeamPeriod(0);
411 metaData.SetResponsible("Haavard Helstrup");
412 metaData.SetComment("Preprocessor AliTPC data base entries.");
413
414 Bool_t storeOK = Store("Calib", "Pedestals", calPadPed, &metaData, 0, kTRUE);
415 if ( !storeOK ) ++result;
416 storeOK = Store("Calib", "PadNoise", calPadRMS, &metaData, 0, kTRUE);
417 if ( !storeOK ) ++result;
418 }
9f016d99 419 } else {
67a165ed 420 Log ("Error: no entries in input file list!");
9f016d99 421 result = 1;
7b54c8e9 422 }
a7dce0bc 423
a7dce0bc 424 return result;
425}
7b54c8e9 426
427//______________________________________________________________________________________________
428
429
9f016d99 430UInt_t AliTPCPreprocessor::ExtractPulser(Int_t sourceFXS)
431{
432 //
433 // Read pulser calibration file from file exchage server
434 // Keep original entry from OCDB in case no new pulser calibration is available
435 //
436 TObjArray *pulserObjects=0;
437 AliTPCCalPad *pulserTmean=0;
438 AliTPCCalPad *pulserTrms=0;
439 AliTPCCalPad *pulserQmean=0;
440 AliCDBEntry* entry = GetFromOCDB("Calib", "Pulser");
441 if (entry) pulserObjects = (TObjArray*)entry->GetObject();
442 if ( pulserObjects==NULL ) {
443 Log("AliTPCPreprocsessor: No previous TPC pulser entry available.\n");
444 pulserObjects = new TObjArray;
445 }
446
447 pulserTmean = (AliTPCCalPad*)pulserObjects->FindObject("PulserTmean");
448 if ( !pulserTmean ) {
449 pulserTmean = new AliTPCCalPad("PulserTmean","PulserTmean");
450 pulserObjects->Add(pulserTmean);
451 }
452 pulserTrms = (AliTPCCalPad*)pulserObjects->FindObject("PulserTrms");
453 if ( !pulserTrms ) {
454 pulserTrms = new AliTPCCalPad("PulserTrms","PulserTrms");
455 pulserObjects->Add(pulserTrms);
456 }
457 pulserQmean = (AliTPCCalPad*)pulserObjects->FindObject("PulserQmean");
458 if ( !pulserQmean ) {
459 pulserQmean = new AliTPCCalPad("PulserQmean","PulserQmean");
460 pulserObjects->Add(pulserQmean);
461 }
462
463
464 UInt_t result=0;
465
466 Int_t nSectors = fROC->GetNSectors();
467 TList* list = GetFileSources(sourceFXS,"pulser");
468
469 if (list && list->GetEntries()>0) {
470
471// loop through all files from LDCs
472
bdffc5fb 473 Bool_t changed=false;
9f016d99 474 UInt_t index = 0;
475 while (list->At(index)!=NULL) {
476 TObjString* fileNameEntry = (TObjString*) list->At(index);
477 if (fileNameEntry!=NULL) {
478 TString fileName = GetFile(sourceFXS, "pulser",
479 fileNameEntry->GetString().Data());
480 TFile *f = TFile::Open(fileName);
481 if (!f) {
482 Log ("Error opening pulser file.");
483 result =2;
484 break;
485 }
486 AliTPCCalibPulser *calPulser;
487 f->GetObject("AliTPCCalibPulser",calPulser);
67a165ed 488 if ( !calPulser ) {
489 Log ("No pulser calibration object in file.");
490 result = 2;
491 break;
492 }
9f016d99 493
494 // replace entries for the sectors available in the present file
495
bdffc5fb 496 changed=true;
9f016d99 497 for (Int_t sector=0; sector<nSectors; sector++) {
498 AliTPCCalROC *rocTmean=calPulser->GetCalRocT0(sector);
499 if ( rocTmean ) pulserTmean->SetCalROC(rocTmean,sector);
500 AliTPCCalROC *rocTrms=calPulser->GetCalRocRMS(sector);
501 if ( rocTrms ) pulserTrms->SetCalROC(rocTrms,sector);
502 AliTPCCalROC *rocQmean=calPulser->GetCalRocQ(sector);
503 if ( rocQmean ) pulserQmean->SetCalROC(rocQmean,sector);
504 }
505 }
506 ++index;
507 } // while(list)
508//
509// Store updated pedestal entry to OCDB
510//
bdffc5fb 511 if (changed) {
512 AliCDBMetaData metaData;
513 metaData.SetBeamPeriod(0);
514 metaData.SetResponsible("Haavard Helstrup");
515 metaData.SetComment("Preprocessor AliTPC data base entries.");
516
517 Bool_t storeOK = Store("Calib", "Pulser", pulserObjects, &metaData, 0, kTRUE);
518 if ( !storeOK ) ++result;
519 }
9f016d99 520 } else {
67a165ed 521 Log ("Error: no entries in input file list!");
9f016d99 522 result = 1;
523 }
524
525 return result;
526}
527
528UInt_t AliTPCPreprocessor::ExtractCE(Int_t sourceFXS)
529{
530 //
531 // Read Central Electrode file from file exchage server
532 // Keep original entry from OCDB in case no new CE calibration is available
533 //
534 TObjArray *ceObjects=0;
535 AliTPCCalPad *ceTmean=0;
536 AliTPCCalPad *ceTrms=0;
537 AliTPCCalPad *ceQmean=0;
538 AliCDBEntry* entry = GetFromOCDB("Calib", "CE");
539 if (entry) ceObjects = (TObjArray*)entry->GetObject();
540 if ( ceObjects==NULL ) {
541 Log("AliTPCPreprocsessor: No previous TPC central electrode entry available.\n");
542 ceObjects = new TObjArray;
543 }
544
545 ceTmean = (AliTPCCalPad*)ceObjects->FindObject("CETmean");
546 if ( !ceTmean ) {
547 ceTmean = new AliTPCCalPad("CETmean","CETmean");
548 ceObjects->Add(ceTmean);
549 }
550 ceTrms = (AliTPCCalPad*)ceObjects->FindObject("CETrms");
551 if ( !ceTrms ) {
552 ceTrms = new AliTPCCalPad("CETrms","CETrms");
553 ceObjects->Add(ceTrms);
554 }
555 ceQmean = (AliTPCCalPad*)ceObjects->FindObject("CEQmean");
556 if ( !ceQmean ) {
557 ceQmean = new AliTPCCalPad("CEQmean","CEQmean");
558 ceObjects->Add(ceQmean);
559 }
560
561
562 UInt_t result=0;
563
564 Int_t nSectors = fROC->GetNSectors();
565 TList* list = GetFileSources(sourceFXS,"CE");
566
567 if (list && list->GetEntries()>0) {
568
569// loop through all files from LDCs
570
571 UInt_t index = 0;
572 while (list->At(index)!=NULL) {
573 TObjString* fileNameEntry = (TObjString*) list->At(index);
574 if (fileNameEntry!=NULL) {
575 TString fileName = GetFile(sourceFXS, "CE",
576 fileNameEntry->GetString().Data());
577 TFile *f = TFile::Open(fileName);
578 if (!f) {
579 Log ("Error opening central electrode file.");
580 result =2;
581 break;
582 }
583 AliTPCCalibCE *calCE;
584 f->GetObject("AliTPCCalibCE",calCE);
585
586 // replace entries for the sectors available in the present file
587
588 for (Int_t sector=0; sector<nSectors; sector++) {
589 AliTPCCalROC *rocTmean=calCE->GetCalRocT0(sector);
590 if ( rocTmean ) ceTmean->SetCalROC(rocTmean,sector);
591 AliTPCCalROC *rocTrms=calCE->GetCalRocRMS(sector);
592 if ( rocTrms ) ceTrms->SetCalROC(rocTrms,sector);
593 AliTPCCalROC *rocQmean=calCE->GetCalRocQ(sector);
594 if ( rocQmean ) ceQmean->SetCalROC(rocQmean,sector);
595 }
596 }
597 ++index;
598 } // while(list)
599//
600// Store updated pedestal entry to OCDB
601//
602 AliCDBMetaData metaData;
603 metaData.SetBeamPeriod(0);
604 metaData.SetResponsible("Haavard Helstrup");
605 metaData.SetComment("Preprocessor AliTPC data base entries.");
606
607 Bool_t storeOK = Store("Calib", "CE", ceObjects, &metaData, 0, kTRUE);
608 if ( !storeOK ) ++result;
609
610 } else {
611 Log ("Error: no entries!");
612 result = 1;
613 }
614
615 return result;
616}