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