]>
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 | |
2b00f997 | 43 | const Double_t kHighVoltageDifference = 1e-4; // don't record High Voltage points |
44 | // differing by less than 1e-4 from | |
45 | // previous point. | |
41c979ea | 46 | const Double_t kGasCompositionDifference = 1e-3; // don't record Gas Composition points |
47 | // differing by less than 1e-3 from | |
48 | // previous point | |
bb30a935 | 49 | const TString kPedestalRunType = "PEDESTAL"; // pedestal run identifier |
9054511b | 50 | const TString kPulserRunType = "PULSER"; // pulser run identifier |
bdffc5fb | 51 | const TString kPhysicsRunType = "PHYSICS"; // physics run identifier |
9054511b | 52 | const TString kCosmicRunType = "COSMIC"; // cosmic run identifier |
53 | const TString kLaserRunType = "LASER"; // laser run identifier | |
9c754ce7 | 54 | const TString kDaqRunType = "DAQ"; // DAQ run identifier |
87d77b35 | 55 | const TString kAmandaTemp = "TPC_PT_%d_TEMPERATURE"; // Amanda string for temperature entries |
f6b5fa33 | 56 | const TString kAmandaDDL = "DDL%d"; // Amanda string for list of active DDLs |
57 | const Int_t kNumDDL = 216; // number of TPC DDLs | |
58 | const Int_t kFirstDDL = 768; // identifier of first DDL | |
bee89eeb | 59 | //const Double_t kFitFraction = 0.7; // Fraction of DCS sensor fits required |
68b512ca | 60 | const Double_t kFitFraction = -1.0; // Don't require minimum number of fits in commissioning run |
09a746c5 | 61 | const Int_t kNumPressureSensors = 3; // number of pressure sensors |
62 | const char* kPressureSensorNames[kNumPressureSensors] = { | |
63 | "CavernAtmosPressure", | |
64 | "CavernAtmosPressure2", | |
65 | "SurfaceAtmosPressure" }; | |
1fc96a8a | 66 | const Int_t kMinCESectors = 32; // minimum number of sectors (per side) |
67 | // to accept CE calibration | |
09a746c5 | 68 | |
cf4216a3 | 69 | |
54472e4f | 70 | // |
71 | // This class is the SHUTTLE preprocessor for the TPC detector. | |
54472e4f | 72 | // |
73 | ||
74 | ClassImp(AliTPCPreprocessor) | |
75 | ||
76 | //______________________________________________________________________________________________ | |
6d07bf74 | 77 | AliTPCPreprocessor::AliTPCPreprocessor(AliShuttleInterface* shuttle) : |
78 | AliPreprocessor("TPC",shuttle), | |
09a746c5 | 79 | fConfEnv(0), fTemp(0), fHighVoltage(0), fHighVoltageStat(0), fGoofie(0), |
41c979ea | 80 | fPressure(0), fGasComposition(0), fConfigOK(kTRUE), fROC(0) |
54472e4f | 81 | { |
82 | // constructor | |
a7dce0bc | 83 | fROC = AliTPCROC::Instance(); |
72534123 | 84 | |
85 | // define run types to be processed | |
86 | ||
87 | AddRunType(kPedestalRunType); | |
88 | AddRunType(kPulserRunType); | |
89 | AddRunType(kPhysicsRunType); | |
72534123 | 90 | AddRunType(kCosmicRunType); |
91 | AddRunType(kLaserRunType); | |
92 | AddRunType(kDaqRunType); | |
93 | ||
54472e4f | 94 | } |
72df5829 | 95 | //______________________________________________________________________________________________ |
f4a89669 | 96 | AliTPCPreprocessor::AliTPCPreprocessor(const AliTPCPreprocessor& ) : |
97 | AliPreprocessor("TPC",0), | |
09a746c5 | 98 | fConfEnv(0), fTemp(0), fHighVoltage(0), fHighVoltageStat(0), fGoofie(0), |
41c979ea | 99 | fPressure(0), fGasComposition(0), fConfigOK(kTRUE), fROC(0) |
f4a89669 | 100 | { |
101 | ||
102 | Fatal("AliTPCPreprocessor", "copy constructor not implemented"); | |
f7f602cc | 103 | // |
104 | // // fTemp = new AliTPCSensorTempArray(*(org.fTemp)); | |
f4a89669 | 105 | } |
54472e4f | 106 | |
107 | //______________________________________________________________________________________________ | |
108 | AliTPCPreprocessor::~AliTPCPreprocessor() | |
109 | { | |
110 | // destructor | |
a7dce0bc | 111 | |
54472e4f | 112 | delete fTemp; |
bdffc5fb | 113 | delete fHighVoltage; |
795dbd3b | 114 | delete fHighVoltageStat; |
115 | delete fGoofie; | |
33f6bae5 | 116 | delete fGasComposition; |
09a746c5 | 117 | delete fPressure; |
54472e4f | 118 | } |
72df5829 | 119 | //______________________________________________________________________________________________ |
120 | AliTPCPreprocessor& AliTPCPreprocessor::operator = (const AliTPCPreprocessor& ) | |
121 | { | |
122 | Fatal("operator =", "assignment operator not implemented"); | |
123 | return *this; | |
124 | } | |
125 | ||
54472e4f | 126 | |
127 | //______________________________________________________________________________________________ | |
128 | void AliTPCPreprocessor::Initialize(Int_t run, UInt_t startTime, | |
129 | UInt_t endTime) | |
130 | { | |
bb30a935 | 131 | |
09a746c5 | 132 | AliPreprocessor::Initialize(run, startTime, endTime); |
54472e4f | 133 | |
134 | AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run, | |
f4a89669 | 135 | TTimeStamp((time_t)startTime,0).AsString(), |
136 | TTimeStamp((time_t)endTime,0).AsString())); | |
54472e4f | 137 | |
7b54c8e9 | 138 | // Preprocessor configuration |
139 | ||
37092b2b | 140 | AliCDBEntry* entry = GetFromOCDB("Config", "Preprocessor"); |
7b54c8e9 | 141 | if (entry) fConfEnv = (TEnv*) entry->GetObject(); |
142 | if ( fConfEnv==0 ) { | |
7b54c8e9 | 143 | Log("AliTPCPreprocsessor: Preprocessor Config OCDB entry missing.\n"); |
37092b2b | 144 | fConfigOK = kFALSE; |
145 | return; | |
7b54c8e9 | 146 | } |
147 | ||
18eade96 | 148 | // Temperature sensors |
149 | ||
136e44f7 | 150 | TTree *confTree = 0; |
151 | ||
152 | TString tempConf = fConfEnv->GetValue("Temperature","ON"); | |
153 | tempConf.ToUpper(); | |
154 | if (tempConf != "OFF" ) { | |
7b54c8e9 | 155 | entry = GetFromOCDB("Config", "Temperature"); |
f7f602cc | 156 | if (entry) confTree = (TTree*) entry->GetObject(); |
18eade96 | 157 | if ( confTree==0 ) { |
18eade96 | 158 | Log("AliTPCPreprocsessor: Temperature Config OCDB entry missing.\n"); |
159 | fConfigOK = kFALSE; | |
f7f602cc | 160 | return; |
18eade96 | 161 | } |
09a746c5 | 162 | fTemp = new AliTPCSensorTempArray(startTime, endTime, confTree, kAmandaTemp); |
18eade96 | 163 | fTemp->SetValCut(kValCutTemp); |
164 | fTemp->SetDiffCut(kDiffCutTemp); | |
136e44f7 | 165 | } |
18eade96 | 166 | |
bdffc5fb | 167 | // High voltage measurements |
168 | ||
136e44f7 | 169 | TString hvConf = fConfEnv->GetValue("HighVoltage","ON"); |
170 | hvConf.ToUpper(); | |
171 | if (hvConf != "OFF" ) { | |
bdffc5fb | 172 | confTree=0; |
173 | entry=0; | |
174 | entry = GetFromOCDB("Config", "HighVoltage"); | |
175 | if (entry) confTree = (TTree*) entry->GetObject(); | |
176 | if ( confTree==0 ) { | |
177 | Log("AliTPCPreprocsessor: High Voltage Config OCDB entry missing.\n"); | |
178 | fConfigOK = kFALSE; | |
179 | return; | |
180 | } | |
03d57022 | 181 | time_t timeStart = (time_t)(((TString)GetRunParameter("DAQ_time_start")).Atoi()); |
182 | time_t timeEnd = (time_t)(((TString)GetRunParameter("DAQ_time_end")).Atoi()); | |
183 | fHighVoltage = new AliDCSSensorArray (UInt_t(timeStart), | |
184 | UInt_t(timeEnd), confTree); | |
bff20895 | 185 | } |
9d2ce539 | 186 | |
187 | // High voltage status values | |
188 | ||
bff20895 | 189 | TString hvStatConf = fConfEnv->GetValue("HighVoltageStat","ON"); |
190 | hvStatConf.ToUpper(); | |
191 | if (hvStatConf != "OFF" ) { | |
9d2ce539 | 192 | confTree=0; |
193 | entry=0; | |
194 | entry = GetFromOCDB("Config", "HighVoltageStat"); | |
195 | if (entry) confTree = (TTree*) entry->GetObject(); | |
196 | if ( confTree==0 ) { | |
197 | Log("AliTPCPreprocsessor: High Voltage Status Config OCDB entry missing.\n"); | |
198 | fConfigOK = kFALSE; | |
199 | return; | |
200 | } | |
fe7f3fe2 | 201 | fHighVoltageStat = new AliDCSSensorArray(startTime, endTime, confTree); |
bdffc5fb | 202 | } |
b6e9fd45 | 203 | |
204 | // Goofie values | |
205 | ||
206 | TString goofieConf = fConfEnv->GetValue("Goofie","ON"); | |
207 | goofieConf.ToUpper(); | |
208 | if (goofieConf != "OFF" ) { | |
209 | confTree=0; | |
210 | entry=0; | |
211 | entry = GetFromOCDB("Config", "Goofie"); | |
212 | if (entry) confTree = (TTree*) entry->GetObject(); | |
213 | if ( confTree==0 ) { | |
214 | Log("AliTPCPreprocsessor: Goofie Config OCDB entry missing.\n"); | |
215 | fConfigOK = kFALSE; | |
216 | return; | |
217 | } | |
09a746c5 | 218 | fGoofie = new AliDCSSensorArray(startTime, endTime, confTree); |
b6e9fd45 | 219 | } |
220 | ||
41c979ea | 221 | |
222 | // Gas composition measurements | |
223 | ||
224 | TString gasConf = fConfEnv->GetValue("GasComposition","OFF"); | |
225 | gasConf.ToUpper(); | |
226 | if (gasConf != "OFF" ) { | |
227 | confTree=0; | |
228 | entry=0; | |
229 | entry = GetFromOCDB("Config", "GasComposition"); | |
230 | if (entry) confTree = (TTree*) entry->GetObject(); | |
231 | if ( confTree==0 ) { | |
232 | Log("AliTPCPreprocsessor: Gas Composition Config OCDB entry missing.\n"); | |
233 | fConfigOK = kFALSE; | |
234 | return; | |
235 | } | |
236 | time_t timeStart = (time_t)(((TString)GetRunParameter("DAQ_time_start")).Atoi()); | |
237 | time_t timeEnd = (time_t)(((TString)GetRunParameter("DAQ_time_end")).Atoi()); | |
238 | fGasComposition = new AliDCSSensorArray (UInt_t(timeStart), | |
239 | UInt_t(timeEnd), confTree); | |
240 | } | |
09a746c5 | 241 | // Pressure values |
242 | ||
243 | TString runType = GetRunType(); | |
244 | ||
245 | if( runType == kPhysicsRunType || | |
246 | runType == kLaserRunType ) { | |
247 | TString pressureConf = fConfEnv->GetValue("Pressure","ON"); | |
248 | pressureConf.ToUpper(); | |
249 | if (pressureConf != "OFF" ) { | |
250 | TClonesArray * array = new TClonesArray("AliDCSSensor",kNumPressureSensors); | |
251 | for(Int_t j = 0; j < kNumPressureSensors; j++) { | |
252 | AliDCSSensor * sens = new ((*array)[j])AliDCSSensor; | |
253 | sens->SetStringID(kPressureSensorNames[j]); | |
254 | } | |
255 | fPressure = new AliDCSSensorArray(startTime, endTime, array); | |
256 | } | |
257 | } | |
54472e4f | 258 | } |
259 | ||
260 | //______________________________________________________________________________________________ | |
261 | UInt_t AliTPCPreprocessor::Process(TMap* dcsAliasMap) | |
262 | { | |
263 | // Fills data into TPC calibrations objects | |
264 | ||
54472e4f | 265 | // Amanda servers provide information directly through dcsAliasMap |
266 | ||
bb30a935 | 267 | |
a7dce0bc | 268 | if (!fConfigOK) return 9; |
136e44f7 | 269 | UInt_t result = 0; |
bb30a935 | 270 | TObjArray *resultArray = new TObjArray(); |
271 | TString errorHandling = fConfEnv->GetValue("ErrorHandling","ON"); | |
272 | errorHandling.ToUpper(); | |
273 | TObject * status; | |
274 | ||
275 | UInt_t dcsResult=0; | |
ff7d4b88 | 276 | if (!dcsAliasMap) { |
277 | dcsResult=1; | |
278 | } else { | |
279 | if (dcsAliasMap->GetEntries() == 0 ) dcsResult=1; | |
280 | } | |
cf4216a3 | 281 | status = new TParameter<int>("dcsResult",dcsResult); |
282 | resultArray->Add(status); | |
bb30a935 | 283 | |
284 | ||
a7dce0bc | 285 | TString runType = GetRunType(); |
286 | ||
cf4216a3 | 287 | if ( dcsResult == 0 ) { |
288 | ||
54472e4f | 289 | // Temperature sensors are processed by AliTPCCalTemp |
72df5829 | 290 | |
cf4216a3 | 291 | TString tempConf = fConfEnv->GetValue("Temperature","ON"); |
292 | tempConf.ToUpper(); | |
293 | if (tempConf != "OFF" ) { | |
294 | UInt_t tempResult = MapTemperature(dcsAliasMap); | |
c589a949 | 295 | if ( tempConf != "TRY") result+=tempResult; |
cf4216a3 | 296 | status = new TParameter<int>("tempResult",tempResult); |
297 | resultArray->Add(status); | |
298 | } | |
18eade96 | 299 | |
bdffc5fb | 300 | // High Voltage recordings |
301 | ||
302 | ||
cf4216a3 | 303 | TString hvConf = fConfEnv->GetValue("HighVoltage","ON"); |
304 | hvConf.ToUpper(); | |
305 | if (hvConf != "OFF" ) { | |
306 | UInt_t hvResult = MapHighVoltage(dcsAliasMap); | |
c589a949 | 307 | if (hvConf != "TRY") result+=hvResult; |
cf4216a3 | 308 | status = new TParameter<int>("hvResult",hvResult); |
309 | resultArray->Add(status); | |
310 | } | |
f7f602cc | 311 | |
cf4216a3 | 312 | // Goofie values |
b6e9fd45 | 313 | |
314 | ||
cf4216a3 | 315 | TString goofieConf = fConfEnv->GetValue("Goofie","ON"); |
316 | goofieConf.ToUpper(); | |
317 | if (goofieConf != "OFF" ) { | |
318 | UInt_t goofieResult = MapGoofie(dcsAliasMap); | |
c589a949 | 319 | if (goofieConf != "TRY") result+=goofieResult; |
cf4216a3 | 320 | status = new TParameter<int>("goofieResult",goofieResult); |
321 | resultArray->Add(status); | |
322 | } | |
09a746c5 | 323 | |
41c979ea | 324 | |
325 | // Gas composition recordings | |
326 | ||
327 | ||
88bca400 | 328 | TString gasConf = fConfEnv->GetValue("GasComposition","OFF"); |
41c979ea | 329 | gasConf.ToUpper(); |
330 | if (gasConf != "OFF" ) { | |
331 | UInt_t gasResult = MapGasComposition(dcsAliasMap); | |
332 | if (gasConf != "TRY") result+=gasResult; | |
333 | status = new TParameter<int>("gasResult",gasResult); | |
334 | resultArray->Add(status); | |
335 | } | |
336 | ||
09a746c5 | 337 | // Pressure values |
338 | ||
339 | if( runType == kPhysicsRunType || | |
340 | runType == kLaserRunType ) { | |
341 | ||
342 | TString pressureConf = fConfEnv->GetValue("Pressure","ON"); | |
343 | pressureConf.ToUpper(); | |
344 | if (pressureConf != "OFF" ) { | |
345 | UInt_t pressureResult = MapPressure(dcsAliasMap); | |
346 | status = new TParameter<int>("pressureResult",pressureResult); | |
347 | resultArray->Add(status); | |
348 | } | |
349 | } | |
cf4216a3 | 350 | } |
54472e4f | 351 | // Other calibration information will be retrieved through FXS files |
a7dce0bc | 352 | // examples: |
54472e4f | 353 | // TList* fileSourcesDAQ = GetFile(AliShuttleInterface::kDAQ, "pedestals"); |
354 | // const char* fileNamePed = GetFile(AliShuttleInterface::kDAQ, "pedestals", "LDC1"); | |
355 | // | |
356 | // TList* fileSourcesHLT = GetFile(AliShuttleInterface::kHLT, "calib"); | |
357 | // const char* fileNameHLT = GetFile(AliShuttleInterface::kHLT, "calib", "LDC1"); | |
358 | ||
9f016d99 | 359 | // pedestal entries |
54472e4f | 360 | |
a7dce0bc | 361 | if(runType == kPedestalRunType) { |
68b512ca | 362 | Int_t numSources = 1; |
363 | Int_t pedestalSource[2] = {AliShuttleInterface::kDAQ,AliShuttleInterface::kHLT} ; | |
7b54c8e9 | 364 | TString source = fConfEnv->GetValue("Pedestal","DAQ"); |
365 | source.ToUpper(); | |
136e44f7 | 366 | if (source != "OFF" ) { |
367 | if ( source == "HLT") pedestalSource[0] = AliShuttleInterface::kHLT; | |
368 | if (!GetHLTStatus()) pedestalSource[0] = AliShuttleInterface::kDAQ; | |
369 | if (source == "HLTDAQ" ) { | |
370 | numSources=2; | |
371 | pedestalSource[0] = AliShuttleInterface::kHLT; | |
372 | pedestalSource[1] = AliShuttleInterface::kDAQ; | |
373 | } | |
374 | if (source == "DAQHLT" ) numSources=2; | |
375 | UInt_t pedestalResult=0; | |
376 | for (Int_t i=0; i<numSources; i++ ) { | |
453bd596 | 377 | pedestalResult = ExtractPedestals(pedestalSource[i]); |
136e44f7 | 378 | if ( pedestalResult == 0 ) break; |
379 | } | |
380 | result += pedestalResult; | |
bb30a935 | 381 | status = new TParameter<int>("pedestalResult",pedestalResult); |
382 | resultArray->Add(status); | |
68b512ca | 383 | } |
a7dce0bc | 384 | } |
385 | ||
9f016d99 | 386 | // pulser trigger processing |
387 | ||
68b512ca | 388 | if(runType == kPulserRunType) { |
389 | Int_t numSources = 1; | |
390 | Int_t pulserSource[2] = {AliShuttleInterface::kDAQ,AliShuttleInterface::kHLT} ; | |
9f016d99 | 391 | TString source = fConfEnv->GetValue("Pulser","DAQ"); |
392 | source.ToUpper(); | |
136e44f7 | 393 | if ( source != "OFF") { |
394 | if ( source == "HLT") pulserSource[0] = AliShuttleInterface::kHLT; | |
395 | if (!GetHLTStatus()) pulserSource[0] = AliShuttleInterface::kDAQ; | |
396 | if (source == "HLTDAQ" ) { | |
397 | numSources=2; | |
398 | pulserSource[0] = AliShuttleInterface::kHLT; | |
399 | pulserSource[1] = AliShuttleInterface::kDAQ; | |
400 | } | |
401 | if (source == "DAQHLT" ) numSources=2; | |
c589a949 | 402 | if (source == "TRY" ) numSources=2; |
136e44f7 | 403 | UInt_t pulserResult=0; |
404 | for (Int_t i=0; i<numSources; i++ ) { | |
405 | pulserResult = ExtractPulser(pulserSource[i]); | |
406 | if ( pulserResult == 0 ) break; | |
407 | } | |
c589a949 | 408 | if (source != "TRY") result += pulserResult; |
bb30a935 | 409 | status = new TParameter<int>("pulserResult",pulserResult); |
410 | resultArray->Add(status); | |
68b512ca | 411 | } |
9f016d99 | 412 | } |
413 | ||
70f224dd | 414 | |
415 | // raw calibration processing | |
416 | ||
417 | if(runType == kPhysicsRunType) { | |
418 | Int_t numSources = 1; | |
419 | Int_t rawSource[2] = {AliShuttleInterface::kDAQ,AliShuttleInterface::kHLT} ; | |
420 | TString source = fConfEnv->GetValue("Raw","DAQ"); | |
421 | source.ToUpper(); | |
422 | if ( source != "OFF") { | |
423 | if ( source == "HLT") rawSource[0] = AliShuttleInterface::kHLT; | |
424 | if (!GetHLTStatus()) rawSource[0] = AliShuttleInterface::kDAQ; | |
425 | if (source == "HLTDAQ" ) { | |
426 | numSources=2; | |
427 | rawSource[0] = AliShuttleInterface::kHLT; | |
428 | rawSource[1] = AliShuttleInterface::kDAQ; | |
429 | } | |
430 | if (source == "DAQHLT" ) numSources=2; | |
c589a949 | 431 | if (source == "TRY" ) numSources=2; |
70f224dd | 432 | UInt_t rawResult=0; |
433 | for (Int_t i=0; i<numSources; i++ ) { | |
434 | rawResult = ExtractRaw(rawSource[i]); | |
435 | if ( rawResult == 0 ) break; | |
436 | } | |
c589a949 | 437 | if (source != "TRY" )result += rawResult; |
70f224dd | 438 | status = new TParameter<int>("rawResult",rawResult); |
439 | resultArray->Add(status); | |
440 | } | |
441 | } | |
442 | ||
443 | ||
9054511b | 444 | // Altro configuration |
445 | ||
446 | ||
447 | TString altroConf = fConfEnv->GetValue("AltroConf","ON"); | |
cf4216a3 | 448 | altroConf.ToUpper(); |
9054511b | 449 | if (altroConf != "OFF" ) { |
f6b5fa33 | 450 | UInt_t altroResult = ExtractAltro(AliShuttleInterface::kDCS,dcsAliasMap); |
c589a949 | 451 | if (altroConf != "TRY" ) result+=altroResult; |
9054511b | 452 | status = new TParameter<int>("altroResult",altroResult); |
453 | resultArray->Add(status); | |
454 | } | |
68b512ca | 455 | |
456 | ||
9f016d99 | 457 | // Central Electrode processing |
458 | ||
9054511b | 459 | if( runType == kPhysicsRunType || |
6f3699dd | 460 | runType == kLaserRunType ) { |
68b512ca | 461 | |
462 | Int_t numSources = 1; | |
463 | Int_t ceSource[2] = {AliShuttleInterface::kDAQ,AliShuttleInterface::kHLT} ; | |
9f016d99 | 464 | TString source = fConfEnv->GetValue("CE","DAQ"); |
465 | source.ToUpper(); | |
136e44f7 | 466 | if ( source != "OFF" ) { |
467 | if ( source == "HLT") ceSource[0] = AliShuttleInterface::kHLT; | |
468 | if (!GetHLTStatus()) ceSource[0] = AliShuttleInterface::kDAQ; | |
469 | if (source == "HLTDAQ" ) { | |
68b512ca | 470 | numSources=2; |
471 | ceSource[0] = AliShuttleInterface::kHLT; | |
472 | ceSource[1] = AliShuttleInterface::kDAQ; | |
136e44f7 | 473 | } |
474 | if (source == "DAQHLT" ) numSources=2; | |
c589a949 | 475 | if (source == "TRY" ) numSources=2; |
136e44f7 | 476 | UInt_t ceResult=0; |
477 | for (Int_t i=0; i<numSources; i++ ) { | |
478 | ceResult = ExtractCE(ceSource[i]); | |
479 | if ( ceResult == 0 ) break; | |
480 | } | |
6f3699dd | 481 | |
482 | // only flag error if CE result is missing from LASER runs | |
483 | // -- for PHYSICS run do CE processing if data available | |
484 | ||
dee76880 | 485 | if ( runType == kLaserRunType && source != "TRY" && ceResult<10 ) result += ceResult; |
bb30a935 | 486 | status = new TParameter<int>("ceResult",ceResult); |
487 | resultArray->Add(status); | |
dca91b3f | 488 | |
489 | numSources = 1; | |
490 | Int_t qaSource[2] = {AliShuttleInterface::kDAQ,AliShuttleInterface::kHLT} ; | |
5e5c1e83 | 491 | source = fConfEnv->GetValue("QA","DAQ"); |
dca91b3f | 492 | source.ToUpper(); |
493 | if ( source != "OFF" ) { | |
494 | if ( source == "HLT") qaSource[0] = AliShuttleInterface::kHLT; | |
495 | if (!GetHLTStatus()) qaSource[0] = AliShuttleInterface::kDAQ; | |
496 | if (source == "HLTDAQ" ) { | |
497 | numSources=2; | |
498 | qaSource[0] = AliShuttleInterface::kHLT; | |
499 | qaSource[1] = AliShuttleInterface::kDAQ; | |
500 | } | |
501 | if (source == "DAQHLT" ) numSources=2; | |
c589a949 | 502 | if (source == "TRY" ) numSources=2; |
dca91b3f | 503 | UInt_t qaResult=0; |
504 | for (Int_t i=0; i<numSources; i++ ) { | |
505 | qaResult = ExtractQA(qaSource[i]); | |
506 | if ( qaResult == 0 ) break; | |
507 | } | |
508 | // result += qaResult; | |
509 | if ( qaResult !=0 ) Log ("ExtractQA failed, no QA entry available."); | |
510 | status = new TParameter<int>("qaResult",qaResult); | |
511 | resultArray->Add(status); | |
68b512ca | 512 | } |
dca91b3f | 513 | } |
9f016d99 | 514 | } |
136e44f7 | 515 | |
c589a949 | 516 | // Store component status to OCDB |
517 | ||
518 | AliCDBMetaData metaData; | |
519 | metaData.SetBeamPeriod(0); | |
520 | metaData.SetResponsible("Haavard Helstrup"); | |
0492edf5 | 521 | metaData.SetAliRootVersion(ALIROOT_BRANCH); |
c589a949 | 522 | metaData.SetComment("Preprocessor AliTPC status."); |
f085dc93 | 523 | Bool_t storeOK = Store("Calib", "PreprocStatus", resultArray, &metaData, 0, kFALSE); |
524 | if (!storeOK) Log ("Unable to store preprocessor status entry"); | |
525 | ||
c589a949 | 526 | resultArray->Delete(); |
527 | delete resultArray; | |
528 | ||
529 | if (errorHandling == "OFF" ) return 0; | |
530 | return result; | |
531 | ||
54472e4f | 532 | } |
533 | //______________________________________________________________________________________________ | |
534 | UInt_t AliTPCPreprocessor::MapTemperature(TMap* dcsAliasMap) | |
535 | { | |
536 | ||
537 | // extract DCS temperature maps. Perform fits to save space | |
538 | ||
72df5829 | 539 | UInt_t result=0; |
54472e4f | 540 | TMap *map = fTemp->ExtractDCS(dcsAliasMap); |
541 | if (map) { | |
542 | fTemp->MakeSplineFit(map); | |
68b512ca | 543 | Double_t fitFraction = 1.0*fTemp->NumFits()/fTemp->NumSensors(); |
67a165ed | 544 | if (fitFraction > kFitFraction ) { |
545 | AliInfo(Form("Temperature values extracted, fits performed.\n")); | |
546 | } else { | |
547 | Log ("Too few temperature maps fitted. \n"); | |
548 | result = 9; | |
549 | } | |
54472e4f | 550 | } else { |
67a165ed | 551 | Log("No temperature map extracted. \n"); |
72df5829 | 552 | result=9; |
54472e4f | 553 | } |
554 | delete map; | |
555 | // Now store the final CDB file | |
a7dce0bc | 556 | |
557 | if ( result == 0 ) { | |
72df5829 | 558 | AliCDBMetaData metaData; |
54472e4f | 559 | metaData.SetBeamPeriod(0); |
560 | metaData.SetResponsible("Haavard Helstrup"); | |
0492edf5 | 561 | metaData.SetAliRootVersion(ALIROOT_BRANCH); |
54472e4f | 562 | metaData.SetComment("Preprocessor AliTPC data base entries."); |
563 | ||
a7dce0bc | 564 | Bool_t storeOK = Store("Calib", "Temperature", fTemp, &metaData, 0, kFALSE); |
565 | if ( !storeOK ) result=1; | |
566 | ||
72df5829 | 567 | } |
54472e4f | 568 | |
569 | return result; | |
7b54c8e9 | 570 | |
54472e4f | 571 | } |
09a746c5 | 572 | //______________________________________________________________________________________________ |
573 | UInt_t AliTPCPreprocessor::MapPressure(TMap* dcsAliasMap) | |
574 | { | |
575 | ||
576 | // extract DCS pressure maps. Perform fits to save space | |
577 | ||
578 | UInt_t result=0; | |
579 | TMap *map = fPressure->ExtractDCS(dcsAliasMap); | |
580 | if (map) { | |
581 | fPressure->MakeSplineFit(map); | |
582 | Double_t fitFraction = 1.0*fPressure->NumFits()/fPressure->NumSensors(); | |
583 | if (fitFraction > kFitFraction ) { | |
1a63b1b0 | 584 | AliInfo(Form("Pressure values extracted, fits performed.\n")); |
09a746c5 | 585 | } else { |
586 | Log ("Too few pressure maps fitted. \n"); | |
587 | result = 9; | |
588 | } | |
589 | } else { | |
590 | Log("No pressure map extracted. \n"); | |
591 | result=9; | |
592 | } | |
593 | delete map; | |
594 | return result; | |
595 | } | |
7b54c8e9 | 596 | |
bdffc5fb | 597 | //______________________________________________________________________________________________ |
598 | UInt_t AliTPCPreprocessor::MapHighVoltage(TMap* dcsAliasMap) | |
599 | { | |
600 | ||
601 | // extract DCS HV maps. Perform fits to save space | |
602 | ||
603 | UInt_t result=0; | |
604 | TMap *map = fHighVoltage->ExtractDCS(dcsAliasMap); | |
605 | if (map) { | |
379fc89a | 606 | fHighVoltage->ClearFit(); |
2b00f997 | 607 | fHighVoltage->RemoveGraphDuplicates(kHighVoltageDifference); |
608 | // don't keep new point if too similar to previous one | |
379fc89a | 609 | fHighVoltage->SetGraph(map); |
bdffc5fb | 610 | } else { |
611 | Log("No high voltage recordings extracted. \n"); | |
612 | result=9; | |
613 | } | |
614 | delete map; | |
9d2ce539 | 615 | |
bff20895 | 616 | TString hvStatConf = fConfEnv->GetValue("HighVoltageStat","ON"); |
617 | hvStatConf.ToUpper(); | |
618 | if (hvStatConf != "OFF" ) { | |
619 | TMap *map2 = fHighVoltageStat->ExtractDCS(dcsAliasMap); | |
620 | if (map2) { | |
dca91b3f | 621 | fHighVoltageStat->ClearFit(); |
622 | fHighVoltageStat->SetGraph(map2); | |
bff20895 | 623 | } else { |
624 | Log("No high voltage status recordings extracted. \n"); | |
625 | result=9; | |
626 | } | |
627 | delete map2; | |
9d2ce539 | 628 | |
bff20895 | 629 | // add status maps to high voltage sensor array |
9d2ce539 | 630 | |
bff20895 | 631 | fHighVoltage->AddSensors(fHighVoltageStat); |
632 | } | |
bdffc5fb | 633 | // Now store the final CDB file |
634 | ||
635 | if ( result == 0 ) { | |
636 | AliCDBMetaData metaData; | |
637 | metaData.SetBeamPeriod(0); | |
638 | metaData.SetResponsible("Haavard Helstrup"); | |
0492edf5 | 639 | metaData.SetAliRootVersion(ALIROOT_BRANCH); |
bdffc5fb | 640 | metaData.SetComment("Preprocessor AliTPC data base entries."); |
641 | ||
642 | Bool_t storeOK = Store("Calib", "HighVoltage", fHighVoltage, &metaData, 0, kFALSE); | |
643 | if ( !storeOK ) result=1; | |
644 | ||
645 | } | |
646 | ||
647 | return result; | |
648 | ||
649 | } | |
650 | ||
b6e9fd45 | 651 | //______________________________________________________________________________________________ |
652 | UInt_t AliTPCPreprocessor::MapGoofie(TMap* dcsAliasMap) | |
653 | { | |
654 | ||
655 | // extract DCS Goofie maps. Do not perform fits (low update rate) | |
656 | ||
657 | UInt_t result=0; | |
658 | ||
659 | TMap *map = fGoofie->ExtractDCS(dcsAliasMap); | |
660 | if (map) { | |
661 | fGoofie->ClearFit(); | |
662 | fGoofie->SetGraph(map); | |
663 | } else { | |
664 | Log("No Goofie recordings extracted. \n"); | |
665 | result=9; | |
666 | } | |
667 | delete map; | |
668 | ||
669 | // Now store the final CDB file | |
670 | ||
671 | if ( result == 0 ) { | |
672 | AliCDBMetaData metaData; | |
673 | metaData.SetBeamPeriod(0); | |
674 | metaData.SetResponsible("Haavard Helstrup"); | |
0492edf5 | 675 | metaData.SetAliRootVersion(ALIROOT_BRANCH); |
b6e9fd45 | 676 | metaData.SetComment("Preprocessor AliTPC data base entries."); |
677 | ||
678 | Bool_t storeOK = Store("Calib", "Goofie", fGoofie, &metaData, 0, kFALSE); | |
679 | if ( !storeOK ) result=1; | |
680 | ||
681 | } | |
682 | ||
683 | return result; | |
684 | ||
685 | } | |
686 | ||
41c979ea | 687 | //______________________________________________________________________________________________ |
688 | UInt_t AliTPCPreprocessor::MapGasComposition(TMap* dcsAliasMap) | |
689 | { | |
690 | ||
691 | // extract DCS HV maps. Perform fits to save space | |
692 | ||
693 | UInt_t result=0; | |
694 | TMap *map = fGasComposition->ExtractDCS(dcsAliasMap); | |
695 | if (map) { | |
33f6bae5 | 696 | fGasComposition->ClearFit(); |
697 | fGasComposition->RemoveGraphDuplicates(kGasCompositionDifference); | |
41c979ea | 698 | // don't keep new point if too similar to previous one |
33f6bae5 | 699 | fGasComposition->SetGraph(map); |
41c979ea | 700 | } else { |
701 | Log("No gas composition recordings extracted. \n"); | |
702 | result=9; | |
703 | } | |
704 | delete map; | |
705 | ||
706 | // Now store the final CDB file | |
707 | ||
708 | if ( result == 0 ) { | |
709 | AliCDBMetaData metaData; | |
710 | metaData.SetBeamPeriod(0); | |
711 | metaData.SetResponsible("Haavard Helstrup"); | |
712 | metaData.SetAliRootVersion(ALIROOT_BRANCH); | |
713 | metaData.SetComment("Preprocessor AliTPC data base entries."); | |
714 | ||
715 | Bool_t storeOK = Store("Calib", "GasComposition", fGasComposition, &metaData, 0, kFALSE); | |
716 | if ( !storeOK ) result=1; | |
717 | ||
718 | } | |
719 | ||
720 | return result; | |
721 | ||
722 | } | |
723 | ||
7b54c8e9 | 724 | |
a7dce0bc | 725 | //______________________________________________________________________________________________ |
7b54c8e9 | 726 | |
727 | UInt_t AliTPCPreprocessor::ExtractPedestals(Int_t sourceFXS) | |
a7dce0bc | 728 | { |
729 | // | |
730 | // Read pedestal file from file exchage server | |
731 | // Keep original entry from OCDB in case no new pedestals are available | |
732 | // | |
ccf58a39 | 733 | AliTPCCalPad *calPadPedOCDB=0; |
a7dce0bc | 734 | AliCDBEntry* entry = GetFromOCDB("Calib", "Pedestals"); |
ccf58a39 | 735 | if (entry) calPadPedOCDB = (AliTPCCalPad*)entry->GetObject(); |
736 | if ( calPadPedOCDB==NULL ) { | |
a7dce0bc | 737 | Log("AliTPCPreprocsessor: No previous TPC pedestal entry available.\n"); |
7b54c8e9 | 738 | } |
739 | ||
ccf58a39 | 740 | AliTPCCalPad *calPadRMSOCDB=0; |
d63b9ad7 | 741 | entry = GetFromOCDB("Calib", "PadNoise"); |
ccf58a39 | 742 | if (entry) calPadRMSOCDB = (AliTPCCalPad*)entry->GetObject(); |
743 | if ( calPadRMSOCDB==NULL ) { | |
7b54c8e9 | 744 | Log("AliTPCPreprocsessor: No previous TPC noise entry available.\n"); |
a7dce0bc | 745 | } |
746 | ||
ccf58a39 | 747 | AliTPCCalPad* calPadPed = new AliTPCCalPad("PedestalsMean","PedestalsMean"); |
748 | AliTPCCalPad* calPadRMS = new AliTPCCalPad("PedestalsRMS","PedestalsRMS"); | |
749 | ||
7b54c8e9 | 750 | |
a7dce0bc | 751 | UInt_t result=0; |
752 | ||
753 | Int_t nSectors = fROC->GetNSectors(); | |
ccf58a39 | 754 | TVectorD foundSectorsPed(nSectors); |
755 | foundSectorsPed=0; | |
756 | TVectorD foundSectorsRMS(nSectors); | |
757 | foundSectorsRMS=0; | |
758 | ||
7b54c8e9 | 759 | TList* list = GetFileSources(sourceFXS,"pedestals"); |
9f016d99 | 760 | |
761 | if (list && list->GetEntries()>0) { | |
a7dce0bc | 762 | |
763 | // loop through all files from LDCs | |
764 | ||
bdffc5fb | 765 | Bool_t changed=false; |
a7dce0bc | 766 | UInt_t index = 0; |
767 | while (list->At(index)!=NULL) { | |
768 | TObjString* fileNameEntry = (TObjString*) list->At(index); | |
769 | if (fileNameEntry!=NULL) { | |
7b54c8e9 | 770 | TString fileName = GetFile(sourceFXS, "pedestals", |
a7dce0bc | 771 | fileNameEntry->GetString().Data()); |
772 | TFile *f = TFile::Open(fileName); | |
9f016d99 | 773 | if (!f) { |
774 | Log ("Error opening pedestal file."); | |
775 | result =2; | |
776 | break; | |
777 | } | |
a7dce0bc | 778 | AliTPCCalibPedestal *calPed; |
e73181c9 | 779 | f->GetObject("tpcCalibPedestal",calPed); |
67a165ed | 780 | if ( !calPed ) { |
781 | Log ("No pedestal calibration object in file."); | |
782 | result = 2; | |
783 | break; | |
784 | } | |
a7dce0bc | 785 | |
786 | // replace entries for the sectors available in the present file | |
787 | ||
bdffc5fb | 788 | changed=true; |
c9c23d80 | 789 | for (Int_t sector=0; sector<nSectors; sector++) { |
7b54c8e9 | 790 | AliTPCCalROC *rocPed=calPed->GetCalRocPedestal(sector, kFALSE); |
ccf58a39 | 791 | if ( rocPed ) { |
792 | AliTPCCalROC* roc=calPadPed->GetCalROC(sector); | |
793 | roc->Add(rocPed,1); | |
794 | foundSectorsPed[sector]++; | |
795 | } | |
7b54c8e9 | 796 | AliTPCCalROC *rocRMS=calPed->GetCalRocRMS(sector, kFALSE); |
ccf58a39 | 797 | if ( rocRMS ) { |
798 | AliTPCCalROC* roc=calPadRMS->GetCalROC(sector); | |
799 | roc->Add(rocRMS,1); | |
800 | foundSectorsRMS[sector]++; | |
801 | } | |
a7dce0bc | 802 | } |
a480de15 | 803 | delete calPed; |
342d3b42 | 804 | f->Close(); |
a7dce0bc | 805 | } |
806 | ++index; | |
807 | } // while(list) | |
ccf58a39 | 808 | |
809 | // | |
810 | // Check if calibration is complete -- otherwise take from old OCDB entry | |
811 | ||
812 | // inner sectors | |
813 | for (Int_t sector=0; sector<nSectors/2; sector++) { | |
814 | if (foundSectorsPed[sector] < 1 ) { | |
f3652e39 | 815 | if (calPadPedOCDB) { |
816 | AliTPCCalROC *rocOCDB=calPadPedOCDB->GetCalROC(sector); | |
817 | calPadPed->SetCalROC(rocOCDB,sector); | |
818 | } else { | |
819 | const int mess_length=100; | |
820 | char message[mess_length]; | |
821 | snprintf(message,mess_length,"Missing pedestals for sector %d - also not available from previous OCDB entry.\n", | |
822 | sector); | |
823 | Log (message); | |
824 | result = 2; | |
825 | } | |
ccf58a39 | 826 | } |
827 | if (foundSectorsRMS[sector] < 1 ) { | |
f3652e39 | 828 | if (calPadRMSOCDB) { |
829 | AliTPCCalROC *rocOCDB=calPadRMSOCDB->GetCalROC(sector); | |
830 | calPadRMS->SetCalROC(rocOCDB,sector); | |
831 | } else { | |
832 | const int mess_length=100; | |
833 | char message[mess_length]; | |
834 | snprintf(message,mess_length,"Missing pedestal RMS for sector %d - also not available from previous OCDB entry.\n", | |
835 | sector); | |
836 | Log (message); | |
837 | result = 2; | |
838 | } | |
ccf58a39 | 839 | } |
840 | } | |
f3652e39 | 841 | |
ccf58a39 | 842 | // outer sectors -- two updates needed |
f3652e39 | 843 | |
ccf58a39 | 844 | for (Int_t sector=nSectors/2; sector<nSectors; sector++) { |
845 | if (foundSectorsPed[sector] < 2 ) { | |
f3652e39 | 846 | if (calPadPedOCDB) { |
847 | AliTPCCalROC *rocOCDB=calPadPedOCDB->GetCalROC(sector); | |
848 | calPadPed->SetCalROC(rocOCDB,sector); | |
849 | } else { | |
850 | const int mess_length=100; | |
851 | char message[mess_length]; | |
852 | snprintf(message,mess_length,"Missing pedestals for sector %d - also not available from previous OCDB entry.\n", | |
853 | sector); | |
854 | Log (message); | |
855 | result = 2; | |
856 | } | |
857 | ||
ccf58a39 | 858 | } |
859 | if (foundSectorsRMS[sector] < 2 ) { | |
f3652e39 | 860 | if (calPadRMSOCDB) { |
861 | AliTPCCalROC *rocOCDB=calPadRMSOCDB->GetCalROC(sector); | |
862 | calPadRMS->SetCalROC(rocOCDB,sector); | |
863 | } else { | |
864 | const int mess_length=100; | |
865 | char message[mess_length]; | |
866 | snprintf(message,mess_length,"Missing pedestal RMS for sector %d - also not available from previous OCDB entry.\n", | |
867 | sector); | |
868 | Log (message); | |
869 | result = 2; | |
870 | } | |
871 | ||
ccf58a39 | 872 | } |
873 | } | |
874 | ||
875 | ||
a7dce0bc | 876 | // |
877 | // Store updated pedestal entry to OCDB | |
878 | // | |
bdffc5fb | 879 | if (changed) { |
880 | AliCDBMetaData metaData; | |
881 | metaData.SetBeamPeriod(0); | |
882 | metaData.SetResponsible("Haavard Helstrup"); | |
0492edf5 | 883 | metaData.SetAliRootVersion(ALIROOT_BRANCH); |
bdffc5fb | 884 | metaData.SetComment("Preprocessor AliTPC data base entries."); |
885 | ||
886 | Bool_t storeOK = Store("Calib", "Pedestals", calPadPed, &metaData, 0, kTRUE); | |
887 | if ( !storeOK ) ++result; | |
888 | storeOK = Store("Calib", "PadNoise", calPadRMS, &metaData, 0, kTRUE); | |
889 | if ( !storeOK ) ++result; | |
890 | } | |
9f016d99 | 891 | } else { |
cf4216a3 | 892 | Log ("Error: no entries in pedestal file list!"); |
9f016d99 | 893 | result = 1; |
7b54c8e9 | 894 | } |
a7dce0bc | 895 | |
795dbd3b | 896 | delete calPadPed; |
897 | delete calPadRMS; | |
ccf58a39 | 898 | delete calPadPedOCDB; |
899 | delete calPadRMSOCDB; | |
795dbd3b | 900 | |
a7dce0bc | 901 | return result; |
902 | } | |
7b54c8e9 | 903 | |
904 | //______________________________________________________________________________________________ | |
905 | ||
906 | ||
9f016d99 | 907 | UInt_t AliTPCPreprocessor::ExtractPulser(Int_t sourceFXS) |
908 | { | |
909 | // | |
910 | // Read pulser calibration file from file exchage server | |
911 | // Keep original entry from OCDB in case no new pulser calibration is available | |
912 | // | |
ccf58a39 | 913 | |
914 | TObjArray *pulserObjects = new TObjArray; | |
915 | TObjArray *pulserObjectsOCDB=0; | |
916 | ||
9f016d99 | 917 | AliCDBEntry* entry = GetFromOCDB("Calib", "Pulser"); |
ccf58a39 | 918 | if (entry) pulserObjectsOCDB = (TObjArray*)entry->GetObject(); |
919 | if ( pulserObjectsOCDB==NULL ) { | |
9f016d99 | 920 | Log("AliTPCPreprocsessor: No previous TPC pulser entry available.\n"); |
9f016d99 | 921 | } |
922 | ||
ccf58a39 | 923 | AliTPCCalPad *pulserTmean = new AliTPCCalPad("PulserTmean","PulserTmean"); |
924 | pulserObjects->Add(pulserTmean); | |
925 | ||
926 | AliTPCCalPad *pulserTrms = new AliTPCCalPad("PulserTrms","PulserTrms"); | |
927 | pulserObjects->Add(pulserTrms); | |
928 | ||
929 | AliTPCCalPad *pulserQmean = new AliTPCCalPad("PulserQmean","PulserQmean"); | |
930 | pulserObjects->Add(pulserQmean); | |
931 | ||
9f016d99 | 932 | |
933 | ||
934 | UInt_t result=0; | |
935 | ||
936 | Int_t nSectors = fROC->GetNSectors(); | |
ccf58a39 | 937 | TVectorD foundTmean(nSectors); |
938 | foundTmean=0; | |
939 | TVectorD foundTrms(nSectors); | |
940 | foundTrms=0; | |
941 | TVectorD foundQmean(nSectors); | |
942 | foundQmean=0; | |
943 | ||
944 | ||
9f016d99 | 945 | TList* list = GetFileSources(sourceFXS,"pulser"); |
946 | ||
947 | if (list && list->GetEntries()>0) { | |
948 | ||
949 | // loop through all files from LDCs | |
950 | ||
bdffc5fb | 951 | Bool_t changed=false; |
9f016d99 | 952 | UInt_t index = 0; |
953 | while (list->At(index)!=NULL) { | |
954 | TObjString* fileNameEntry = (TObjString*) list->At(index); | |
955 | if (fileNameEntry!=NULL) { | |
956 | TString fileName = GetFile(sourceFXS, "pulser", | |
957 | fileNameEntry->GetString().Data()); | |
958 | TFile *f = TFile::Open(fileName); | |
959 | if (!f) { | |
960 | Log ("Error opening pulser file."); | |
961 | result =2; | |
962 | break; | |
963 | } | |
964 | AliTPCCalibPulser *calPulser; | |
e73181c9 | 965 | f->GetObject("tpcCalibPulser",calPulser); |
67a165ed | 966 | if ( !calPulser ) { |
967 | Log ("No pulser calibration object in file."); | |
968 | result = 2; | |
969 | break; | |
970 | } | |
9f016d99 | 971 | |
972 | // replace entries for the sectors available in the present file | |
973 | ||
bdffc5fb | 974 | changed=true; |
9f016d99 | 975 | for (Int_t sector=0; sector<nSectors; sector++) { |
976 | AliTPCCalROC *rocTmean=calPulser->GetCalRocT0(sector); | |
ccf58a39 | 977 | if ( rocTmean ) { |
978 | AliTPCCalROC* roc=pulserTmean->GetCalROC(sector); | |
979 | roc->Add(rocTmean,1); | |
980 | foundTmean[sector]++; | |
981 | } | |
9f016d99 | 982 | AliTPCCalROC *rocTrms=calPulser->GetCalRocRMS(sector); |
ccf58a39 | 983 | if ( rocTrms ) { |
984 | AliTPCCalROC* roc=pulserTrms->GetCalROC(sector); | |
985 | roc->Add(rocTrms,1); | |
986 | foundTrms[sector]++; | |
987 | } | |
9f016d99 | 988 | AliTPCCalROC *rocQmean=calPulser->GetCalRocQ(sector); |
ccf58a39 | 989 | if ( rocQmean ) { |
990 | AliTPCCalROC* roc=pulserQmean->GetCalROC(sector); | |
991 | roc->Add(rocQmean,1); | |
992 | foundQmean[sector]++; | |
993 | } | |
9f016d99 | 994 | } |
a480de15 | 995 | delete calPulser; |
342d3b42 | 996 | f->Close(); |
9f016d99 | 997 | } |
998 | ++index; | |
999 | } // while(list) | |
ccf58a39 | 1000 | |
1001 | ||
1002 | ||
1003 | ||
1004 | if (pulserObjectsOCDB) { | |
1005 | AliTPCCalPad* pulserTmeanOCDB = (AliTPCCalPad*)pulserObjectsOCDB->FindObject("PulserTmean"); | |
1006 | AliTPCCalPad* pulserTrmsOCDB = (AliTPCCalPad*)pulserObjectsOCDB->FindObject("PulserTrms"); | |
1007 | AliTPCCalPad* pulserQmeanOCDB = (AliTPCCalPad*)pulserObjectsOCDB->FindObject("PulserQmean"); | |
1008 | ||
1009 | // | |
1010 | // Check if calibration is complete -- otherwise take from old OCDB entry | |
1011 | ||
1012 | // inner sectors | |
1013 | for (Int_t sector=0; sector<nSectors/2; sector++) { | |
1014 | if (foundTmean[sector] < 1 ) { | |
1015 | if (pulserTmeanOCDB) { | |
1016 | AliTPCCalROC* rocOCDB = pulserTmeanOCDB->GetCalROC(sector); | |
1017 | if ( rocOCDB ) pulserTmean->SetCalROC(rocOCDB,sector); | |
1018 | } | |
1019 | } | |
1020 | if (foundTrms[sector] < 1 ) { | |
1021 | if (pulserTrmsOCDB) { | |
1022 | AliTPCCalROC* rocOCDB = pulserTrmsOCDB->GetCalROC(sector); | |
1023 | if ( rocOCDB ) pulserTrms->SetCalROC(rocOCDB,sector); | |
1024 | } | |
1025 | } | |
1026 | if (foundQmean[sector] < 1 ) { | |
1027 | if (pulserQmeanOCDB) { | |
1028 | AliTPCCalROC* rocOCDB = pulserQmeanOCDB->GetCalROC(sector); | |
1029 | if ( rocOCDB ) pulserQmean->SetCalROC(rocOCDB,sector); | |
1030 | } | |
1031 | } | |
1032 | } | |
1033 | ||
1034 | // outer sectors -- two updates needed | |
1035 | ||
1036 | for (Int_t sector=0; sector<nSectors/2; sector++) { | |
1037 | if (foundTmean[sector] < 2 ) { | |
1038 | if (pulserTmeanOCDB) { | |
1039 | AliTPCCalROC* rocOCDB = pulserTmeanOCDB->GetCalROC(sector); | |
1040 | if ( rocOCDB ) pulserTmean->SetCalROC(rocOCDB,sector); | |
1041 | } | |
1042 | } | |
1043 | if (foundTrms[sector] < 2 ) { | |
1044 | if (pulserTrmsOCDB) { | |
1045 | AliTPCCalROC* rocOCDB = pulserTrmsOCDB->GetCalROC(sector); | |
1046 | if ( rocOCDB ) pulserTrms->SetCalROC(rocOCDB,sector); | |
1047 | } | |
1048 | } | |
1049 | if (foundQmean[sector] < 2 ) { | |
1050 | if (pulserQmeanOCDB) { | |
1051 | AliTPCCalROC* rocOCDB = pulserQmeanOCDB->GetCalROC(sector); | |
1052 | if ( rocOCDB ) pulserQmean->SetCalROC(rocOCDB,sector); | |
1053 | } | |
1054 | } | |
1055 | ||
1056 | } | |
1057 | } | |
1058 | ||
9f016d99 | 1059 | // |
1060 | // Store updated pedestal entry to OCDB | |
1061 | // | |
bdffc5fb | 1062 | if (changed) { |
1063 | AliCDBMetaData metaData; | |
1064 | metaData.SetBeamPeriod(0); | |
1065 | metaData.SetResponsible("Haavard Helstrup"); | |
0492edf5 | 1066 | metaData.SetAliRootVersion(ALIROOT_BRANCH); |
bdffc5fb | 1067 | metaData.SetComment("Preprocessor AliTPC data base entries."); |
1068 | ||
1069 | Bool_t storeOK = Store("Calib", "Pulser", pulserObjects, &metaData, 0, kTRUE); | |
1070 | if ( !storeOK ) ++result; | |
1071 | } | |
9f016d99 | 1072 | } else { |
cf4216a3 | 1073 | Log ("Error: no entries in pulser file list!"); |
9f016d99 | 1074 | result = 1; |
1075 | } | |
795dbd3b | 1076 | pulserObjects->Delete(); |
1077 | delete pulserObjects; | |
f3652e39 | 1078 | if (pulserObjectsOCDB) pulserObjectsOCDB->Delete(); |
ccf58a39 | 1079 | delete pulserObjectsOCDB; |
9f016d99 | 1080 | |
1081 | return result; | |
1082 | } | |
1083 | ||
70f224dd | 1084 | //______________________________________________________________________________________________ |
1085 | ||
1086 | ||
1087 | UInt_t AliTPCPreprocessor::ExtractRaw(Int_t sourceFXS) | |
1088 | { | |
1089 | // | |
1090 | // Read Raw calibration file from file exchage server | |
1091 | // | |
1092 | ||
1093 | UInt_t result=0; | |
90581ff1 | 1094 | TObjArray* rawArray = new TObjArray; |
70f224dd | 1095 | |
9b1478f9 | 1096 | TList* list = GetFileSources(sourceFXS,"tpcCalibRaw"); |
70f224dd | 1097 | |
1098 | if (list && list->GetEntries()>0) { | |
1099 | ||
1100 | // loop through all files | |
1101 | ||
1102 | UInt_t index = 0; | |
1103 | while (list->At(index)!=NULL) { | |
1104 | TObjString* fileNameEntry = (TObjString*) list->At(index); | |
1105 | if (fileNameEntry!=NULL) { | |
1106 | TString fileName = GetFile(sourceFXS, "tpcCalibRaw", | |
1107 | fileNameEntry->GetString().Data()); | |
1108 | TFile *f = TFile::Open(fileName); | |
1109 | if (!f) { | |
1110 | Log ("Error opening raw file."); | |
1111 | result =2; | |
1112 | break; | |
1113 | } | |
90581ff1 | 1114 | AliTPCCalibRaw *calRaw; |
70f224dd | 1115 | f->GetObject("tpcCalibRaw",calRaw); |
1116 | if ( !calRaw ) { | |
1117 | Log ("No raw calibration object in file."); | |
1118 | result = 2; | |
1119 | break; | |
1120 | } | |
90581ff1 | 1121 | rawArray->Add(calRaw); |
70f224dd | 1122 | f->Close(); |
1123 | } | |
1124 | ++index; | |
1125 | } // while(list) | |
1126 | // | |
1127 | // Store updated pedestal entry to OCDB | |
1128 | // | |
1129 | AliCDBMetaData metaData; | |
1130 | metaData.SetBeamPeriod(0); | |
1131 | metaData.SetResponsible("Haavard Helstrup"); | |
0492edf5 | 1132 | metaData.SetAliRootVersion(ALIROOT_BRANCH); |
70f224dd | 1133 | metaData.SetComment("Preprocessor AliTPC data base entries."); |
1134 | ||
90581ff1 | 1135 | Bool_t storeOK = Store("Calib", "Raw", rawArray, &metaData, 0, kTRUE); |
70f224dd | 1136 | if ( !storeOK ) ++result; |
1137 | } else { | |
cf4216a3 | 1138 | Log ("Error: no entries in raw file list!"); |
70f224dd | 1139 | result = 1; |
1140 | } | |
795dbd3b | 1141 | |
1142 | rawArray->Delete(); | |
1143 | delete rawArray; | |
70f224dd | 1144 | |
1145 | return result; | |
1146 | } | |
1147 | //______________________________________________________________________________________________ | |
1148 | ||
9f016d99 | 1149 | UInt_t AliTPCPreprocessor::ExtractCE(Int_t sourceFXS) |
1150 | { | |
1151 | // | |
1152 | // Read Central Electrode file from file exchage server | |
9f016d99 | 1153 | // |
e2d642a2 | 1154 | // |
1155 | AliTPCCalPad *ceTmean=0; | |
1156 | AliTPCCalPad *ceTrms=0; | |
1157 | AliTPCCalPad *ceQmean=0; | |
1158 | TObjArray *rocTtime=0; | |
1159 | TObjArray *rocQtime=0; | |
1160 | ||
1161 | TObjArray *ceObjects= new TObjArray; | |
1162 | ||
1163 | ||
1164 | Int_t nSectors = fROC->GetNSectors(); | |
1165 | ||
1166 | ceTmean = new AliTPCCalPad("CETmean","CETmean"); | |
1167 | ceObjects->Add(ceTmean); | |
1168 | ||
1169 | ceTrms = new AliTPCCalPad("CETrms","CETrms"); | |
1170 | ceObjects->Add(ceTrms); | |
1171 | ||
1172 | ceQmean = new AliTPCCalPad("CEQmean","CEQmean"); | |
1173 | ceObjects->Add(ceQmean); | |
1174 | ||
1175 | rocTtime = new TObjArray(nSectors+2); // also make room for A and C side average | |
1176 | rocTtime->SetName("rocTtime"); | |
1177 | ceObjects->Add(rocTtime); | |
1178 | ||
1179 | rocQtime = new TObjArray(nSectors); | |
1180 | rocQtime->SetName("rocQtime"); | |
1181 | ceObjects->Add(rocQtime); | |
1182 | ||
1183 | //=== new part | |
1184 | TObjArray *arrFitGraphs=new TObjArray; | |
1185 | arrFitGraphs->SetName("ceFitsDrift"); | |
1186 | ceObjects->Add(arrFitGraphs); | |
70f224dd | 1187 | |
09a746c5 | 1188 | // Temperature maps |
e2d642a2 | 1189 | |
1190 | if (fTemp) { | |
df8595b9 | 1191 | AliTPCSensorTempArray *tempMap = new AliTPCSensorTempArray(*fTemp); |
1192 | tempMap->SetNameTitle("TempMap","TempMap"); | |
1193 | ceObjects->Add(tempMap); | |
e2d642a2 | 1194 | } |
1195 | ||
09a746c5 | 1196 | // Pressure maps |
e2d642a2 | 1197 | |
1198 | if (fPressure) { | |
1199 | AliDCSSensor *sensor=0, *sensorCopy=0; | |
1200 | for (Int_t isensor=0; isensor<kNumPressureSensors; ++isensor ) { | |
09a746c5 | 1201 | sensor = fPressure->GetSensor(kPressureSensorNames[isensor]); |
b5886f0f | 1202 | if (sensor) { |
e2d642a2 | 1203 | sensorCopy = new AliDCSSensor(*sensor); |
1204 | sensorCopy->SetNameTitle(kPressureSensorNames[isensor],kPressureSensorNames[isensor]); | |
1205 | ceObjects->Add(sensorCopy); | |
b5886f0f | 1206 | } |
e2d642a2 | 1207 | } |
1208 | } | |
1209 | ||
1210 | UInt_t result=0; | |
1211 | ||
1212 | TList* list = GetFileSources(sourceFXS,"CE"); | |
1213 | ||
1214 | if (list && list->GetEntries()>0) { | |
1215 | ||
9f016d99 | 1216 | // loop through all files from LDCs |
e2d642a2 | 1217 | |
9f016d99 | 1218 | UInt_t index = 0; |
1219 | while (list->At(index)!=NULL) { | |
e2d642a2 | 1220 | TObjString* fileNameEntry = (TObjString*) list->At(index); |
1221 | if (fileNameEntry!=NULL) { | |
9f016d99 | 1222 | TString fileName = GetFile(sourceFXS, "CE", |
e2d642a2 | 1223 | fileNameEntry->GetString().Data()); |
6d3584e9 | 1224 | AliTPCCalibCE *calCE=AliTPCCalibCE::ReadFromFile(fileName.Data()); |
e2d642a2 | 1225 | |
7c2575c4 | 1226 | if (!calCE) { |
e2d642a2 | 1227 | Log ("No valid calibCE object."); |
1228 | result=2; | |
1229 | break; | |
1230 | } | |
9f016d99 | 1231 | // replace entries for the sectors available in the present file |
e2d642a2 | 1232 | |
9f016d99 | 1233 | for (Int_t sector=0; sector<nSectors; sector++) { |
e2d642a2 | 1234 | AliTPCCalROC *rocTmean=calCE->GetCalRocT0(sector); |
1235 | if ( rocTmean ) ceTmean->SetCalROC(rocTmean,sector); | |
1236 | AliTPCCalROC *rocTrms=calCE->GetCalRocRMS(sector); | |
1237 | if ( rocTrms ) ceTrms->SetCalROC(rocTrms,sector); | |
1238 | AliTPCCalROC *rocQmean=calCE->GetCalRocQ(sector); | |
1239 | if ( rocQmean ) ceQmean->SetCalROC(rocQmean,sector); | |
1240 | TGraph *grT=calCE->MakeGraphTimeCE(sector,0,2); // T time graph | |
1241 | if ( grT ) rocTtime->AddAt(grT,sector); | |
1242 | TGraph *grQ=calCE->MakeGraphTimeCE(sector,0,3); // Q time graph | |
1243 | if ( grQ ) rocQtime->AddAt(grQ,sector); | |
9f016d99 | 1244 | } |
e2d642a2 | 1245 | |
1246 | TGraph *grT=calCE->MakeGraphTimeCE(-1,0,2); // A side average | |
1247 | if ( grT ) { | |
1248 | rocTtime->AddAt(grT,nSectors); | |
1249 | } else { | |
31c50f68 | 1250 | result=10; |
e2d642a2 | 1251 | } |
1252 | grT=calCE->MakeGraphTimeCE(-2,0,2); // C side average | |
1253 | if ( grT ) { | |
1254 | rocTtime->AddAt(grT,nSectors+1); | |
1255 | } else { | |
31c50f68 | 1256 | result=10; |
e2d642a2 | 1257 | } |
1fc96a8a | 1258 | |
e2d642a2 | 1259 | delete calCE; |
9f016d99 | 1260 | } |
e2d642a2 | 1261 | ++index; |
9f016d99 | 1262 | } // while(list) |
1fc96a8a | 1263 | // |
1264 | // Check number of calibrated sectors per side | |
1265 | // | |
1266 | Int_t aside=0, cside=0; | |
1267 | for (Int_t ind=0; ind<nSectors/4; ind++ ) { | |
1268 | TGraph *grT=(TGraph*)rocTtime->At(ind); | |
1269 | if (grT) aside++; | |
1270 | grT=(TGraph*)rocTtime->At(ind+nSectors/2); | |
1271 | if (grT) aside++; | |
1272 | grT=(TGraph*)rocTtime->At(ind+nSectors/4); | |
1273 | if (grT) cside++; | |
1274 | grT=(TGraph*)rocTtime->At(ind+3*nSectors/4); | |
1275 | if (grT) cside++; | |
1276 | } | |
f085dc93 | 1277 | if ( (aside<kMinCESectors) && (cside<kMinCESectors) ) { |
1278 | Log (Form("ExtractCE: Too few fitted sectors: Aside =%d, Cside=%d\n", | |
1279 | aside, cside)) ; | |
1280 | result=10; | |
1281 | } | |
e2d642a2 | 1282 | |
1283 | // | |
1284 | //=== New CE part | |
1285 | // if it is validated this part needs to be modified again | |
1286 | // currently its only processed if there is a valid standard CE object | |
1287 | // | |
1288 | list = GetFileSources(sourceFXS,"CEnew"); | |
1289 | ||
1290 | if (result==0 && list && list->GetEntries()>0) { | |
1291 | ||
1292 | // loop through all files from LDCs | |
1293 | ||
1294 | UInt_t index2 = 0; | |
1295 | while (list->At(index2)!=NULL) { | |
1296 | TObjString* fileNameEntry = (TObjString*) list->At(index2); | |
1297 | if (fileNameEntry!=NULL) { | |
1298 | TString fileName = GetFile(sourceFXS, "CEnew", | |
1299 | fileNameEntry->GetString().Data()); | |
82bf5037 | 1300 | AliTPCCalibCE *calCE=AliTPCCalibCE::ReadFromFile(fileName.Data()); |
e2d642a2 | 1301 | |
1302 | if (!calCE) { | |
1303 | Log ("No valid new calibCE object."); | |
1304 | // result=2; | |
1305 | break; | |
1306 | } | |
1307 | ||
1308 | TIter nextObj(calCE->GetArrFitGraphs()); | |
1309 | TObject *obj=0x0; | |
1310 | while ( (obj=nextObj()) ){ | |
1311 | arrFitGraphs->Add(obj->Clone()); | |
1312 | } | |
1313 | delete calCE; | |
e2d642a2 | 1314 | } |
1315 | ++index2; | |
1316 | } | |
1317 | } | |
1318 | ||
9f016d99 | 1319 | // |
1320 | // Store updated pedestal entry to OCDB | |
1321 | // | |
1322 | AliCDBMetaData metaData; | |
1323 | metaData.SetBeamPeriod(0); | |
1324 | metaData.SetResponsible("Haavard Helstrup"); | |
0492edf5 | 1325 | metaData.SetAliRootVersion(ALIROOT_BRANCH); |
9f016d99 | 1326 | metaData.SetComment("Preprocessor AliTPC data base entries."); |
e2d642a2 | 1327 | |
31c50f68 | 1328 | if ( result == 0 ) { |
e2d642a2 | 1329 | Bool_t storeOK = Store("Calib", "CE", ceObjects, &metaData, 0, kTRUE); |
1330 | if ( !storeOK ) ++result; | |
31c50f68 | 1331 | } else { |
e2d642a2 | 1332 | Log ("Warning: Average time graphs not available - no OCDB entry written"); |
1333 | } | |
9f016d99 | 1334 | } else { |
cf4216a3 | 1335 | Log ("Error: no CE entries available from FXS!"); |
9f016d99 | 1336 | result = 1; |
1337 | } | |
e2d642a2 | 1338 | |
795dbd3b | 1339 | ceObjects->Delete(); |
1340 | delete ceObjects; | |
1341 | ||
9f016d99 | 1342 | return result; |
1343 | } | |
dca91b3f | 1344 | //______________________________________________________________________________________________ |
1345 | ||
1346 | UInt_t AliTPCPreprocessor::ExtractQA(Int_t sourceFXS) | |
1347 | { | |
1348 | // | |
1349 | // Read Quality Assurance file from file exchage server | |
1350 | // | |
1351 | ||
1352 | UInt_t result=0; | |
1353 | ||
1354 | TList* list = GetFileSources(sourceFXS,"QA"); | |
1355 | ||
1356 | if (list && list->GetEntries()>0) { | |
1357 | ||
ccf58a39 | 1358 | // only one QA object should be available! |
dca91b3f | 1359 | |
1360 | AliTPCdataQA *calQA; | |
1361 | ||
1362 | UInt_t nentries = list->GetEntries(); | |
1363 | UInt_t index=0; | |
1364 | if ( nentries > 1) Log ( "More than one QA entry. First one processed"); | |
1365 | TObjString* fileNameEntry = (TObjString*) list->At(index); | |
1366 | if (fileNameEntry!=NULL) { | |
1367 | TString fileName = GetFile(sourceFXS, "QA", | |
1368 | fileNameEntry->GetString().Data()); | |
1369 | TFile *f = TFile::Open(fileName); | |
1370 | if (!f) { | |
1371 | Log ("Error opening QA file."); | |
a2465b54 | 1372 | result =2; |
1373 | } else { | |
1374 | f->GetObject("tpcCalibQA",calQA); | |
7c2575c4 | 1375 | if ( calQA ) { |
dca91b3f | 1376 | // |
1377 | // Store updated pedestal entry to OCDB | |
1378 | // | |
7c2575c4 | 1379 | AliCDBMetaData metaData; |
1380 | metaData.SetBeamPeriod(0); | |
1381 | metaData.SetResponsible("Haavard Helstrup"); | |
0492edf5 | 1382 | metaData.SetAliRootVersion(ALIROOT_BRANCH); |
7c2575c4 | 1383 | metaData.SetComment("Preprocessor AliTPC data base entries."); |
1384 | ||
cf4216a3 | 1385 | Bool_t storeOK = Store("Calib", "QA", calQA, &metaData, 0, kFALSE); |
7c2575c4 | 1386 | if ( !storeOK ) ++result; |
795dbd3b | 1387 | |
1388 | delete calQA; | |
7c2575c4 | 1389 | } |
a2465b54 | 1390 | } |
1391 | } else { | |
1392 | Log ("Error: no QA files on FXS!"); | |
1393 | result = 2; | |
1394 | } | |
dca91b3f | 1395 | } else { |
a2465b54 | 1396 | Log ("Error: no QA entries in FXS list!"); |
dca91b3f | 1397 | result = 1; |
1398 | } | |
dca91b3f | 1399 | return result; |
1400 | } | |
1401 | ||
9054511b | 1402 | //______________________________________________________________________________________________ |
1403 | ||
1404 | ||
f6b5fa33 | 1405 | UInt_t AliTPCPreprocessor::ExtractAltro(Int_t sourceFXS, TMap* dcsMap) |
9054511b | 1406 | { |
1407 | // | |
f6b5fa33 | 1408 | // Read Altro configuration file from file exchage server |
9054511b | 1409 | // Keep original entry from OCDB in case no new pulser calibration is available |
1410 | // | |
1411 | TObjArray *altroObjects=0; | |
1412 | AliTPCCalPad *acqStart=0; | |
1413 | AliTPCCalPad *zsThr=0; | |
1414 | AliTPCCalPad *acqStop=0; | |
1415 | AliTPCCalPad *FPED=0; | |
1416 | AliTPCCalPad *masked=0; | |
cf4216a3 | 1417 | AliTPCCalPad *k1=0, *k2=0, *k3=0; |
1418 | AliTPCCalPad *l1=0, *l2=0, *l3=0; | |
1419 | TMap *mapRCUconfig=0; | |
9054511b | 1420 | |
14ae505e | 1421 | AliCDBEntry* entry = GetFromOCDB("Calib", "AltroConfig"); |
9054511b | 1422 | if (entry) altroObjects = (TObjArray*)entry->GetObject(); |
1423 | if ( altroObjects==NULL ) { | |
1424 | Log("AliTPCPreprocsessor: No previous TPC altro calibration entry available.\n"); | |
1425 | altroObjects = new TObjArray; | |
1426 | } | |
1427 | ||
1428 | acqStart = (AliTPCCalPad*)altroObjects->FindObject("AcqStart"); | |
1429 | if ( !acqStart ) { | |
1430 | acqStart = new AliTPCCalPad("AcqStart","AcqStart"); | |
1431 | altroObjects->Add(acqStart); | |
1432 | } | |
1433 | zsThr = (AliTPCCalPad*)altroObjects->FindObject("ZsThr"); | |
1434 | if ( !zsThr ) { | |
1435 | zsThr = new AliTPCCalPad("ZsThr","ZsThr"); | |
1436 | altroObjects->Add(zsThr); | |
1437 | } | |
1438 | FPED = (AliTPCCalPad*)altroObjects->FindObject("FPED"); | |
1439 | if ( !FPED ) { | |
1440 | FPED = new AliTPCCalPad("FPED","FPED"); | |
1441 | altroObjects->Add(FPED); | |
1442 | } | |
1443 | acqStop = (AliTPCCalPad*)altroObjects->FindObject("AcqStop"); | |
1444 | if ( !acqStop ) { | |
1445 | acqStop = new AliTPCCalPad("AcqStop","AcqStop"); | |
1446 | altroObjects->Add(acqStop); | |
1447 | } | |
1448 | masked = (AliTPCCalPad*)altroObjects->FindObject("Masked"); | |
1449 | if ( !masked ) { | |
1450 | masked = new AliTPCCalPad("Masked","Masked"); | |
1451 | altroObjects->Add(masked); | |
1452 | } | |
cf4216a3 | 1453 | k1 = (AliTPCCalPad*)altroObjects->FindObject("K1"); |
1454 | if ( !k1 ) { | |
1455 | k1 = new AliTPCCalPad("K1","K1"); | |
1456 | altroObjects->Add(k1); | |
1457 | } | |
1458 | k2 = (AliTPCCalPad*)altroObjects->FindObject("K2"); | |
1459 | if ( !k2 ) { | |
1460 | k2 = new AliTPCCalPad("K2","K2"); | |
1461 | altroObjects->Add(k2); | |
1462 | } | |
1463 | k3 = (AliTPCCalPad*)altroObjects->FindObject("K3"); | |
1464 | if ( !k3 ) { | |
1465 | k3 = new AliTPCCalPad("K3","K3"); | |
1466 | altroObjects->Add(k3); | |
1467 | } | |
1468 | l1 = (AliTPCCalPad*)altroObjects->FindObject("L1"); | |
1469 | if ( !l1 ) { | |
1470 | l1 = new AliTPCCalPad("L1","L1"); | |
1471 | altroObjects->Add(l1); | |
1472 | } | |
1473 | l2 = (AliTPCCalPad*)altroObjects->FindObject("L2"); | |
1474 | if ( !l2 ) { | |
1475 | l2 = new AliTPCCalPad("L2","L2"); | |
1476 | altroObjects->Add(l2); | |
1477 | } | |
1478 | l3 = (AliTPCCalPad*)altroObjects->FindObject("L3"); | |
1479 | if ( !l3 ) { | |
1480 | l3 = new AliTPCCalPad("L3","L3"); | |
1481 | altroObjects->Add(l3); | |
1482 | } | |
1483 | mapRCUconfig = (TMap*)altroObjects->FindObject("RCUconfig"); | |
1484 | if (!mapRCUconfig) { | |
1485 | mapRCUconfig = new TMap(); | |
1486 | mapRCUconfig->SetName("RCUconfig"); | |
1487 | altroObjects->Add(mapRCUconfig); | |
1488 | } | |
9054511b | 1489 | |
1490 | ||
1491 | UInt_t result=0; | |
1492 | TString idFXS[2]={"AltroConfigA","AltroConfigC"}; | |
1493 | ||
1494 | Int_t nSectors = fROC->GetNSectors(); | |
1495 | Bool_t changed=false; | |
f6b5fa33 | 1496 | if (altroObjects == 0 ) altroObjects = new TObjArray; |
1497 | ||
1498 | // extract list of active DDLs | |
1499 | ||
f3652e39 | 1500 | if (dcsMap) { |
f6b5fa33 | 1501 | Bool_t found; |
1502 | TString arrDDL(kNumDDL); | |
2b00f997 | 1503 | arrDDL.Append('x',kNumDDL); |
f6b5fa33 | 1504 | for ( Int_t iDDL = 0; iDDL<kNumDDL; iDDL++ ) { |
1505 | TString stringID = Form (kAmandaDDL.Data(),iDDL+kFirstDDL); | |
1506 | TPair *pair = (TPair*)dcsMap->FindObject(stringID.Data()); | |
1507 | found = false; | |
1508 | if ( pair ) { | |
1509 | TObjArray *valueSet=(TObjArray*)pair->Value(); | |
1510 | if ( valueSet) { | |
1511 | AliDCSValue *val = (AliDCSValue*)valueSet->At(0); | |
2b00f997 | 1512 | if (val) { |
1513 | found = val->GetBool(); | |
1514 | if (found){ | |
1515 | arrDDL[iDDL] = '1'; | |
1516 | } else { | |
1517 | arrDDL[iDDL] = '0'; | |
1518 | } | |
1519 | } | |
f6b5fa33 | 1520 | } |
1521 | } | |
f6b5fa33 | 1522 | } |
1523 | TObjString *ddlArray = new TObjString; | |
1524 | ddlArray->SetString(arrDDL); | |
1525 | TMap *activeDDL = new TMap; | |
1526 | activeDDL->SetName("DDLArray"); | |
1527 | TObjString *key = new TObjString("DDLArray"); | |
1528 | activeDDL->Add(key,ddlArray); | |
1529 | altroObjects->Add(activeDDL); | |
1530 | changed=true; | |
f3652e39 | 1531 | } else { |
1532 | Log ("ExtractAltro: No DCS map available. Active DDL list cannot be obtained."); | |
1533 | result = 3; | |
1534 | } | |
f6b5fa33 | 1535 | |
1536 | // extract Altro configuration files | |
1537 | ||
9054511b | 1538 | for ( Int_t id=0; id<2; id++) { |
1539 | TList* list = GetFileSources(sourceFXS,idFXS[id].Data()); | |
1540 | ||
1541 | if (list && list->GetEntries()>0) { | |
9054511b | 1542 | |
1543 | // loop through all files from LDCs | |
1544 | ||
1545 | UInt_t index = 0; | |
1546 | while (list->At(index)!=NULL) { | |
1547 | TObjString* fileNameEntry = (TObjString*) list->At(index); | |
1548 | if (fileNameEntry!=NULL) { | |
1549 | TString fileName = GetFile(sourceFXS, idFXS[id].Data(), | |
1550 | fileNameEntry->GetString().Data()); | |
1551 | TFile *f = TFile::Open(fileName); | |
1552 | if (!f) { | |
ff7d4b88 | 1553 | const int mess_length=40; |
1554 | char message[mess_length]; | |
1555 | snprintf(message,mess_length,"Error opening Altro configuration file, id = %d",id); | |
9054511b | 1556 | Log (message); |
1557 | result =2; | |
1558 | break; | |
1559 | } | |
1560 | TObjArray *altroFXS; | |
1561 | f->GetObject("AltroConfig",altroFXS); | |
1562 | if ( !altroFXS ) { | |
1563 | Log ("No Altro configuration object in file."); | |
1564 | result = 2; | |
1565 | break; | |
1566 | } | |
1567 | ||
1568 | // replace entries for the sectors available in the present file | |
1569 | AliTPCCalPad *acqStartFXS=(AliTPCCalPad*)altroFXS->FindObject("AcqStart"); | |
1570 | AliTPCCalPad *zsThrFXS=(AliTPCCalPad*)altroFXS->FindObject("ZsThr"); | |
1571 | AliTPCCalPad *acqStopFXS=(AliTPCCalPad*)altroFXS->FindObject("AcqStop"); | |
1572 | AliTPCCalPad *FPEDFXS=(AliTPCCalPad*)altroFXS->FindObject("FPED"); | |
1573 | AliTPCCalPad *maskedFXS=(AliTPCCalPad*)altroFXS->FindObject("Masked"); | |
cf4216a3 | 1574 | AliTPCCalPad *k1FXS=(AliTPCCalPad*)altroFXS->FindObject("K1"); |
1575 | AliTPCCalPad *k2FXS=(AliTPCCalPad*)altroFXS->FindObject("K2"); | |
1576 | AliTPCCalPad *k3FXS=(AliTPCCalPad*)altroFXS->FindObject("K3"); | |
1577 | AliTPCCalPad *l1FXS=(AliTPCCalPad*)altroFXS->FindObject("L1"); | |
1578 | AliTPCCalPad *l2FXS=(AliTPCCalPad*)altroFXS->FindObject("L2"); | |
1579 | AliTPCCalPad *l3FXS=(AliTPCCalPad*)altroFXS->FindObject("L3"); | |
1580 | TMap *mapRCUconfigFXS = (TMap*)altroFXS->FindObject("RCUconfig"); | |
1581 | TIterator *mapFXSiter = mapRCUconfigFXS->MakeIterator(); | |
1582 | ||
9054511b | 1583 | changed=true; |
1584 | for (Int_t sector=0; sector<nSectors; sector++) { | |
1585 | ||
1586 | if (acqStartFXS) { | |
1587 | AliTPCCalROC *rocAcqStart=acqStartFXS->GetCalROC(sector); | |
1588 | if ( rocAcqStart ) acqStart->SetCalROC(rocAcqStart,sector); | |
1589 | } | |
1590 | if (zsThrFXS ) { | |
1591 | AliTPCCalROC *rocZsThr=zsThrFXS->GetCalROC(sector); | |
1592 | if ( rocZsThr ) zsThr->SetCalROC(rocZsThr,sector); | |
1593 | } | |
1594 | if (acqStopFXS) { | |
1595 | AliTPCCalROC *rocAcqStop=acqStopFXS->GetCalROC(sector); | |
1596 | if ( rocAcqStop ) acqStop->SetCalROC(rocAcqStop,sector); | |
1597 | } | |
1598 | if (FPEDFXS ) { | |
1599 | AliTPCCalROC *rocFPED=FPEDFXS->GetCalROC(sector); | |
2d47cfd4 | 1600 | if ( rocFPED ) FPED->SetCalROC(rocFPED,sector); |
9054511b | 1601 | } |
1602 | if (maskedFXS) { | |
1603 | AliTPCCalROC *rocMasked=maskedFXS->GetCalROC(sector); | |
1604 | if ( rocMasked ) masked->SetCalROC(rocMasked,sector); | |
1605 | } | |
cf4216a3 | 1606 | if (k1FXS) { |
1607 | AliTPCCalROC *rocK1=k1FXS->GetCalROC(sector); | |
1608 | if ( rocK1 ) k1->SetCalROC(rocK1,sector); | |
1609 | } | |
1610 | if (k2FXS) { | |
1611 | AliTPCCalROC *rocK2=k2FXS->GetCalROC(sector); | |
1612 | if ( rocK2 ) k2->SetCalROC(rocK2,sector); | |
1613 | } | |
1614 | if (k3FXS) { | |
1615 | AliTPCCalROC *rocK3=k3FXS->GetCalROC(sector); | |
1616 | if ( rocK3 ) k3->SetCalROC(rocK3,sector); | |
1617 | } | |
1618 | if (l1FXS) { | |
1619 | AliTPCCalROC *rocL1=l1FXS->GetCalROC(sector); | |
1620 | if ( rocL1 ) l1->SetCalROC(rocL1,sector); | |
1621 | } | |
1622 | if (l2FXS) { | |
1623 | AliTPCCalROC *rocL2=l2FXS->GetCalROC(sector); | |
1624 | if ( rocL2 ) l2->SetCalROC(rocL2,sector); | |
1625 | } | |
1626 | if (l3FXS) { | |
1627 | AliTPCCalROC *rocL3=l3FXS->GetCalROC(sector); | |
1628 | if ( rocL3 ) l3->SetCalROC(rocL3,sector); | |
1629 | } | |
1630 | } | |
1631 | if (mapRCUconfigFXS) { | |
1632 | Int_t mapEntries = mapRCUconfigFXS->GetEntries(); | |
1633 | TObjString* keyFXS; | |
1634 | TVectorF* vecFXS; | |
1635 | TVectorF* vec; // nSectors = 72 (total number of inner/outer sectors) | |
1636 | for (Int_t i=0; i<mapEntries; ++i) { | |
1637 | keyFXS=(TObjString*)mapFXSiter->Next(); | |
1638 | vecFXS=(TVectorF*)mapRCUconfigFXS->GetValue(keyFXS); | |
1639 | vec=(TVectorF*)mapRCUconfig->GetValue(keyFXS); | |
1640 | if (!vec) { | |
1641 | vec = new TVectorF(3*nSectors); | |
1642 | *vec = -1; | |
1643 | mapRCUconfig->Add(keyFXS,vec); | |
1644 | } | |
1645 | if (vec->GetNoElements() != 3*nSectors ) { | |
1646 | vec->ResizeTo(3*nSectors); | |
1647 | } | |
1648 | if (id==0) { // A side | |
1649 | vec->SetSub(0,vecFXS->GetSub(0,nSectors/2-1)); | |
1650 | vec->SetSub(nSectors,vecFXS->GetSub(nSectors,2*nSectors-1)); | |
1651 | } else { // C side | |
1652 | vec->SetSub(nSectors/2,vecFXS->GetSub(nSectors/2,nSectors-1)); | |
1653 | vec->SetSub(2*nSectors,vecFXS->GetSub(2*nSectors,3*nSectors-1)); | |
1654 | } | |
1655 | } | |
9054511b | 1656 | } |
1657 | delete altroFXS; | |
1658 | f->Close(); | |
1659 | } | |
1660 | ++index; | |
1661 | } // while(list) | |
1662 | } else { | |
cf4216a3 | 1663 | Log ("Error: no entries in AltroConfig file list!"); |
9054511b | 1664 | result = 1; |
1665 | } | |
1666 | ||
1667 | } // for - id | |
1668 | // | |
1669 | // Store updated pedestal entry to OCDB | |
1670 | // | |
1671 | if (changed) { | |
1672 | AliCDBMetaData metaData; | |
1673 | metaData.SetBeamPeriod(0); | |
1674 | metaData.SetResponsible("Haavard Helstrup"); | |
0492edf5 | 1675 | metaData.SetAliRootVersion(ALIROOT_BRANCH); |
9054511b | 1676 | metaData.SetComment("Preprocessor AliTPC data base entries."); |
1677 | ||
dbc10140 | 1678 | Bool_t storeOK = Store("Calib", "AltroConfig", altroObjects, &metaData, 0, kFALSE); |
9054511b | 1679 | if ( !storeOK ) ++result; |
1680 | } | |
1681 | ||
795dbd3b | 1682 | altroObjects->Delete(); |
1683 | delete altroObjects; | |
1684 | ||
9054511b | 1685 | return result; |
1686 | } |