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