]>
Commit | Line | Data |
---|---|---|
33c82fbf | 1 | /************************************************************************** |
3dedb44a | 2 | * Copyright(c) 1998-1999, 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 | ||
7ca4655f | 16 | /* $Id$ */ |
17 | ||
3dedb44a | 18 | //------------------------------------------------------------------------- |
19 | // Class AliGRPPreprocessor | |
20 | // Global Run Parameters (GRP) preprocessor | |
21 | // Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch | |
e7a6790f | 22 | // Modified: Ernesto.Lopez.Torres@cern.ch CEADEN-CERN |
3dedb44a | 23 | //------------------------------------------------------------------------- |
24 | ||
836d8b4f | 25 | #include <TChain.h> |
7ca4655f | 26 | #include <TList.h> |
27 | #include <TMap.h> | |
28 | #include <TObjString.h> | |
44e45fac | 29 | #include <TGraph.h> |
7ca4655f | 30 | |
3dedb44a | 31 | #include "AliGRPPreprocessor.h" |
44e45fac | 32 | #include "AliGRPObject.h" |
33 | #include "AliDCSSensor.h" | |
34 | #include "AliSplineFit.h" | |
17984b61 | 35 | #include "AliDCSSensorArray.h" |
3dedb44a | 36 | |
48b1b444 | 37 | #include "AliTriggerConfiguration.h" |
38 | #include "AliTriggerRunScalers.h" | |
39 | ||
3dedb44a | 40 | #include "AliCDBMetaData.h" |
41 | #include "AliLog.h" | |
42 | ||
3dedb44a | 43 | class AliDCSValue; |
44 | class AliShuttleInterface; | |
45 | ||
1e27bb6b | 46 | // needed for ReceivePromptRecoParameters |
39e3007b | 47 | |
1e27bb6b | 48 | #include <TSQLServer.h> |
49 | #include <TSQLResult.h> | |
50 | #include <TSQLRow.h> | |
51 | #include <AliCDBManager.h> | |
52 | #include <AliCDBMetaData.h> | |
53 | #include <AliCDBId.h> | |
54 | #include <AliTriggerConfiguration.h> | |
55 | ||
17984b61 | 56 | const Double_t kFitFraction = 0.7; // Fraction of DCS sensor fits required |
57 | ||
3dedb44a | 58 | ClassImp(AliGRPPreprocessor) |
59 | ||
17984b61 | 60 | //_______________________________________________________________ |
44e45fac | 61 | |
e7a6790f | 62 | const Int_t AliGRPPreprocessor::fgknDAQLbPar = 8; // num parameters in the logbook |
44e45fac | 63 | const Int_t AliGRPPreprocessor::fgknDCSDP = 50; // number of dcs dps |
39e3007b | 64 | const Int_t AliGRPPreprocessor::fgknDCSDPHallProbes = 40; // number of dcs dps |
e7a6790f | 65 | const char* AliGRPPreprocessor::fgkDCSDataPoints[AliGRPPreprocessor::fgknDCSDP] = { |
1676baf1 | 66 | "LHCState", // missing in DCS |
e7a6790f | 67 | "L3Polarity", |
68 | "DipolePolarity", | |
1676baf1 | 69 | "LHCLuminosity", // missing in DCS |
70 | "BeamIntensity", // missing in DCS | |
e7a6790f | 71 | "L3Current", |
72 | "DipoleCurrent", | |
44e45fac | 73 | "L3_BSF17_H1", |
74 | "L3_BSF17_H2", | |
75 | "L3_BSF17_H3", | |
76 | "L3_BSF17_Temperature", | |
77 | "L3_BSF4_H1", | |
78 | "L3_BSF4_H2", | |
79 | "L3_BSF4_H3", | |
80 | "L3_BSF4_Temperature", | |
81 | "L3_BKF17_H1", | |
82 | "L3_BKF17_H2", | |
83 | "L3_BKF17_H3", | |
84 | "L3_BKF17_Temperature", | |
85 | "L3_BKF4_H1", | |
86 | "L3_BKF4_H2", | |
87 | "L3_BKF4_H3", | |
88 | "L3_BKF4_Temperature", | |
89 | "L3_BSF13_H1", | |
90 | "L3_BSF13_H2", | |
91 | "L3_BSF13_H3", | |
92 | "L3_BSF13_Temperature", | |
93 | "L3_BSF8_H1", | |
94 | "L3_BSF8_H2", | |
95 | "L3_BSF8_H3", | |
96 | "L3_BSF8_Temperature", | |
97 | "L3_BKF13_H1", | |
98 | "L3_BKF13_H2", | |
99 | "L3_BKF13_H3", | |
100 | "L3_BKF13_Temperature", | |
101 | "L3_BKF8_H1", | |
102 | "L3_BKF8_H2", | |
103 | "L3_BKF8_H3", | |
104 | "L3_BKF8_Temperature", | |
105 | "Dipole_Inside_H1", | |
106 | "Dipole_Inside_H2", | |
107 | "Dipole_Inside_H3", | |
108 | "Dipole_Inside_Temperature", | |
109 | "Dipole_Outside_H1", | |
110 | "Dipole_Outside_H2", | |
111 | "Dipole_Outside_H3", | |
112 | "Dipole_Outside_Temperature", | |
e7a6790f | 113 | "CavernTemperature", |
114 | "CavernAtmosPressure", | |
6240e6a4 | 115 | "SurfaceAtmosPressure" |
e7a6790f | 116 | }; |
44e45fac | 117 | |
39e3007b | 118 | const char* AliGRPPreprocessor::fgkDCSDataPointsHallProbes[AliGRPPreprocessor::fgknDCSDPHallProbes] = { |
44e45fac | 119 | "L3_BSF17_H1", |
120 | "L3_BSF17_H2", | |
121 | "L3_BSF17_H3", | |
122 | "L3_BSF17_Temperature", | |
123 | "L3_BSF4_H1", | |
124 | "L3_BSF4_H2", | |
125 | "L3_BSF4_H3", | |
126 | "L3_BSF4_Temperature", | |
127 | "L3_BKF17_H1", | |
128 | "L3_BKF17_H2", | |
129 | "L3_BKF17_H3", | |
130 | "L3_BKF17_Temperature", | |
131 | "L3_BKF4_H1", | |
132 | "L3_BKF4_H2", | |
133 | "L3_BKF4_H3", | |
134 | "L3_BKF4_Temperature", | |
135 | "L3_BSF13_H1", | |
136 | "L3_BSF13_H2", | |
137 | "L3_BSF13_H3", | |
138 | "L3_BSF13_Temperature", | |
139 | "L3_BSF8_H1", | |
140 | "L3_BSF8_H2", | |
141 | "L3_BSF8_H3", | |
142 | "L3_BSF8_Temperature", | |
143 | "L3_BKF13_H1", | |
144 | "L3_BKF13_H2", | |
145 | "L3_BKF13_H3", | |
146 | "L3_BKF13_Temperature", | |
147 | "L3_BKF8_H1", | |
148 | "L3_BKF8_H2", | |
149 | "L3_BKF8_H3", | |
150 | "L3_BKF8_Temperature", | |
151 | "Dipole_Inside_H1", | |
152 | "Dipole_Inside_H2", | |
153 | "Dipole_Inside_H3", | |
154 | "Dipole_Inside_Temperature", | |
155 | "Dipole_Outside_H1", | |
156 | "Dipole_Outside_H2", | |
157 | "Dipole_Outside_H3", | |
158 | "Dipole_Outside_Temperature", | |
159 | }; | |
e7a6790f | 160 | |
44e45fac | 161 | const Short_t kSensors = 48; // start index position of sensor in DCS DPs |
162 | const Short_t kNumSensors = 2; // Number of sensors in DCS DPs | |
e7a6790f | 163 | |
164 | const char* AliGRPPreprocessor::fgkLHCState[20] = { | |
165 | "P", "PREPARE", | |
166 | "J", "PREINJECTION", | |
167 | "I", "INJECTION", | |
168 | "F", "FILLING", | |
169 | "A", "ADJUST", | |
170 | "U", "UNSTABLE BEAMS", | |
171 | "S", "STABLE BEAMS", | |
172 | "D", "BEAM DUMP", | |
173 | "R", "RECOVER", | |
174 | "C", "PRECYCLE" | |
175 | }; | |
176 | ||
177 | const char* kppError[] = { | |
178 | "", | |
179 | "(DAQ logbook ERROR)", | |
180 | "(DAQ FXS ERROR)", | |
181 | "(DCS FXS ERROR)", | |
7e1a6c0b | 182 | "(DCS data points ERROR)", |
183 | "(Trigger Configuration ERROR)" | |
e7a6790f | 184 | }; |
17984b61 | 185 | |
3dedb44a | 186 | //_______________________________________________________________ |
44e45fac | 187 | |
3dedb44a | 188 | AliGRPPreprocessor::AliGRPPreprocessor(AliShuttleInterface* shuttle): |
08a446c2 | 189 | AliPreprocessor("GRP",shuttle), fPressure(0) |
e7a6790f | 190 | { |
44e45fac | 191 | // constructor - shuttle must be instantiated! |
ad103e84 | 192 | |
7eaa854b | 193 | AddRunType("COSMIC"); |
194 | AddRunType("LASER"); | |
44e45fac | 195 | AddRunType("PHYSICS"); |
c2ad5069 | 196 | AddRunType("CALIBRATION_BC"); |
197 | AddRunType("CALIBRATION_CENTRAL"); | |
198 | AddRunType("CALIBRATION_EMD"); | |
199 | AddRunType("CALIBRATION_MB"); | |
200 | AddRunType("CALIBRATION_SEMICENTRAL"); | |
69bf9b19 | 201 | AddRunType("CALIBRATION"); |
202 | AddRunType("PEDESTAL"); | |
7be24dea | 203 | AddRunType("STANDALONE"); |
204 | AddRunType("GAIN"); | |
3242245e | 205 | AddRunType("NOISE"); |
206 | AddRunType("PULSER"); | |
b7a928fe | 207 | AddRunType("STANDALONE_PULSER"); |
3dedb44a | 208 | } |
209 | ||
210 | //_______________________________________________________________ | |
44e45fac | 211 | |
e7a6790f | 212 | AliGRPPreprocessor::~AliGRPPreprocessor() |
213 | { | |
44e45fac | 214 | //destructor |
215 | ||
216 | delete fPressure; | |
3dedb44a | 217 | } |
218 | ||
219 | //_______________________________________________________________ | |
44e45fac | 220 | |
e7a6790f | 221 | void AliGRPPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime) |
222 | { | |
3dedb44a | 223 | // Initialize preprocessor |
5a5052e5 | 224 | |
225 | AliPreprocessor::Initialize(run, startTime, endTime); | |
e7a6790f | 226 | |
17984b61 | 227 | AliInfo("Initialization of the GRP preprocessor."); |
6240e6a4 | 228 | TClonesArray * array = new TClonesArray("AliDCSSensor",kNumSensors); |
229 | for(Int_t j = 0; j < kNumSensors; j++) { | |
17984b61 | 230 | AliDCSSensor * sens = new ((*array)[j])AliDCSSensor; |
e7a6790f | 231 | sens->SetStringID(fgkDCSDataPoints[j+kSensors]); |
17984b61 | 232 | } |
233 | AliInfo(Form("Pressure Entries: %d",array->GetEntries())); | |
234 | ||
563f2a84 | 235 | // fPressure = new AliDCSSensorArray(fStartTime, fEndTime, array); |
236 | fPressure = new AliDCSSensorArray(GetStartTimeDCSQuery(), GetEndTimeDCSQuery(), array); | |
3dedb44a | 237 | } |
238 | ||
239 | //_______________________________________________________________ | |
44e45fac | 240 | |
e7a6790f | 241 | UInt_t AliGRPPreprocessor::Process(TMap* valueMap) |
242 | { | |
44e45fac | 243 | // process data retrieved by the Shuttle |
244 | ||
245 | AliGRPObject *grpobj = new AliGRPObject(); // object to store data | |
246 | ||
247 | //=================// | |
248 | // DAQ logbook // | |
249 | //=================// | |
250 | UInt_t error = 0; | |
251 | ||
252 | grpobj = ProcessDaqLB(); | |
253 | ||
254 | //=================// | |
255 | // DAQ FXS // | |
256 | //=================// | |
257 | UInt_t iDaqFxs = ProcessDaqFxs(); | |
258 | if( iDaqFxs == 0 ) { | |
259 | Log(Form("DAQ FXS, successful!")); | |
260 | } else { | |
261 | Log(Form("DAQ FXS, could not store run raw tag file!!!")); | |
262 | error |= 2; | |
263 | } | |
264 | ||
265 | //=================// | |
266 | // DCS FXS // | |
267 | //=================// | |
268 | UInt_t iDcsFxs = ProcessDcsFxs(); | |
269 | if( iDcsFxs == 0 ) { | |
270 | Log(Form("DCS FXS, successful!")); | |
271 | } else { | |
76820ec2 | 272 | Log(Form("DCS FXS, Could not store CTP scalers!!!")); |
44e45fac | 273 | error |= 4; |
274 | } | |
275 | ||
276 | //=================// | |
277 | // DCS data points // | |
278 | //=================// | |
7e6f5523 | 279 | Log(Form("Starting DCS Query at %d and finishing at %d",GetStartTimeDCSQuery(),GetEndTimeDCSQuery())); |
44e45fac | 280 | Int_t entries = ProcessDcsDPs( valueMap, grpobj ); |
7e6f5523 | 281 | Log(Form("entries found = %d",entries)); |
24c16c5d | 282 | if( entries < fgknDCSDP-4 ) { // FIXME (!= ) LHState, LHCLuminosity, BeamIntensity, LH3_BSF4_H3 are not working yet... |
44e45fac | 283 | Log(Form("Problem with the DCS data points!!!")); |
284 | error |= 8; | |
285 | } else Log(Form("DCS data points, successful!")); | |
286 | ||
287 | //=======================// | |
288 | // Trigger Configuration // | |
289 | //=======================// | |
290 | // either from DAQ logbook..... | |
291 | const char * triggerConf = GetTriggerConfiguration(); | |
292 | if (triggerConf!= NULL) { | |
293 | Log("Found trigger configuration in DAQ logbook"); | |
294 | AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfigurationFromString(triggerConf); | |
295 | if (!runcfg) { | |
296 | Log("Bad CTP run configuration file from DAQ logbook! The corresponding CDB entry will not be filled!"); | |
297 | error |= 16; | |
298 | } | |
299 | else { | |
300 | TString titleCTPcfg = Form("CTP cfg for run %i from DAQ",fRun); | |
301 | runcfg->SetTitle(titleCTPcfg); | |
302 | AliCDBMetaData metaData; | |
303 | metaData.SetBeamPeriod(0); | |
304 | metaData.SetResponsible("Roman Lietava"); | |
305 | metaData.SetComment("CTP run configuration from DAQ logbook"); | |
306 | if (!Store("CTP","Config", runcfg, &metaData, 0, 0)) { | |
307 | Log("Unable to store the CTP run configuration object to OCDB!"); | |
308 | error |= 16; | |
309 | } | |
310 | } | |
311 | } | |
a453acbf | 312 | else { |
313 | Log("Trigger configuration NOT FOUND in DAQ logbook"); | |
314 | error |= 16; | |
315 | } | |
316 | ||
44e45fac | 317 | /* the DCS should not been used any more to access this stuff!!! |
318 | // ...or from DCS FXS | |
319 | else{ | |
320 | Log("No trigger configuration found in the DAQ logbook!! Trying reading from DCS FXS..."); | |
321 | TString runcfgfile = GetFile(kDCS, "CTP_runconfig", ""); | |
322 | if (runcfgfile.IsNull()) { | |
323 | Log("No CTP runconfig files has been found in DCS FXS!"); | |
324 | error |= 16; | |
325 | } | |
326 | else { | |
327 | Log(Form("File with Id CTP_runconfig found! Copied to %s",runcfgfile.Data())); | |
328 | AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfiguration(runcfgfile); | |
329 | if (!runcfg) { | |
330 | Log("Bad CTP run configuration file from DCS FXS! The corresponding CDB entry will not be filled!"); | |
331 | error |= 16;; | |
332 | } | |
333 | else { | |
334 | TString titleCTPcfg = Form("CTP cfg for run %i from DCS",fRun); | |
335 | runcfg->SetTitle(titleCTPcfg); | |
336 | AliCDBMetaData metaData; | |
337 | metaData.SetBeamPeriod(0); | |
338 | metaData.SetResponsible("Roman Lietava"); | |
339 | metaData.SetComment("CTP run configuration from DCS FXS"); | |
340 | if (!Store("CTP","Config", runcfg, &metaData, 0, 0)) { | |
341 | Log("Unable to store the CTP run configuration object to OCDB!"); | |
342 | error |= 16; | |
343 | } | |
344 | } | |
345 | } | |
346 | } | |
347 | */ | |
348 | AliCDBMetaData md; | |
349 | md.SetResponsible("Ernesto Lopez Torres"); | |
350 | md.SetComment("Output parameters from the GRP preprocessor."); | |
351 | ||
352 | Bool_t result = kTRUE; | |
44e45fac | 353 | result = Store("GRP", "Data", grpobj, &md); |
354 | delete grpobj; | |
355 | ||
356 | if (result && !error ) { | |
357 | Log("GRP Preprocessor Success"); | |
358 | return 0; | |
359 | } else { | |
360 | Log( Form("GRP Preprocessor FAILS!!! %s%s%s%s%s", | |
361 | kppError[(error&1)?1:0], | |
362 | kppError[(error&2)?2:0], | |
363 | kppError[(error&4)?3:0], | |
364 | kppError[(error&8)?4:0], | |
365 | kppError[(error&16)?5:0] | |
366 | )); | |
367 | return error; | |
368 | } | |
17984b61 | 369 | } |
370 | ||
17984b61 | 371 | //_______________________________________________________________ |
17984b61 | 372 | |
44e45fac | 373 | AliGRPObject* AliGRPPreprocessor::ProcessDaqLB() |
374 | { | |
375 | //Getting the DAQ lb information | |
376 | ||
377 | time_t timeStart = (time_t)(((TString)GetRunParameter("DAQ_time_start")).Atoi()); | |
378 | time_t timeEnd = (time_t)(((TString)GetRunParameter("DAQ_time_end")).Atoi()); | |
379 | Float_t beamEnergy = (Float_t)(((TString)GetRunParameter("beamEnergy")).Atof()); | |
380 | TString beamType = (TString)GetRunParameter("beamType"); | |
381 | Char_t numberOfDetectors = (Char_t)(((TString)GetRunParameter("numberOfDetectors")).Atoi()); | |
382 | UInt_t detectorMask= (UInt_t)(((TString)GetRunParameter("detectorMask")).Atoi()); | |
383 | TString lhcPeriod = (TString)GetRunParameter("LHCperiod"); | |
384 | TString runType = (TString)GetRunType(); | |
385 | ||
386 | AliGRPObject* grpObj = new AliGRPObject(); | |
387 | ||
388 | if (timeStart != 0){ | |
389 | grpObj->SetTimeStart(timeStart); | |
390 | Log(Form("Start time for run %d: %d",fRun, (Int_t)timeStart)); | |
391 | } | |
392 | else { | |
393 | Log(Form("Start time not put in logbook, setting to invalid in GRP entry!")); | |
394 | } | |
395 | ||
396 | if (timeEnd != 0){ | |
397 | grpObj->SetTimeEnd(timeEnd); | |
398 | Log(Form("End time for run %d: %i",fRun, (Int_t)timeEnd)); | |
399 | } | |
400 | else { | |
401 | Log(Form("End time not put in logbook, setting to invalid in GRP entry!")); | |
402 | } | |
403 | ||
404 | if (beamEnergy != 0){ | |
405 | grpObj->SetBeamEnergy(beamEnergy); | |
406 | Log(Form("Beam Energy for run %d: %f",fRun, beamEnergy)); | |
407 | } | |
408 | else { | |
409 | Log(Form("Beam Energy not put in logbook, setting to invalid in GRP entry!")); | |
410 | } | |
411 | ||
412 | Log(Form("Beam Type for run %d: %s",fRun, beamType.Data())); | |
413 | ||
414 | if (beamType.Length() != 0){ | |
415 | grpObj->SetBeamType(beamType); | |
416 | Log(Form("Beam Type for run %d: %s",fRun, beamType.Data())); | |
417 | } | |
418 | else { | |
419 | Log(Form("Beam Type not put in logbook, setting to invalid in GRP entry!")); | |
420 | } | |
421 | ||
422 | if (numberOfDetectors != 0){ | |
423 | grpObj->SetNumberOfDetectors(numberOfDetectors); | |
424 | Log(Form("Number Of Detectors for run %d: %d",fRun, (Int_t)numberOfDetectors)); | |
425 | } | |
426 | else { | |
427 | Log(Form("Number Of Detectors not put in logbook, setting to invalid in GRP entry!")); | |
428 | } | |
429 | ||
430 | if (detectorMask != 0){ | |
431 | grpObj->SetDetectorMask(detectorMask); | |
432 | Log(Form("Detector Mask for run %d: %d",fRun, detectorMask)); | |
433 | } | |
434 | else { | |
435 | Log(Form("Detector Mask not put in logbook, setting to invalid in GRP entry!")); | |
436 | } | |
437 | ||
438 | if (lhcPeriod.Length() != 0) { | |
439 | grpObj->SetLHCPeriod(lhcPeriod); | |
440 | Log(Form("LHC period (DAQ) for run %d: %s",fRun, lhcPeriod.Data())); | |
441 | } else { | |
442 | Log(Form("LHCperiod not put in logbook, setting to invalid in GRP entry!")); | |
443 | } | |
444 | if (runType.Length() != 0) { | |
445 | grpObj->SetRunType(runType); | |
446 | Log(Form("Run Type (DAQ) for run %d: %s",fRun, runType.Data())); | |
447 | } else { | |
448 | Log(Form("Run Type not put in logbook, setting to invalid in GRP entry!")); | |
449 | } | |
450 | ||
451 | return grpObj; | |
452 | } | |
17984b61 | 453 | |
44e45fac | 454 | //_______________________________________________________________ |
17984b61 | 455 | |
44e45fac | 456 | UInt_t AliGRPPreprocessor::ProcessDaqFxs() |
457 | { | |
458 | //======DAQ FXS======// | |
459 | ||
460 | TList* list = GetFileSources(kDAQ); | |
461 | if (!list) { | |
462 | Log("No raw data tag list: connection problems with DAQ FXS logbook!"); | |
463 | return 1; | |
464 | } | |
465 | ||
466 | if (list->GetEntries() == 0) { | |
467 | Log("no raw data tags in this run: nothing to merge!"); | |
468 | delete list; list=0; | |
469 | return 0; | |
470 | } | |
471 | ||
472 | TChain *fRawTagChain = new TChain("T"); | |
473 | Int_t nFiles=0; | |
474 | TIterator* iter = list->MakeIterator(); | |
475 | TObject* obj = 0; | |
476 | while ((obj = iter->Next())) { | |
477 | TObjString* objStr = dynamic_cast<TObjString*> (obj); | |
478 | if (objStr) { | |
479 | Log(Form("Found source %s", objStr->String().Data())); | |
480 | TList* list2 = GetFileIDs(kDAQ, objStr->String()); | |
481 | if (!list2) { | |
482 | Log("No list with ids from DAQ was found: connection problems with DAQ FXS logbook!"); | |
483 | delete fRawTagChain; fRawTagChain=0; | |
484 | return 1; | |
485 | } | |
486 | Log(Form("Number of ids: %d",list2->GetEntries())); | |
487 | for(Int_t i = 0; i < list2->GetEntries(); i++) { | |
488 | TObjString *idStr = (TObjString *)list2->At(i); | |
489 | TString fileName = GetFile(kDAQ,idStr->String().Data(),objStr->String().Data()); | |
490 | if (fileName.Length() > 0) { | |
491 | Log(Form("Adding file in the chain: %s",fileName.Data())); | |
492 | fRawTagChain->Add(fileName.Data()); | |
493 | nFiles++; | |
494 | } else { | |
495 | Log(Form("Could not retrieve file with id %s from source %s: " | |
496 | "connection problems with DAQ FXS!", | |
497 | idStr->String().Data(), objStr->String().Data())); | |
498 | delete list; list=0; | |
499 | delete list2; list2=0; | |
500 | delete fRawTagChain; fRawTagChain=0; | |
501 | return 2; | |
502 | } | |
503 | } | |
504 | delete list2; | |
505 | } | |
506 | } | |
507 | ||
508 | TString fRawDataFileName = "GRP_Merged.tag.root"; | |
509 | Log(Form("Merging %d raw data tags into file: %s", nFiles, fRawDataFileName.Data())); | |
7e6f5523 | 510 | |
44e45fac | 511 | if( fRawTagChain->Merge(fRawDataFileName) < 1 ) { |
512 | Log("Error merging raw data files!!!"); | |
513 | return 3; | |
514 | } | |
7e6f5523 | 515 | |
44e45fac | 516 | TString outputfile = Form("Run%d.Merged.RAW.tag.root", fRun); |
517 | Bool_t result = StoreRunMetadataFile(fRawDataFileName.Data(),outputfile.Data()); | |
518 | ||
519 | if (!result) { | |
520 | Log("Problem storing raw data tags in local file!!!"); | |
521 | } else { | |
522 | Log("Raw data tags merged successfully!!"); | |
523 | } | |
524 | ||
525 | delete iter; | |
526 | delete list; | |
527 | delete fRawTagChain; fRawTagChain=0; | |
528 | ||
529 | if (result == kFALSE) { | |
530 | return 4; | |
531 | } | |
532 | ||
533 | return 0; | |
534 | ||
535 | } | |
17984b61 | 536 | |
44e45fac | 537 | //_______________________________________________________________ |
538 | UInt_t AliGRPPreprocessor::ProcessDcsFxs() | |
539 | { | |
39e3007b | 540 | |
541 | // processing the info | |
542 | // stored in the DCS FXS | |
543 | // coming from the trigger | |
544 | ||
44e45fac | 545 | { |
546 | // Get the CTP counters information | |
547 | TList* list = GetFileSources(kDCS,"CTP_xcounters"); | |
548 | if (!list) { | |
121f4621 | 549 | Log("No CTP counters file: connection problems with DCS FXS logbook!"); |
44e45fac | 550 | return 1; |
551 | } | |
552 | ||
553 | if (list->GetEntries() == 0) { | |
554 | Log("No CTP counters file to be processed!"); | |
555 | return 1; | |
556 | } | |
557 | else { | |
558 | TIter iter(list); | |
559 | TObjString *source; | |
560 | while ((source = dynamic_cast<TObjString *> (iter.Next()))) { | |
561 | TString countersfile = GetFile(kDCS, "CTP_xcounters", source->GetName()); | |
562 | if (countersfile.IsNull()) { | |
563 | Log("No CTP counters files has been found: empty source!"); | |
564 | } | |
565 | else { | |
566 | Log(Form("File with Id CTP_xcounters found in source %s! Copied to %s",source->GetName(),countersfile.Data())); | |
567 | AliTriggerRunScalers *scalers = AliTriggerRunScalers::ReadScalers(countersfile); | |
568 | if (!scalers) { | |
569 | Log("Bad CTP counters file! The corresponding CDB entry will not be filled!"); | |
570 | return 1; | |
571 | } | |
572 | else { | |
573 | AliCDBMetaData metaData; | |
574 | metaData.SetBeamPeriod(0); | |
575 | metaData.SetResponsible("Roman Lietava"); | |
576 | metaData.SetComment("CTP scalers"); | |
577 | if (!Store("CTP","Scalers", scalers, &metaData, 0, 0)) { | |
578 | Log("Unable to store the CTP scalers object to OCDB!"); | |
579 | } | |
580 | } | |
581 | } | |
582 | } | |
583 | } | |
584 | delete list; | |
585 | } | |
586 | ||
587 | return 0; | |
588 | } | |
589 | //_______________________________________________________________ | |
17984b61 | 590 | |
44e45fac | 591 | Int_t AliGRPPreprocessor::ProcessDcsDPs(TMap* valueMap, AliGRPObject* grpObj) |
592 | { | |
17984b61 | 593 | |
44e45fac | 594 | // |
595 | // processing DCS DPs | |
596 | // | |
597 | ||
26c1dff2 | 598 | Int_t entries = 0; // counting the entries that are in the DCS DB, not taking care whether they have values or not |
44e45fac | 599 | Int_t nLHCEntries = 0; |
600 | Int_t nL3Entries = 0; | |
601 | Int_t nDipoleEntries = 0; | |
602 | Int_t nEnvEntries = 0; | |
603 | Int_t nHallProbesEntries = 0; | |
604 | nLHCEntries = ProcessLHCDPs(valueMap, grpObj); | |
605 | nL3Entries = ProcessL3DPs(valueMap, grpObj); | |
606 | nDipoleEntries = ProcessDipoleDPs(valueMap, grpObj); | |
607 | nEnvEntries = ProcessEnvDPs(valueMap, grpObj); | |
608 | nHallProbesEntries = ProcessHPDPs(valueMap, grpObj); | |
609 | ||
610 | entries = nLHCEntries + nL3Entries + nDipoleEntries + nEnvEntries + nHallProbesEntries; | |
611 | return entries; | |
17984b61 | 612 | |
17984b61 | 613 | } |
614 | ||
615 | //_______________________________________________________________ | |
29cc8704 | 616 | |
39e3007b | 617 | Int_t AliGRPPreprocessor::ProcessL3DPs(const TMap* valueMap, AliGRPObject* grpObj) |
44e45fac | 618 | { |
39e3007b | 619 | |
620 | // processing DPs | |
621 | // related to | |
622 | // L3 info | |
623 | ||
44e45fac | 624 | Int_t nL3Entries = 0; |
625 | TObjArray *array = 0x0; | |
626 | Int_t indexDP = -1; | |
627 | ||
628 | AliInfo(Form("==========L3Polarity===========")); | |
629 | indexDP = kL3Polarity; | |
630 | array = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[indexDP]); | |
631 | if(!array) { | |
632 | Log(Form("%s not found in the map!!!",fgkDCSDataPoints[indexDP])); | |
633 | } | |
634 | else { | |
26c1dff2 | 635 | if (array->GetEntries() == 0){ |
636 | AliError(Form("No entries found in array! setting %s Polarity to invalid...",fgkDCSDataPoints[indexDP])); | |
637 | } | |
638 | else { | |
639 | Char_t charDCS = ProcessBool(array); | |
640 | grpObj->SetL3Polarity(charDCS); | |
641 | AliInfo(Form("%s set to %d",fgkDCSDataPoints[indexDP],(Int_t)(grpObj->GetL3Polarity()))); | |
642 | } | |
44e45fac | 643 | nL3Entries++; |
644 | } | |
645 | ||
646 | if (array) array = 0x0; | |
647 | ||
648 | AliInfo(Form("==========L3Current===========")); | |
649 | indexDP = kL3Current; | |
650 | array = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[indexDP]); | |
651 | if(!array) { | |
652 | Log(Form("%s not found in the map!!!",fgkDCSDataPoints[indexDP])); | |
653 | } | |
654 | else { | |
26c1dff2 | 655 | if (array->GetEntries() == 0){ |
656 | AliError(Form("No entries found in array! setting %s to invalid...",fgkDCSDataPoints[indexDP])); | |
657 | } | |
658 | else { | |
659 | Float_t *floatDCS = ProcessFloatAll(array); | |
660 | grpObj->SetL3Current(floatDCS); | |
661 | delete floatDCS; | |
662 | } | |
44e45fac | 663 | nL3Entries++; |
664 | } | |
665 | ||
666 | return nL3Entries; | |
e7a6790f | 667 | |
44e45fac | 668 | } |
669 | //_______________________________________________________________ | |
ff97356e | 670 | |
39e3007b | 671 | Int_t AliGRPPreprocessor::ProcessDipoleDPs(const TMap* valueMap, AliGRPObject* grpObj) |
44e45fac | 672 | { |
39e3007b | 673 | // processing DPs |
674 | // related to | |
675 | // the Dipole info | |
676 | ||
44e45fac | 677 | Int_t nDipoleEntries = 0; |
678 | TObjArray *array = 0x0; | |
679 | Int_t indexDP = -1; | |
680 | ||
681 | AliInfo(Form("==========DipolePolarity===========")); | |
682 | indexDP = kDipolePolarity; | |
44e45fac | 683 | array = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[indexDP]); |
44e45fac | 684 | if(!array) { |
685 | Log(Form("%s not found in the map!!!",fgkDCSDataPoints[indexDP])); | |
686 | } | |
687 | else { | |
26c1dff2 | 688 | if (array->GetEntries() == 0){ |
689 | AliError(Form("No entries found in array! setting %s to invalid...",fgkDCSDataPoints[indexDP])); | |
690 | } | |
691 | else { | |
692 | Char_t charDCS = ProcessBool(array); | |
693 | grpObj->SetDipolePolarity(charDCS); | |
694 | AliInfo(Form("%s set to %d",fgkDCSDataPoints[indexDP],(Int_t)(grpObj->GetDipolePolarity()))); | |
695 | } | |
44e45fac | 696 | nDipoleEntries++; |
697 | } | |
698 | ||
699 | if (array) array = 0x0; | |
700 | ||
701 | AliInfo(Form("==========DipoleCurrent===========")); | |
702 | indexDP = kDipoleCurrent; | |
703 | array = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[indexDP]); | |
704 | if(!array) { | |
705 | Log(Form("%s not found in the map!!!",fgkDCSDataPoints[indexDP])); | |
706 | } | |
707 | else { | |
26c1dff2 | 708 | if (array->GetEntries() == 0){ |
709 | AliError(Form("No entries found in array! setting %s to invalid...",fgkDCSDataPoints[indexDP])); | |
710 | } | |
711 | else { | |
712 | Float_t *floatDCS = ProcessFloatAll(array); | |
713 | grpObj->SetDipoleCurrent(floatDCS); | |
714 | delete floatDCS; | |
715 | } | |
44e45fac | 716 | nDipoleEntries++; |
717 | } | |
718 | ||
719 | return nDipoleEntries; | |
e7a6790f | 720 | |
44e45fac | 721 | } |
722 | //_______________________________________________________________ | |
e7a6790f | 723 | |
44e45fac | 724 | Int_t AliGRPPreprocessor::ProcessEnvDPs(TMap* valueMap, AliGRPObject* grpObj) |
725 | { | |
39e3007b | 726 | // processing DPs |
727 | // related to | |
728 | // evironment conditions (temperature, pressure) info | |
729 | ||
44e45fac | 730 | Int_t nEnvEntries = 0; |
731 | TObjArray *array = 0x0; | |
732 | Int_t indexDP = -1; | |
733 | ||
734 | AliInfo(Form("==========CavernTemperature===========")); | |
735 | indexDP = kCavernTemperature; | |
736 | array = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[indexDP]); | |
737 | if(!array) { | |
738 | Log(Form("%s not found in the map!!!",fgkDCSDataPoints[indexDP])); | |
739 | } | |
740 | else { | |
26c1dff2 | 741 | if (array->GetEntries() == 0){ |
742 | AliError(Form("No entries found in array! setting %s to invalid...",fgkDCSDataPoints[indexDP])); | |
743 | } | |
744 | else { | |
745 | Float_t *floatDCS = ProcessFloatAll(array); | |
746 | grpObj->SetCavernTemperature(floatDCS); | |
747 | delete floatDCS; | |
748 | } | |
44e45fac | 749 | nEnvEntries++; |
750 | } | |
751 | ||
752 | if (array) array = 0x0; | |
753 | ||
754 | AliInfo(Form("==========AtmosPressures (Cavern + Surface)===========")); | |
755 | AliDCSSensorArray *dcsSensorArray = GetPressureMap(valueMap); | |
756 | dcsSensorArray->Print(); | |
44e45fac | 757 | if( fPressure->NumFits()==0 ) { |
758 | Log("Problem with the pressure sensor values!!!"); | |
759 | } | |
760 | else { | |
761 | AliInfo(Form("==========CavernAtmosPressure===========")); | |
762 | indexDP = kCavernAtmosPressure; | |
763 | AliDCSSensor* sensorCavernP2 = dcsSensorArray->GetSensor(fgkDCSDataPoints[indexDP]); | |
764 | AliDebug(2,Form("sensorCavernP2 = %p", sensorCavernP2)); | |
765 | if( sensorCavernP2->GetFit() ) { | |
766 | Log(Form("<%s> for run %d: Sensor Fit found",fgkDCSDataPoints[indexDP], fRun)); | |
767 | grpObj->SetCavernAtmosPressure(sensorCavernP2); | |
768 | nEnvEntries++; | |
769 | } | |
770 | //if (sensorP2) delete sensorP2; | |
771 | else { | |
772 | Log(Form("ERROR Sensor Fit for %s not found: ", fgkDCSDataPoints[indexDP] )); | |
773 | } | |
774 | AliInfo(Form("==========SurfaceAtmosPressure===========")); | |
775 | indexDP = kSurfaceAtmosPressure; | |
776 | AliDCSSensor* sensorP2 = dcsSensorArray->GetSensor(fgkDCSDataPoints[indexDP]); | |
777 | AliDebug(2,Form("sensorP2 = %p", sensorP2)); | |
778 | if( sensorP2->GetFit() ) { | |
779 | Log(Form("<%s> for run %d: Sensor Fit found",fgkDCSDataPoints[indexDP], fRun)); | |
780 | grpObj->SetSurfaceAtmosPressure(sensorP2); | |
781 | nEnvEntries++; | |
782 | } | |
783 | //if (sensorP2) delete sensorP2; | |
784 | else { | |
785 | Log(Form("ERROR Sensor Fit for %s not found: ", fgkDCSDataPoints[indexDP] )); | |
786 | } | |
787 | ||
788 | } | |
789 | ||
790 | /* indexDP = kCavernAtmosPressure; | |
791 | array = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[indexDP]); | |
792 | if(!array) { | |
793 | Log(Form("%s not found in the map!!!",fgkDCSDataPoints[indexDP])); | |
794 | } | |
795 | else { | |
796 | Float_t *floatDCS = ProcessFloatAll(array); | |
797 | grpObj->SetCavernAtmosPressure(floatDCS); | |
798 | delete floatDCS; | |
799 | nEnvEntries++; | |
800 | } | |
801 | ||
802 | ||
803 | if (array) array = 0x0; | |
804 | ||
805 | AliInfo(Form("==========SurfaceAtmosPressure===========")); | |
806 | indexDP = kSurfaceAtmosPressure; | |
807 | AliDCSSensorArray *dcsSensorArray = GetPressureMap(valueMap); | |
808 | dcsSensorArray->Print(); | |
809 | AliInfo(Form("fPressure = %p",fPressure)); | |
810 | AliInfo(Form("dcsSensorArray = %p",dcsSensorArray)); | |
811 | if( fPressure->NumFits()==0 ) { | |
812 | Log("Problem with the pressure sensor values!!!"); | |
813 | } | |
814 | else { | |
815 | AliDCSSensor* sensorP2 = dcsSensorArray->GetSensor(fgkDCSDataPoints[indexDP]); | |
816 | AliDebug(2,Form("sensorP2 = %p", sensorP2)); | |
817 | if( sensorP2->GetFit() ) { | |
818 | Log(Form("<%s> for run %d: Sensor Fit found",fgkDCSDataPoints[indexDP], fRun)); | |
819 | grpObj->SetSurfaceAtmosPressure(sensorP2); | |
820 | nEnvEntries++; | |
821 | } | |
822 | //if (sensorP2) delete sensorP2; | |
823 | else { | |
824 | Log(Form("ERROR Sensor Fit for %s not found: ", fgkDCSDataPoints[indexDP] )); | |
825 | } | |
826 | ||
827 | } | |
828 | */ | |
829 | ||
830 | return nEnvEntries; | |
831 | } | |
832 | //_______________________________________________________________ | |
e7a6790f | 833 | |
39e3007b | 834 | Int_t AliGRPPreprocessor::ProcessHPDPs(const TMap* valueMap, AliGRPObject* grpObj) |
44e45fac | 835 | { |
39e3007b | 836 | // processing DPs |
837 | // related to | |
838 | // Hall Probes info | |
839 | ||
44e45fac | 840 | Int_t nHPEntries = 0; |
841 | TObjArray *array = 0x0; | |
842 | Int_t indexDP = -1; | |
843 | ||
39e3007b | 844 | if (fgknDCSDPHallProbes != AliGRPObject::GetNumberOfHP()){ |
845 | AliError(Form("Number of Hall probes expected in GRP Preprocessor (i.e. %d) different from number of Hall Probes foreseen in GRP object (i.e. %d). Looping on entries from GRP object anyway.", fgknDCSDPHallProbes, AliGRPObject::GetNumberOfHP())); | |
44e45fac | 846 | } |
847 | for (indexDP = 0; indexDP < AliGRPObject::GetNumberOfHP(); indexDP++){ | |
848 | AliInfo(Form("==========%s===========",AliGRPObject::GetHPDP(indexDP))); | |
849 | array = (TObjArray *)valueMap->GetValue(AliGRPObject::GetHPDP(indexDP)); | |
850 | if(!array) { | |
851 | Log(Form("%s not found in the map!!!",AliGRPObject::GetHPDP(indexDP))); | |
852 | } | |
853 | else { | |
26c1dff2 | 854 | if (array->GetEntries() == 0){ |
855 | AliError(Form("No entries found in array! setting %s to invalid...",AliGRPObject::GetHPDP(indexDP))); | |
856 | } | |
857 | else { | |
858 | Float_t *floatDCS = ProcessFloatAll(array); | |
859 | AliDebug(2,Form("value[0] = %f, value[1] = %f, value[2] = %f, value[3] = %f, value[4] = %f",floatDCS[0],floatDCS[1],floatDCS[2],floatDCS[3],floatDCS[4])); | |
860 | grpObj->SetHallProbes((AliGRPObject::DP_HallProbes)indexDP,floatDCS); | |
861 | for (Int_t kk = 0 ; kk< 5; kk++){ | |
862 | AliDebug(2,Form("HallProbe[%d][%d]=%f",indexDP,kk,grpObj->GetHallProbes((AliGRPObject::DP_HallProbes)indexDP,(AliGRPObject::Stats)kk))); | |
863 | } | |
864 | delete floatDCS; | |
44e45fac | 865 | } |
44e45fac | 866 | nHPEntries++; |
867 | } | |
868 | } | |
869 | ||
7e6f5523 | 870 | Log(Form("Hall Probes = %d ", nHPEntries)); |
871 | return nHPEntries; | |
17984b61 | 872 | } |
873 | ||
48b1b444 | 874 | //_______________________________________________________________ |
44e45fac | 875 | |
39e3007b | 876 | Int_t AliGRPPreprocessor::ProcessLHCDPs(const TMap* valueMap, AliGRPObject* grpObj) |
e7a6790f | 877 | { |
48b1b444 | 878 | |
44e45fac | 879 | // |
880 | // processing of LHC related DCS DPs, i.e.: | |
881 | // LHCState | |
882 | // LHCLuminosity | |
883 | // BeamIntensity | |
884 | // | |
885 | ||
886 | Int_t nLHCEntries = 0; | |
887 | TObjArray *array = 0x0; | |
888 | Int_t indexDP = -1; | |
889 | ||
890 | AliInfo(Form("==========LHCState===========")); | |
891 | indexDP = kLHCState; | |
892 | array = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[indexDP]); | |
893 | if(!array) { | |
894 | Log(Form("%s not found in the map!!!",fgkDCSDataPoints[indexDP])); | |
895 | } | |
896 | else { | |
26c1dff2 | 897 | if (array->GetEntries() == 0){ |
898 | AliError(Form("No entries found in array! setting %s to invalid...",fgkDCSDataPoints[indexDP])); | |
899 | } | |
900 | else { | |
901 | TString stringDCS = ProcessChar(array); | |
902 | if (stringDCS.Length()!=0) { | |
903 | Bool_t found = kFALSE; | |
904 | for( Int_t i=0; i<20; i+=2 ) { | |
905 | if( stringDCS.CompareTo(fgkLHCState[i]) == 0 ) { | |
906 | stringDCS = fgkLHCState[i+1]; | |
907 | found = kTRUE; | |
908 | break; | |
909 | } | |
44e45fac | 910 | } |
26c1dff2 | 911 | if (found){ |
912 | Log(Form("<%s> for run %d: %s",fgkDCSDataPoints[indexDP],fRun, stringDCS.Data())); | |
913 | grpObj->SetLHCState(stringDCS); | |
914 | } | |
915 | else{ | |
916 | Log(Form("%s values found not valid!",fgkDCSDataPoints[indexDP])); | |
917 | grpObj->SetLHCState(AliGRPObject::GetInvalidString()); | |
918 | } | |
44e45fac | 919 | } |
26c1dff2 | 920 | else { |
921 | Log(Form("%s not valid (null length), string set as invalid!",fgkDCSDataPoints[indexDP])); | |
44e45fac | 922 | grpObj->SetLHCState(AliGRPObject::GetInvalidString()); |
26c1dff2 | 923 | } |
44e45fac | 924 | } |
44e45fac | 925 | nLHCEntries++; |
926 | } | |
927 | ||
928 | if (array) array = 0x0; | |
929 | ||
930 | AliInfo(Form("==========LHCLuminosity===========")); | |
931 | indexDP = kLHCLuminosity; | |
932 | array = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[indexDP]); | |
933 | if(!array) { | |
934 | Log(Form("%s not found in the map!!!",fgkDCSDataPoints[indexDP])); | |
935 | } | |
936 | else { | |
26c1dff2 | 937 | if (array->GetEntries() == 0){ |
938 | AliError(Form("No entries found in array! setting %s and its Spline Fit to invalid...",fgkDCSDataPoints[indexDP])); | |
939 | } | |
940 | else { | |
941 | Float_t *floatDCS = ProcessFloatAll(array); | |
942 | grpObj->SetLHCLuminosity(floatDCS); | |
943 | delete floatDCS; | |
944 | AliSplineFit* splfit = GetSplineFit(array,fgkDCSDataPoints[indexDP]); | |
945 | grpObj->SetLHCLuminositySplineFit(splfit); | |
946 | // delete splfit; | |
947 | } | |
44e45fac | 948 | nLHCEntries++; |
949 | } | |
950 | ||
951 | if (array) array = 0x0; | |
952 | ||
953 | AliInfo(Form("==========BeamIntensity===========")); | |
954 | indexDP = kBeamIntensity; | |
955 | array = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[indexDP]); | |
956 | if(!array) { | |
957 | Log(Form("%s not found in the map!!!",fgkDCSDataPoints[indexDP])); | |
958 | } | |
959 | else { | |
26c1dff2 | 960 | if (array->GetEntries() == 0){ |
961 | AliError(Form("No entries found in array! setting %s and its Spline Fit to invalid...",fgkDCSDataPoints[indexDP])); | |
962 | } | |
963 | else { | |
964 | Float_t *floatDCS = ProcessFloatAll(array); | |
965 | grpObj->SetBeamIntensity(floatDCS); | |
966 | delete floatDCS; | |
967 | AliSplineFit* splfit1 = GetSplineFit(array,fgkDCSDataPoints[indexDP]); | |
968 | grpObj->SetBeamIntensitySplineFit(splfit1); | |
969 | //delete splfit; | |
970 | } | |
44e45fac | 971 | nLHCEntries++; |
972 | } | |
973 | ||
974 | return nLHCEntries; | |
975 | } | |
976 | //_________________________________________________________________________ | |
977 | ||
39e3007b | 978 | AliSplineFit* AliGRPPreprocessor::GetSplineFit(const TObjArray *array, const TString& stringID){ |
979 | ||
980 | ||
981 | // | |
982 | // returning Spline Fit | |
983 | // | |
44e45fac | 984 | |
985 | Int_t entriesarray = array->GetEntries(); | |
986 | Float_t* value = new Float_t[entriesarray]; | |
987 | Float_t* time = new Float_t[entriesarray]; | |
988 | AliDCSValue* v = 0x0; | |
989 | for (Int_t iarray = 0; iarray < entriesarray; iarray++){ | |
990 | v = (AliDCSValue*)array->At(iarray); | |
991 | value[iarray] = v->GetFloat(); | |
992 | time[iarray] = v->GetTimeStamp(); | |
993 | AliInfo(Form("iarray = %d, value = %f, time = %f",iarray,value[iarray],time[iarray])); | |
994 | } | |
995 | TGraph* gr = new TGraph(entriesarray,value,time); | |
996 | if (!gr ) { | |
997 | AliWarning(Form("%s: no input graph to compute SplineFit",stringID.Data())); | |
998 | return NULL; | |
999 | } | |
1000 | AliSplineFit *fit = new AliSplineFit(); | |
1001 | fit->SetMinPoints(10); | |
1002 | fit->InitKnots(gr,10,10,0.0); | |
1003 | fit->SplineFit(2); | |
1004 | fit->Cleanup(); | |
1005 | if (!fit) { | |
1006 | AliWarning(Form("%s: no fit performed",stringID.Data())); | |
1007 | return NULL; | |
1008 | } | |
1009 | return fit; | |
48b1b444 | 1010 | } |
1011 | ||
44e45fac | 1012 | //_________________________________________________________________________ |
1013 | ||
39e3007b | 1014 | TString AliGRPPreprocessor::ProcessChar(const TObjArray *array) |
e7a6790f | 1015 | { |
17984b61 | 1016 | |
44e45fac | 1017 | // |
1018 | // processing char | |
1019 | // | |
1020 | ||
1021 | TString aDCSString=""; | |
1022 | ||
1023 | AliDCSValue *v = 0x0; | |
1024 | for(Int_t iCount = 0; iCount < array->GetEntries(); iCount++) { | |
1025 | v = (AliDCSValue *)array->At(iCount); | |
26c1dff2 | 1026 | if (((Int_t)(v->GetTimeStamp()) < (Int_t)GetStartTimeDCSQuery()) || ((Int_t)(v->GetTimeStamp()) > (Int_t)GetEndTimeDCSQuery())) { |
44e45fac | 1027 | AliError(Form("DCS values for the parameter outside the queried interval")); |
1028 | continue; | |
1029 | } | |
1030 | if (iCount > 0) { | |
7e6f5523 | 1031 | if (aDCSString != v->GetChar()) |
44e45fac | 1032 | AliError(Form("DCS values for the parameter changed from %s to %c within the queried interval", aDCSString.Data(), (Char_t)v->GetChar())); |
1033 | } | |
1034 | aDCSString = (TString)v->GetChar(); // keeping always last value in the array | |
1035 | } | |
1036 | return aDCSString; | |
1037 | } | |
e7a6790f | 1038 | |
44e45fac | 1039 | //__________________________________________________________________________________________________________________ |
e7a6790f | 1040 | |
39e3007b | 1041 | Float_t* AliGRPPreprocessor::ProcessFloatAll(const TObjArray* array) |
44e45fac | 1042 | { |
1043 | // | |
1044 | // processing Float values using Mean, Median, Standard Deviation wrt Mean, Standar Deviation wrt Median | |
1045 | // | |
1046 | // parameters[0] = mean | |
1047 | // parameters[1] = truncated mean (calculated excluding points outside +/- 3RMS from mean | |
1048 | // parameters[2] = median | |
1049 | // parameters[3] = standard deviation wrt mean | |
1050 | // parameters[4] = standard deviation wrt median | |
1051 | // | |
1052 | ||
5138cd05 | 1053 | Float_t* parameters = new Float_t[5]; |
44e45fac | 1054 | Double_t aDCSArrayMean = 0; // Mean |
1055 | Double_t aDCSArrayTruncMean = 0;// Truncated Mean | |
1056 | Double_t aDCSArrayMedian = 0; // Median | |
1057 | Double_t aDCSArraySDMean = 0; // Standard Deviation wrt Mean | |
1058 | Double_t aDCSArraySDMedian = 0; // Standard Deviation wrt Median | |
1059 | Float_t aDCSArraySum = 0.0; | |
1060 | Int_t iCounts = 0; | |
1061 | Int_t iCounts1 = 0; | |
1062 | Float_t temp = 0; | |
1063 | Float_t temp1 = 0; | |
1064 | Int_t nCounts = array->GetEntries(); | |
1065 | Float_t *tempArray = new Float_t[nCounts]; | |
1066 | for(Int_t i = 0; i < nCounts; i++) { | |
1067 | AliDCSValue *v = (AliDCSValue *)array->At(i); | |
26c1dff2 | 1068 | if(((Int_t)(v->GetTimeStamp()) >= (Int_t)GetStartTimeDCSQuery()) &&((Int_t)(v->GetTimeStamp()) <= (Int_t)GetEndTimeDCSQuery())) { |
44e45fac | 1069 | aDCSArraySum += v->GetFloat(); |
1070 | tempArray[i] = v->GetFloat(); | |
1071 | AliDebug(2,Form("%d-th entry = %f",i,tempArray[i])); | |
1072 | iCounts += 1; | |
1073 | } | |
1074 | } | |
1075 | ||
26c1dff2 | 1076 | AliDebug(2,Form("Using %i entries, starting from %i entries",iCounts,nCounts)); |
44e45fac | 1077 | if(iCounts != 0) { |
26c1dff2 | 1078 | aDCSArrayMean = TMath::Mean(iCounts,tempArray); |
1079 | aDCSArrayMedian = TMath::Median(iCounts,tempArray); | |
1080 | aDCSArraySDMean = TMath::RMS(iCounts,tempArray); | |
1081 | AliDebug(2,Form("SD = %f",aDCSArraySDMean)); | |
44e45fac | 1082 | // computing standard deviation wrt median |
1083 | AliDebug(2,Form("maximum = %f, minimum = %f", aDCSArrayMean+3*aDCSArraySDMean, aDCSArrayMean-3*aDCSArraySDMean)); | |
1084 | for (Int_t i = 0; i < iCounts; i++){ | |
1085 | AliDCSValue *v = (AliDCSValue *)array->At(i); | |
1086 | AliDebug(2,Form("maximum = %f, minimum = %f", aDCSArrayMean+3*aDCSArraySDMean, aDCSArrayMean-3*aDCSArraySDMean)); | |
1087 | AliDebug(2,Form("%i-th entry = %f",i, v->GetFloat())); | |
c135d475 | 1088 | if ((v->GetFloat()<=aDCSArrayMean+3*aDCSArraySDMean) && (v->GetFloat()>=aDCSArrayMean-3*aDCSArraySDMean)){ |
44e45fac | 1089 | temp1+=v->GetFloat(); |
1090 | iCounts1++; | |
c135d475 | 1091 | AliDebug(2,Form("temp1 = %f, iCounts1 = %i",temp1,iCounts1)); |
44e45fac | 1092 | } |
1093 | temp += (v->GetFloat()-aDCSArrayMedian)*(v->GetFloat()-aDCSArrayMedian); | |
1094 | } | |
c135d475 | 1095 | AliDebug(3,Form("temp before the ratio = %f, with %d counts", temp, iCounts)); |
44e45fac | 1096 | temp/=iCounts; |
c135d475 | 1097 | AliDebug(3,Form("temp after the ratio = %f", temp)); |
44e45fac | 1098 | if (temp>0) { |
1099 | aDCSArraySDMedian = TMath::Sqrt(temp); | |
1100 | } | |
c135d475 | 1101 | else if (temp==0) { |
1102 | AliInfo(Form("Radical = 0 in computing standard deviation wrt median! Setting it to zero....")); | |
1103 | aDCSArraySDMedian = 0; | |
1104 | } | |
44e45fac | 1105 | else{ |
c135d475 | 1106 | AliError(Form("Radical < 0 in computing standard deviation! Setting it to invalid....")); |
44e45fac | 1107 | aDCSArraySDMedian = AliGRPObject::GetInvalidFloat(); |
1108 | } | |
1109 | } | |
1110 | else { | |
1111 | aDCSArrayMean = AliGRPObject::GetInvalidFloat(); | |
1112 | aDCSArrayMedian = AliGRPObject::GetInvalidFloat(); | |
1113 | aDCSArraySDMean = AliGRPObject::GetInvalidFloat(); | |
1114 | } | |
c135d475 | 1115 | AliDebug(2,Form("iCounts1 = %d and temp1 = %f",iCounts1, temp1)); |
44e45fac | 1116 | if (iCounts1 > 0) { |
1117 | aDCSArrayTruncMean = temp1/iCounts1; | |
1118 | } | |
1119 | else{ | |
1120 | aDCSArrayTruncMean = AliGRPObject::GetInvalidFloat(); | |
1121 | } | |
1122 | ||
1123 | ||
1124 | ||
26c1dff2 | 1125 | AliDebug(2,Form("mean within %d counts = %f ",iCounts,aDCSArrayMean)); |
1126 | AliDebug(2,Form("truncated mean within %d counts = %f (%i values used)",iCounts,aDCSArrayTruncMean,iCounts1)); | |
1127 | AliDebug(2,Form("median within %d counts = %f ",iCounts,aDCSArrayMedian)); | |
1128 | AliDebug(2,Form("standard deviation with mean within %d counts = %f ",iCounts,aDCSArraySDMean)); | |
1129 | AliDebug(2,Form("standard deviation with median within %d counts = %f ",iCounts,aDCSArraySDMedian)); | |
44e45fac | 1130 | |
1131 | parameters[0] = aDCSArrayMean; | |
1132 | parameters[1] = aDCSArrayTruncMean; | |
1133 | parameters[2] = aDCSArrayMedian; | |
1134 | parameters[3] = aDCSArraySDMean; | |
1135 | parameters[4] = aDCSArraySDMedian; | |
1136 | ||
c135d475 | 1137 | // AliDebug(2,Form("mean = %f, truncated mean = %f, median = %f, SD wrt mean = %f, SD wrt median = %f ",parameters[0],parameters[1],parameters[2],parameters[3],parameters[4])); |
1138 | AliInfo(Form("mean = %f, truncated mean = %f, median = %f, SD wrt mean = %f, SD wrt median = %f ",parameters[0],parameters[1],parameters[2],parameters[3],parameters[4])); | |
44e45fac | 1139 | |
1140 | return parameters; | |
1141 | } | |
125567f8 | 1142 | |
e97cc90e | 1143 | |
44e45fac | 1144 | //_______________________________________________________________ |
e97cc90e | 1145 | |
39e3007b | 1146 | Char_t AliGRPPreprocessor::ProcessBool(const TObjArray* array) |
44e45fac | 1147 | { |
1148 | // | |
1149 | // processing Boolean values | |
1150 | // | |
1151 | ||
1152 | Bool_t aDCSBool = kTRUE; | |
1153 | ||
1154 | AliDCSValue *v = 0x0; | |
26c1dff2 | 1155 | |
44e45fac | 1156 | for(Int_t iCount = 0; iCount < array->GetEntries(); iCount++) { |
1157 | v = (AliDCSValue *)array->At(iCount); | |
26c1dff2 | 1158 | if (((Int_t)(v->GetTimeStamp()) < (Int_t)GetStartTimeDCSQuery()) || ((Int_t)(v->GetTimeStamp()) > (Int_t)GetEndTimeDCSQuery())) { |
44e45fac | 1159 | AliError(Form("DCS values for the parameter outside the queried interval")); |
1160 | continue; | |
1161 | } | |
1162 | if (iCount > 0) { | |
7e6f5523 | 1163 | if (aDCSBool != v->GetBool()) |
44e45fac | 1164 | AliError(Form("DCS values for the parameter changed from %d to %d within the queried interval", (UInt_t)aDCSBool, (UInt_t)v->GetBool())); |
1165 | } | |
1166 | aDCSBool = v->GetBool(); // always keeping last value | |
26c1dff2 | 1167 | AliDebug(2,Form("Bool = %d",(Int_t)aDCSBool)); |
44e45fac | 1168 | } |
1169 | ||
26c1dff2 | 1170 | Char_t caDCSBool = (Char_t) aDCSBool; |
44e45fac | 1171 | return caDCSBool; |
1172 | ||
1173 | } | |
e97cc90e | 1174 | |
44e45fac | 1175 | //_______________________________________________________________ |
e97cc90e | 1176 | |
39e3007b | 1177 | Float_t AliGRPPreprocessor::ProcessInt(const TObjArray* array) |
44e45fac | 1178 | { |
1179 | // | |
1180 | // processing Int values, returning mean | |
1181 | // | |
1182 | ||
1183 | Float_t aDCSArraySum = 0.0; | |
1184 | Float_t aDCSArrayMean = 0.0; | |
1185 | Int_t iCounts = 0; | |
1186 | AliDCSValue* v = 0x0; | |
1187 | ||
1188 | for(Int_t iCount = 0; iCount < array->GetEntries(); iCount++) { | |
1189 | v = (AliDCSValue *)array->At(iCount); | |
26c1dff2 | 1190 | if(((Int_t)(v->GetTimeStamp()) >= (Int_t)GetStartTimeDCSQuery()) &&((Int_t)(v->GetTimeStamp()) <= (Int_t)GetEndTimeDCSQuery())) { |
44e45fac | 1191 | aDCSArraySum += v->GetInt(); |
1192 | iCounts += 1; | |
1193 | } | |
1194 | } | |
1195 | ||
1196 | if(iCounts != 0) aDCSArrayMean = aDCSArraySum/iCounts; | |
1197 | else aDCSArrayMean = AliGRPObject::GetInvalidFloat(); | |
1198 | ||
1199 | return aDCSArrayMean; | |
e97cc90e | 1200 | |
44e45fac | 1201 | } |
1202 | //_______________________________________________________________ | |
e7a6790f | 1203 | |
39e3007b | 1204 | Float_t AliGRPPreprocessor::ProcessUInt(const TObjArray* array) |
44e45fac | 1205 | { |
1206 | // | |
1207 | // processing Int values, returning mean | |
1208 | // | |
1209 | ||
1210 | Float_t aDCSArraySum = 0.0; | |
1211 | Float_t aDCSArrayMean = 0.0; | |
1212 | Int_t iCounts = 0; | |
1213 | AliDCSValue* v = 0x0; | |
1214 | ||
1215 | for(Int_t iCount = 0; iCount < array->GetEntries(); iCount++) { | |
1216 | v = (AliDCSValue *)array->At(iCount); | |
26c1dff2 | 1217 | if(((Int_t)(v->GetTimeStamp()) >= (Int_t)GetStartTimeDCSQuery()) &&((Int_t)(v->GetTimeStamp()) <= (Int_t)GetEndTimeDCSQuery())) { |
44e45fac | 1218 | aDCSArraySum += v->GetUInt(); |
1219 | iCounts += 1; | |
1220 | } | |
1221 | } | |
1222 | ||
1223 | if(iCounts != 0) aDCSArrayMean = aDCSArraySum/iCounts; | |
1224 | else aDCSArrayMean = AliGRPObject::GetInvalidFloat(); | |
1225 | ||
1226 | return aDCSArrayMean; | |
e7a6790f | 1227 | |
17984b61 | 1228 | } |
125567f8 | 1229 | |
44e45fac | 1230 | |
17984b61 | 1231 | //_______________________________________________________________ |
44e45fac | 1232 | |
3ba92a38 | 1233 | AliDCSSensorArray *AliGRPPreprocessor::GetPressureMap(TMap* dcsAliasMap) |
e7a6790f | 1234 | { |
44e45fac | 1235 | // extract DCS pressure maps. Perform fits to save space |
1236 | ||
44e45fac | 1237 | TMap *map = fPressure->ExtractDCS(dcsAliasMap); |
1238 | if (map) { | |
1239 | fPressure->MakeSplineFit(map); | |
1240 | Double_t fitFraction = fPressure->NumFits()/fPressure->NumSensors(); | |
1241 | if (fitFraction > kFitFraction ) { | |
1242 | AliInfo(Form("Pressure values extracted, %d fits performed.", fPressure->NumFits())); | |
1243 | } else { | |
1244 | AliInfo("Too few pressure maps fitted!!!"); | |
1245 | } | |
1246 | } else { | |
1247 | AliInfo("no atmospheric pressure map extracted!!!"); | |
1248 | } | |
1249 | delete map; | |
1250 | ||
1251 | return fPressure; | |
17984b61 | 1252 | } |
e97cc90e | 1253 | |
1e27bb6b | 1254 | |
1255 | ||
1256 | //_______________________________________________________________ | |
3dfcd47d | 1257 | Int_t AliGRPPreprocessor::ReceivePromptRecoParameters(UInt_t run, const char* dbHost, Int_t dbPort, const char* dbName, const char* user, const char* password, const char *cdbRoot) |
1e27bb6b | 1258 | { |
44e45fac | 1259 | // |
1260 | // Retrieves logbook and trigger information from the online logbook | |
1261 | // This information is needed for prompt reconstruction | |
1262 | // | |
1263 | // Parameters are: | |
1264 | // Run number | |
1265 | // DAQ params: dbHost, dbPort, dbName, user, password, logbookTable, triggerTable | |
1266 | // cdbRoot | |
1267 | // | |
1268 | // returns: | |
1269 | // positive on success: the return code is the run number of last run processed of the same run type already processed by the SHUTTLE | |
1270 | // 0 on success and no run was found | |
1271 | // negative on error | |
1272 | // | |
1273 | // This function is NOT called during the preprocessor run in the Shuttle! | |
1274 | // | |
1275 | ||
1276 | // defaults | |
1277 | if (dbPort == 0) | |
1278 | dbPort = 3306; | |
1279 | ||
1280 | // CDB connection | |
1281 | AliCDBManager* cdb = AliCDBManager::Instance(); | |
1282 | cdb->SetDefaultStorage(cdbRoot); | |
1283 | ||
1284 | // SQL connection | |
1285 | TSQLServer* server = TSQLServer::Connect(Form("mysql://%s:%d/%s", dbHost, dbPort, dbName), user, password); | |
1286 | ||
1287 | if (!server) | |
1288 | { | |
1289 | Printf("ERROR: Could not connect to DAQ LB"); | |
1290 | return -1; | |
1291 | } | |
1292 | ||
1293 | // main logbook | |
1294 | TString sqlQuery; | |
26c1dff2 | 1295 | sqlQuery.Form("SELECT DAQ_time_start, run_type, detectorMask, L3_magnetCurrent, Dipole_magnetCurrent FROM logbook WHERE run = %d", run); |
44e45fac | 1296 | TSQLResult* result = server->Query(sqlQuery); |
1297 | if (!result) | |
1298 | { | |
1299 | Printf("ERROR: Can't execute query <%s>!", sqlQuery.Data()); | |
1300 | return -2; | |
1301 | } | |
1302 | ||
1303 | if (result->GetRowCount() == 0) | |
1304 | { | |
1305 | Printf("ERROR: Run %d not found", run); | |
1306 | delete result; | |
1307 | return -3; | |
1308 | } | |
1309 | ||
1310 | TSQLRow* row = result->Next(); | |
1311 | if (!row) | |
1312 | { | |
1313 | Printf("ERROR: Could not receive data from run %d", run); | |
1314 | delete result; | |
1315 | return -4; | |
1316 | } | |
1317 | ||
26c1dff2 | 1318 | TString timeStartString(row->GetField(0)); |
44e45fac | 1319 | TString runType(row->GetField(1)); |
26c1dff2 | 1320 | TString detectorMaskString(row->GetField(2)); |
1321 | TString l3CurrentString(row->GetField(3)); | |
1322 | TString dipoleCurrentString(row->GetField(4)); | |
1323 | time_t timeStart = (time_t)(timeStartString.Atoi()); | |
1324 | UInt_t detectorMask = (UInt_t)(detectorMaskString.Atoi()); | |
1325 | Float_t l3Current = (Float_t)(TMath::Abs(l3CurrentString.Atof())); | |
1326 | Float_t dipoleCurrent = (Float_t)(TMath::Abs(dipoleCurrentString.Atof())); | |
44e45fac | 1327 | |
26c1dff2 | 1328 | AliGRPObject * grpObj = new AliGRPObject(); |
1329 | grpObj->SetTimeStart(timeStart); | |
1330 | grpObj->SetRunType((TString)(row->GetField(1))); | |
1331 | grpObj->SetDetectorMask(detectorMask); | |
1332 | grpObj->SetL3Current(l3Current,(AliGRPObject::Stats)0); | |
1333 | grpObj->SetDipoleCurrent(dipoleCurrent,(AliGRPObject::Stats)0); | |
1334 | ||
44e45fac | 1335 | delete row; |
1336 | row = 0; | |
1337 | ||
1338 | delete result; | |
1339 | result = 0; | |
1340 | ||
1341 | Printf("Storing GRP/GRP/Data object with the following content"); | |
26c1dff2 | 1342 | grpObj->Dump(); |
44e45fac | 1343 | |
1344 | AliCDBMetaData metadata; | |
26c1dff2 | 1345 | metadata.SetResponsible("Jan Fiete Grosse-Oetringhaus & Chiara Zampolli"); |
44e45fac | 1346 | metadata.SetComment("GRP Output parameters received during online running"); |
1347 | ||
1348 | AliCDBId id("GRP/GRP/Data", run, run); | |
26c1dff2 | 1349 | Bool_t success = cdb->Put(grpObj, id, &metadata); |
44e45fac | 1350 | |
26c1dff2 | 1351 | delete grpObj; |
44e45fac | 1352 | |
1353 | if (!success) | |
1354 | { | |
1355 | Printf("ERROR: Could not store GRP/GRP/Data into OCDB"); | |
1356 | return -5; | |
1357 | } | |
1358 | ||
1359 | // Receive trigger information | |
1360 | sqlQuery.Form("SELECT configFile FROM logbook_trigger_config WHERE run = %d", run); | |
1361 | result = server->Query(sqlQuery); | |
1362 | if (!result) | |
1363 | { | |
1364 | Printf("ERROR: Can't execute query <%s>!", sqlQuery.Data()); | |
1365 | return -11; | |
1366 | } | |
1367 | ||
1368 | if (result->GetRowCount() == 0) | |
1369 | { | |
1370 | Printf("ERROR: Run %d not found in logbook_trigger_config", run); | |
1371 | delete result; | |
1372 | return -12; | |
1373 | } | |
1374 | ||
1375 | row = result->Next(); | |
1376 | if (!row) | |
1377 | { | |
1378 | Printf("ERROR: Could not receive logbook_trigger_config data from run %d", run); | |
1379 | delete result; | |
1380 | return -13; | |
1381 | } | |
1382 | ||
1383 | TString triggerConfig(row->GetField(0)); | |
1384 | ||
1385 | delete row; | |
1386 | row = 0; | |
1387 | ||
1388 | delete result; | |
1389 | result = 0; | |
1390 | ||
1391 | Printf("Found trigger configuration: %s", triggerConfig.Data()); | |
1392 | ||
1393 | AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfigurationFromString(triggerConfig); | |
1394 | if (!runcfg) | |
1395 | { | |
1396 | Printf("ERROR: Could not create CTP configuration object"); | |
1397 | return -14; | |
1398 | } | |
1399 | ||
1400 | metadata.SetComment("CTP run configuration received during online running"); | |
1401 | ||
1402 | AliCDBId id2("GRP/CTP/Config", run, run); | |
1403 | success = cdb->Put(runcfg, id2, &metadata); | |
1404 | ||
1405 | delete runcfg; | |
1406 | runcfg = 0; | |
1407 | ||
1408 | if (!success) | |
1409 | { | |
1410 | Printf("ERROR: Could not store GRP/CTP/Config into OCDB"); | |
1411 | return -15; | |
1412 | } | |
1413 | ||
1414 | // get last run with same run type that was already processed by the SHUTTLE | |
1415 | ||
1416 | sqlQuery.Form("SELECT max(logbook.run) FROM logbook LEFT JOIN logbook_shuttle ON logbook_shuttle.run = logbook.run WHERE run_type = '%s' AND shuttle_done = 1", runType.Data()); | |
1417 | result = server->Query(sqlQuery); | |
1418 | if (!result) | |
1419 | { | |
1420 | Printf("ERROR: Can't execute query <%s>!", sqlQuery.Data()); | |
1421 | return -21; | |
1422 | } | |
1423 | ||
1424 | if (result->GetRowCount() == 0) | |
1425 | { | |
1426 | Printf("ERROR: No result with query <%s>", sqlQuery.Data()); | |
1427 | delete result; | |
1428 | return -22; | |
1429 | } | |
1430 | ||
1431 | row = result->Next(); | |
1432 | if (!row) | |
1433 | { | |
1434 | Printf("ERROR: Could not receive data for query <%s>", sqlQuery.Data()); | |
1435 | delete result; | |
1436 | return -23; | |
1437 | } | |
1438 | ||
1439 | TString lastRunStr(row->GetField(0)); | |
1440 | Int_t lastRun = lastRunStr.Atoi(); | |
1441 | ||
1442 | Printf("Last run with same run type %s is %d", runType.Data(), lastRun); | |
1443 | ||
1444 | delete row; | |
1445 | row = 0; | |
1446 | ||
1447 | delete result; | |
1448 | result = 0; | |
1449 | ||
1450 | server->Close(); | |
1451 | delete server; | |
1452 | server = 0; | |
1453 | ||
1454 | return lastRun; | |
1e27bb6b | 1455 | } |