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