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