1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //-------------------------------------------------------------------------
19 // Class AliGRPPreprocessor
20 // Global Run Parameters (GRP) preprocessor
21 // Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
22 //-------------------------------------------------------------------------
27 #include <TObjString.h>
28 #include <TTimeStamp.h>
30 #include "AliGRPPreprocessor.h"
31 #include "AliGRPDCS.h"
33 #include "AliCDBMetaData.h"
37 class AliShuttleInterface;
41 ClassImp(AliGRPPreprocessor)
43 //_______________________________________________________________
44 AliGRPPreprocessor::AliGRPPreprocessor():
45 AliPreprocessor("GRP",0) {
46 // default constructor - Don't use this!
50 //_______________________________________________________________
51 AliGRPPreprocessor::AliGRPPreprocessor(AliShuttleInterface* shuttle):
52 AliPreprocessor("GRP",shuttle) {
53 // constructor - shuttle must be instantiated!
57 //_______________________________________________________________
58 AliGRPPreprocessor::~AliGRPPreprocessor() {
62 //_______________________________________________________________
63 void AliGRPPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime) {
64 // Initialize preprocessor
66 AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run, TTimeStamp(startTime).AsString(), TTimeStamp(endTime).AsString()));
69 fStartTime = startTime;
71 AliInfo("This preprocessor is to test the GetRunParameter function.");
74 //_______________________________________________________________
75 UInt_t AliGRPPreprocessor::Process(TMap* valueMap) {
76 // process data retrieved by the Shuttle
77 const char* timeStart = GetRunParameter("time_start");
78 UInt_t iStartTime = atoi(timeStart);
79 const char* timeEnd = GetRunParameter("time_end");
80 UInt_t iStopTime = atoi(timeEnd);
81 const char* beamEnergy = GetRunParameter("beamEnergy");
82 const char* beamType = GetRunParameter("beamType");
83 const char* numberOfDetectors = GetRunParameter("numberOfDetectors");
84 const char* detectorMask = GetRunParameter("detectorMask");
85 const char* lhcPeriod = GetRunParameter("LHCperiod");
87 //======DAQ FXS======//
88 TChain *fRawTagChain = new TChain("T");
89 TString fRawDataFileName;
90 TList* list = GetFileSources(kDAQ);
92 Log("No raw data tag list found!!!");
95 TIterator* iter = list->MakeIterator();
97 while ((obj = iter->Next())) {
98 TObjString* objStr = dynamic_cast<TObjString*> (obj);
100 Log(Form("Found source %s", objStr->String().Data()));
101 TList* list2 = GetFileIDs(kDAQ, objStr->String());
103 Log("No list with ids from DAQ was found!!!");
106 Log(Form("Number of ids: %d",list2->GetEntries()));
107 for(Int_t i = 0; i < list2->GetEntries(); i++) {
108 TObjString *idStr = (TObjString *)list2->At(i);
109 //Log(Form("Filename1: %s",idStr->String().Data()));
110 TString fileName = GetFile(kDAQ,idStr->String().Data(),objStr->String().Data());
111 Log(Form("Adding file in the chain: %s",fileName.Data()));
112 fRawTagChain->Add(fileName.Data());
113 fRawDataFileName = fileName(0,fileName.First("_"));
120 fRawDataFileName += "_GRP_Merged.tag.root";
121 Log(Form("Merging raw data tags into file: %s",fRawDataFileName.Data()));
122 fRawTagChain->Merge(fRawDataFileName);
127 TObjArray *aliasLHCState = (TObjArray *)valueMap->GetValue("LHCState");
129 Log(Form("LHCState not found!!!"));
132 AliInfo(Form("==========LHCState==========="));
133 AliGRPDCS *dcs1 = new AliGRPDCS(aliasLHCState,iStartTime,iStopTime);
134 TString sLHCState = dcs1->ProcessDCS(3);
136 Log(Form("<LHCState> for run %d: %s",fRun, sLHCState.Data()));
138 Log(Form("LHCState not put in TMap!"));
141 TObjArray *aliasLHCPeriod = (TObjArray *)valueMap->GetValue("LHCPeriod");
142 if(!aliasLHCPeriod) {
143 Log(Form("LHCPeriod not found!!!"));
146 AliInfo(Form("==========LHCPeriod==========="));
147 AliGRPDCS *dcs2 = new AliGRPDCS(aliasLHCPeriod,iStartTime,iStopTime);
148 TString sLHCPeriod = dcs2->ProcessDCS(3);
150 Log(Form("<LHCPeriod> for run %d: %s",fRun, sLHCPeriod.Data()));
152 Log(Form("LHCPeriod not put in TMap!"));
155 TObjArray *aliasLHCLuminosity = (TObjArray *)valueMap->GetValue("LHCLuminosity");
156 if(!aliasLHCLuminosity) {
157 Log(Form("LHCLuminosity not found!!!"));
160 AliInfo(Form("==========LHCLuminosity==========="));
161 AliGRPDCS *dcs3 = new AliGRPDCS(aliasLHCLuminosity,iStartTime,iStopTime);
162 TString sMeanLHCLuminosity = dcs3->ProcessDCS(2);
163 if (sMeanLHCLuminosity) {
164 Log(Form("<LHCLuminosity> for run %d: %s",fRun, sMeanLHCLuminosity.Data()));
166 Log(Form("LHCLuminosity not put in TMap!"));
169 TObjArray *aliasBeamIntensity = (TObjArray *)valueMap->GetValue("BeamIntensity");
170 if(!aliasBeamIntensity) {
171 Log(Form("BeamIntensity not found!!!"));
174 AliInfo(Form("==========BeamIntensity==========="));
175 AliGRPDCS *dcs4 = new AliGRPDCS(aliasBeamIntensity,iStartTime,iStopTime);
176 TString sMeanBeamIntensity = dcs4->ProcessDCS(2);
177 if (sMeanBeamIntensity) {
178 Log(Form("<BeamIntensity> for run %d: %s",fRun, sMeanBeamIntensity.Data()));
180 Log(Form("BeamIntensity not put in TMap!"));
183 TObjArray *aliasL3Current = (TObjArray *)valueMap->GetValue("L3Current");
184 if(!aliasL3Current) {
185 Log(Form("L3Current not found!!!"));
188 AliInfo(Form("==========L3Current==========="));
189 AliGRPDCS *dcs5 = new AliGRPDCS(aliasL3Current,iStartTime,iStopTime);
190 TString sMeanL3Current = dcs5->ProcessDCS(2);
191 if (sMeanL3Current) {
192 Log(Form("<L3Current> for run %d: %s",fRun, sMeanL3Current.Data()));
194 Log(Form("L3Current not put in TMap!"));
197 TObjArray *aliasL3Polarity = (TObjArray *)valueMap->GetValue("L3Polarity");
198 if(!aliasL3Polarity) {
199 Log(Form("L3Polarity not found!!!"));
202 AliInfo(Form("==========L3Polarity==========="));
203 AliGRPDCS *dcs6 = new AliGRPDCS(aliasL3Polarity,iStartTime,iStopTime);
204 TString sL3Polarity = dcs6->ProcessDCS(4);
206 Log(Form("<L3Polarity> for run %d: %s",fRun, sL3Polarity.Data()));
208 Log(Form("L3Polarity not put in TMap!"));
211 TObjArray *aliasDipoleCurrent = (TObjArray *)valueMap->GetValue("DipoleCurrent");
212 if(!aliasDipoleCurrent) {
213 Log(Form("DipoleCurrent not found!!!"));
216 AliInfo(Form("==========DipoleCurrent==========="));
217 AliGRPDCS *dcs7 = new AliGRPDCS(aliasDipoleCurrent,iStartTime,iStopTime);
218 TString sMeanDipoleCurrent = dcs7->ProcessDCS(2);
219 if (sMeanDipoleCurrent) {
220 Log(Form("<DipoleCurrent> for run %d: %s",fRun, sMeanDipoleCurrent.Data()));
222 Log(Form("DipoleCurrent not put in TMap!"));
225 TObjArray *aliasDipolePolarity = (TObjArray *)valueMap->GetValue("DipolePolarity");
226 if(!aliasDipolePolarity) {
227 Log(Form("DipolePolarity not found!!!"));
230 AliInfo(Form("==========DipolePolarity==========="));
231 AliGRPDCS *dcs8 = new AliGRPDCS(aliasDipolePolarity,iStartTime,iStopTime);
232 TString sDipolePolarity = dcs8->ProcessDCS(4);
233 if (sDipolePolarity) {
234 Log(Form("<DipolePolarity> for run %d: %s",fRun, sDipolePolarity.Data()));
236 Log(Form("DipolePolarity not put in TMap!"));
239 TObjArray *aliasCavernTemperature = (TObjArray *)valueMap->GetValue("CavernTemperature");
240 if(!aliasCavernTemperature) {
241 Log(Form("CavernTemperature not found!!!"));
244 AliInfo(Form("==========CavernTemperature==========="));
245 AliGRPDCS *dcs9 = new AliGRPDCS(aliasCavernTemperature,iStartTime,iStopTime);
246 TString sMeanCavernTemperature = dcs9->ProcessDCS(2);
247 if (sMeanCavernTemperature) {
248 Log(Form("<CavernTemperature> for run %d: %s",fRun, sMeanCavernTemperature.Data()));
250 Log(Form("CavernTemperature not put in TMap!"));
253 TObjArray *aliasCavernPressure = (TObjArray *)valueMap->GetValue("CavernAtmosPressure");
254 if(!aliasCavernPressure) {
255 Log(Form("CavernPressure not found!!!"));
258 AliInfo(Form("==========CavernPressure==========="));
259 AliGRPDCS *dcs10 = new AliGRPDCS(aliasCavernPressure,iStartTime,iStopTime);
260 TString sMeanCavernPressure = dcs10->ProcessDCS(2);
261 if (sMeanCavernPressure) {
262 Log(Form("<CavernPressure> for run %d: %s",fRun, sMeanCavernPressure.Data()));
264 Log(Form("CavernPressure not put in TMap!"));
271 Log(Form("Start time for run %d: %s",fRun, timeStart));
273 Log(Form("Start time not put in logbook!"));
276 Log(Form("End time for run %d: %s",fRun, timeEnd));
278 Log(Form("End time not put in logbook!"));
281 Log(Form("Beam energy for run %d: %s",fRun, beamEnergy));
283 Log(Form("Beam energy not put in logbook!"));
286 Log(Form("Beam type for run %d: %s",fRun, beamType));
288 Log(Form("Beam type not put in logbook!"));
290 if (numberOfDetectors) {
291 Log(Form("Number of active detectors for run %d: %s",fRun, numberOfDetectors));
293 Log(Form("Number of active detectors not put in logbook!"));
296 Log(Form("Detector mask for run %d: %s",fRun, detectorMask));
298 Log(Form("Detector mask not put in logbook!"));
301 Log(Form("LHC period (DAQ) for run %d: %s",fRun, lhcPeriod));
303 Log(Form("LHCperiod not put in logbook!"));
306 TList *values = new TList();
310 TMap *mapDAQ1 = new TMap();
311 mapDAQ1->Add(new TObjString("fAliceStartTime"),new TObjString(timeStart));
312 values->Add(mapDAQ1);
314 TMap *mapDAQ2 = new TMap();
315 mapDAQ2->Add(new TObjString("fAliceStopTime"),new TObjString(timeEnd));
316 values->Add(mapDAQ2);
318 TMap *mapDAQ3 = new TMap();
319 mapDAQ3->Add(new TObjString("fAliceBeamEnergy"),new TObjString(beamEnergy));
320 values->Add(mapDAQ3);
322 TMap *mapDAQ4 = new TMap();
323 mapDAQ4->Add(new TObjString("fAliceBeamType"),new TObjString(beamType));
324 values->Add(mapDAQ4);
326 TMap *mapDAQ5 = new TMap();
327 mapDAQ5->Add(new TObjString("fNumberOfDetectors"),new TObjString(numberOfDetectors));
328 values->Add(mapDAQ5);
330 TMap *mapDAQ6 = new TMap();
331 mapDAQ6->Add(new TObjString("fDetectorMask"),new TObjString(detectorMask));
332 values->Add(mapDAQ6);
334 TMap *mapDAQ7 = new TMap();
335 mapDAQ7->Add(new TObjString("fLHCPeriod"),new TObjString(lhcPeriod));
336 values->Add(mapDAQ7);
339 TMap *mapDCS1 = new TMap();
340 mapDCS1->Add(new TObjString("fLHCState"),new TObjString(sLHCState));
341 values->Add(mapDCS1);
343 TMap *mapDCS2 = new TMap();
344 mapDCS2->Add(new TObjString("fLHCCondition"),new TObjString(sLHCPeriod));
345 values->Add(mapDCS2);
347 TMap *mapDCS3 = new TMap();
348 mapDCS3->Add(new TObjString("fLHCLuminosity"),new TObjString(sMeanLHCLuminosity));
349 values->Add(mapDCS3);
351 TMap *mapDCS4 = new TMap();
352 mapDCS4->Add(new TObjString("fBeamIntensity"),new TObjString(sMeanBeamIntensity));
353 values->Add(mapDCS4);
355 TMap *mapDCS5 = new TMap();
356 mapDCS5->Add(new TObjString("fL3Current"),new TObjString(sMeanL3Current));
357 values->Add(mapDCS5);
359 TMap *mapDCS6 = new TMap();
360 mapDCS6->Add(new TObjString("fL3Polarity"),new TObjString(sL3Polarity));
361 values->Add(mapDCS6);
363 TMap *mapDCS7 = new TMap();
364 mapDCS7->Add(new TObjString("fDipoleCurrent"),new TObjString(sMeanDipoleCurrent));
365 values->Add(mapDCS7);
367 TMap *mapDCS8 = new TMap();
368 mapDCS8->Add(new TObjString("fDipolePolarity"),new TObjString(sDipolePolarity));
369 values->Add(mapDCS8);
371 TMap *mapDCS9 = new TMap();
372 mapDCS9->Add(new TObjString("fCavernTemperature"),new TObjString(sMeanCavernTemperature));
373 values->Add(mapDCS9);
375 TMap *mapDCS10 = new TMap();
376 mapDCS10->Add(new TObjString("fCavernPressure"),new TObjString(sMeanCavernPressure));
377 values->Add(mapDCS10);
380 md.SetResponsible("Panos");
382 Bool_t result = Store("GRP", "Values", values, &md);