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