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 //-------------------------------------------------------------------------
26 #include <TObjString.h>
27 #include <TTimeStamp.h>
29 #include "AliGRPPreprocessor.h"
30 #include "AliGRPDCS.h"
32 #include "AliCDBMetaData.h"
36 class AliShuttleInterface;
40 ClassImp(AliGRPPreprocessor)
42 //_______________________________________________________________
43 AliGRPPreprocessor::AliGRPPreprocessor():
44 AliPreprocessor("GRP",0) {
45 // default constructor - Don't use this!
49 //_______________________________________________________________
50 AliGRPPreprocessor::AliGRPPreprocessor(AliShuttleInterface* shuttle):
51 AliPreprocessor("GRP",shuttle) {
52 // constructor - shuttle must be instantiated!
56 //_______________________________________________________________
57 AliGRPPreprocessor::~AliGRPPreprocessor() {
61 //_______________________________________________________________
62 void AliGRPPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime) {
63 // Initialize preprocessor
65 AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run, TTimeStamp(startTime).AsString(), TTimeStamp(endTime).AsString()));
68 fStartTime = startTime;
70 AliInfo("This preprocessor is to test the GetRunParameter function.");
73 //_______________________________________________________________
74 UInt_t AliGRPPreprocessor::Process(TMap* valueMap) {
75 // process data retrieved by the Shuttle
76 const char* timeStart = GetRunParameter("time_start");
77 const char* timeEnd = GetRunParameter("time_end");
78 const char* beamEnergy = GetRunParameter("beamEnergy");
79 const char* beamType = GetRunParameter("beamType");
80 const char* numberOfDetectors = GetRunParameter("numberOfDetectors");
81 const char* detectorMask = GetRunParameter("detectorMask");
82 const char* lhcPeriod = GetRunParameter("LHCperiod");
87 TObjArray *aliasLHCState = (TObjArray *)valueMap->GetValue("LHCState");
89 Log(Form("LHCState not found!!!"));
92 AliGRPDCS *dcs1 = new AliGRPDCS(aliasLHCState);
93 TString sLHCState = dcs1->ProcessDCS(3);
95 Log(Form("<LHCState> for run %d: %s",fRun, sLHCState.Data()));
97 Log(Form("LHCState not put in TMap!"));
100 TObjArray *aliasLHCPeriod = (TObjArray *)valueMap->GetValue("LHCPeriod");
101 if(!aliasLHCPeriod) {
102 Log(Form("LHCPeriod not found!!!"));
105 AliGRPDCS *dcs2 = new AliGRPDCS(aliasLHCPeriod);
106 TString sLHCPeriod = dcs2->ProcessDCS(3);
108 Log(Form("<LHCPeriod> for run %d: %s",fRun, sLHCPeriod.Data()));
110 Log(Form("LHCPeriod not put in TMap!"));
113 TObjArray *aliasLHCLuminosity = (TObjArray *)valueMap->GetValue("LHCLuminosity");
114 if(!aliasLHCLuminosity) {
115 Log(Form("LHCLuminosity not found!!!"));
118 AliGRPDCS *dcs3 = new AliGRPDCS(aliasLHCLuminosity);
119 TString sMeanLHCLuminosity = dcs3->ProcessDCS(2);
120 if (sMeanLHCLuminosity) {
121 Log(Form("<LHCLuminosity> for run %d: %s",fRun, sMeanLHCLuminosity.Data()));
123 Log(Form("LHCLuminosity not put in TMap!"));
126 TObjArray *aliasBeamIntensity = (TObjArray *)valueMap->GetValue("BeamIntensity");
127 if(!aliasBeamIntensity) {
128 Log(Form("BeamIntensity not found!!!"));
131 AliGRPDCS *dcs4 = new AliGRPDCS(aliasBeamIntensity);
132 TString sMeanBeamIntensity = dcs4->ProcessDCS(2);
133 if (sMeanBeamIntensity) {
134 Log(Form("<BeamIntensity> for run %d: %s",fRun, sMeanBeamIntensity.Data()));
136 Log(Form("BeamIntensity not put in TMap!"));
139 TObjArray *aliasL3Current = (TObjArray *)valueMap->GetValue("L3Current");
140 if(!aliasL3Current) {
141 Log(Form("L3Current not found!!!"));
144 AliGRPDCS *dcs5 = new AliGRPDCS(aliasL3Current);
145 TString sMeanL3Current = dcs5->ProcessDCS(2);
146 if (sMeanL3Current) {
147 Log(Form("<L3Current> for run %d: %s",fRun, sMeanL3Current.Data()));
149 Log(Form("L3Current not put in TMap!"));
152 TObjArray *aliasL3Polarity = (TObjArray *)valueMap->GetValue("L3Polarity");
153 if(!aliasL3Polarity) {
154 Log(Form("L3Polarity not found!!!"));
157 AliGRPDCS *dcs6 = new AliGRPDCS(aliasL3Polarity);
158 TString sL3Polarity = dcs6->ProcessDCS(4);
160 Log(Form("<L3Polarity> for run %d: %s",fRun, sL3Polarity.Data()));
162 Log(Form("L3Polarity not put in TMap!"));
165 TObjArray *aliasDipoleCurrent = (TObjArray *)valueMap->GetValue("DipoleCurrent");
166 if(!aliasDipoleCurrent) {
167 Log(Form("DipoleCurrent not found!!!"));
170 AliGRPDCS *dcs7 = new AliGRPDCS(aliasDipoleCurrent);
171 TString sMeanDipoleCurrent = dcs7->ProcessDCS(2);
172 if (sMeanDipoleCurrent) {
173 Log(Form("<DipoleCurrent> for run %d: %s",fRun, sMeanDipoleCurrent.Data()));
175 Log(Form("DipoleCurrent not put in TMap!"));
178 TObjArray *aliasDipolePolarity = (TObjArray *)valueMap->GetValue("DipolePolarity");
179 if(!aliasDipolePolarity) {
180 Log(Form("DipolePolarity not found!!!"));
183 AliGRPDCS *dcs8 = new AliGRPDCS(aliasDipolePolarity);
184 TString sDipolePolarity = dcs8->ProcessDCS(4);
185 if (sDipolePolarity) {
186 Log(Form("<DipolePolarity> for run %d: %s",fRun, sDipolePolarity.Data()));
188 Log(Form("DipolePolarity not put in TMap!"));
191 TObjArray *aliasCavernTemperature = (TObjArray *)valueMap->GetValue("CavernTemperature");
192 if(!aliasCavernTemperature) {
193 Log(Form("CavernTemperature not found!!!"));
196 AliGRPDCS *dcs9 = new AliGRPDCS(aliasCavernTemperature);
197 TString sMeanCavernTemperature = dcs9->ProcessDCS(2);
198 if (sMeanCavernTemperature) {
199 Log(Form("<CavernTemperature> for run %d: %s",fRun, sMeanCavernTemperature.Data()));
201 Log(Form("CavernTemperature not put in TMap!"));
204 TObjArray *aliasCavernPressure = (TObjArray *)valueMap->GetValue("CavernPressure");
205 if(!aliasCavernPressure) {
206 Log(Form("CavernPressure not found!!!"));
209 AliGRPDCS *dcs10 = new AliGRPDCS(aliasCavernPressure);
210 TString sMeanCavernPressure = dcs10->ProcessDCS(2);
211 if (sMeanCavernPressure) {
212 Log(Form("<CavernPressure> for run %d: %s",fRun, sMeanCavernPressure.Data()));
214 Log(Form("CavernPressure not put in TMap!"));
221 Log(Form("Start time for run %d: %s",fRun, timeStart));
223 Log(Form("Start time not put in logbook!"));
226 Log(Form("End time for run %d: %s",fRun, timeEnd));
228 Log(Form("End time not put in logbook!"));
231 Log(Form("Beam energy for run %d: %s",fRun, beamEnergy));
233 Log(Form("Beam energy not put in logbook!"));
236 Log(Form("Beam type for run %d: %s",fRun, beamType));
238 Log(Form("Beam type not put in logbook!"));
240 if (numberOfDetectors) {
241 Log(Form("Number of active detectors for run %d: %s",fRun, numberOfDetectors));
243 Log(Form("Number of active detectors not put in logbook!"));
246 Log(Form("Detector mask for run %d: %s",fRun, detectorMask));
248 Log(Form("Detector mask not put in logbook!"));
251 Log(Form("LHC period (DAQ) for run %d: %s",fRun, lhcPeriod));
253 Log(Form("LHCperiod not put in logbook!"));
256 TList *values = new TList();
260 TMap *mapDAQ1 = new TMap();
261 mapDAQ1->Add(new TObjString("fAliceStartTime"),new TObjString(timeStart));
262 values->Add(mapDAQ1);
264 TMap *mapDAQ2 = new TMap();
265 mapDAQ2->Add(new TObjString("fAliceStopTime"),new TObjString(timeEnd));
266 values->Add(mapDAQ2);
268 TMap *mapDAQ3 = new TMap();
269 mapDAQ3->Add(new TObjString("fAliceBeamEnergy"),new TObjString(beamEnergy));
270 values->Add(mapDAQ3);
272 TMap *mapDAQ4 = new TMap();
273 mapDAQ4->Add(new TObjString("fAliceBeamType"),new TObjString(beamType));
274 values->Add(mapDAQ4);
276 TMap *mapDAQ5 = new TMap();
277 mapDAQ5->Add(new TObjString("fNumberOfDetectors"),new TObjString(numberOfDetectors));
278 values->Add(mapDAQ5);
280 TMap *mapDAQ6 = new TMap();
281 mapDAQ6->Add(new TObjString("fDetectorMask"),new TObjString(detectorMask));
282 values->Add(mapDAQ6);
284 TMap *mapDAQ7 = new TMap();
285 mapDAQ7->Add(new TObjString("fLHCPeriod"),new TObjString(lhcPeriod));
286 values->Add(mapDAQ7);
289 TMap *mapDCS1 = new TMap();
290 mapDCS1->Add(new TObjString("fLHCState"),new TObjString(sLHCState));
291 values->Add(mapDCS1);
293 TMap *mapDCS2 = new TMap();
294 mapDCS2->Add(new TObjString("fLHCCondition"),new TObjString(sLHCPeriod));
295 values->Add(mapDCS2);
297 TMap *mapDCS3 = new TMap();
298 mapDCS3->Add(new TObjString("fLHCLuminosity"),new TObjString(sMeanLHCLuminosity));
299 values->Add(mapDCS3);
301 TMap *mapDCS4 = new TMap();
302 mapDCS4->Add(new TObjString("fBeamIntensity"),new TObjString(sMeanBeamIntensity));
303 values->Add(mapDCS4);
305 TMap *mapDCS5 = new TMap();
306 mapDCS5->Add(new TObjString("fL3Current"),new TObjString(sMeanL3Current));
307 values->Add(mapDCS5);
309 TMap *mapDCS6 = new TMap();
310 mapDCS6->Add(new TObjString("fL3Polarity"),new TObjString(sL3Polarity));
311 values->Add(mapDCS6);
313 TMap *mapDCS7 = new TMap();
314 mapDCS7->Add(new TObjString("fDipoleCurrent"),new TObjString(sMeanDipoleCurrent));
315 values->Add(mapDCS7);
317 TMap *mapDCS8 = new TMap();
318 mapDCS8->Add(new TObjString("fDipolePolarity"),new TObjString(sDipolePolarity));
319 values->Add(mapDCS8);
321 TMap *mapDCS9 = new TMap();
322 mapDCS9->Add(new TObjString("fCavernTemperature"),new TObjString(sMeanCavernTemperature));
323 values->Add(mapDCS9);
325 TMap *mapDCS10 = new TMap();
326 mapDCS10->Add(new TObjString("fCavernPressure"),new TObjString(sMeanCavernPressure));
327 values->Add(mapDCS10);
330 md.SetResponsible("Panos");
333 result = Store("GRP", "Values", values, &md);