]>
Commit | Line | Data |
---|---|---|
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 | 35 | class AliDCSValue; |
36 | class AliShuttleInterface; | |
37 | ||
38 | #include <TH1.h> | |
39 | ||
40 | ClassImp(AliGRPPreprocessor) | |
41 | ||
42 | //_______________________________________________________________ | |
43 | AliGRPPreprocessor::AliGRPPreprocessor(): | |
44 | AliPreprocessor("GRP",0) { | |
45 | // default constructor - Don't use this! | |
46 | ||
47 | } | |
48 | ||
49 | //_______________________________________________________________ | |
50 | AliGRPPreprocessor::AliGRPPreprocessor(AliShuttleInterface* shuttle): | |
51 | AliPreprocessor("GRP",shuttle) { | |
52 | // constructor - shuttle must be instantiated! | |
53 | ||
54 | } | |
55 | ||
56 | //_______________________________________________________________ | |
57 | AliGRPPreprocessor::~AliGRPPreprocessor() { | |
58 | //destructor | |
59 | } | |
60 | ||
61 | //_______________________________________________________________ | |
62 | void 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 | //_______________________________________________________________ | |
74 | UInt_t AliGRPPreprocessor::Process(TMap* valueMap) { | |
75 | // process data retrieved by the Shuttle | |
76 | const char* timeStart = GetRunParameter("time_start"); | |
1f9bf847 | 77 | UInt_t iStartTime = atoi(timeStart); |
3dedb44a | 78 | const char* timeEnd = GetRunParameter("time_end"); |
1f9bf847 | 79 | UInt_t iStopTime = atoi(timeEnd); |
125567f8 | 80 | const char* beamEnergy = GetRunParameter("beamEnergy"); |
81 | const char* beamType = GetRunParameter("beamType"); | |
82 | const char* numberOfDetectors = GetRunParameter("numberOfDetectors"); | |
83 | const char* detectorMask = GetRunParameter("detectorMask"); | |
fed5d40b | 84 | const char* lhcPeriod = GetRunParameter("LHCperiod"); |
125567f8 | 85 | |
c865efca | 86 | TList* list = GetFileSources(kDAQ); |
87 | if (!list) { | |
88 | Log("No raw data tag list found!!!"); | |
89 | return kTRUE; | |
90 | } | |
4a33bdd9 | 91 | TIterator* iter = list->MakeIterator(); |
92 | TObject* obj = 0; | |
958ecabf | 93 | while ((obj = iter->Next())) { |
94 | TObjString* objStr = dynamic_cast<TObjString*> (obj); | |
95 | if (objStr) { | |
96 | Log(Form("Found source %s", objStr->String().Data())); | |
97 | TList* list2 = GetFileIDs(kDAQ, objStr->String()); | |
98 | list2->Print(); | |
99 | delete list2; | |
100 | } | |
101 | } | |
102 | delete iter; | |
103 | delete list; | |
4a33bdd9 | 104 | |
e97cc90e | 105 | //===========// |
106 | //DCS data points | |
107 | //===========// | |
108 | TObjArray *aliasLHCState = (TObjArray *)valueMap->GetValue("LHCState"); | |
109 | if(!aliasLHCState) { | |
110 | Log(Form("LHCState not found!!!")); | |
9827400b | 111 | return 1; |
8ecdaed6 | 112 | } |
958ecabf | 113 | AliInfo(Form("==========LHCState===========")); |
1f9bf847 | 114 | AliGRPDCS *dcs1 = new AliGRPDCS(aliasLHCState,iStartTime,iStopTime); |
e97cc90e | 115 | TString sLHCState = dcs1->ProcessDCS(3); |
116 | if (sLHCState) { | |
117 | Log(Form("<LHCState> for run %d: %s",fRun, sLHCState.Data())); | |
118 | } else { | |
119 | Log(Form("LHCState not put in TMap!")); | |
120 | } | |
121 | ||
122 | TObjArray *aliasLHCPeriod = (TObjArray *)valueMap->GetValue("LHCPeriod"); | |
123 | if(!aliasLHCPeriod) { | |
124 | Log(Form("LHCPeriod not found!!!")); | |
9827400b | 125 | return 1; |
e97cc90e | 126 | } |
958ecabf | 127 | AliInfo(Form("==========LHCPeriod===========")); |
1f9bf847 | 128 | AliGRPDCS *dcs2 = new AliGRPDCS(aliasLHCPeriod,iStartTime,iStopTime); |
e97cc90e | 129 | TString sLHCPeriod = dcs2->ProcessDCS(3); |
130 | if (sLHCPeriod) { | |
131 | Log(Form("<LHCPeriod> for run %d: %s",fRun, sLHCPeriod.Data())); | |
3dedb44a | 132 | } else { |
e97cc90e | 133 | Log(Form("LHCPeriod not put in TMap!")); |
3dedb44a | 134 | } |
125567f8 | 135 | |
e97cc90e | 136 | TObjArray *aliasLHCLuminosity = (TObjArray *)valueMap->GetValue("LHCLuminosity"); |
137 | if(!aliasLHCLuminosity) { | |
138 | Log(Form("LHCLuminosity not found!!!")); | |
9827400b | 139 | return 1; |
e97cc90e | 140 | } |
958ecabf | 141 | AliInfo(Form("==========LHCLuminosity===========")); |
1f9bf847 | 142 | AliGRPDCS *dcs3 = new AliGRPDCS(aliasLHCLuminosity,iStartTime,iStopTime); |
e97cc90e | 143 | TString sMeanLHCLuminosity = dcs3->ProcessDCS(2); |
144 | if (sMeanLHCLuminosity) { | |
145 | Log(Form("<LHCLuminosity> for run %d: %s",fRun, sMeanLHCLuminosity.Data())); | |
146 | } else { | |
147 | Log(Form("LHCLuminosity not put in TMap!")); | |
148 | } | |
149 | ||
150 | TObjArray *aliasBeamIntensity = (TObjArray *)valueMap->GetValue("BeamIntensity"); | |
151 | if(!aliasBeamIntensity) { | |
152 | Log(Form("BeamIntensity not found!!!")); | |
9827400b | 153 | return 1; |
e97cc90e | 154 | } |
958ecabf | 155 | AliInfo(Form("==========BeamIntensity===========")); |
1f9bf847 | 156 | AliGRPDCS *dcs4 = new AliGRPDCS(aliasBeamIntensity,iStartTime,iStopTime); |
e97cc90e | 157 | TString sMeanBeamIntensity = dcs4->ProcessDCS(2); |
158 | if (sMeanBeamIntensity) { | |
159 | Log(Form("<BeamIntensity> for run %d: %s",fRun, sMeanBeamIntensity.Data())); | |
160 | } else { | |
161 | Log(Form("BeamIntensity not put in TMap!")); | |
162 | } | |
163 | ||
164 | TObjArray *aliasL3Current = (TObjArray *)valueMap->GetValue("L3Current"); | |
165 | if(!aliasL3Current) { | |
166 | Log(Form("L3Current not found!!!")); | |
9827400b | 167 | return 1; |
e97cc90e | 168 | } |
958ecabf | 169 | AliInfo(Form("==========L3Current===========")); |
1f9bf847 | 170 | AliGRPDCS *dcs5 = new AliGRPDCS(aliasL3Current,iStartTime,iStopTime); |
e97cc90e | 171 | TString sMeanL3Current = dcs5->ProcessDCS(2); |
172 | if (sMeanL3Current) { | |
173 | Log(Form("<L3Current> for run %d: %s",fRun, sMeanL3Current.Data())); | |
174 | } else { | |
175 | Log(Form("L3Current not put in TMap!")); | |
176 | } | |
177 | ||
178 | TObjArray *aliasL3Polarity = (TObjArray *)valueMap->GetValue("L3Polarity"); | |
179 | if(!aliasL3Polarity) { | |
180 | Log(Form("L3Polarity not found!!!")); | |
9827400b | 181 | return 1; |
e97cc90e | 182 | } |
958ecabf | 183 | AliInfo(Form("==========L3Polarity===========")); |
1f9bf847 | 184 | AliGRPDCS *dcs6 = new AliGRPDCS(aliasL3Polarity,iStartTime,iStopTime); |
e97cc90e | 185 | TString sL3Polarity = dcs6->ProcessDCS(4); |
186 | if (sL3Polarity) { | |
187 | Log(Form("<L3Polarity> for run %d: %s",fRun, sL3Polarity.Data())); | |
188 | } else { | |
189 | Log(Form("L3Polarity not put in TMap!")); | |
190 | } | |
191 | ||
192 | TObjArray *aliasDipoleCurrent = (TObjArray *)valueMap->GetValue("DipoleCurrent"); | |
193 | if(!aliasDipoleCurrent) { | |
194 | Log(Form("DipoleCurrent not found!!!")); | |
9827400b | 195 | return 1; |
e97cc90e | 196 | } |
958ecabf | 197 | AliInfo(Form("==========DipoleCurrent===========")); |
1f9bf847 | 198 | AliGRPDCS *dcs7 = new AliGRPDCS(aliasDipoleCurrent,iStartTime,iStopTime); |
e97cc90e | 199 | TString sMeanDipoleCurrent = dcs7->ProcessDCS(2); |
200 | if (sMeanDipoleCurrent) { | |
201 | Log(Form("<DipoleCurrent> for run %d: %s",fRun, sMeanDipoleCurrent.Data())); | |
202 | } else { | |
203 | Log(Form("DipoleCurrent not put in TMap!")); | |
204 | } | |
205 | ||
206 | TObjArray *aliasDipolePolarity = (TObjArray *)valueMap->GetValue("DipolePolarity"); | |
207 | if(!aliasDipolePolarity) { | |
208 | Log(Form("DipolePolarity not found!!!")); | |
9827400b | 209 | return 1; |
e97cc90e | 210 | } |
958ecabf | 211 | AliInfo(Form("==========DipolePolarity===========")); |
1f9bf847 | 212 | AliGRPDCS *dcs8 = new AliGRPDCS(aliasDipolePolarity,iStartTime,iStopTime); |
e97cc90e | 213 | TString sDipolePolarity = dcs8->ProcessDCS(4); |
214 | if (sDipolePolarity) { | |
215 | Log(Form("<DipolePolarity> for run %d: %s",fRun, sDipolePolarity.Data())); | |
216 | } else { | |
217 | Log(Form("DipolePolarity not put in TMap!")); | |
218 | } | |
219 | ||
220 | TObjArray *aliasCavernTemperature = (TObjArray *)valueMap->GetValue("CavernTemperature"); | |
221 | if(!aliasCavernTemperature) { | |
222 | Log(Form("CavernTemperature not found!!!")); | |
9827400b | 223 | return 1; |
e97cc90e | 224 | } |
958ecabf | 225 | AliInfo(Form("==========CavernTemperature===========")); |
1f9bf847 | 226 | AliGRPDCS *dcs9 = new AliGRPDCS(aliasCavernTemperature,iStartTime,iStopTime); |
e97cc90e | 227 | TString sMeanCavernTemperature = dcs9->ProcessDCS(2); |
228 | if (sMeanCavernTemperature) { | |
229 | Log(Form("<CavernTemperature> for run %d: %s",fRun, sMeanCavernTemperature.Data())); | |
230 | } else { | |
231 | Log(Form("CavernTemperature not put in TMap!")); | |
232 | } | |
233 | ||
5e328d2e | 234 | TObjArray *aliasCavernPressure = (TObjArray *)valueMap->GetValue("CavernAtmosPressure"); |
e97cc90e | 235 | if(!aliasCavernPressure) { |
236 | Log(Form("CavernPressure not found!!!")); | |
9827400b | 237 | return 1; |
e97cc90e | 238 | } |
958ecabf | 239 | AliInfo(Form("==========CavernPressure===========")); |
1f9bf847 | 240 | AliGRPDCS *dcs10 = new AliGRPDCS(aliasCavernPressure,iStartTime,iStopTime); |
e97cc90e | 241 | TString sMeanCavernPressure = dcs10->ProcessDCS(2); |
242 | if (sMeanCavernPressure) { | |
243 | Log(Form("<CavernPressure> for run %d: %s",fRun, sMeanCavernPressure.Data())); | |
244 | } else { | |
245 | Log(Form("CavernPressure not put in TMap!")); | |
246 | } | |
247 | ||
248 | //===========// | |
125567f8 | 249 | //DAQ logbook |
e97cc90e | 250 | //===========// |
3dedb44a | 251 | if (timeStart) { |
252 | Log(Form("Start time for run %d: %s",fRun, timeStart)); | |
253 | } else { | |
254 | Log(Form("Start time not put in logbook!")); | |
255 | } | |
256 | if (timeEnd) { | |
257 | Log(Form("End time for run %d: %s",fRun, timeEnd)); | |
258 | } else { | |
259 | Log(Form("End time not put in logbook!")); | |
260 | } | |
125567f8 | 261 | if (beamEnergy) { |
262 | Log(Form("Beam energy for run %d: %s",fRun, beamEnergy)); | |
263 | } else { | |
264 | Log(Form("Beam energy not put in logbook!")); | |
265 | } | |
266 | if (beamType) { | |
267 | Log(Form("Beam type for run %d: %s",fRun, beamType)); | |
268 | } else { | |
269 | Log(Form("Beam type not put in logbook!")); | |
270 | } | |
271 | if (numberOfDetectors) { | |
272 | Log(Form("Number of active detectors for run %d: %s",fRun, numberOfDetectors)); | |
273 | } else { | |
274 | Log(Form("Number of active detectors not put in logbook!")); | |
275 | } | |
276 | if (detectorMask) { | |
277 | Log(Form("Detector mask for run %d: %s",fRun, detectorMask)); | |
278 | } else { | |
279 | Log(Form("Detector mask not put in logbook!")); | |
280 | } | |
fed5d40b | 281 | if (lhcPeriod) { |
282 | Log(Form("LHC period (DAQ) for run %d: %s",fRun, lhcPeriod)); | |
283 | } else { | |
284 | Log(Form("LHCperiod not put in logbook!")); | |
285 | } | |
125567f8 | 286 | |
3dedb44a | 287 | TList *values = new TList(); |
288 | values->SetOwner(1); | |
289 | ||
125567f8 | 290 | //DAQ logbook |
291 | TMap *mapDAQ1 = new TMap(); | |
292 | mapDAQ1->Add(new TObjString("fAliceStartTime"),new TObjString(timeStart)); | |
293 | values->Add(mapDAQ1); | |
294 | ||
295 | TMap *mapDAQ2 = new TMap(); | |
296 | mapDAQ2->Add(new TObjString("fAliceStopTime"),new TObjString(timeEnd)); | |
297 | values->Add(mapDAQ2); | |
298 | ||
299 | TMap *mapDAQ3 = new TMap(); | |
300 | mapDAQ3->Add(new TObjString("fAliceBeamEnergy"),new TObjString(beamEnergy)); | |
301 | values->Add(mapDAQ3); | |
302 | ||
303 | TMap *mapDAQ4 = new TMap(); | |
304 | mapDAQ4->Add(new TObjString("fAliceBeamType"),new TObjString(beamType)); | |
305 | values->Add(mapDAQ4); | |
306 | ||
307 | TMap *mapDAQ5 = new TMap(); | |
308 | mapDAQ5->Add(new TObjString("fNumberOfDetectors"),new TObjString(numberOfDetectors)); | |
309 | values->Add(mapDAQ5); | |
310 | ||
311 | TMap *mapDAQ6 = new TMap(); | |
312 | mapDAQ6->Add(new TObjString("fDetectorMask"),new TObjString(detectorMask)); | |
313 | values->Add(mapDAQ6); | |
314 | ||
fed5d40b | 315 | TMap *mapDAQ7 = new TMap(); |
316 | mapDAQ7->Add(new TObjString("fLHCPeriod"),new TObjString(lhcPeriod)); | |
317 | values->Add(mapDAQ7); | |
318 | ||
125567f8 | 319 | //DCS dp |
320 | TMap *mapDCS1 = new TMap(); | |
e97cc90e | 321 | mapDCS1->Add(new TObjString("fLHCState"),new TObjString(sLHCState)); |
125567f8 | 322 | values->Add(mapDCS1); |
323 | ||
324 | TMap *mapDCS2 = new TMap(); | |
fed5d40b | 325 | mapDCS2->Add(new TObjString("fLHCCondition"),new TObjString(sLHCPeriod)); |
125567f8 | 326 | values->Add(mapDCS2); |
3dedb44a | 327 | |
e97cc90e | 328 | TMap *mapDCS3 = new TMap(); |
329 | mapDCS3->Add(new TObjString("fLHCLuminosity"),new TObjString(sMeanLHCLuminosity)); | |
330 | values->Add(mapDCS3); | |
331 | ||
332 | TMap *mapDCS4 = new TMap(); | |
333 | mapDCS4->Add(new TObjString("fBeamIntensity"),new TObjString(sMeanBeamIntensity)); | |
334 | values->Add(mapDCS4); | |
335 | ||
336 | TMap *mapDCS5 = new TMap(); | |
337 | mapDCS5->Add(new TObjString("fL3Current"),new TObjString(sMeanL3Current)); | |
338 | values->Add(mapDCS5); | |
339 | ||
340 | TMap *mapDCS6 = new TMap(); | |
341 | mapDCS6->Add(new TObjString("fL3Polarity"),new TObjString(sL3Polarity)); | |
342 | values->Add(mapDCS6); | |
343 | ||
344 | TMap *mapDCS7 = new TMap(); | |
345 | mapDCS7->Add(new TObjString("fDipoleCurrent"),new TObjString(sMeanDipoleCurrent)); | |
346 | values->Add(mapDCS7); | |
347 | ||
348 | TMap *mapDCS8 = new TMap(); | |
349 | mapDCS8->Add(new TObjString("fDipolePolarity"),new TObjString(sDipolePolarity)); | |
350 | values->Add(mapDCS8); | |
351 | ||
352 | TMap *mapDCS9 = new TMap(); | |
353 | mapDCS9->Add(new TObjString("fCavernTemperature"),new TObjString(sMeanCavernTemperature)); | |
354 | values->Add(mapDCS9); | |
355 | ||
356 | TMap *mapDCS10 = new TMap(); | |
357 | mapDCS10->Add(new TObjString("fCavernPressure"),new TObjString(sMeanCavernPressure)); | |
358 | values->Add(mapDCS10); | |
359 | ||
3dedb44a | 360 | AliCDBMetaData md; |
361 | md.SetResponsible("Panos"); | |
362 | ||
9827400b | 363 | Bool_t result = Store("GRP", "Values", values, &md); |
3dedb44a | 364 | |
365 | delete values; | |
366 | ||
9827400b | 367 | if (result) |
368 | return 0; | |
369 | else | |
370 | return 1; | |
3dedb44a | 371 | } |
372 |