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