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