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