]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - STEER/AliPreprocessor.cxx
Updated QA classes (Yves)
[u/mrichter/AliRoot.git] / STEER / AliPreprocessor.cxx
... / ...
CommitLineData
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
16/*
17$Log$
18Revision 1.14 2007/05/30 06:35:21 jgrosseo
19Adding functionality to the Shuttle/TestShuttle:
20o) Function to retrieve list of sources from a given system (GetFileSources with id=0)
21o) Function to retrieve list of IDs for a given source (GetFileIDs)
22These functions are needed for dealing with the tag files that are saved for the GRP preprocessor
23Example code has been added to the TestProcessor in TestShuttle
24
25Revision 1.13 2007/04/12 08:26:33 jgrosseo
26updated commment
27
28Revision 1.12 2007/04/05 08:05:55 acolla
29Conversion from online to offline detector name in StoreReferenceFile
30
31Revision 1.11 2007/04/04 10:29:18 jgrosseo
321) Storing of files to the Grid is now done _after_ your preprocessors succeeded. This is transparent, which means that you can still use the same functions (Store, StoreReferenceData) to store files to the Grid. However, the Shuttle first stores them locally and transfers them after the preprocessor finished. The return code of these two functions has changed from UInt_t to Bool_t which gives you the success of the storing.
33In case of an error with the Grid, the Shuttle will retry the storing later, the preprocessor does not need to be run again.
34
352) The meaning of the return code of the preprocessor has changed. 0 is now success and any other value means failure. This value is stored in the log and you can use it to keep details about the error condition.
36
373) New function StoreReferenceFile to _directly_ store a file (without opening it) to the reference storage.
38
394) The memory usage of the preprocessor is monitored. If it exceeds 2 GB it is terminated.
40
415) New function AliPreprocessor::ProcessDCS(). If you do not need to have DCS data in all cases, you can skip the processing by implemting this function and returning kFALSE under certain conditions. E.g. if there is a certain run type.
42If you always need DCS data (like before), you do not need to implement it.
43
446) The run type has been added to the monitoring page
45
46Revision 1.9 2007/02/28 10:42:58 acolla
47Run type field added in SHUTTLE framework. Run type is read from "run type" logbook and retrieved by
48AliPreprocessor::GetRunType() function.
49
50Revision 1.7 2006/11/06 14:24:21 jgrosseo
51reading of run parameters from the logbook
52online offline naming conversion
53
54Revision 1.6 2006/10/02 12:57:48 jgrosseo
55Small interface change of function StoreReferenceData in Shuttle
56
57Revision 1.5 2006/09/04 17:42:34 hristov
58Changes required by Effective C++
59
60Revision 1.4 2006/08/08 14:20:49 jgrosseo
61Update to shuttle classes (Alberto)
62
63- Possibility to set the full object's path in the Preprocessor's and
64Shuttle's Store functions
65- Possibility to extend the object's run validity in the same classes
66("startValidity" and "validityInfinite" parameters)
67- Implementation of the StoreReferenceData function to store reference
68data in a dedicated CDB storage.
69
70Revision 1.3 2006/07/11 12:42:43 jgrosseo
71adding parameters for extended validity range of data produced by preprocessor
72
73Revision 1.2 2006/06/06 16:36:49 jgrosseo
74minor changes in AliShuttleInterface and AliPreprocessor
75
76Revision 1.1 2006/06/02 14:14:36 hristov
77Separate library for CDB (Jan)
78
79Revision 1.2 2006/03/07 07:52:34 hristov
80New version (B.Yordanov)
81
82Revision 1.3 2005/11/17 17:47:34 byordano
83TList changed to TObjArray
84
85Revision 1.2 2005/11/17 14:43:22 byordano
86import to local CVS
87
88Revision 1.1.1.1 2005/10/28 07:33:58 hristov
89Initial import as subdirectory in AliRoot
90
91Revision 1.1.1.1 2005/09/12 22:11:40 byordano
92SHUTTLE package
93
94Revision 1.2 2005/08/29 21:15:47 byordano
95some docs added
96
97*/
98
99// Description:
100// This class is the CDBPreProcessor interface,
101// supposed to be implemented by any detector
102// interested in immediate processing of data
103// which is retrieved from DCS.
104// For every particular run set of aliases and
105// their corespoding value sets are returned.
106// Usage schema:
107// 1) virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
108// This method is called at the begining of data retrieval.
109// run: run number
110// startTime: when the run started
111// endTime: when the run finished
112//
113// 2) virtual void Process()
114//
115// This method is called and passed a list of retrieved values from DCS
116//
117//
118
119
120#include "AliPreprocessor.h"
121
122#include <TString.h>
123#include <TList.h>
124#include <TMap.h>
125
126#include "AliLog.h"
127#include "AliCDBMetaData.h"
128#include "AliCDBStorage.h"
129#include "AliCDBId.h"
130#include "AliCDBPath.h"
131#include "AliCDBEntry.h"
132#include "AliShuttleInterface.h"
133
134ClassImp(AliPreprocessor)
135
136//______________________________________________________________________________________________
137AliPreprocessor::AliPreprocessor(const char* detector, AliShuttleInterface* shuttle) :
138 TNamed(detector, ""),
139 fRun(-1),
140 fStartTime(0),
141 fEndTime(0),
142 fShuttle(shuttle)
143{
144 SetTitle(Form("AliPreprocessor for %s subdetector.", detector));
145
146 if (!fShuttle)
147 {
148 AliFatal("Initialized without Shuttle instance.");
149 return;
150 }
151
152 fShuttle->RegisterPreprocessor(this);
153}
154
155//______________________________________________________________________________________________
156AliPreprocessor::~AliPreprocessor()
157{
158}
159
160//______________________________________________________________________________________________
161void AliPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
162{
163 // Sets the information of the run which is currently processed
164 // can be overriden for special behaviour, make sure that you call base class
165 // function
166
167 fRun = run;
168 fStartTime = startTime;
169 fEndTime = endTime;
170}
171
172//______________________________________________________________________________________________
173Bool_t AliPreprocessor::Store(const char* pathLevel2, const char* pathLevel3, TObject* object,
174 AliCDBMetaData* metaData, Int_t validityStart, Bool_t validityInfinite)
175{
176 // Stores a CDB object in the storage for offline reconstruction. Objects that are not needed for
177 // offline reconstruction, but should be stored anyway (e.g. for debugging) should NOT be stored
178 // using this function. Use StoreReferenceData instead!
179 //
180 // This function should be called at the end of the preprocessor cycle
181 //
182 // The parameters are
183 // 1, 2) the 2nd and 3rd level of the object's path. The first level is the detector name which is provided
184 // by the Preprocessor and converted to the Offline name. Thus the object's path is "DET/level2/level3"
185 // 3) the object to be stored
186 // 4) the metaData to be associated with the object
187 // 5) the validity start run number w.r.t. the current run,
188 // if the data is valid only for this run leave the default 0
189 // 6) specifies if the calibration data is valid for infinity (this means until updated),
190 // typical for calibration runs, the default is kFALSE
191 //
192 // The call is delegated to AliShuttleInterface
193
194 const char* offlineDetName = AliShuttleInterface::GetOfflineDetName(GetName());
195 if(!offlineDetName) return 0;
196
197 return fShuttle->Store(AliCDBPath(offlineDetName, pathLevel2, pathLevel3), object,
198 metaData, validityStart, validityInfinite);
199}
200
201//______________________________________________________________________________________________
202Bool_t AliPreprocessor::StoreReferenceData(const char* pathLevel2, const char* pathLevel3, TObject* object,
203 AliCDBMetaData* metaData)
204{
205 // Stores a CDB object in the storage for reference data. This objects will not be available during
206 // offline reconstrunction. Use this function for reference data only!
207 //
208 // This function should be called at the end of the preprocessor cycle
209 //
210 // The parameters are
211 // 1, 2) the 2nd and 3rd level of the object's path. The first level is the detector name which is provided
212 // by the Preprocessor and converted to the Offline name. Thus the object's path is "DET/level2/level3"
213 // 3) the object to be stored
214 // 4) the metaData to be associated with the object
215 //
216 // The call is delegated to AliShuttleInterface
217
218 const char* offlineDetName = AliShuttleInterface::GetOfflineDetName(GetName());
219 if(!offlineDetName) return 0;
220
221 return fShuttle->StoreReferenceData(AliCDBPath(offlineDetName, pathLevel2, pathLevel3), object,
222 metaData);
223}
224
225//______________________________________________________________________________________________
226Bool_t AliPreprocessor::StoreReferenceFile(const char* localFile, const char* gridFileName)
227{
228 //
229 // Stores a file directly (without opening it) in the reference storage in the Grid
230 //
231 // The file is stored under the following location:
232 // <base folder of reference storage>/<DET>/<RUN#>_<gridFileName>
233 // where <gridFileName> is the second parameter given to the function
234 //
235 // The call is delegated to AliShuttleInterface
236
237 const char* offlineDetName = AliShuttleInterface::GetOfflineDetName(GetName());
238 if(!offlineDetName) return 0;
239 return fShuttle->StoreReferenceFile(GetName(), localFile, gridFileName);
240}
241
242//______________________________________________________________________________________________
243const char* AliPreprocessor::GetFile(Int_t system, const char* id, const char* source)
244{
245 // This function retrieves a file from the given system (kDAQ, kDCS, kHLT) with the given file id
246 // and from the given source in the system.
247 // The function returnes the path to the local file.
248 //
249 // The call is delegated to AliShuttleInterface
250
251 return fShuttle->GetFile(system, GetName(), id, source);
252}
253
254//______________________________________________________________________________________________
255TList* AliPreprocessor::GetFileSources(Int_t system, const char* id)
256{
257 // Returns a list of sources in a given system that saved a file with the given id
258 // if id is not given all sources are returned
259 //
260 // The call is delegated to AliShuttleInterface
261
262 return fShuttle->GetFileSources(system, GetName(), id);
263}
264
265//______________________________________________________________________________________________
266TList* AliPreprocessor::GetFileIDs(Int_t system, const char* source)
267{
268 // Returns a list of ids in a given system that saved a file with the given source
269 //
270 // The call is delegated to AliShuttleInterface
271
272 return fShuttle->GetFileIDs(system, GetName(), source);
273}
274
275//______________________________________________________________________________________________
276void AliPreprocessor::Log(const char* message)
277{
278 // Adds a log message to the Shuttle log of this preprocessor
279 //
280 // The call is delegated to AliShuttleInterface
281
282 fShuttle->Log(GetName(), message);
283}
284
285//______________________________________________________________________________________________
286const char* AliPreprocessor::GetRunParameter(const char* param)
287{
288 // Return run parameter read from run logbook
289 //
290 // The call is delegated to AliShuttleInterface
291
292 return fShuttle->GetRunParameter(param);
293}
294
295//______________________________________________________________________________________________
296AliCDBEntry* AliPreprocessor::GetFromOCDB(const char* pathLevel2, const char* pathLevel3)
297{
298 // Return object from OCDB valid for current run
299 //
300 // The call is delegated to AliShuttleInterface
301
302 const char* offlineDetName = AliShuttleInterface::GetOfflineDetName(GetName());
303 if (!offlineDetName) return 0;
304
305 return dynamic_cast<AliCDBEntry*>
306 (fShuttle->GetFromOCDB(GetName(), AliCDBPath(offlineDetName, pathLevel2, pathLevel3)));
307}
308
309//______________________________________________________________________________________________
310const char* AliPreprocessor::GetRunType()
311{
312 // Return run type string read from "run type" logbook
313 //
314 // The call is delegated to AliShuttleInterface
315
316 return fShuttle->GetRunType();
317}