Add newline at the end
[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"
70f224dd 30#include "AliTPCCalibRaw.h"
dca91b3f 31#include "AliTPCdataQA.h"
eeeac1b2 32#include "ARVersion.h"
9e66a8dd 33#include "TFile.h"
7b54c8e9 34#include "TTree.h"
bb30a935 35#include "TGraph.h"
7b54c8e9 36#include "TEnv.h"
bb30a935 37#include "TParameter.h"
54472e4f 38
39#include <TTimeStamp.h>
40
a7dce0bc 41const Int_t kValCutTemp = 100; // discard temperatures > 100 degrees
42const Int_t kDiffCutTemp = 5; // discard temperature differences > 5 degrees
bb30a935 43const TString kPedestalRunType = "PEDESTAL"; // pedestal run identifier
9054511b 44const TString kPulserRunType = "PULSER"; // pulser run identifier
bdffc5fb 45const TString kPhysicsRunType = "PHYSICS"; // physics run identifier
9054511b 46const TString kCosmicRunType = "COSMIC"; // cosmic run identifier
47const TString kLaserRunType = "LASER"; // laser run identifier
9c754ce7 48const TString kDaqRunType = "DAQ"; // DAQ run identifier
87d77b35 49const TString kAmandaTemp = "TPC_PT_%d_TEMPERATURE"; // Amanda string for temperature entries
bee89eeb 50//const Double_t kFitFraction = 0.7; // Fraction of DCS sensor fits required
68b512ca 51const Double_t kFitFraction = -1.0; // Don't require minimum number of fits in commissioning run
72df5829 52
cf4216a3 53
54472e4f 54//
55// This class is the SHUTTLE preprocessor for the TPC detector.
54472e4f 56//
57
58ClassImp(AliTPCPreprocessor)
59
60//______________________________________________________________________________________________
6d07bf74 61AliTPCPreprocessor::AliTPCPreprocessor(AliShuttleInterface* shuttle) :
62 AliPreprocessor("TPC",shuttle),
b6e9fd45 63 fConfEnv(0), fTemp(0), fHighVoltage(0), fHighVoltageStat(0), fGoofie(0), fConfigOK(kTRUE), fROC(0)
54472e4f 64{
65 // constructor
a7dce0bc 66 fROC = AliTPCROC::Instance();
72534123 67
68 // define run types to be processed
69
70 AddRunType(kPedestalRunType);
71 AddRunType(kPulserRunType);
72 AddRunType(kPhysicsRunType);
72534123 73 AddRunType(kCosmicRunType);
74 AddRunType(kLaserRunType);
75 AddRunType(kDaqRunType);
76
54472e4f 77}
72df5829 78//______________________________________________________________________________________________
f4a89669 79 AliTPCPreprocessor::AliTPCPreprocessor(const AliTPCPreprocessor& ) :
80 AliPreprocessor("TPC",0),
b6e9fd45 81 fConfEnv(0), fTemp(0), fHighVoltage(0), fHighVoltageStat(0), fGoofie(0), fConfigOK(kTRUE), fROC(0)
f4a89669 82 {
83
84 Fatal("AliTPCPreprocessor", "copy constructor not implemented");
f7f602cc 85//
86// // fTemp = new AliTPCSensorTempArray(*(org.fTemp));
f4a89669 87 }
54472e4f 88
89//______________________________________________________________________________________________
90AliTPCPreprocessor::~AliTPCPreprocessor()
91{
92 // destructor
a7dce0bc 93
54472e4f 94 delete fTemp;
bdffc5fb 95 delete fHighVoltage;
54472e4f 96}
72df5829 97//______________________________________________________________________________________________
98AliTPCPreprocessor& AliTPCPreprocessor::operator = (const AliTPCPreprocessor& )
99{
100 Fatal("operator =", "assignment operator not implemented");
101 return *this;
102}
103
54472e4f 104
105//______________________________________________________________________________________________
106void AliTPCPreprocessor::Initialize(Int_t run, UInt_t startTime,
107 UInt_t endTime)
108{
bb30a935 109 // Creates AliTestDataDCS object -- start maps half an hour beforre actual run start
54472e4f 110
dca91b3f 111 UInt_t startTimeLocal = startTime-3600;
112 UInt_t endTimeLocal = endTime+1800;
bb30a935 113
dca91b3f 114 AliPreprocessor::Initialize(run, startTimeLocal, endTimeLocal);
54472e4f 115
116 AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
f4a89669 117 TTimeStamp((time_t)startTime,0).AsString(),
118 TTimeStamp((time_t)endTime,0).AsString()));
54472e4f 119
7b54c8e9 120 // Preprocessor configuration
121
37092b2b 122 AliCDBEntry* entry = GetFromOCDB("Config", "Preprocessor");
7b54c8e9 123 if (entry) fConfEnv = (TEnv*) entry->GetObject();
124 if ( fConfEnv==0 ) {
7b54c8e9 125 Log("AliTPCPreprocsessor: Preprocessor Config OCDB entry missing.\n");
37092b2b 126 fConfigOK = kFALSE;
127 return;
7b54c8e9 128 }
129
18eade96 130 // Temperature sensors
131
136e44f7 132 TTree *confTree = 0;
133
134 TString tempConf = fConfEnv->GetValue("Temperature","ON");
135 tempConf.ToUpper();
136 if (tempConf != "OFF" ) {
7b54c8e9 137 entry = GetFromOCDB("Config", "Temperature");
f7f602cc 138 if (entry) confTree = (TTree*) entry->GetObject();
18eade96 139 if ( confTree==0 ) {
18eade96 140 Log("AliTPCPreprocsessor: Temperature Config OCDB entry missing.\n");
141 fConfigOK = kFALSE;
f7f602cc 142 return;
18eade96 143 }
dca91b3f 144 fTemp = new AliTPCSensorTempArray(startTimeLocal, endTimeLocal, confTree, kAmandaTemp);
18eade96 145 fTemp->SetValCut(kValCutTemp);
146 fTemp->SetDiffCut(kDiffCutTemp);
136e44f7 147 }
18eade96 148
bdffc5fb 149 // High voltage measurements
150
136e44f7 151 TString hvConf = fConfEnv->GetValue("HighVoltage","ON");
152 hvConf.ToUpper();
153 if (hvConf != "OFF" ) {
bdffc5fb 154 confTree=0;
155 entry=0;
156 entry = GetFromOCDB("Config", "HighVoltage");
157 if (entry) confTree = (TTree*) entry->GetObject();
158 if ( confTree==0 ) {
159 Log("AliTPCPreprocsessor: High Voltage Config OCDB entry missing.\n");
160 fConfigOK = kFALSE;
161 return;
162 }
fe7f3fe2 163 fHighVoltage = new AliDCSSensorArray(startTime, endTime, confTree);
bff20895 164 }
9d2ce539 165
166 // High voltage status values
167
bff20895 168 TString hvStatConf = fConfEnv->GetValue("HighVoltageStat","ON");
169 hvStatConf.ToUpper();
170 if (hvStatConf != "OFF" ) {
9d2ce539 171 confTree=0;
172 entry=0;
173 entry = GetFromOCDB("Config", "HighVoltageStat");
174 if (entry) confTree = (TTree*) entry->GetObject();
175 if ( confTree==0 ) {
176 Log("AliTPCPreprocsessor: High Voltage Status Config OCDB entry missing.\n");
177 fConfigOK = kFALSE;
178 return;
179 }
fe7f3fe2 180 fHighVoltageStat = new AliDCSSensorArray(startTime, endTime, confTree);
bdffc5fb 181 }
b6e9fd45 182
183 // Goofie values
184
185 TString goofieConf = fConfEnv->GetValue("Goofie","ON");
186 goofieConf.ToUpper();
187 if (goofieConf != "OFF" ) {
188 confTree=0;
189 entry=0;
190 entry = GetFromOCDB("Config", "Goofie");
191 if (entry) confTree = (TTree*) entry->GetObject();
192 if ( confTree==0 ) {
193 Log("AliTPCPreprocsessor: Goofie Config OCDB entry missing.\n");
194 fConfigOK = kFALSE;
195 return;
196 }
197 fGoofie = new AliDCSSensorArray(startTimeLocal, endTimeLocal, confTree);
198 }
199
200
54472e4f 201}
202
203//______________________________________________________________________________________________
204UInt_t AliTPCPreprocessor::Process(TMap* dcsAliasMap)
205{
206 // Fills data into TPC calibrations objects
207
54472e4f 208 // Amanda servers provide information directly through dcsAliasMap
209
bb30a935 210
a7dce0bc 211 if (!fConfigOK) return 9;
136e44f7 212 UInt_t result = 0;
bb30a935 213 TObjArray *resultArray = new TObjArray();
214 TString errorHandling = fConfEnv->GetValue("ErrorHandling","ON");
215 errorHandling.ToUpper();
216 TObject * status;
217
218 UInt_t dcsResult=0;
cf4216a3 219 if (!dcsAliasMap) dcsResult=1;
220 if (dcsAliasMap->GetEntries() == 0 ) dcsResult=1;
221 status = new TParameter<int>("dcsResult",dcsResult);
222 resultArray->Add(status);
bb30a935 223
224
a7dce0bc 225 TString runType = GetRunType();
226
cf4216a3 227 if ( dcsResult == 0 ) {
228
54472e4f 229 // Temperature sensors are processed by AliTPCCalTemp
72df5829 230
cf4216a3 231 TString tempConf = fConfEnv->GetValue("Temperature","ON");
232 tempConf.ToUpper();
233 if (tempConf != "OFF" ) {
234 UInt_t tempResult = MapTemperature(dcsAliasMap);
235 result=tempResult;
236 status = new TParameter<int>("tempResult",tempResult);
237 resultArray->Add(status);
238 }
18eade96 239
bdffc5fb 240 // High Voltage recordings
241
242
cf4216a3 243 TString hvConf = fConfEnv->GetValue("HighVoltage","ON");
244 hvConf.ToUpper();
245 if (hvConf != "OFF" ) {
246 UInt_t hvResult = MapHighVoltage(dcsAliasMap);
247 result+=hvResult;
248 status = new TParameter<int>("hvResult",hvResult);
249 resultArray->Add(status);
250 }
f7f602cc 251
cf4216a3 252 // Goofie values
b6e9fd45 253
254
cf4216a3 255 TString goofieConf = fConfEnv->GetValue("Goofie","ON");
256 goofieConf.ToUpper();
257 if (goofieConf != "OFF" ) {
258 UInt_t goofieResult = MapGoofie(dcsAliasMap);
259 result+=goofieResult;
260 status = new TParameter<int>("goofieResult",goofieResult);
261 resultArray->Add(status);
262 }
263 }
54472e4f 264 // Other calibration information will be retrieved through FXS files
a7dce0bc 265 // examples:
54472e4f 266 // TList* fileSourcesDAQ = GetFile(AliShuttleInterface::kDAQ, "pedestals");
267 // const char* fileNamePed = GetFile(AliShuttleInterface::kDAQ, "pedestals", "LDC1");
268 //
269 // TList* fileSourcesHLT = GetFile(AliShuttleInterface::kHLT, "calib");
270 // const char* fileNameHLT = GetFile(AliShuttleInterface::kHLT, "calib", "LDC1");
271
9f016d99 272 // pedestal entries
54472e4f 273
a7dce0bc 274 if(runType == kPedestalRunType) {
68b512ca 275 Int_t numSources = 1;
276 Int_t pedestalSource[2] = {AliShuttleInterface::kDAQ,AliShuttleInterface::kHLT} ;
7b54c8e9 277 TString source = fConfEnv->GetValue("Pedestal","DAQ");
278 source.ToUpper();
136e44f7 279 if (source != "OFF" ) {
280 if ( source == "HLT") pedestalSource[0] = AliShuttleInterface::kHLT;
281 if (!GetHLTStatus()) pedestalSource[0] = AliShuttleInterface::kDAQ;
282 if (source == "HLTDAQ" ) {
283 numSources=2;
284 pedestalSource[0] = AliShuttleInterface::kHLT;
285 pedestalSource[1] = AliShuttleInterface::kDAQ;
286 }
287 if (source == "DAQHLT" ) numSources=2;
288 UInt_t pedestalResult=0;
289 for (Int_t i=0; i<numSources; i++ ) {
453bd596 290 pedestalResult = ExtractPedestals(pedestalSource[i]);
136e44f7 291 if ( pedestalResult == 0 ) break;
292 }
293 result += pedestalResult;
bb30a935 294 status = new TParameter<int>("pedestalResult",pedestalResult);
295 resultArray->Add(status);
68b512ca 296 }
a7dce0bc 297 }
298
9f016d99 299 // pulser trigger processing
300
68b512ca 301 if(runType == kPulserRunType) {
302 Int_t numSources = 1;
303 Int_t pulserSource[2] = {AliShuttleInterface::kDAQ,AliShuttleInterface::kHLT} ;
9f016d99 304 TString source = fConfEnv->GetValue("Pulser","DAQ");
305 source.ToUpper();
136e44f7 306 if ( source != "OFF") {
307 if ( source == "HLT") pulserSource[0] = AliShuttleInterface::kHLT;
308 if (!GetHLTStatus()) pulserSource[0] = AliShuttleInterface::kDAQ;
309 if (source == "HLTDAQ" ) {
310 numSources=2;
311 pulserSource[0] = AliShuttleInterface::kHLT;
312 pulserSource[1] = AliShuttleInterface::kDAQ;
313 }
314 if (source == "DAQHLT" ) numSources=2;
315 UInt_t pulserResult=0;
316 for (Int_t i=0; i<numSources; i++ ) {
317 pulserResult = ExtractPulser(pulserSource[i]);
318 if ( pulserResult == 0 ) break;
319 }
320 result += pulserResult;
bb30a935 321 status = new TParameter<int>("pulserResult",pulserResult);
322 resultArray->Add(status);
68b512ca 323 }
9f016d99 324 }
325
70f224dd 326
327// raw calibration processing
328
329 if(runType == kPhysicsRunType) {
330 Int_t numSources = 1;
331 Int_t rawSource[2] = {AliShuttleInterface::kDAQ,AliShuttleInterface::kHLT} ;
332 TString source = fConfEnv->GetValue("Raw","DAQ");
333 source.ToUpper();
334 if ( source != "OFF") {
335 if ( source == "HLT") rawSource[0] = AliShuttleInterface::kHLT;
336 if (!GetHLTStatus()) rawSource[0] = AliShuttleInterface::kDAQ;
337 if (source == "HLTDAQ" ) {
338 numSources=2;
339 rawSource[0] = AliShuttleInterface::kHLT;
340 rawSource[1] = AliShuttleInterface::kDAQ;
341 }
342 if (source == "DAQHLT" ) numSources=2;
343 UInt_t rawResult=0;
344 for (Int_t i=0; i<numSources; i++ ) {
345 rawResult = ExtractRaw(rawSource[i]);
346 if ( rawResult == 0 ) break;
347 }
348 result += rawResult;
349 status = new TParameter<int>("rawResult",rawResult);
350 resultArray->Add(status);
351 }
352 }
353
354
9054511b 355 // Altro configuration
356
357
358 TString altroConf = fConfEnv->GetValue("AltroConf","ON");
cf4216a3 359 altroConf.ToUpper();
9054511b 360 if (altroConf != "OFF" ) {
db9ef692 361 UInt_t altroResult = ExtractAltro(AliShuttleInterface::kDCS);
9054511b 362 result+=altroResult;
363 status = new TParameter<int>("altroResult",altroResult);
364 resultArray->Add(status);
365 }
68b512ca 366
367
9f016d99 368 // Central Electrode processing
369
9054511b 370 if( runType == kPhysicsRunType ||
6f3699dd 371 runType == kLaserRunType ) {
68b512ca 372
373 Int_t numSources = 1;
374 Int_t ceSource[2] = {AliShuttleInterface::kDAQ,AliShuttleInterface::kHLT} ;
9f016d99 375 TString source = fConfEnv->GetValue("CE","DAQ");
376 source.ToUpper();
136e44f7 377 if ( source != "OFF" ) {
378 if ( source == "HLT") ceSource[0] = AliShuttleInterface::kHLT;
379 if (!GetHLTStatus()) ceSource[0] = AliShuttleInterface::kDAQ;
380 if (source == "HLTDAQ" ) {
68b512ca 381 numSources=2;
382 ceSource[0] = AliShuttleInterface::kHLT;
383 ceSource[1] = AliShuttleInterface::kDAQ;
136e44f7 384 }
385 if (source == "DAQHLT" ) numSources=2;
386 UInt_t ceResult=0;
387 for (Int_t i=0; i<numSources; i++ ) {
388 ceResult = ExtractCE(ceSource[i]);
389 if ( ceResult == 0 ) break;
390 }
6f3699dd 391
392 // only flag error if CE result is missing from LASER runs
393 // -- for PHYSICS run do CE processing if data available
394
395 if ( runType == kLaserRunType ) result += ceResult;
bb30a935 396 status = new TParameter<int>("ceResult",ceResult);
397 resultArray->Add(status);
dca91b3f 398
399 numSources = 1;
400 Int_t qaSource[2] = {AliShuttleInterface::kDAQ,AliShuttleInterface::kHLT} ;
5e5c1e83 401 source = fConfEnv->GetValue("QA","DAQ");
dca91b3f 402 source.ToUpper();
403 if ( source != "OFF" ) {
404 if ( source == "HLT") qaSource[0] = AliShuttleInterface::kHLT;
405 if (!GetHLTStatus()) qaSource[0] = AliShuttleInterface::kDAQ;
406 if (source == "HLTDAQ" ) {
407 numSources=2;
408 qaSource[0] = AliShuttleInterface::kHLT;
409 qaSource[1] = AliShuttleInterface::kDAQ;
410 }
411 if (source == "DAQHLT" ) numSources=2;
412 UInt_t qaResult=0;
413 for (Int_t i=0; i<numSources; i++ ) {
414 qaResult = ExtractQA(qaSource[i]);
415 if ( qaResult == 0 ) break;
416 }
417// result += qaResult;
418 if ( qaResult !=0 ) Log ("ExtractQA failed, no QA entry available.");
419 status = new TParameter<int>("qaResult",qaResult);
420 resultArray->Add(status);
68b512ca 421 }
dca91b3f 422 }
9f016d99 423 }
136e44f7 424
136e44f7 425 if (errorHandling == "OFF" ) {
bb30a935 426 AliCDBMetaData metaData;
427 metaData.SetBeamPeriod(0);
428 metaData.SetResponsible("Haavard Helstrup");
eeeac1b2 429 metaData.SetAliRootVersion(ALIROOT_SVN_BRANCH);
bb30a935 430 metaData.SetComment("Preprocessor AliTPC status.");
431 Store("Calib", "PreprocStatus", resultArray, &metaData, 0, kFALSE);
432 resultArray->Delete();
433 return 0;
136e44f7 434 } else {
bb30a935 435 return result;
136e44f7 436 }
54472e4f 437}
438//______________________________________________________________________________________________
439UInt_t AliTPCPreprocessor::MapTemperature(TMap* dcsAliasMap)
440{
441
442 // extract DCS temperature maps. Perform fits to save space
443
72df5829 444 UInt_t result=0;
54472e4f 445 TMap *map = fTemp->ExtractDCS(dcsAliasMap);
446 if (map) {
447 fTemp->MakeSplineFit(map);
68b512ca 448 Double_t fitFraction = 1.0*fTemp->NumFits()/fTemp->NumSensors();
67a165ed 449 if (fitFraction > kFitFraction ) {
450 AliInfo(Form("Temperature values extracted, fits performed.\n"));
451 } else {
452 Log ("Too few temperature maps fitted. \n");
453 result = 9;
454 }
54472e4f 455 } else {
67a165ed 456 Log("No temperature map extracted. \n");
72df5829 457 result=9;
54472e4f 458 }
459 delete map;
460 // Now store the final CDB file
a7dce0bc 461
462 if ( result == 0 ) {
72df5829 463 AliCDBMetaData metaData;
54472e4f 464 metaData.SetBeamPeriod(0);
465 metaData.SetResponsible("Haavard Helstrup");
eeeac1b2 466 metaData.SetAliRootVersion(ALIROOT_SVN_BRANCH);
54472e4f 467 metaData.SetComment("Preprocessor AliTPC data base entries.");
468
a7dce0bc 469 Bool_t storeOK = Store("Calib", "Temperature", fTemp, &metaData, 0, kFALSE);
470 if ( !storeOK ) result=1;
471
72df5829 472 }
54472e4f 473
474 return result;
7b54c8e9 475
54472e4f 476}
7b54c8e9 477
bdffc5fb 478//______________________________________________________________________________________________
479UInt_t AliTPCPreprocessor::MapHighVoltage(TMap* dcsAliasMap)
480{
481
482 // extract DCS HV maps. Perform fits to save space
483
484 UInt_t result=0;
485 TMap *map = fHighVoltage->ExtractDCS(dcsAliasMap);
486 if (map) {
fe7f3fe2 487 fHighVoltage->MakeSplineFit(map, kTRUE); // keep both spline fits and original maps
68b512ca 488 Double_t fitFraction = 1.0*fHighVoltage->NumFits()/fHighVoltage->NumSensors();
bdffc5fb 489 if (fitFraction > kFitFraction ) {
136e44f7 490 AliInfo(Form("High voltage recordings extracted, fits performed.\n"));
bdffc5fb 491 } else {
492 Log ("Too few high voltage recordings fitted. \n");
493 result = 9;
494 }
495 } else {
496 Log("No high voltage recordings extracted. \n");
497 result=9;
498 }
499 delete map;
9d2ce539 500
bff20895 501 TString hvStatConf = fConfEnv->GetValue("HighVoltageStat","ON");
502 hvStatConf.ToUpper();
503 if (hvStatConf != "OFF" ) {
504 TMap *map2 = fHighVoltageStat->ExtractDCS(dcsAliasMap);
505 if (map2) {
dca91b3f 506 fHighVoltageStat->ClearFit();
507 fHighVoltageStat->SetGraph(map2);
bff20895 508 } else {
509 Log("No high voltage status recordings extracted. \n");
510 result=9;
511 }
512 delete map2;
9d2ce539 513
bff20895 514 // add status maps to high voltage sensor array
9d2ce539 515
bff20895 516 fHighVoltage->AddSensors(fHighVoltageStat);
517 }
bdffc5fb 518 // Now store the final CDB file
519
520 if ( result == 0 ) {
521 AliCDBMetaData metaData;
522 metaData.SetBeamPeriod(0);
523 metaData.SetResponsible("Haavard Helstrup");
eeeac1b2 524 metaData.SetAliRootVersion(ALIROOT_SVN_BRANCH);
bdffc5fb 525 metaData.SetComment("Preprocessor AliTPC data base entries.");
526
527 Bool_t storeOK = Store("Calib", "HighVoltage", fHighVoltage, &metaData, 0, kFALSE);
528 if ( !storeOK ) result=1;
529
530 }
531
532 return result;
533
534}
535
b6e9fd45 536//______________________________________________________________________________________________
537UInt_t AliTPCPreprocessor::MapGoofie(TMap* dcsAliasMap)
538{
539
540 // extract DCS Goofie maps. Do not perform fits (low update rate)
541
542 UInt_t result=0;
543
544 TMap *map = fGoofie->ExtractDCS(dcsAliasMap);
545 if (map) {
546 fGoofie->ClearFit();
547 fGoofie->SetGraph(map);
548 } else {
549 Log("No Goofie recordings extracted. \n");
550 result=9;
551 }
552 delete map;
553
554 // Now store the final CDB file
555
556 if ( result == 0 ) {
557 AliCDBMetaData metaData;
558 metaData.SetBeamPeriod(0);
559 metaData.SetResponsible("Haavard Helstrup");
eeeac1b2 560 metaData.SetAliRootVersion(ALIROOT_SVN_BRANCH);
b6e9fd45 561 metaData.SetComment("Preprocessor AliTPC data base entries.");
562
563 Bool_t storeOK = Store("Calib", "Goofie", fGoofie, &metaData, 0, kFALSE);
564 if ( !storeOK ) result=1;
565
566 }
567
568 return result;
569
570}
571
7b54c8e9 572
a7dce0bc 573//______________________________________________________________________________________________
7b54c8e9 574
575UInt_t AliTPCPreprocessor::ExtractPedestals(Int_t sourceFXS)
a7dce0bc 576{
577 //
578 // Read pedestal file from file exchage server
579 // Keep original entry from OCDB in case no new pedestals are available
580 //
581 AliTPCCalPad *calPadPed=0;
582 AliCDBEntry* entry = GetFromOCDB("Calib", "Pedestals");
583 if (entry) calPadPed = (AliTPCCalPad*)entry->GetObject();
584 if ( calPadPed==NULL ) {
a7dce0bc 585 Log("AliTPCPreprocsessor: No previous TPC pedestal entry available.\n");
7b54c8e9 586 calPadPed = new AliTPCCalPad("PedestalsMean","PedestalsMean");
587 }
588
589 AliTPCCalPad *calPadRMS=0;
d63b9ad7 590 entry = GetFromOCDB("Calib", "PadNoise");
7b54c8e9 591 if (entry) calPadRMS = (AliTPCCalPad*)entry->GetObject();
592 if ( calPadRMS==NULL ) {
7b54c8e9 593 Log("AliTPCPreprocsessor: No previous TPC noise entry available.\n");
594 calPadRMS = new AliTPCCalPad("PedestalsRMS","PedestalsRMS");
a7dce0bc 595 }
596
7b54c8e9 597
a7dce0bc 598 UInt_t result=0;
599
600 Int_t nSectors = fROC->GetNSectors();
7b54c8e9 601 TList* list = GetFileSources(sourceFXS,"pedestals");
9f016d99 602
603 if (list && list->GetEntries()>0) {
a7dce0bc 604
605// loop through all files from LDCs
606
bdffc5fb 607 Bool_t changed=false;
a7dce0bc 608 UInt_t index = 0;
609 while (list->At(index)!=NULL) {
610 TObjString* fileNameEntry = (TObjString*) list->At(index);
611 if (fileNameEntry!=NULL) {
7b54c8e9 612 TString fileName = GetFile(sourceFXS, "pedestals",
a7dce0bc 613 fileNameEntry->GetString().Data());
614 TFile *f = TFile::Open(fileName);
9f016d99 615 if (!f) {
616 Log ("Error opening pedestal file.");
617 result =2;
618 break;
619 }
a7dce0bc 620 AliTPCCalibPedestal *calPed;
e73181c9 621 f->GetObject("tpcCalibPedestal",calPed);
67a165ed 622 if ( !calPed ) {
623 Log ("No pedestal calibration object in file.");
624 result = 2;
625 break;
626 }
a7dce0bc 627
628 // replace entries for the sectors available in the present file
629
bdffc5fb 630 changed=true;
c9c23d80 631 for (Int_t sector=0; sector<nSectors; sector++) {
7b54c8e9 632 AliTPCCalROC *rocPed=calPed->GetCalRocPedestal(sector, kFALSE);
633 if ( rocPed ) calPadPed->SetCalROC(rocPed,sector);
634 AliTPCCalROC *rocRMS=calPed->GetCalRocRMS(sector, kFALSE);
635 if ( rocRMS ) calPadRMS->SetCalROC(rocRMS,sector);
a7dce0bc 636 }
a480de15 637 delete calPed;
342d3b42 638 f->Close();
a7dce0bc 639 }
640 ++index;
641 } // while(list)
642//
643// Store updated pedestal entry to OCDB
644//
bdffc5fb 645 if (changed) {
646 AliCDBMetaData metaData;
647 metaData.SetBeamPeriod(0);
648 metaData.SetResponsible("Haavard Helstrup");
eeeac1b2 649 metaData.SetAliRootVersion(ALIROOT_SVN_BRANCH);
bdffc5fb 650 metaData.SetComment("Preprocessor AliTPC data base entries.");
651
652 Bool_t storeOK = Store("Calib", "Pedestals", calPadPed, &metaData, 0, kTRUE);
653 if ( !storeOK ) ++result;
654 storeOK = Store("Calib", "PadNoise", calPadRMS, &metaData, 0, kTRUE);
655 if ( !storeOK ) ++result;
656 }
9f016d99 657 } else {
cf4216a3 658 Log ("Error: no entries in pedestal file list!");
9f016d99 659 result = 1;
7b54c8e9 660 }
a7dce0bc 661
a7dce0bc 662 return result;
663}
7b54c8e9 664
665//______________________________________________________________________________________________
666
667
9f016d99 668UInt_t AliTPCPreprocessor::ExtractPulser(Int_t sourceFXS)
669{
670 //
671 // Read pulser calibration file from file exchage server
672 // Keep original entry from OCDB in case no new pulser calibration is available
673 //
674 TObjArray *pulserObjects=0;
675 AliTPCCalPad *pulserTmean=0;
676 AliTPCCalPad *pulserTrms=0;
677 AliTPCCalPad *pulserQmean=0;
678 AliCDBEntry* entry = GetFromOCDB("Calib", "Pulser");
679 if (entry) pulserObjects = (TObjArray*)entry->GetObject();
680 if ( pulserObjects==NULL ) {
681 Log("AliTPCPreprocsessor: No previous TPC pulser entry available.\n");
682 pulserObjects = new TObjArray;
683 }
684
685 pulserTmean = (AliTPCCalPad*)pulserObjects->FindObject("PulserTmean");
686 if ( !pulserTmean ) {
687 pulserTmean = new AliTPCCalPad("PulserTmean","PulserTmean");
688 pulserObjects->Add(pulserTmean);
689 }
690 pulserTrms = (AliTPCCalPad*)pulserObjects->FindObject("PulserTrms");
691 if ( !pulserTrms ) {
692 pulserTrms = new AliTPCCalPad("PulserTrms","PulserTrms");
693 pulserObjects->Add(pulserTrms);
694 }
695 pulserQmean = (AliTPCCalPad*)pulserObjects->FindObject("PulserQmean");
696 if ( !pulserQmean ) {
697 pulserQmean = new AliTPCCalPad("PulserQmean","PulserQmean");
698 pulserObjects->Add(pulserQmean);
699 }
700
701
702 UInt_t result=0;
703
704 Int_t nSectors = fROC->GetNSectors();
705 TList* list = GetFileSources(sourceFXS,"pulser");
706
707 if (list && list->GetEntries()>0) {
708
709// loop through all files from LDCs
710
bdffc5fb 711 Bool_t changed=false;
9f016d99 712 UInt_t index = 0;
713 while (list->At(index)!=NULL) {
714 TObjString* fileNameEntry = (TObjString*) list->At(index);
715 if (fileNameEntry!=NULL) {
716 TString fileName = GetFile(sourceFXS, "pulser",
717 fileNameEntry->GetString().Data());
718 TFile *f = TFile::Open(fileName);
719 if (!f) {
720 Log ("Error opening pulser file.");
721 result =2;
722 break;
723 }
724 AliTPCCalibPulser *calPulser;
e73181c9 725 f->GetObject("tpcCalibPulser",calPulser);
67a165ed 726 if ( !calPulser ) {
727 Log ("No pulser calibration object in file.");
728 result = 2;
729 break;
730 }
9f016d99 731
732 // replace entries for the sectors available in the present file
733
bdffc5fb 734 changed=true;
9f016d99 735 for (Int_t sector=0; sector<nSectors; sector++) {
736 AliTPCCalROC *rocTmean=calPulser->GetCalRocT0(sector);
737 if ( rocTmean ) pulserTmean->SetCalROC(rocTmean,sector);
738 AliTPCCalROC *rocTrms=calPulser->GetCalRocRMS(sector);
739 if ( rocTrms ) pulserTrms->SetCalROC(rocTrms,sector);
740 AliTPCCalROC *rocQmean=calPulser->GetCalRocQ(sector);
741 if ( rocQmean ) pulserQmean->SetCalROC(rocQmean,sector);
742 }
a480de15 743 delete calPulser;
342d3b42 744 f->Close();
9f016d99 745 }
746 ++index;
747 } // while(list)
748//
749// Store updated pedestal entry to OCDB
750//
bdffc5fb 751 if (changed) {
752 AliCDBMetaData metaData;
753 metaData.SetBeamPeriod(0);
754 metaData.SetResponsible("Haavard Helstrup");
eeeac1b2 755 metaData.SetAliRootVersion(ALIROOT_SVN_BRANCH);
bdffc5fb 756 metaData.SetComment("Preprocessor AliTPC data base entries.");
757
758 Bool_t storeOK = Store("Calib", "Pulser", pulserObjects, &metaData, 0, kTRUE);
759 if ( !storeOK ) ++result;
760 }
9f016d99 761 } else {
cf4216a3 762 Log ("Error: no entries in pulser file list!");
9f016d99 763 result = 1;
764 }
765
766 return result;
767}
768
70f224dd 769//______________________________________________________________________________________________
770
771
772UInt_t AliTPCPreprocessor::ExtractRaw(Int_t sourceFXS)
773{
774 //
775 // Read Raw calibration file from file exchage server
776 //
777
778 UInt_t result=0;
90581ff1 779 TObjArray* rawArray = new TObjArray;
70f224dd 780
9b1478f9 781 TList* list = GetFileSources(sourceFXS,"tpcCalibRaw");
70f224dd 782
783 if (list && list->GetEntries()>0) {
784
785// loop through all files
786
787 UInt_t index = 0;
788 while (list->At(index)!=NULL) {
789 TObjString* fileNameEntry = (TObjString*) list->At(index);
790 if (fileNameEntry!=NULL) {
791 TString fileName = GetFile(sourceFXS, "tpcCalibRaw",
792 fileNameEntry->GetString().Data());
793 TFile *f = TFile::Open(fileName);
794 if (!f) {
795 Log ("Error opening raw file.");
796 result =2;
797 break;
798 }
90581ff1 799 AliTPCCalibRaw *calRaw;
70f224dd 800 f->GetObject("tpcCalibRaw",calRaw);
801 if ( !calRaw ) {
802 Log ("No raw calibration object in file.");
803 result = 2;
804 break;
805 }
90581ff1 806 rawArray->Add(calRaw);
70f224dd 807 f->Close();
808 }
809 ++index;
810 } // while(list)
811//
812// Store updated pedestal entry to OCDB
813//
814 AliCDBMetaData metaData;
815 metaData.SetBeamPeriod(0);
816 metaData.SetResponsible("Haavard Helstrup");
817 metaData.SetAliRootVersion(ALIROOT_SVN_BRANCH);
818 metaData.SetComment("Preprocessor AliTPC data base entries.");
819
90581ff1 820 Bool_t storeOK = Store("Calib", "Raw", rawArray, &metaData, 0, kTRUE);
70f224dd 821 if ( !storeOK ) ++result;
822 } else {
cf4216a3 823 Log ("Error: no entries in raw file list!");
70f224dd 824 result = 1;
825 }
826
827 return result;
828}
829//______________________________________________________________________________________________
830
9f016d99 831UInt_t AliTPCPreprocessor::ExtractCE(Int_t sourceFXS)
832{
833 //
834 // Read Central Electrode file from file exchage server
70f224dd 835 //
9f016d99 836 //
9f016d99 837 AliTPCCalPad *ceTmean=0;
838 AliTPCCalPad *ceTrms=0;
839 AliTPCCalPad *ceQmean=0;
bb30a935 840 TObjArray *rocTtime=0;
841 TObjArray *rocQtime=0;
842
70f224dd 843 TObjArray *ceObjects= new TObjArray;
844
9f016d99 845
bb30a935 846 Int_t nSectors = fROC->GetNSectors();
847
70f224dd 848 ceTmean = new AliTPCCalPad("CETmean","CETmean");
849 ceObjects->Add(ceTmean);
9f016d99 850
70f224dd 851 ceTrms = new AliTPCCalPad("CETrms","CETrms");
852 ceObjects->Add(ceTrms);
853
854 ceQmean = new AliTPCCalPad("CEQmean","CEQmean");
855 ceObjects->Add(ceQmean);
856
857 rocTtime = new TObjArray(nSectors+2); // also make room for A and C side average
858 rocTtime->SetName("rocTtime");
859 ceObjects->Add(rocTtime);
860
861 rocQtime = new TObjArray(nSectors);
862 rocQtime->SetName("rocQtime");
863 ceObjects->Add(rocQtime);
864
9f016d99 865
866 UInt_t result=0;
867
9f016d99 868 TList* list = GetFileSources(sourceFXS,"CE");
869
870 if (list && list->GetEntries()>0) {
871
872// loop through all files from LDCs
873
874 UInt_t index = 0;
875 while (list->At(index)!=NULL) {
876 TObjString* fileNameEntry = (TObjString*) list->At(index);
877 if (fileNameEntry!=NULL) {
878 TString fileName = GetFile(sourceFXS, "CE",
879 fileNameEntry->GetString().Data());
880 TFile *f = TFile::Open(fileName);
881 if (!f) {
882 Log ("Error opening central electrode file.");
883 result =2;
884 break;
885 }
886 AliTPCCalibCE *calCE;
e73181c9 887 f->GetObject("tpcCalibCE",calCE);
9f016d99 888
7c2575c4 889 if (!calCE) {
890 Log ("No valid calibCE object.");
891 result=2;
892 break;
893 }
9f016d99 894 // replace entries for the sectors available in the present file
895
896 for (Int_t sector=0; sector<nSectors; sector++) {
897 AliTPCCalROC *rocTmean=calCE->GetCalRocT0(sector);
898 if ( rocTmean ) ceTmean->SetCalROC(rocTmean,sector);
899 AliTPCCalROC *rocTrms=calCE->GetCalRocRMS(sector);
900 if ( rocTrms ) ceTrms->SetCalROC(rocTrms,sector);
901 AliTPCCalROC *rocQmean=calCE->GetCalRocQ(sector);
38fcad6d 902 if ( rocQmean ) ceQmean->SetCalROC(rocQmean,sector);
bb30a935 903 TGraph *grT=calCE->MakeGraphTimeCE(sector,0,2); // T time graph
904 if ( grT ) rocTtime->AddAt(grT,sector);
905 TGraph *grQ=calCE->MakeGraphTimeCE(sector,0,3); // Q time graph
a8ee5a87 906 if ( grQ ) rocQtime->AddAt(grQ,sector);
9f016d99 907 }
70f224dd 908
909 TGraph *grT=calCE->MakeGraphTimeCE(-1,0,2); // A side average
910 if ( grT ) rocTtime->AddAt(grT,nSectors);
911 grT=calCE->MakeGraphTimeCE(-2,0,2); // C side average
912 if ( grT ) rocTtime->AddAt(grT,nSectors+1);
913
914
a480de15 915 delete calCE;
342d3b42 916 f->Close();
9f016d99 917 }
918 ++index;
919 } // while(list)
920//
921// Store updated pedestal entry to OCDB
922//
923 AliCDBMetaData metaData;
924 metaData.SetBeamPeriod(0);
925 metaData.SetResponsible("Haavard Helstrup");
eeeac1b2 926 metaData.SetAliRootVersion(ALIROOT_SVN_BRANCH);
9f016d99 927 metaData.SetComment("Preprocessor AliTPC data base entries.");
928
929 Bool_t storeOK = Store("Calib", "CE", ceObjects, &metaData, 0, kTRUE);
930 if ( !storeOK ) ++result;
931
932 } else {
cf4216a3 933 Log ("Error: no CE entries available from FXS!");
9f016d99 934 result = 1;
935 }
936
937 return result;
938}
dca91b3f 939//______________________________________________________________________________________________
940
941UInt_t AliTPCPreprocessor::ExtractQA(Int_t sourceFXS)
942{
943 //
944 // Read Quality Assurance file from file exchage server
945 //
946
947 UInt_t result=0;
948
949 TList* list = GetFileSources(sourceFXS,"QA");
950
951 if (list && list->GetEntries()>0) {
952
953// only one QA objetc should be available!
954
955 AliTPCdataQA *calQA;
956
957 UInt_t nentries = list->GetEntries();
958 UInt_t index=0;
959 if ( nentries > 1) Log ( "More than one QA entry. First one processed");
960 TObjString* fileNameEntry = (TObjString*) list->At(index);
961 if (fileNameEntry!=NULL) {
962 TString fileName = GetFile(sourceFXS, "QA",
963 fileNameEntry->GetString().Data());
964 TFile *f = TFile::Open(fileName);
965 if (!f) {
966 Log ("Error opening QA file.");
a2465b54 967 result =2;
968 } else {
969 f->GetObject("tpcCalibQA",calQA);
7c2575c4 970 if ( calQA ) {
dca91b3f 971//
972// Store updated pedestal entry to OCDB
973//
7c2575c4 974 AliCDBMetaData metaData;
975 metaData.SetBeamPeriod(0);
976 metaData.SetResponsible("Haavard Helstrup");
eeeac1b2 977 metaData.SetAliRootVersion(ALIROOT_SVN_BRANCH);
7c2575c4 978 metaData.SetComment("Preprocessor AliTPC data base entries.");
979
cf4216a3 980 Bool_t storeOK = Store("Calib", "QA", calQA, &metaData, 0, kFALSE);
7c2575c4 981 if ( !storeOK ) ++result;
982 }
a2465b54 983 }
984 } else {
985 Log ("Error: no QA files on FXS!");
986 result = 2;
987 }
dca91b3f 988 } else {
a2465b54 989 Log ("Error: no QA entries in FXS list!");
dca91b3f 990 result = 1;
991 }
dca91b3f 992 return result;
993}
994
9054511b 995//______________________________________________________________________________________________
996
997
998UInt_t AliTPCPreprocessor::ExtractAltro(Int_t sourceFXS)
999{
1000 //
1001 // Read pulser calibration file from file exchage server
1002 // Keep original entry from OCDB in case no new pulser calibration is available
1003 //
1004 TObjArray *altroObjects=0;
1005 AliTPCCalPad *acqStart=0;
1006 AliTPCCalPad *zsThr=0;
1007 AliTPCCalPad *acqStop=0;
1008 AliTPCCalPad *FPED=0;
1009 AliTPCCalPad *masked=0;
cf4216a3 1010 AliTPCCalPad *k1=0, *k2=0, *k3=0;
1011 AliTPCCalPad *l1=0, *l2=0, *l3=0;
1012 TMap *mapRCUconfig=0;
9054511b 1013
14ae505e 1014 AliCDBEntry* entry = GetFromOCDB("Calib", "AltroConfig");
9054511b 1015 if (entry) altroObjects = (TObjArray*)entry->GetObject();
1016 if ( altroObjects==NULL ) {
1017 Log("AliTPCPreprocsessor: No previous TPC altro calibration entry available.\n");
1018 altroObjects = new TObjArray;
1019 }
1020
1021 acqStart = (AliTPCCalPad*)altroObjects->FindObject("AcqStart");
1022 if ( !acqStart ) {
1023 acqStart = new AliTPCCalPad("AcqStart","AcqStart");
1024 altroObjects->Add(acqStart);
1025 }
1026 zsThr = (AliTPCCalPad*)altroObjects->FindObject("ZsThr");
1027 if ( !zsThr ) {
1028 zsThr = new AliTPCCalPad("ZsThr","ZsThr");
1029 altroObjects->Add(zsThr);
1030 }
1031 FPED = (AliTPCCalPad*)altroObjects->FindObject("FPED");
1032 if ( !FPED ) {
1033 FPED = new AliTPCCalPad("FPED","FPED");
1034 altroObjects->Add(FPED);
1035 }
1036 acqStop = (AliTPCCalPad*)altroObjects->FindObject("AcqStop");
1037 if ( !acqStop ) {
1038 acqStop = new AliTPCCalPad("AcqStop","AcqStop");
1039 altroObjects->Add(acqStop);
1040 }
1041 masked = (AliTPCCalPad*)altroObjects->FindObject("Masked");
1042 if ( !masked ) {
1043 masked = new AliTPCCalPad("Masked","Masked");
1044 altroObjects->Add(masked);
1045 }
cf4216a3 1046 k1 = (AliTPCCalPad*)altroObjects->FindObject("K1");
1047 if ( !k1 ) {
1048 k1 = new AliTPCCalPad("K1","K1");
1049 altroObjects->Add(k1);
1050 }
1051 k2 = (AliTPCCalPad*)altroObjects->FindObject("K2");
1052 if ( !k2 ) {
1053 k2 = new AliTPCCalPad("K2","K2");
1054 altroObjects->Add(k2);
1055 }
1056 k3 = (AliTPCCalPad*)altroObjects->FindObject("K3");
1057 if ( !k3 ) {
1058 k3 = new AliTPCCalPad("K3","K3");
1059 altroObjects->Add(k3);
1060 }
1061 l1 = (AliTPCCalPad*)altroObjects->FindObject("L1");
1062 if ( !l1 ) {
1063 l1 = new AliTPCCalPad("L1","L1");
1064 altroObjects->Add(l1);
1065 }
1066 l2 = (AliTPCCalPad*)altroObjects->FindObject("L2");
1067 if ( !l2 ) {
1068 l2 = new AliTPCCalPad("L2","L2");
1069 altroObjects->Add(l2);
1070 }
1071 l3 = (AliTPCCalPad*)altroObjects->FindObject("L3");
1072 if ( !l3 ) {
1073 l3 = new AliTPCCalPad("L3","L3");
1074 altroObjects->Add(l3);
1075 }
1076 mapRCUconfig = (TMap*)altroObjects->FindObject("RCUconfig");
1077 if (!mapRCUconfig) {
1078 mapRCUconfig = new TMap();
1079 mapRCUconfig->SetName("RCUconfig");
1080 altroObjects->Add(mapRCUconfig);
1081 }
9054511b 1082
1083
1084 UInt_t result=0;
1085 TString idFXS[2]={"AltroConfigA","AltroConfigC"};
1086
1087 Int_t nSectors = fROC->GetNSectors();
1088 Bool_t changed=false;
1089 for ( Int_t id=0; id<2; id++) {
1090 TList* list = GetFileSources(sourceFXS,idFXS[id].Data());
1091
1092 if (list && list->GetEntries()>0) {
1093 if (altroObjects == 0 ) altroObjects = new TObjArray;
1094
1095// loop through all files from LDCs
1096
1097 UInt_t index = 0;
1098 while (list->At(index)!=NULL) {
1099 TObjString* fileNameEntry = (TObjString*) list->At(index);
1100 if (fileNameEntry!=NULL) {
1101 TString fileName = GetFile(sourceFXS, idFXS[id].Data(),
1102 fileNameEntry->GetString().Data());
1103 TFile *f = TFile::Open(fileName);
1104 if (!f) {
1105 char message[40];
1106 sprintf(message,"Error opening Altro configuration file, id = %d",id);
1107 Log (message);
1108 result =2;
1109 break;
1110 }
1111 TObjArray *altroFXS;
1112 f->GetObject("AltroConfig",altroFXS);
1113 if ( !altroFXS ) {
1114 Log ("No Altro configuration object in file.");
1115 result = 2;
1116 break;
1117 }
1118
1119 // replace entries for the sectors available in the present file
1120 AliTPCCalPad *acqStartFXS=(AliTPCCalPad*)altroFXS->FindObject("AcqStart");
1121 AliTPCCalPad *zsThrFXS=(AliTPCCalPad*)altroFXS->FindObject("ZsThr");
1122 AliTPCCalPad *acqStopFXS=(AliTPCCalPad*)altroFXS->FindObject("AcqStop");
1123 AliTPCCalPad *FPEDFXS=(AliTPCCalPad*)altroFXS->FindObject("FPED");
1124 AliTPCCalPad *maskedFXS=(AliTPCCalPad*)altroFXS->FindObject("Masked");
cf4216a3 1125 AliTPCCalPad *k1FXS=(AliTPCCalPad*)altroFXS->FindObject("K1");
1126 AliTPCCalPad *k2FXS=(AliTPCCalPad*)altroFXS->FindObject("K2");
1127 AliTPCCalPad *k3FXS=(AliTPCCalPad*)altroFXS->FindObject("K3");
1128 AliTPCCalPad *l1FXS=(AliTPCCalPad*)altroFXS->FindObject("L1");
1129 AliTPCCalPad *l2FXS=(AliTPCCalPad*)altroFXS->FindObject("L2");
1130 AliTPCCalPad *l3FXS=(AliTPCCalPad*)altroFXS->FindObject("L3");
1131 TMap *mapRCUconfigFXS = (TMap*)altroFXS->FindObject("RCUconfig");
1132 TIterator *mapFXSiter = mapRCUconfigFXS->MakeIterator();
1133
9054511b 1134 changed=true;
1135 for (Int_t sector=0; sector<nSectors; sector++) {
1136
1137 if (acqStartFXS) {
1138 AliTPCCalROC *rocAcqStart=acqStartFXS->GetCalROC(sector);
1139 if ( rocAcqStart ) acqStart->SetCalROC(rocAcqStart,sector);
1140 }
1141 if (zsThrFXS ) {
1142 AliTPCCalROC *rocZsThr=zsThrFXS->GetCalROC(sector);
1143 if ( rocZsThr ) zsThr->SetCalROC(rocZsThr,sector);
1144 }
1145 if (acqStopFXS) {
1146 AliTPCCalROC *rocAcqStop=acqStopFXS->GetCalROC(sector);
1147 if ( rocAcqStop ) acqStop->SetCalROC(rocAcqStop,sector);
1148 }
1149 if (FPEDFXS ) {
1150 AliTPCCalROC *rocFPED=FPEDFXS->GetCalROC(sector);
2d47cfd4 1151 if ( rocFPED ) FPED->SetCalROC(rocFPED,sector);
9054511b 1152 }
1153 if (maskedFXS) {
1154 AliTPCCalROC *rocMasked=maskedFXS->GetCalROC(sector);
1155 if ( rocMasked ) masked->SetCalROC(rocMasked,sector);
1156 }
cf4216a3 1157 if (k1FXS) {
1158 AliTPCCalROC *rocK1=k1FXS->GetCalROC(sector);
1159 if ( rocK1 ) k1->SetCalROC(rocK1,sector);
1160 }
1161 if (k2FXS) {
1162 AliTPCCalROC *rocK2=k2FXS->GetCalROC(sector);
1163 if ( rocK2 ) k2->SetCalROC(rocK2,sector);
1164 }
1165 if (k3FXS) {
1166 AliTPCCalROC *rocK3=k3FXS->GetCalROC(sector);
1167 if ( rocK3 ) k3->SetCalROC(rocK3,sector);
1168 }
1169 if (l1FXS) {
1170 AliTPCCalROC *rocL1=l1FXS->GetCalROC(sector);
1171 if ( rocL1 ) l1->SetCalROC(rocL1,sector);
1172 }
1173 if (l2FXS) {
1174 AliTPCCalROC *rocL2=l2FXS->GetCalROC(sector);
1175 if ( rocL2 ) l2->SetCalROC(rocL2,sector);
1176 }
1177 if (l3FXS) {
1178 AliTPCCalROC *rocL3=l3FXS->GetCalROC(sector);
1179 if ( rocL3 ) l3->SetCalROC(rocL3,sector);
1180 }
1181 }
1182 if (mapRCUconfigFXS) {
1183 Int_t mapEntries = mapRCUconfigFXS->GetEntries();
1184 TObjString* keyFXS;
1185 TVectorF* vecFXS;
1186 TVectorF* vec; // nSectors = 72 (total number of inner/outer sectors)
1187 for (Int_t i=0; i<mapEntries; ++i) {
1188 keyFXS=(TObjString*)mapFXSiter->Next();
1189 vecFXS=(TVectorF*)mapRCUconfigFXS->GetValue(keyFXS);
1190 vec=(TVectorF*)mapRCUconfig->GetValue(keyFXS);
1191 if (!vec) {
1192 vec = new TVectorF(3*nSectors);
1193 *vec = -1;
1194 mapRCUconfig->Add(keyFXS,vec);
1195 }
1196 if (vec->GetNoElements() != 3*nSectors ) {
1197 vec->ResizeTo(3*nSectors);
1198 }
1199 if (id==0) { // A side
1200 vec->SetSub(0,vecFXS->GetSub(0,nSectors/2-1));
1201 vec->SetSub(nSectors,vecFXS->GetSub(nSectors,2*nSectors-1));
1202 } else { // C side
1203 vec->SetSub(nSectors/2,vecFXS->GetSub(nSectors/2,nSectors-1));
1204 vec->SetSub(2*nSectors,vecFXS->GetSub(2*nSectors,3*nSectors-1));
1205 }
1206 }
9054511b 1207 }
1208 delete altroFXS;
1209 f->Close();
1210 }
1211 ++index;
1212 } // while(list)
1213 } else {
cf4216a3 1214 Log ("Error: no entries in AltroConfig file list!");
9054511b 1215 result = 1;
1216 }
1217
1218 } // for - id
1219//
1220// Store updated pedestal entry to OCDB
1221//
1222 if (changed) {
1223 AliCDBMetaData metaData;
1224 metaData.SetBeamPeriod(0);
1225 metaData.SetResponsible("Haavard Helstrup");
eeeac1b2 1226 metaData.SetAliRootVersion(ALIROOT_SVN_BRANCH);
9054511b 1227 metaData.SetComment("Preprocessor AliTPC data base entries.");
1228
dbc10140 1229 Bool_t storeOK = Store("Calib", "AltroConfig", altroObjects, &metaData, 0, kFALSE);
9054511b 1230 if ( !storeOK ) ++result;
1231 }
1232
1233 return result;
1234}