1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.11 2007/04/04 10:29:18 jgrosseo
19 1) 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.
20 In case of an error with the Grid, the Shuttle will retry the storing later, the preprocessor does not need to be run again.
22 2) 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.
24 3) New function StoreReferenceFile to _directly_ store a file (without opening it) to the reference storage.
26 4) The memory usage of the preprocessor is monitored. If it exceeds 2 GB it is terminated.
28 5) 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.
29 If you always need DCS data (like before), you do not need to implement it.
31 6) The run type has been added to the monitoring page
33 Revision 1.9 2007/02/28 10:42:58 acolla
34 Run type field added in SHUTTLE framework. Run type is read from "run type" logbook and retrieved by
35 AliPreprocessor::GetRunType() function.
37 Revision 1.7 2006/11/06 14:24:21 jgrosseo
38 reading of run parameters from the logbook
39 online offline naming conversion
41 Revision 1.6 2006/10/02 12:57:48 jgrosseo
42 Small interface change of function StoreReferenceData in Shuttle
44 Revision 1.5 2006/09/04 17:42:34 hristov
45 Changes required by Effective C++
47 Revision 1.4 2006/08/08 14:20:49 jgrosseo
48 Update to shuttle classes (Alberto)
50 - Possibility to set the full object's path in the Preprocessor's and
51 Shuttle's Store functions
52 - Possibility to extend the object's run validity in the same classes
53 ("startValidity" and "validityInfinite" parameters)
54 - Implementation of the StoreReferenceData function to store reference
55 data in a dedicated CDB storage.
57 Revision 1.3 2006/07/11 12:42:43 jgrosseo
58 adding parameters for extended validity range of data produced by preprocessor
60 Revision 1.2 2006/06/06 16:36:49 jgrosseo
61 minor changes in AliShuttleInterface and AliPreprocessor
63 Revision 1.1 2006/06/02 14:14:36 hristov
64 Separate library for CDB (Jan)
66 Revision 1.2 2006/03/07 07:52:34 hristov
67 New version (B.Yordanov)
69 Revision 1.3 2005/11/17 17:47:34 byordano
70 TList changed to TObjArray
72 Revision 1.2 2005/11/17 14:43:22 byordano
75 Revision 1.1.1.1 2005/10/28 07:33:58 hristov
76 Initial import as subdirectory in AliRoot
78 Revision 1.1.1.1 2005/09/12 22:11:40 byordano
81 Revision 1.2 2005/08/29 21:15:47 byordano
87 // This class is the CDBPreProcessor interface,
88 // supposed to be implemented by any detector
89 // interested in immediate processing of data
90 // which is retrieved from DCS.
91 // For every particular run set of aliases and
92 // their corespoding value sets are returned.
94 // 1) virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
95 // This method is called at the begining of data retrieval.
97 // startTime: when the run started
98 // endTime: when the run finished
100 // 2) virtual void Process()
102 // This method is called and passed a list of retrieved values from DCS
107 #include "AliPreprocessor.h"
114 #include "AliCDBMetaData.h"
115 #include "AliCDBStorage.h"
116 #include "AliCDBId.h"
117 #include "AliCDBPath.h"
118 #include "AliCDBEntry.h"
119 #include "AliShuttleInterface.h"
121 ClassImp(AliPreprocessor)
123 //______________________________________________________________________________________________
124 AliPreprocessor::AliPreprocessor(const char* detector, AliShuttleInterface* shuttle) :
125 TNamed(detector, ""),
131 SetTitle(Form("AliPreprocessor for %s subdetector.", detector));
135 AliFatal("Initialized without Shuttle instance.");
139 fShuttle->RegisterPreprocessor(this);
142 //______________________________________________________________________________________________
143 AliPreprocessor::~AliPreprocessor()
147 //______________________________________________________________________________________________
148 void AliPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
150 // Sets the information of the run which is currently processed
151 // can be overriden for special behaviour, make sure that you call base class
155 fStartTime = startTime;
159 //______________________________________________________________________________________________
160 Bool_t AliPreprocessor::Store(const char* pathLevel2, const char* pathLevel3, TObject* object,
161 AliCDBMetaData* metaData, Int_t validityStart, Bool_t validityInfinite)
163 // Stores a CDB object in the storage for offline reconstruction. Objects that are not needed for
164 // offline reconstruction, but should be stored anyway (e.g. for debugging) should NOT be stored
165 // using this function. Use StoreReferenceData instead!
167 // This function should be called at the end of the preprocessor cycle
169 // The parameters are
170 // 1, 2) the 2nd and 3rd level of the object's path. The first level is the detector name which is provided
171 // by the Preprocessor and converted to the Offline name. Thus the object's path is "DET/level2/level3"
172 // 3) the object to be stored
173 // 4) the metaData to be associated with the object
174 // 5) the validity start run number w.r.t. the current run,
175 // if the data is valid only for this run leave the default 0
176 // 6) specifies if the calibration data is valid for infinity (this means until updated),
177 // typical for calibration runs, the default is kFALSE
179 // The call is delegated to AliShuttleInterface
181 const char* offlineDetName = AliShuttleInterface::GetOfflineDetName(GetName());
182 if(!offlineDetName) return 0;
184 return fShuttle->Store(AliCDBPath(offlineDetName, pathLevel2, pathLevel3), object,
185 metaData, validityStart, validityInfinite);
188 //______________________________________________________________________________________________
189 Bool_t AliPreprocessor::StoreReferenceData(const char* pathLevel2, const char* pathLevel3, TObject* object,
190 AliCDBMetaData* metaData)
192 // Stores a CDB object in the storage for reference data. This objects will not be available during
193 // offline reconstrunction. Use this function for reference data only!
195 // This function should be called at the end of the preprocessor cycle
197 // The parameters are
198 // 1, 2) the 2nd and 3rd level of the object's path. The first level is the detector name which is provided
199 // by the Preprocessor and converted to the Offline name. Thus the object's path is "DET/level2/level3"
200 // 3) the object to be stored
201 // 4) the metaData to be associated with the object
203 // The call is delegated to AliShuttleInterface
205 const char* offlineDetName = AliShuttleInterface::GetOfflineDetName(GetName());
206 if(!offlineDetName) return 0;
208 return fShuttle->StoreReferenceData(AliCDBPath(offlineDetName, pathLevel2, pathLevel3), object,
212 //______________________________________________________________________________________________
213 Bool_t AliPreprocessor::StoreReferenceFile(const char* localFile, const char* gridFileName)
216 // Stores a file directly (without opening it) in the reference storage in the Grid
218 // The call is delegated to AliShuttleInterface
220 const char* offlineDetName = AliShuttleInterface::GetOfflineDetName(GetName());
221 if(!offlineDetName) return 0;
222 return fShuttle->StoreReferenceFile(GetName(), localFile, gridFileName);
225 //______________________________________________________________________________________________
226 const char* AliPreprocessor::GetFile(Int_t system, const char* id, const char* source)
228 // This function retrieves a file from the given system (kDAQ, kDCS, kHLT) with the given file id
229 // and from the given source in the system.
230 // The function returnes the path to the local file.
232 // The call is delegated to AliShuttleInterface
234 return fShuttle->GetFile(system, GetName(), id, source);
237 //______________________________________________________________________________________________
238 TList* AliPreprocessor::GetFileSources(Int_t system, const char* id)
240 // Returns a list of sources in a given system that saved a file with the given id
242 // The call is delegated to AliShuttleInterface
244 return fShuttle->GetFileSources(system, GetName(), id);
247 //______________________________________________________________________________________________
248 void AliPreprocessor::Log(const char* message)
250 // Adds a log message to the Shuttle log of this preprocessor
252 // The call is delegated to AliShuttleInterface
254 fShuttle->Log(GetName(), message);
257 //______________________________________________________________________________________________
258 const char* AliPreprocessor::GetRunParameter(const char* param)
260 // Return run parameter read from run logbook
262 // The call is delegated to AliShuttleInterface
264 return fShuttle->GetRunParameter(param);
267 //______________________________________________________________________________________________
268 AliCDBEntry* AliPreprocessor::GetFromOCDB(const char* pathLevel2, const char* pathLevel3)
270 // Return object from OCDB valid for current run
272 // The call is delegated to AliShuttleInterface
274 const char* offlineDetName = AliShuttleInterface::GetOfflineDetName(GetName());
275 if (!offlineDetName) return 0;
277 return dynamic_cast<AliCDBEntry*>
278 (fShuttle->GetFromOCDB(GetName(), AliCDBPath(offlineDetName, pathLevel2, pathLevel3)));
281 //______________________________________________________________________________________________
282 const char* AliPreprocessor::GetRunType()
284 // Return run type string read from "run type" logbook
286 // The call is delegated to AliShuttleInterface
288 return fShuttle->GetRunType();