Changed calls to RawSampledResponse to use AliEMCALRawUtils
[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
7ca4655f 24#include <TList.h>
25#include <TMap.h>
26#include <TObjString.h>
27#include <TTimeStamp.h>
28
3dedb44a 29#include "AliGRPPreprocessor.h"
30#include "AliGRPDCS.h"
31
32#include "AliCDBMetaData.h"
33#include "AliLog.h"
34
3dedb44a 35class AliDCSValue;
36class AliShuttleInterface;
37
38#include <TH1.h>
39
40ClassImp(AliGRPPreprocessor)
41
42//_______________________________________________________________
43AliGRPPreprocessor::AliGRPPreprocessor():
44 AliPreprocessor("GRP",0) {
45 // default constructor - Don't use this!
46
47}
48
49//_______________________________________________________________
50AliGRPPreprocessor::AliGRPPreprocessor(AliShuttleInterface* shuttle):
51 AliPreprocessor("GRP",shuttle) {
52 // constructor - shuttle must be instantiated!
53
54}
55
56//_______________________________________________________________
57AliGRPPreprocessor::~AliGRPPreprocessor() {
58 //destructor
59}
60
61//_______________________________________________________________
62void AliGRPPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime) {
63 // Initialize preprocessor
64
65 AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run, TTimeStamp(startTime).AsString(), TTimeStamp(endTime).AsString()));
66
67 fRun = run;
68 fStartTime = startTime;
69 fEndTime = endTime;
70 AliInfo("This preprocessor is to test the GetRunParameter function.");
71}
72
73//_______________________________________________________________
74UInt_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");
125567f8 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
e97cc90e 83 //===========//
84 //DCS data points
85 //===========//
86 TObjArray *aliasLHCState = (TObjArray *)valueMap->GetValue("LHCState");
87 if(!aliasLHCState) {
88 Log(Form("LHCState not found!!!"));
8ecdaed6 89 return 0;
90 }
e97cc90e 91 AliGRPDCS *dcs1 = new AliGRPDCS(aliasLHCState);
92 TString sLHCState = dcs1->ProcessDCS(3);
93 if (sLHCState) {
94 Log(Form("<LHCState> for run %d: %s",fRun, sLHCState.Data()));
95 } else {
96 Log(Form("LHCState not put in TMap!"));
97 }
98
99 TObjArray *aliasLHCPeriod = (TObjArray *)valueMap->GetValue("LHCPeriod");
100 if(!aliasLHCPeriod) {
101 Log(Form("LHCPeriod not found!!!"));
102 return 0;
103 }
104 AliGRPDCS *dcs2 = new AliGRPDCS(aliasLHCPeriod);
105 TString sLHCPeriod = dcs2->ProcessDCS(3);
106 if (sLHCPeriod) {
107 Log(Form("<LHCPeriod> for run %d: %s",fRun, sLHCPeriod.Data()));
3dedb44a 108 } else {
e97cc90e 109 Log(Form("LHCPeriod not put in TMap!"));
3dedb44a 110 }
125567f8 111
e97cc90e 112 TObjArray *aliasLHCLuminosity = (TObjArray *)valueMap->GetValue("LHCLuminosity");
113 if(!aliasLHCLuminosity) {
114 Log(Form("LHCLuminosity not found!!!"));
115 return 0;
116 }
117 AliGRPDCS *dcs3 = new AliGRPDCS(aliasLHCLuminosity);
118 TString sMeanLHCLuminosity = dcs3->ProcessDCS(2);
119 if (sMeanLHCLuminosity) {
120 Log(Form("<LHCLuminosity> for run %d: %s",fRun, sMeanLHCLuminosity.Data()));
121 } else {
122 Log(Form("LHCLuminosity not put in TMap!"));
123 }
124
125 TObjArray *aliasBeamIntensity = (TObjArray *)valueMap->GetValue("BeamIntensity");
126 if(!aliasBeamIntensity) {
127 Log(Form("BeamIntensity not found!!!"));
128 return 0;
129 }
130 AliGRPDCS *dcs4 = new AliGRPDCS(aliasBeamIntensity);
131 TString sMeanBeamIntensity = dcs4->ProcessDCS(2);
132 if (sMeanBeamIntensity) {
133 Log(Form("<BeamIntensity> for run %d: %s",fRun, sMeanBeamIntensity.Data()));
134 } else {
135 Log(Form("BeamIntensity not put in TMap!"));
136 }
137
138 TObjArray *aliasL3Current = (TObjArray *)valueMap->GetValue("L3Current");
139 if(!aliasL3Current) {
140 Log(Form("L3Current not found!!!"));
141 return 0;
142 }
143 AliGRPDCS *dcs5 = new AliGRPDCS(aliasL3Current);
144 TString sMeanL3Current = dcs5->ProcessDCS(2);
145 if (sMeanL3Current) {
146 Log(Form("<L3Current> for run %d: %s",fRun, sMeanL3Current.Data()));
147 } else {
148 Log(Form("L3Current not put in TMap!"));
149 }
150
151 TObjArray *aliasL3Polarity = (TObjArray *)valueMap->GetValue("L3Polarity");
152 if(!aliasL3Polarity) {
153 Log(Form("L3Polarity not found!!!"));
154 return 0;
155 }
156 AliGRPDCS *dcs6 = new AliGRPDCS(aliasL3Polarity);
157 TString sL3Polarity = dcs6->ProcessDCS(4);
158 if (sL3Polarity) {
159 Log(Form("<L3Polarity> for run %d: %s",fRun, sL3Polarity.Data()));
160 } else {
161 Log(Form("L3Polarity not put in TMap!"));
162 }
163
164 TObjArray *aliasDipoleCurrent = (TObjArray *)valueMap->GetValue("DipoleCurrent");
165 if(!aliasDipoleCurrent) {
166 Log(Form("DipoleCurrent not found!!!"));
167 return 0;
168 }
169 AliGRPDCS *dcs7 = new AliGRPDCS(aliasDipoleCurrent);
170 TString sMeanDipoleCurrent = dcs7->ProcessDCS(2);
171 if (sMeanDipoleCurrent) {
172 Log(Form("<DipoleCurrent> for run %d: %s",fRun, sMeanDipoleCurrent.Data()));
173 } else {
174 Log(Form("DipoleCurrent not put in TMap!"));
175 }
176
177 TObjArray *aliasDipolePolarity = (TObjArray *)valueMap->GetValue("DipolePolarity");
178 if(!aliasDipolePolarity) {
179 Log(Form("DipolePolarity not found!!!"));
180 return 0;
181 }
182 AliGRPDCS *dcs8 = new AliGRPDCS(aliasDipolePolarity);
183 TString sDipolePolarity = dcs8->ProcessDCS(4);
184 if (sDipolePolarity) {
185 Log(Form("<DipolePolarity> for run %d: %s",fRun, sDipolePolarity.Data()));
186 } else {
187 Log(Form("DipolePolarity not put in TMap!"));
188 }
189
190 TObjArray *aliasCavernTemperature = (TObjArray *)valueMap->GetValue("CavernTemperature");
191 if(!aliasCavernTemperature) {
192 Log(Form("CavernTemperature not found!!!"));
193 return 0;
194 }
195 AliGRPDCS *dcs9 = new AliGRPDCS(aliasCavernTemperature);
196 TString sMeanCavernTemperature = dcs9->ProcessDCS(2);
197 if (sMeanCavernTemperature) {
198 Log(Form("<CavernTemperature> for run %d: %s",fRun, sMeanCavernTemperature.Data()));
199 } else {
200 Log(Form("CavernTemperature not put in TMap!"));
201 }
202
203 TObjArray *aliasCavernPressure = (TObjArray *)valueMap->GetValue("CavernPressure");
204 if(!aliasCavernPressure) {
205 Log(Form("CavernPressure not found!!!"));
206 return 0;
207 }
208 AliGRPDCS *dcs10 = new AliGRPDCS(aliasCavernPressure);
209 TString sMeanCavernPressure = dcs10->ProcessDCS(2);
210 if (sMeanCavernPressure) {
211 Log(Form("<CavernPressure> for run %d: %s",fRun, sMeanCavernPressure.Data()));
212 } else {
213 Log(Form("CavernPressure not put in TMap!"));
214 }
215
216 //===========//
125567f8 217 //DAQ logbook
e97cc90e 218 //===========//
3dedb44a 219 if (timeStart) {
220 Log(Form("Start time for run %d: %s",fRun, timeStart));
221 } else {
222 Log(Form("Start time not put in logbook!"));
223 }
224 if (timeEnd) {
225 Log(Form("End time for run %d: %s",fRun, timeEnd));
226 } else {
227 Log(Form("End time not put in logbook!"));
228 }
125567f8 229 if (beamEnergy) {
230 Log(Form("Beam energy for run %d: %s",fRun, beamEnergy));
231 } else {
232 Log(Form("Beam energy not put in logbook!"));
233 }
234 if (beamType) {
235 Log(Form("Beam type for run %d: %s",fRun, beamType));
236 } else {
237 Log(Form("Beam type not put in logbook!"));
238 }
239 if (numberOfDetectors) {
240 Log(Form("Number of active detectors for run %d: %s",fRun, numberOfDetectors));
241 } else {
242 Log(Form("Number of active detectors not put in logbook!"));
243 }
244 if (detectorMask) {
245 Log(Form("Detector mask for run %d: %s",fRun, detectorMask));
246 } else {
247 Log(Form("Detector mask not put in logbook!"));
248 }
249
3dedb44a 250 TList *values = new TList();
251 values->SetOwner(1);
252
125567f8 253 //DAQ logbook
254 TMap *mapDAQ1 = new TMap();
255 mapDAQ1->Add(new TObjString("fAliceStartTime"),new TObjString(timeStart));
256 values->Add(mapDAQ1);
257
258 TMap *mapDAQ2 = new TMap();
259 mapDAQ2->Add(new TObjString("fAliceStopTime"),new TObjString(timeEnd));
260 values->Add(mapDAQ2);
261
262 TMap *mapDAQ3 = new TMap();
263 mapDAQ3->Add(new TObjString("fAliceBeamEnergy"),new TObjString(beamEnergy));
264 values->Add(mapDAQ3);
265
266 TMap *mapDAQ4 = new TMap();
267 mapDAQ4->Add(new TObjString("fAliceBeamType"),new TObjString(beamType));
268 values->Add(mapDAQ4);
269
270 TMap *mapDAQ5 = new TMap();
271 mapDAQ5->Add(new TObjString("fNumberOfDetectors"),new TObjString(numberOfDetectors));
272 values->Add(mapDAQ5);
273
274 TMap *mapDAQ6 = new TMap();
275 mapDAQ6->Add(new TObjString("fDetectorMask"),new TObjString(detectorMask));
276 values->Add(mapDAQ6);
277
278 //DCS dp
279 TMap *mapDCS1 = new TMap();
e97cc90e 280 mapDCS1->Add(new TObjString("fLHCState"),new TObjString(sLHCState));
125567f8 281 values->Add(mapDCS1);
282
283 TMap *mapDCS2 = new TMap();
e97cc90e 284 mapDCS2->Add(new TObjString("fLHCPeriod"),new TObjString(sLHCPeriod));
125567f8 285 values->Add(mapDCS2);
3dedb44a 286
e97cc90e 287 TMap *mapDCS3 = new TMap();
288 mapDCS3->Add(new TObjString("fLHCLuminosity"),new TObjString(sMeanLHCLuminosity));
289 values->Add(mapDCS3);
290
291 TMap *mapDCS4 = new TMap();
292 mapDCS4->Add(new TObjString("fBeamIntensity"),new TObjString(sMeanBeamIntensity));
293 values->Add(mapDCS4);
294
295 TMap *mapDCS5 = new TMap();
296 mapDCS5->Add(new TObjString("fL3Current"),new TObjString(sMeanL3Current));
297 values->Add(mapDCS5);
298
299 TMap *mapDCS6 = new TMap();
300 mapDCS6->Add(new TObjString("fL3Polarity"),new TObjString(sL3Polarity));
301 values->Add(mapDCS6);
302
303 TMap *mapDCS7 = new TMap();
304 mapDCS7->Add(new TObjString("fDipoleCurrent"),new TObjString(sMeanDipoleCurrent));
305 values->Add(mapDCS7);
306
307 TMap *mapDCS8 = new TMap();
308 mapDCS8->Add(new TObjString("fDipolePolarity"),new TObjString(sDipolePolarity));
309 values->Add(mapDCS8);
310
311 TMap *mapDCS9 = new TMap();
312 mapDCS9->Add(new TObjString("fCavernTemperature"),new TObjString(sMeanCavernTemperature));
313 values->Add(mapDCS9);
314
315 TMap *mapDCS10 = new TMap();
316 mapDCS10->Add(new TObjString("fCavernPressure"),new TObjString(sMeanCavernPressure));
317 values->Add(mapDCS10);
318
3dedb44a 319 AliCDBMetaData md;
320 md.SetResponsible("Panos");
321
e97cc90e 322 Int_t result=0;
3dedb44a 323 result = Store("GRP", "Values", values, &md);
324
325 delete values;
326
327 return result;
328}
329