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