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