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