Added methods for finding a given module in the DDL map (F. Prino)
[u/mrichter/AliRoot.git] / STEER / AliGRPPreprocessor.cxx
CommitLineData
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
22//-------------------------------------------------------------------------
23
836d8b4f 24#include <TChain.h>
7ca4655f 25#include <TList.h>
26#include <TMap.h>
27#include <TObjString.h>
28#include <TTimeStamp.h>
29cc8704 29#include <TSystem.h>
30#include <TFile.h>
7ca4655f 31
3dedb44a 32#include "AliGRPPreprocessor.h"
33#include "AliGRPDCS.h"
17984b61 34#include "AliDCSSensorArray.h"
3dedb44a 35
48b1b444 36#include "AliTriggerConfiguration.h"
37#include "AliTriggerRunScalers.h"
38
3dedb44a 39#include "AliCDBMetaData.h"
40#include "AliLog.h"
41
3dedb44a 42class AliDCSValue;
43class AliShuttleInterface;
44
45#include <TH1.h>
46
17984b61 47const Double_t kFitFraction = 0.7; // Fraction of DCS sensor fits required
48
3dedb44a 49ClassImp(AliGRPPreprocessor)
50
51//_______________________________________________________________
17984b61 52 const char* AliGRPPreprocessor::fgkDCSDataPoints[12] = {"LHCState","LHCPeriod","LHCLuminosity","BeamIntensity","L3Current","L3Polarity","DipoleCurrent","DipolePolarity","CavernTemperature","CavernAtmosPressure","gva_cr5AtmosphericPressure","gva_meyrinAtmosphericPressure"};
53
54//_______________________________________________________________
3dedb44a 55AliGRPPreprocessor::AliGRPPreprocessor():
17984b61 56 AliPreprocessor("GRP",0), fPressure(0) {
3dedb44a 57 // default constructor - Don't use this!
58
59}
60
61//_______________________________________________________________
62AliGRPPreprocessor::AliGRPPreprocessor(AliShuttleInterface* shuttle):
17984b61 63 AliPreprocessor("GRP",shuttle), fPressure(0) {
3dedb44a 64 // constructor - shuttle must be instantiated!
65
66}
67
68//_______________________________________________________________
69AliGRPPreprocessor::~AliGRPPreprocessor() {
70 //destructor
17984b61 71 delete fPressure;
3dedb44a 72}
73
74//_______________________________________________________________
75void AliGRPPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime) {
76 // Initialize preprocessor
77
78 AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run, TTimeStamp(startTime).AsString(), TTimeStamp(endTime).AsString()));
79
80 fRun = run;
81 fStartTime = startTime;
82 fEndTime = endTime;
17984b61 83 AliInfo("Initialization of the GRP preprocessor.");
84
85 TClonesArray * array = new TClonesArray("AliDCSSensor",2);
86 for(Int_t j = 0; j < 2; j++) {
87 AliDCSSensor * sens = new ((*array)[j])AliDCSSensor;
88 sens->SetStringID(fgkDCSDataPoints[j+10]);
89 }
90 AliInfo(Form("Pressure Entries: %d",array->GetEntries()));
91
92 fPressure = new AliDCSSensorArray(fStartTime, fEndTime, array);
3dedb44a 93}
94
95//_______________________________________________________________
96UInt_t AliGRPPreprocessor::Process(TMap* valueMap) {
97 // process data retrieved by the Shuttle
17984b61 98
99 //=================//
100 // DAQ logbook //
101 //=================//
29cc8704 102
17984b61 103 TList *daqlblist = ProcessDaqLB();
104 if(!daqlblist) {
105 Log(Form("Problem with the DAQ logbook parameters!!!"));
b49acef7 106 return 1;
17984b61 107 }
108 TMap *m1 = (TMap *)daqlblist->At(0);
109 TObjString *s1 = (TObjString *)m1->GetValue("fAliceStartTime");
110 UInt_t iStartTime = atoi(s1->String().Data());
111 TMap *m2 = (TMap *)daqlblist->At(1);
112 TObjString *s2 = (TObjString *)m2->GetValue("fAliceStopTime");
113 UInt_t iStopTime = atoi(s2->String().Data());
17984b61 114
115 //=================//
116 // DAQ FXS //
117 //=================//
bba57327 118 UInt_t iDaqFxs = ProcessDaqFxs();
8b5f35a9 119 if(iDaqFxs == 0) {
120 Log(Form("ProcessDaqFxs successful!"));
b49acef7 121 } else {
122 Log(Form("Could not store run raw tag file!"));
123 return 1;
124 }
125
48b1b444 126 //=================//
127 // DCS FXS //
128 //=================//
129 UInt_t iDcsFxs = ProcessDcsFxs();
130 if(iDcsFxs == 0) {
131 Log(Form("ProcessDcsFxs successful!"));
132 } else {
133 Log(Form("Could not store CTP run configuration and scalers!"));
134 return 1;
135 }
b49acef7 136
17984b61 137 //=================//
138 // DCS data points //
139 //=================//
140 TList *dcsdplist = ProcessDcsDPs(valueMap, iStartTime, iStopTime);
141 if(!dcsdplist) {
142 Log(Form("Problem with the DCS data points!!!"));
09d9e56b 143 return 1;
17984b61 144 }
145 if(dcsdplist->GetEntries() != 10) {
146 Log(Form("Problem with the DCS data points!!!"));
09d9e56b 147 // return 1; // TODO:COMMENTED FOR TESTING PURPOSES!
17984b61 148 }
149 //NEEDS TO BE REVISED - BREAKS!!!
150// AliDCSSensorArray *dcsSensorArray = GetPressureMap(valueMap,fPressure);
151// if(!dcsSensorArray) {
152// Log(Form("Problem with the pressure sensor values!!!"));
153// return 0;
154// }
155
156 TList * list = new TList();
157 list = GetGlobalList(daqlblist,dcsdplist);
158 list->SetOwner(1);
159 AliInfo(Form("Final list entries: %d",list->GetEntries()));
160
161 AliCDBMetaData md;
162 md.SetResponsible("Panos Christakoglou");
163 md.SetComment("Output parameters from the GRP preprocessor.");
164
165 Bool_t result = Store("GRP", "Data", list, &md);
166
167 delete list;
168
169 if (result)
170 return 0;
171 else
172 return 1;
173}
174
175//_______________________________________________________________
176TList *AliGRPPreprocessor::GetGlobalList(TList *l1, TList *l2) {
177 //Getting the global output TList
178 TList *list = new TList();
179 TMap *map = new TMap();
180 for(Int_t i = 0; i < l1->GetEntries(); i++)
181 list->AddLast(map = (TMap *)l1->At(i));
182 for(Int_t i = 0; i < l2->GetEntries(); i++)
183 list->AddLast(map = (TMap *)l2->At(i));
184
185 return list;
186}
187
188//_______________________________________________________________
189TList *AliGRPPreprocessor::ProcessDaqLB() {
190 //Getting the DAQ lb informnation
3dedb44a 191 const char* timeStart = GetRunParameter("time_start");
192 const char* timeEnd = GetRunParameter("time_end");
125567f8 193 const char* beamEnergy = GetRunParameter("beamEnergy");
194 const char* beamType = GetRunParameter("beamType");
195 const char* numberOfDetectors = GetRunParameter("numberOfDetectors");
196 const char* detectorMask = GetRunParameter("detectorMask");
fed5d40b 197 const char* lhcPeriod = GetRunParameter("LHCperiod");
125567f8 198
17984b61 199 if (timeStart) {
200 Log(Form("Start time for run %d: %s",fRun, timeStart));
201 } else {
202 Log(Form("Start time not put in logbook!"));
203 }
204 TMap *mapDAQ1 = new TMap();
205 mapDAQ1->Add(new TObjString("fAliceStartTime"),new TObjString(timeStart));
206
207 if (timeEnd) {
208 Log(Form("End time for run %d: %s",fRun, timeEnd));
209 } else {
210 Log(Form("End time not put in logbook!"));
211 }
212 TMap *mapDAQ2 = new TMap();
213 mapDAQ2->Add(new TObjString("fAliceStopTime"),new TObjString(timeEnd));
214
215 if (beamEnergy) {
216 Log(Form("Beam energy for run %d: %s",fRun, beamEnergy));
217 } else {
218 Log(Form("Beam energy not put in logbook!"));
219 }
220 TMap *mapDAQ3 = new TMap();
221 mapDAQ3->Add(new TObjString("fAliceBeamEnergy"),new TObjString(beamEnergy));
222
223 if (beamType) {
224 Log(Form("Beam type for run %d: %s",fRun, beamType));
225 } else {
226 Log(Form("Beam type not put in logbook!"));
227 }
228 TMap *mapDAQ4 = new TMap();
229 mapDAQ4->Add(new TObjString("fAliceBeamType"),new TObjString(beamType));
230
231 if (numberOfDetectors) {
232 Log(Form("Number of active detectors for run %d: %s",fRun, numberOfDetectors));
233 } else {
234 Log(Form("Number of active detectors not put in logbook!"));
235 }
236 TMap *mapDAQ5 = new TMap();
237 mapDAQ5->Add(new TObjString("fNumberOfDetectors"),new TObjString(numberOfDetectors));
238
239 if (detectorMask) {
240 Log(Form("Detector mask for run %d: %s",fRun, detectorMask));
241 } else {
242 Log(Form("Detector mask not put in logbook!"));
243 }
244 TMap *mapDAQ6 = new TMap();
245 mapDAQ6->Add(new TObjString("fDetectorMask"),new TObjString(detectorMask));
246
247 if (lhcPeriod) {
248 Log(Form("LHC period (DAQ) for run %d: %s",fRun, lhcPeriod));
249 } else {
250 Log(Form("LHCperiod not put in logbook!"));
251 }
252 TMap *mapDAQ7 = new TMap();
253 mapDAQ7->Add(new TObjString("fLHCPeriod"),new TObjString(lhcPeriod));
254
255 TList *list = new TList();
256 list->Add(mapDAQ1); list->Add(mapDAQ2);
257 list->Add(mapDAQ3); list->Add(mapDAQ4);
258 list->Add(mapDAQ5); list->Add(mapDAQ6);
259 list->Add(mapDAQ7);
260
261 return list;
262}
263
264//_______________________________________________________________
bba57327 265UInt_t AliGRPPreprocessor::ProcessDaqFxs() {
836d8b4f 266 //======DAQ FXS======//
29cc8704 267
c865efca 268 TList* list = GetFileSources(kDAQ);
269 if (!list) {
ff97356e 270 Log("No raw data tag list: connection problems with DAQ FXS logbook!");
271 return 1;
272 }
273
274 if (list->GetEntries() == 0)
275 {
276 Log("no raw data tags in this run: nothing to merge!");
277 delete list; list=0;
278 return 0;
c865efca 279 }
ff97356e 280
281 TChain *fRawTagChain = new TChain("T");
282 Int_t nFiles=0;
4a33bdd9 283 TIterator* iter = list->MakeIterator();
284 TObject* obj = 0;
958ecabf 285 while ((obj = iter->Next())) {
286 TObjString* objStr = dynamic_cast<TObjString*> (obj);
287 if (objStr) {
288 Log(Form("Found source %s", objStr->String().Data()));
289 TList* list2 = GetFileIDs(kDAQ, objStr->String());
836d8b4f 290 if (!list2) {
ff97356e 291 Log("No list with ids from DAQ was found: connection problems with DAQ FXS logbook!");
292 delete fRawTagChain; fRawTagChain=0;
293 return 1;
836d8b4f 294 }
295 Log(Form("Number of ids: %d",list2->GetEntries()));
296 for(Int_t i = 0; i < list2->GetEntries(); i++) {
297 TObjString *idStr = (TObjString *)list2->At(i);
ff97356e 298 TString fileName = GetFile(kDAQ,idStr->String().Data(),objStr->String().Data());
299 if (fileName.Length() > 0)
300 {
301 Log(Form("Adding file in the chain: %s",fileName.Data()));
302 fRawTagChain->Add(fileName.Data());
303 nFiles++;
304 } else {
305 Log(Form("Could not retrieve file with id %s from source %s: "
306 "connection problems with DAQ FXS!",
307 idStr->String().Data(),objStr->String().Data()));
308 delete list; list=0;
309 delete list2; list2=0;
310 delete fRawTagChain; fRawTagChain=0;
311 return 2;
312 }
836d8b4f 313 }
958ecabf 314 delete list2;
315 }
316 }
ff97356e 317
29cc8704 318 TString fRawDataFileName = "GRP_Merged.tag.root";
ff97356e 319 Log(Form("Merging %d raw data tags into file: %s", nFiles, fRawDataFileName.Data()));
b49acef7 320 fRawTagChain->Merge(fRawDataFileName);
29cc8704 321
b49acef7 322 TString outputfile = Form("Run%d.Merged.RAW.tag.root", fRun);
bba57327 323 Bool_t result = StoreRunMetadataFile(fRawDataFileName.Data(),outputfile.Data());
ff97356e 324
325 if (!result)
326 {
327 Log("Problem storing raw data tags in local file!!");
8b5f35a9 328 } else {
329 Log("Raw data tags merged successfully!!");
ff97356e 330 }
331
332 delete iter;
333 delete list;
334 delete fRawTagChain; fRawTagChain=0;
8b5f35a9 335
336 if (result == kFALSE)
337 {
338 return 3;
339 }
340
073502c9 341 return 0;
8b5f35a9 342
17984b61 343}
344
345//_______________________________________________________________
48b1b444 346UInt_t AliGRPPreprocessor::ProcessDcsFxs() {
347 //======DCS FXS======//
348 // Get the CTP run configuration
349 // and scalers from DCS FXS
350
351 {
352 // Get the CTP run configuration
353 TList* list = GetFileSources(kDCS,"CTP_runconfig");
354 if (!list) {
cbdd8439 355 Log("No CTP runconfig file: connection problems with DCS FXS logbook!");
48b1b444 356 return 1;
357 }
358
359 if (list->GetEntries() == 0) {
360 Log("No CTP runconfig file to be processed!");
361 }
362 else {
363 TIter iter(list);
364 TObjString *source;
365 while ((source = dynamic_cast<TObjString *> (iter.Next()))) {
366 TString runcfgfile = GetFile(kDCS, "CTP_runconfig", source->GetName());
7229d3c2 367 if (runcfgfile.IsNull()) {
368 Log("No CTP runconfig files has been found: empty source!");
48b1b444 369 }
7229d3c2 370 else {
371 Log(Form("File with Id CTP_runconfig found in source %s! Copied to %s",source->GetName(),runcfgfile.Data()));
372 AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfiguration(runcfgfile);
373 if (!runcfg) {
374 Log("Bad CTP run configuration file! The corresponding CDB entry will not be filled!");
375 }
376 else {
377 AliCDBMetaData metaData;
378 metaData.SetBeamPeriod(0);
379 metaData.SetResponsible("Roman Lietava");
380 metaData.SetComment("CTP run configuration");
381 if (!Store("CTP","Config", runcfg, &metaData, 0, 0)) {
382 Log("Unable to store the CTP run configuration object to OCDB!");
383 }
384 }
48b1b444 385 }
386 }
387 }
388 delete list;
389 }
390
391 {
392 // Get the CTP counters information
393 TList* list = GetFileSources(kDCS,"CTP_xcounters");
394 if (!list) {
395 Log("No CTP counters file: connection problems with DAQ FXS logbook!");
396 return 1;
397 }
398
399 if (list->GetEntries() == 0) {
400 Log("No CTP counters file to be processed!");
401 }
402 else {
403 TIter iter(list);
404 TObjString *source;
405 while ((source = dynamic_cast<TObjString *> (iter.Next()))) {
406 TString countersfile = GetFile(kDCS, "CTP_xcounters", source->GetName());
7229d3c2 407 if (countersfile.IsNull()) {
408 Log("No CTP counters files has been found: empty source!");
48b1b444 409 }
7229d3c2 410 else {
411 Log(Form("File with Id CTP_xcounters found in source %s! Copied to %s",source->GetName(),countersfile.Data()));
412 AliTriggerRunScalers *scalers = AliTriggerRunScalers::ReadScalers(countersfile);
413 if (!scalers) {
414 Log("Bad CTP counters file! The corresponding CDB entry will not be filled!");
415 }
416 else {
417 AliCDBMetaData metaData;
418 metaData.SetBeamPeriod(0);
419 metaData.SetResponsible("Roman Lietava");
420 metaData.SetComment("CTP scalers");
421 if (!Store("CTP","Scalers", scalers, &metaData, 0, 0)) {
422 Log("Unable to store the CTP scalers object to OCDB!");
423 }
424 }
48b1b444 425 }
426 }
427 }
428 delete list;
429 }
430
431 return 0;
432}
433
434//_______________________________________________________________
17984b61 435TList *AliGRPPreprocessor::ProcessDcsDPs(TMap* valueMap, UInt_t iStartTime, UInt_t iStopTime) {
436 //Getting the DCS dps
e97cc90e 437 //===========//
17984b61 438
439 TList *list = new TList();
440
e97cc90e 441 //DCS data points
442 //===========//
17984b61 443 AliInfo(Form("==========LHCState==========="));
444 TObjArray *aliasLHCState = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[0]);
e97cc90e 445 if(!aliasLHCState) {
446 Log(Form("LHCState not found!!!"));
17984b61 447 return list;
8ecdaed6 448 }
1f9bf847 449 AliGRPDCS *dcs1 = new AliGRPDCS(aliasLHCState,iStartTime,iStopTime);
e97cc90e 450 TString sLHCState = dcs1->ProcessDCS(3);
451 if (sLHCState) {
452 Log(Form("<LHCState> for run %d: %s",fRun, sLHCState.Data()));
453 } else {
454 Log(Form("LHCState not put in TMap!"));
455 }
17984b61 456 TMap *mapDCS1 = new TMap();
457 mapDCS1->Add(new TObjString("fLHCState"),new TObjString(sLHCState));
458 list->Add(mapDCS1);
e97cc90e 459
17984b61 460 AliInfo(Form("==========LHCPeriod==========="));
461 TObjArray *aliasLHCPeriod = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[1]);
e97cc90e 462 if(!aliasLHCPeriod) {
463 Log(Form("LHCPeriod not found!!!"));
17984b61 464 return list;
e97cc90e 465 }
1f9bf847 466 AliGRPDCS *dcs2 = new AliGRPDCS(aliasLHCPeriod,iStartTime,iStopTime);
e97cc90e 467 TString sLHCPeriod = dcs2->ProcessDCS(3);
468 if (sLHCPeriod) {
469 Log(Form("<LHCPeriod> for run %d: %s",fRun, sLHCPeriod.Data()));
3dedb44a 470 } else {
e97cc90e 471 Log(Form("LHCPeriod not put in TMap!"));
3dedb44a 472 }
17984b61 473 TMap *mapDCS2 = new TMap();
474 mapDCS2->Add(new TObjString("fLHCCondition"),new TObjString(sLHCPeriod));
475 list->Add(mapDCS2);
125567f8 476
17984b61 477 AliInfo(Form("==========LHCLuminosity==========="));
478 TObjArray *aliasLHCLuminosity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[2]);
e97cc90e 479 if(!aliasLHCLuminosity) {
480 Log(Form("LHCLuminosity not found!!!"));
17984b61 481 return list;
e97cc90e 482 }
1f9bf847 483 AliGRPDCS *dcs3 = new AliGRPDCS(aliasLHCLuminosity,iStartTime,iStopTime);
e97cc90e 484 TString sMeanLHCLuminosity = dcs3->ProcessDCS(2);
485 if (sMeanLHCLuminosity) {
486 Log(Form("<LHCLuminosity> for run %d: %s",fRun, sMeanLHCLuminosity.Data()));
487 } else {
488 Log(Form("LHCLuminosity not put in TMap!"));
489 }
17984b61 490 TMap *mapDCS3 = new TMap();
491 mapDCS3->Add(new TObjString("fLHCLuminosity"),new TObjString(sMeanLHCLuminosity));
492 list->Add(mapDCS3);
e97cc90e 493
17984b61 494 AliInfo(Form("==========BeamIntensity==========="));
495 TObjArray *aliasBeamIntensity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[3]);
e97cc90e 496 if(!aliasBeamIntensity) {
497 Log(Form("BeamIntensity not found!!!"));
17984b61 498 return list;
e97cc90e 499 }
1f9bf847 500 AliGRPDCS *dcs4 = new AliGRPDCS(aliasBeamIntensity,iStartTime,iStopTime);
e97cc90e 501 TString sMeanBeamIntensity = dcs4->ProcessDCS(2);
502 if (sMeanBeamIntensity) {
503 Log(Form("<BeamIntensity> for run %d: %s",fRun, sMeanBeamIntensity.Data()));
504 } else {
505 Log(Form("BeamIntensity not put in TMap!"));
506 }
17984b61 507 TMap *mapDCS4 = new TMap();
508 mapDCS4->Add(new TObjString("fBeamIntensity"),new TObjString(sMeanBeamIntensity));
509 list->Add(mapDCS4);
e97cc90e 510
17984b61 511 AliInfo(Form("==========L3Current==========="));
512 TObjArray *aliasL3Current = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[4]);
e97cc90e 513 if(!aliasL3Current) {
514 Log(Form("L3Current not found!!!"));
17984b61 515 return list;
e97cc90e 516 }
1f9bf847 517 AliGRPDCS *dcs5 = new AliGRPDCS(aliasL3Current,iStartTime,iStopTime);
e97cc90e 518 TString sMeanL3Current = dcs5->ProcessDCS(2);
519 if (sMeanL3Current) {
520 Log(Form("<L3Current> for run %d: %s",fRun, sMeanL3Current.Data()));
521 } else {
522 Log(Form("L3Current not put in TMap!"));
523 }
17984b61 524 TMap *mapDCS5 = new TMap();
525 mapDCS5->Add(new TObjString("fL3Current"),new TObjString(sMeanL3Current));
526 list->Add(mapDCS5);
e97cc90e 527
17984b61 528 AliInfo(Form("==========L3Polarity==========="));
529 TObjArray *aliasL3Polarity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[5]);
e97cc90e 530 if(!aliasL3Polarity) {
531 Log(Form("L3Polarity not found!!!"));
17984b61 532 return list;
e97cc90e 533 }
1f9bf847 534 AliGRPDCS *dcs6 = new AliGRPDCS(aliasL3Polarity,iStartTime,iStopTime);
e97cc90e 535 TString sL3Polarity = dcs6->ProcessDCS(4);
536 if (sL3Polarity) {
537 Log(Form("<L3Polarity> for run %d: %s",fRun, sL3Polarity.Data()));
538 } else {
539 Log(Form("L3Polarity not put in TMap!"));
540 }
17984b61 541 TMap *mapDCS6 = new TMap();
542 mapDCS6->Add(new TObjString("fL3Polarity"),new TObjString(sL3Polarity));
543 list->Add(mapDCS6);
e97cc90e 544
17984b61 545 AliInfo(Form("==========DipoleCurrent==========="));
546 TObjArray *aliasDipoleCurrent = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[6]);
e97cc90e 547 if(!aliasDipoleCurrent) {
548 Log(Form("DipoleCurrent not found!!!"));
17984b61 549 return list;
e97cc90e 550 }
1f9bf847 551 AliGRPDCS *dcs7 = new AliGRPDCS(aliasDipoleCurrent,iStartTime,iStopTime);
e97cc90e 552 TString sMeanDipoleCurrent = dcs7->ProcessDCS(2);
553 if (sMeanDipoleCurrent) {
554 Log(Form("<DipoleCurrent> for run %d: %s",fRun, sMeanDipoleCurrent.Data()));
555 } else {
556 Log(Form("DipoleCurrent not put in TMap!"));
557 }
17984b61 558 TMap *mapDCS7 = new TMap();
559 mapDCS7->Add(new TObjString("fDipoleCurrent"),new TObjString(sMeanDipoleCurrent));
560 list->Add(mapDCS7);
e97cc90e 561
17984b61 562 AliInfo(Form("==========DipolePolarity==========="));
563 TObjArray *aliasDipolePolarity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[7]);
e97cc90e 564 if(!aliasDipolePolarity) {
565 Log(Form("DipolePolarity not found!!!"));
17984b61 566 return list;
e97cc90e 567 }
1f9bf847 568 AliGRPDCS *dcs8 = new AliGRPDCS(aliasDipolePolarity,iStartTime,iStopTime);
e97cc90e 569 TString sDipolePolarity = dcs8->ProcessDCS(4);
570 if (sDipolePolarity) {
571 Log(Form("<DipolePolarity> for run %d: %s",fRun, sDipolePolarity.Data()));
572 } else {
573 Log(Form("DipolePolarity not put in TMap!"));
574 }
17984b61 575 TMap *mapDCS8 = new TMap();
576 mapDCS8->Add(new TObjString("fDipolePolarity"),new TObjString(sDipolePolarity));
577 list->Add(mapDCS8);
e97cc90e 578
17984b61 579 AliInfo(Form("==========CavernTemperature==========="));
580 TObjArray *aliasCavernTemperature = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[8]);
e97cc90e 581 if(!aliasCavernTemperature) {
582 Log(Form("CavernTemperature not found!!!"));
17984b61 583 return list;
e97cc90e 584 }
1f9bf847 585 AliGRPDCS *dcs9 = new AliGRPDCS(aliasCavernTemperature,iStartTime,iStopTime);
e97cc90e 586 TString sMeanCavernTemperature = dcs9->ProcessDCS(2);
587 if (sMeanCavernTemperature) {
588 Log(Form("<CavernTemperature> for run %d: %s",fRun, sMeanCavernTemperature.Data()));
589 } else {
590 Log(Form("CavernTemperature not put in TMap!"));
591 }
17984b61 592 TMap *mapDCS9 = new TMap();
593 mapDCS9->Add(new TObjString("fCavernTemperature"),new TObjString(sMeanCavernTemperature));
594 list->Add(mapDCS9);
e97cc90e 595
17984b61 596 AliInfo(Form("==========CavernPressure==========="));
597 TObjArray *aliasCavernPressure = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[9]);
e97cc90e 598 if(!aliasCavernPressure) {
599 Log(Form("CavernPressure not found!!!"));
17984b61 600 return list;
e97cc90e 601 }
1f9bf847 602 AliGRPDCS *dcs10 = new AliGRPDCS(aliasCavernPressure,iStartTime,iStopTime);
e97cc90e 603 TString sMeanCavernPressure = dcs10->ProcessDCS(2);
604 if (sMeanCavernPressure) {
605 Log(Form("<CavernPressure> for run %d: %s",fRun, sMeanCavernPressure.Data()));
606 } else {
607 Log(Form("CavernPressure not put in TMap!"));
608 }
17984b61 609 TMap *mapDCS10 = new TMap();
610 mapDCS10->Add(new TObjString("fCavernPressure"),new TObjString(sMeanCavernPressure));
611 list->Add(mapDCS10);
e97cc90e 612
17984b61 613 return list;
614}
125567f8 615
17984b61 616//_______________________________________________________________
617AliDCSSensorArray *AliGRPPreprocessor::GetPressureMap(TMap* dcsAliasMap, AliDCSSensorArray *fPressure) {
618 // extract DCS pressure maps. Perform fits to save space
3dedb44a 619
17984b61 620 TMap *map = fPressure->ExtractDCS(dcsAliasMap);
621 if (map) {
622 fPressure->MakeSplineFit(map);
623 Double_t fitFraction = fPressure->NumFits()/fPressure->NumSensors();
624 if (fitFraction > kFitFraction ) {
625 AliInfo(Form("Pressure values extracted, fits performed.\n"));
626 } else {
627 AliInfo("Too few pressure maps fitted. \n");
628 }
629 } else {
630 AliInfo("AliGRPDCS: no atmospheric pressure map extracted. \n");
631 }
632 delete map;
633
634 return fPressure;
635}
e97cc90e 636
17984b61 637//_______________________________________________________________
638/*UInt_t AliGRPPreprocessor::MapPressure(TMap* dcsAliasMap) {
639 // extract DCS pressure maps. Perform fits to save space
3dedb44a 640
17984b61 641 UInt_t result=0;
642 TMap *map = fPressure->ExtractDCS(dcsAliasMap);
643 if (map) {
644 fPressure->MakeSplineFit(map);
645 Double_t fitFraction = fPressure->NumFits()/fPressure->NumSensors();
646 if (fitFraction > kFitFraction ) {
647 AliInfo(Form("Pressure values extracted, fits performed.\n"));
648 } else {
649 Log ("Too few pressure maps fitted. \n");
650 result = 9;
651 }
652 } else {
653 Log("AliTPCPreprocsessor: no atmospheric pressure map extracted. \n");
654 result=9;
655 }
656 delete map;
657 // Now store the final CDB file
3dedb44a 658
17984b61 659 if ( result == 0 ) {
660 AliCDBMetaData metaData;
661 metaData.SetBeamPeriod(0);
662 metaData.SetResponsible("Panos Christakoglou");
663 metaData.SetComment("Preprocessor AliGRP data base pressure entries.");
664
665 Bool_t storeOK = Store("Calib", "Pressure", fPressure, &metaData, 0, 0);
666 if ( !storeOK ) result=1;
667 }
3dedb44a 668
17984b61 669 return result;
670 }*/