Proton analysis for AODs - analysis train
[u/mrichter/AliRoot.git] / STEER / AliGRPPreprocessor.cxx
CommitLineData
3dedb44a 1/**************************************************************************
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
17984b61 51//_______________________________________________________________
52 const char* AliGRPPreprocessor::fgkDCSDataPoints[12] = {"LHCState","LHCPeriod","LHCLuminosity","BeamIntensity","L3Current","L3Polarity","DipoleCurrent","DipolePolarity","CavernTemperature","CavernAtmosPressure","gva_cr5AtmosphericPressure","gva_meyrinAtmosphericPressure"};
53
3dedb44a 54//_______________________________________________________________
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
48b1b444 345//_______________________________________________________________
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) {
355 Log("No CTP runconfig file: connection problems with DAQ FXS logbook!");
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());
367 Log(Form("File with Id CTP_runconfig found in source %s! Copied to %s",source->GetName(),runcfgfile.Data()));
368 AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfiguration(runcfgfile);
369 if (!runcfg) {
370 Log("Bad CTP run configuration file! The corresponding CDB entry will not be filled!");
371 }
372 AliCDBMetaData metaData;
373 metaData.SetBeamPeriod(0);
374 metaData.SetResponsible("Roman Lietava");
375 metaData.SetComment("CTP run configuration");
376 if (!Store("CTP","Config", runcfg, &metaData, 0, 0)) {
377 Log("Unable to store the CTP run configuration object to OCDB!");
378 }
379 }
380 }
381 delete list;
382 }
383
384 {
385 // Get the CTP counters information
386 TList* list = GetFileSources(kDCS,"CTP_xcounters");
387 if (!list) {
388 Log("No CTP counters file: connection problems with DAQ FXS logbook!");
389 return 1;
390 }
391
392 if (list->GetEntries() == 0) {
393 Log("No CTP counters file to be processed!");
394 }
395 else {
396 TIter iter(list);
397 TObjString *source;
398 while ((source = dynamic_cast<TObjString *> (iter.Next()))) {
399 TString countersfile = GetFile(kDCS, "CTP_xcounters", source->GetName());
400 Log(Form("File with Id CTP_xcounters found in source %s! Copied to %s",source->GetName(),countersfile.Data()));
401 AliTriggerRunScalers *scalers = AliTriggerRunScalers::ReadScalers(countersfile);
402 if (!scalers) {
403 Log("Bad CTP counters file! The corresponding CDB entry will not be filled!");
404 }
405 AliCDBMetaData metaData;
406 metaData.SetBeamPeriod(0);
407 metaData.SetResponsible("Roman Lietava");
408 metaData.SetComment("CTP scalers");
409 if (!Store("CTP","Scalers", scalers, &metaData, 0, 0)) {
410 Log("Unable to store the CTP scalers object to OCDB!");
411 }
412 }
413 }
414 delete list;
415 }
416
417 return 0;
418}
419
17984b61 420//_______________________________________________________________
421TList *AliGRPPreprocessor::ProcessDcsDPs(TMap* valueMap, UInt_t iStartTime, UInt_t iStopTime) {
422 //Getting the DCS dps
e97cc90e 423 //===========//
17984b61 424
425 TList *list = new TList();
426
e97cc90e 427 //DCS data points
428 //===========//
17984b61 429 AliInfo(Form("==========LHCState==========="));
430 TObjArray *aliasLHCState = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[0]);
e97cc90e 431 if(!aliasLHCState) {
432 Log(Form("LHCState not found!!!"));
17984b61 433 return list;
8ecdaed6 434 }
1f9bf847 435 AliGRPDCS *dcs1 = new AliGRPDCS(aliasLHCState,iStartTime,iStopTime);
e97cc90e 436 TString sLHCState = dcs1->ProcessDCS(3);
437 if (sLHCState) {
438 Log(Form("<LHCState> for run %d: %s",fRun, sLHCState.Data()));
439 } else {
440 Log(Form("LHCState not put in TMap!"));
441 }
17984b61 442 TMap *mapDCS1 = new TMap();
443 mapDCS1->Add(new TObjString("fLHCState"),new TObjString(sLHCState));
444 list->Add(mapDCS1);
e97cc90e 445
17984b61 446 AliInfo(Form("==========LHCPeriod==========="));
447 TObjArray *aliasLHCPeriod = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[1]);
e97cc90e 448 if(!aliasLHCPeriod) {
449 Log(Form("LHCPeriod not found!!!"));
17984b61 450 return list;
e97cc90e 451 }
1f9bf847 452 AliGRPDCS *dcs2 = new AliGRPDCS(aliasLHCPeriod,iStartTime,iStopTime);
e97cc90e 453 TString sLHCPeriod = dcs2->ProcessDCS(3);
454 if (sLHCPeriod) {
455 Log(Form("<LHCPeriod> for run %d: %s",fRun, sLHCPeriod.Data()));
3dedb44a 456 } else {
e97cc90e 457 Log(Form("LHCPeriod not put in TMap!"));
3dedb44a 458 }
17984b61 459 TMap *mapDCS2 = new TMap();
460 mapDCS2->Add(new TObjString("fLHCCondition"),new TObjString(sLHCPeriod));
461 list->Add(mapDCS2);
125567f8 462
17984b61 463 AliInfo(Form("==========LHCLuminosity==========="));
464 TObjArray *aliasLHCLuminosity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[2]);
e97cc90e 465 if(!aliasLHCLuminosity) {
466 Log(Form("LHCLuminosity not found!!!"));
17984b61 467 return list;
e97cc90e 468 }
1f9bf847 469 AliGRPDCS *dcs3 = new AliGRPDCS(aliasLHCLuminosity,iStartTime,iStopTime);
e97cc90e 470 TString sMeanLHCLuminosity = dcs3->ProcessDCS(2);
471 if (sMeanLHCLuminosity) {
472 Log(Form("<LHCLuminosity> for run %d: %s",fRun, sMeanLHCLuminosity.Data()));
473 } else {
474 Log(Form("LHCLuminosity not put in TMap!"));
475 }
17984b61 476 TMap *mapDCS3 = new TMap();
477 mapDCS3->Add(new TObjString("fLHCLuminosity"),new TObjString(sMeanLHCLuminosity));
478 list->Add(mapDCS3);
e97cc90e 479
17984b61 480 AliInfo(Form("==========BeamIntensity==========="));
481 TObjArray *aliasBeamIntensity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[3]);
e97cc90e 482 if(!aliasBeamIntensity) {
483 Log(Form("BeamIntensity not found!!!"));
17984b61 484 return list;
e97cc90e 485 }
1f9bf847 486 AliGRPDCS *dcs4 = new AliGRPDCS(aliasBeamIntensity,iStartTime,iStopTime);
e97cc90e 487 TString sMeanBeamIntensity = dcs4->ProcessDCS(2);
488 if (sMeanBeamIntensity) {
489 Log(Form("<BeamIntensity> for run %d: %s",fRun, sMeanBeamIntensity.Data()));
490 } else {
491 Log(Form("BeamIntensity not put in TMap!"));
492 }
17984b61 493 TMap *mapDCS4 = new TMap();
494 mapDCS4->Add(new TObjString("fBeamIntensity"),new TObjString(sMeanBeamIntensity));
495 list->Add(mapDCS4);
e97cc90e 496
17984b61 497 AliInfo(Form("==========L3Current==========="));
498 TObjArray *aliasL3Current = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[4]);
e97cc90e 499 if(!aliasL3Current) {
500 Log(Form("L3Current not found!!!"));
17984b61 501 return list;
e97cc90e 502 }
1f9bf847 503 AliGRPDCS *dcs5 = new AliGRPDCS(aliasL3Current,iStartTime,iStopTime);
e97cc90e 504 TString sMeanL3Current = dcs5->ProcessDCS(2);
505 if (sMeanL3Current) {
506 Log(Form("<L3Current> for run %d: %s",fRun, sMeanL3Current.Data()));
507 } else {
508 Log(Form("L3Current not put in TMap!"));
509 }
17984b61 510 TMap *mapDCS5 = new TMap();
511 mapDCS5->Add(new TObjString("fL3Current"),new TObjString(sMeanL3Current));
512 list->Add(mapDCS5);
e97cc90e 513
17984b61 514 AliInfo(Form("==========L3Polarity==========="));
515 TObjArray *aliasL3Polarity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[5]);
e97cc90e 516 if(!aliasL3Polarity) {
517 Log(Form("L3Polarity not found!!!"));
17984b61 518 return list;
e97cc90e 519 }
1f9bf847 520 AliGRPDCS *dcs6 = new AliGRPDCS(aliasL3Polarity,iStartTime,iStopTime);
e97cc90e 521 TString sL3Polarity = dcs6->ProcessDCS(4);
522 if (sL3Polarity) {
523 Log(Form("<L3Polarity> for run %d: %s",fRun, sL3Polarity.Data()));
524 } else {
525 Log(Form("L3Polarity not put in TMap!"));
526 }
17984b61 527 TMap *mapDCS6 = new TMap();
528 mapDCS6->Add(new TObjString("fL3Polarity"),new TObjString(sL3Polarity));
529 list->Add(mapDCS6);
e97cc90e 530
17984b61 531 AliInfo(Form("==========DipoleCurrent==========="));
532 TObjArray *aliasDipoleCurrent = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[6]);
e97cc90e 533 if(!aliasDipoleCurrent) {
534 Log(Form("DipoleCurrent not found!!!"));
17984b61 535 return list;
e97cc90e 536 }
1f9bf847 537 AliGRPDCS *dcs7 = new AliGRPDCS(aliasDipoleCurrent,iStartTime,iStopTime);
e97cc90e 538 TString sMeanDipoleCurrent = dcs7->ProcessDCS(2);
539 if (sMeanDipoleCurrent) {
540 Log(Form("<DipoleCurrent> for run %d: %s",fRun, sMeanDipoleCurrent.Data()));
541 } else {
542 Log(Form("DipoleCurrent not put in TMap!"));
543 }
17984b61 544 TMap *mapDCS7 = new TMap();
545 mapDCS7->Add(new TObjString("fDipoleCurrent"),new TObjString(sMeanDipoleCurrent));
546 list->Add(mapDCS7);
e97cc90e 547
17984b61 548 AliInfo(Form("==========DipolePolarity==========="));
549 TObjArray *aliasDipolePolarity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[7]);
e97cc90e 550 if(!aliasDipolePolarity) {
551 Log(Form("DipolePolarity not found!!!"));
17984b61 552 return list;
e97cc90e 553 }
1f9bf847 554 AliGRPDCS *dcs8 = new AliGRPDCS(aliasDipolePolarity,iStartTime,iStopTime);
e97cc90e 555 TString sDipolePolarity = dcs8->ProcessDCS(4);
556 if (sDipolePolarity) {
557 Log(Form("<DipolePolarity> for run %d: %s",fRun, sDipolePolarity.Data()));
558 } else {
559 Log(Form("DipolePolarity not put in TMap!"));
560 }
17984b61 561 TMap *mapDCS8 = new TMap();
562 mapDCS8->Add(new TObjString("fDipolePolarity"),new TObjString(sDipolePolarity));
563 list->Add(mapDCS8);
e97cc90e 564
17984b61 565 AliInfo(Form("==========CavernTemperature==========="));
566 TObjArray *aliasCavernTemperature = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[8]);
e97cc90e 567 if(!aliasCavernTemperature) {
568 Log(Form("CavernTemperature not found!!!"));
17984b61 569 return list;
e97cc90e 570 }
1f9bf847 571 AliGRPDCS *dcs9 = new AliGRPDCS(aliasCavernTemperature,iStartTime,iStopTime);
e97cc90e 572 TString sMeanCavernTemperature = dcs9->ProcessDCS(2);
573 if (sMeanCavernTemperature) {
574 Log(Form("<CavernTemperature> for run %d: %s",fRun, sMeanCavernTemperature.Data()));
575 } else {
576 Log(Form("CavernTemperature not put in TMap!"));
577 }
17984b61 578 TMap *mapDCS9 = new TMap();
579 mapDCS9->Add(new TObjString("fCavernTemperature"),new TObjString(sMeanCavernTemperature));
580 list->Add(mapDCS9);
e97cc90e 581
17984b61 582 AliInfo(Form("==========CavernPressure==========="));
583 TObjArray *aliasCavernPressure = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[9]);
e97cc90e 584 if(!aliasCavernPressure) {
585 Log(Form("CavernPressure not found!!!"));
17984b61 586 return list;
e97cc90e 587 }
1f9bf847 588 AliGRPDCS *dcs10 = new AliGRPDCS(aliasCavernPressure,iStartTime,iStopTime);
e97cc90e 589 TString sMeanCavernPressure = dcs10->ProcessDCS(2);
590 if (sMeanCavernPressure) {
591 Log(Form("<CavernPressure> for run %d: %s",fRun, sMeanCavernPressure.Data()));
592 } else {
593 Log(Form("CavernPressure not put in TMap!"));
594 }
17984b61 595 TMap *mapDCS10 = new TMap();
596 mapDCS10->Add(new TObjString("fCavernPressure"),new TObjString(sMeanCavernPressure));
597 list->Add(mapDCS10);
e97cc90e 598
17984b61 599 return list;
600}
125567f8 601
17984b61 602//_______________________________________________________________
603AliDCSSensorArray *AliGRPPreprocessor::GetPressureMap(TMap* dcsAliasMap, AliDCSSensorArray *fPressure) {
604 // extract DCS pressure maps. Perform fits to save space
3dedb44a 605
17984b61 606 TMap *map = fPressure->ExtractDCS(dcsAliasMap);
607 if (map) {
608 fPressure->MakeSplineFit(map);
609 Double_t fitFraction = fPressure->NumFits()/fPressure->NumSensors();
610 if (fitFraction > kFitFraction ) {
611 AliInfo(Form("Pressure values extracted, fits performed.\n"));
612 } else {
613 AliInfo("Too few pressure maps fitted. \n");
614 }
615 } else {
616 AliInfo("AliGRPDCS: no atmospheric pressure map extracted. \n");
617 }
618 delete map;
619
620 return fPressure;
621}
e97cc90e 622
17984b61 623//_______________________________________________________________
624/*UInt_t AliGRPPreprocessor::MapPressure(TMap* dcsAliasMap) {
625 // extract DCS pressure maps. Perform fits to save space
3dedb44a 626
17984b61 627 UInt_t result=0;
628 TMap *map = fPressure->ExtractDCS(dcsAliasMap);
629 if (map) {
630 fPressure->MakeSplineFit(map);
631 Double_t fitFraction = fPressure->NumFits()/fPressure->NumSensors();
632 if (fitFraction > kFitFraction ) {
633 AliInfo(Form("Pressure values extracted, fits performed.\n"));
634 } else {
635 Log ("Too few pressure maps fitted. \n");
636 result = 9;
637 }
638 } else {
639 Log("AliTPCPreprocsessor: no atmospheric pressure map extracted. \n");
640 result=9;
641 }
642 delete map;
643 // Now store the final CDB file
3dedb44a 644
17984b61 645 if ( result == 0 ) {
646 AliCDBMetaData metaData;
647 metaData.SetBeamPeriod(0);
648 metaData.SetResponsible("Panos Christakoglou");
649 metaData.SetComment("Preprocessor AliGRP data base pressure entries.");
650
651 Bool_t storeOK = Store("Calib", "Pressure", fPressure, &metaData, 0, 0);
652 if ( !storeOK ) result=1;
653 }
3dedb44a 654
17984b61 655 return result;
656 }*/