]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliPreprocessor.cxx
Updated QA classes (Yves)
[u/mrichter/AliRoot.git] / STEER / AliPreprocessor.cxx
CommitLineData
57459306 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$
03b6e5e2 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
4a33bdd9 25Revision 1.13 2007/04/12 08:26:33 jgrosseo
26updated commment
27
7a6c91b3 28Revision 1.12 2007/04/05 08:05:55 acolla
29Conversion from online to offline detector name in StoreReferenceFile
30
36a9f79d 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
eb4a4f5c 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
4426d64a 50Revision 1.7 2006/11/06 14:24:21 jgrosseo
51reading of run parameters from the logbook
52online offline naming conversion
53
1b82b32d 54Revision 1.6 2006/10/02 12:57:48 jgrosseo
55Small interface change of function StoreReferenceData in Shuttle
56
3c78eaa5 57Revision 1.5 2006/09/04 17:42:34 hristov
58Changes required by Effective C++
59
fe12e09c 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
84090f85 70Revision 1.3 2006/07/11 12:42:43 jgrosseo
71adding parameters for extended validity range of data produced by preprocessor
72
17111222 73Revision 1.2 2006/06/06 16:36:49 jgrosseo
74minor changes in AliShuttleInterface and AliPreprocessor
75
b88146b7 76Revision 1.1 2006/06/02 14:14:36 hristov
77Separate library for CDB (Jan)
78
57459306 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"
4426d64a 131#include "AliCDBEntry.h"
57459306 132#include "AliShuttleInterface.h"
133
134ClassImp(AliPreprocessor)
135
84090f85 136//______________________________________________________________________________________________
57459306 137AliPreprocessor::AliPreprocessor(const char* detector, AliShuttleInterface* shuttle) :
138 TNamed(detector, ""),
fe12e09c 139 fRun(-1),
140 fStartTime(0),
141 fEndTime(0),
57459306 142 fShuttle(shuttle)
143{
144 SetTitle(Form("AliPreprocessor for %s subdetector.", detector));
145
146 if (!fShuttle)
b88146b7 147 {
57459306 148 AliFatal("Initialized without Shuttle instance.");
b88146b7 149 return;
150 }
151
152 fShuttle->RegisterPreprocessor(this);
57459306 153}
154
84090f85 155//______________________________________________________________________________________________
57459306 156AliPreprocessor::~AliPreprocessor()
157{
158}
159
84090f85 160//______________________________________________________________________________________________
57459306 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
84090f85 172//______________________________________________________________________________________________
eb4a4f5c 173Bool_t AliPreprocessor::Store(const char* pathLevel2, const char* pathLevel3, TObject* object,
84090f85 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
1b82b32d 184 // by the Preprocessor and converted to the Offline name. Thus the object's path is "DET/level2/level3"
84090f85 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
1b82b32d 194 const char* offlineDetName = AliShuttleInterface::GetOfflineDetName(GetName());
195 if(!offlineDetName) return 0;
196
197 return fShuttle->Store(AliCDBPath(offlineDetName, pathLevel2, pathLevel3), object,
84090f85 198 metaData, validityStart, validityInfinite);
199}
200
201//______________________________________________________________________________________________
eb4a4f5c 202Bool_t AliPreprocessor::StoreReferenceData(const char* pathLevel2, const char* pathLevel3, TObject* object,
3c78eaa5 203 AliCDBMetaData* metaData)
57459306 204{
84090f85 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 //
57459306 208 // This function should be called at the end of the preprocessor cycle
209 //
17111222 210 // The parameters are
84090f85 211 // 1, 2) the 2nd and 3rd level of the object's path. The first level is the detector name which is provided
1b82b32d 212 // by the Preprocessor and converted to the Offline name. Thus the object's path is "DET/level2/level3"
84090f85 213 // 3) the object to be stored
214 // 4) the metaData to be associated with the object
17111222 215 //
57459306 216 // The call is delegated to AliShuttleInterface
217
1b82b32d 218 const char* offlineDetName = AliShuttleInterface::GetOfflineDetName(GetName());
219 if(!offlineDetName) return 0;
220
221 return fShuttle->StoreReferenceData(AliCDBPath(offlineDetName, pathLevel2, pathLevel3), object,
3c78eaa5 222 metaData);
57459306 223}
9827400b 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 //
7a6c91b3 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 //
9827400b 235 // The call is delegated to AliShuttleInterface
236
36a9f79d 237 const char* offlineDetName = AliShuttleInterface::GetOfflineDetName(GetName());
238 if(!offlineDetName) return 0;
9827400b 239 return fShuttle->StoreReferenceFile(GetName(), localFile, gridFileName);
240}
57459306 241
84090f85 242//______________________________________________________________________________________________
57459306 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
84090f85 254//______________________________________________________________________________________________
57459306 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
4a33bdd9 258 // if id is not given all sources are returned
57459306 259 //
260 // The call is delegated to AliShuttleInterface
261
262 return fShuttle->GetFileSources(system, GetName(), id);
263}
264
4a33bdd9 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
84090f85 275//______________________________________________________________________________________________
57459306 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}
1b82b32d 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}
4426d64a 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*>
9827400b 306 (fShuttle->GetFromOCDB(GetName(), AliCDBPath(offlineDetName, pathLevel2, pathLevel3)));
4426d64a 307}
5c957e4a 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
9827400b 316 return fShuttle->GetRunType();
5c957e4a 317}