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