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.7 2006/11/06 14:24:21 jgrosseo
19 reading of run parameters from the logbook
20 online offline naming conversion
22 Revision 1.6 2006/10/02 12:57:48 jgrosseo
23 Small interface change of function StoreReferenceData in Shuttle
25 Revision 1.5 2006/09/04 17:42:34 hristov
26 Changes required by Effective C++
28 Revision 1.4 2006/08/08 14:20:49 jgrosseo
29 Update to shuttle classes (Alberto)
31 - Possibility to set the full object's path in the Preprocessor's and
32 Shuttle's Store functions
33 - Possibility to extend the object's run validity in the same classes
34 ("startValidity" and "validityInfinite" parameters)
35 - Implementation of the StoreReferenceData function to store reference
36 data in a dedicated CDB storage.
38 Revision 1.3 2006/07/11 12:42:43 jgrosseo
39 adding parameters for extended validity range of data produced by preprocessor
41 Revision 1.2 2006/06/06 16:36:49 jgrosseo
42 minor changes in AliShuttleInterface and AliPreprocessor
44 Revision 1.1 2006/06/02 14:14:36 hristov
45 Separate library for CDB (Jan)
47 Revision 1.2 2006/03/07 07:52:34 hristov
48 New version (B.Yordanov)
50 Revision 1.3 2005/11/17 17:47:34 byordano
51 TList changed to TObjArray
53 Revision 1.2 2005/11/17 14:43:22 byordano
56 Revision 1.1.1.1 2005/10/28 07:33:58 hristov
57 Initial import as subdirectory in AliRoot
59 Revision 1.1.1.1 2005/09/12 22:11:40 byordano
62 Revision 1.2 2005/08/29 21:15:47 byordano
68 // This class is the CDBPreProcessor interface,
69 // supposed to be implemented by any detector
70 // interested in immediate processing of data
71 // which is retrieved from DCS.
72 // For every particular run set of aliases and
73 // their corespoding value sets are returned.
75 // 1) virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
76 // This method is called at the begining of data retrieval.
78 // startTime: when the run started
79 // endTime: when the run finished
81 // 2) virtual void Process()
83 // This method is called and passed a list of retrieved values from DCS
88 #include "AliPreprocessor.h"
95 #include "AliCDBMetaData.h"
96 #include "AliCDBStorage.h"
98 #include "AliCDBPath.h"
99 #include "AliCDBEntry.h"
100 #include "AliShuttleInterface.h"
102 ClassImp(AliPreprocessor)
104 //______________________________________________________________________________________________
105 AliPreprocessor::AliPreprocessor(const char* detector, AliShuttleInterface* shuttle) :
106 TNamed(detector, ""),
112 SetTitle(Form("AliPreprocessor for %s subdetector.", detector));
116 AliFatal("Initialized without Shuttle instance.");
120 fShuttle->RegisterPreprocessor(this);
123 //______________________________________________________________________________________________
124 AliPreprocessor::~AliPreprocessor()
128 //______________________________________________________________________________________________
129 void AliPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
131 // Sets the information of the run which is currently processed
132 // can be overriden for special behaviour, make sure that you call base class
136 fStartTime = startTime;
140 //______________________________________________________________________________________________
141 UInt_t AliPreprocessor::Store(const char* pathLevel2, const char* pathLevel3, TObject* object,
142 AliCDBMetaData* metaData, Int_t validityStart, Bool_t validityInfinite)
144 // Stores a CDB object in the storage for offline reconstruction. Objects that are not needed for
145 // offline reconstruction, but should be stored anyway (e.g. for debugging) should NOT be stored
146 // using this function. Use StoreReferenceData instead!
148 // This function should be called at the end of the preprocessor cycle
150 // The parameters are
151 // 1, 2) the 2nd and 3rd level of the object's path. The first level is the detector name which is provided
152 // by the Preprocessor and converted to the Offline name. Thus the object's path is "DET/level2/level3"
153 // 3) the object to be stored
154 // 4) the metaData to be associated with the object
155 // 5) the validity start run number w.r.t. the current run,
156 // if the data is valid only for this run leave the default 0
157 // 6) specifies if the calibration data is valid for infinity (this means until updated),
158 // typical for calibration runs, the default is kFALSE
160 // The call is delegated to AliShuttleInterface
162 const char* offlineDetName = AliShuttleInterface::GetOfflineDetName(GetName());
163 if(!offlineDetName) return 0;
165 return fShuttle->Store(AliCDBPath(offlineDetName, pathLevel2, pathLevel3), object,
166 metaData, validityStart, validityInfinite);
169 //______________________________________________________________________________________________
170 UInt_t AliPreprocessor::StoreReferenceData(const char* pathLevel2, const char* pathLevel3, TObject* object,
171 AliCDBMetaData* metaData)
173 // Stores a CDB object in the storage for reference data. This objects will not be available during
174 // offline reconstrunction. Use this function for reference data only!
176 // This function should be called at the end of the preprocessor cycle
178 // The parameters are
179 // 1, 2) the 2nd and 3rd level of the object's path. The first level is the detector name which is provided
180 // by the Preprocessor and converted to the Offline name. Thus the object's path is "DET/level2/level3"
181 // 3) the object to be stored
182 // 4) the metaData to be associated with the object
184 // The call is delegated to AliShuttleInterface
186 const char* offlineDetName = AliShuttleInterface::GetOfflineDetName(GetName());
187 if(!offlineDetName) return 0;
189 return fShuttle->StoreReferenceData(AliCDBPath(offlineDetName, pathLevel2, pathLevel3), object,
193 //______________________________________________________________________________________________
194 const char* AliPreprocessor::GetFile(Int_t system, const char* id, const char* source)
196 // This function retrieves a file from the given system (kDAQ, kDCS, kHLT) with the given file id
197 // and from the given source in the system.
198 // The function returnes the path to the local file.
200 // The call is delegated to AliShuttleInterface
202 return fShuttle->GetFile(system, GetName(), id, source);
205 //______________________________________________________________________________________________
206 TList* AliPreprocessor::GetFileSources(Int_t system, const char* id)
208 // Returns a list of sources in a given system that saved a file with the given id
210 // The call is delegated to AliShuttleInterface
212 return fShuttle->GetFileSources(system, GetName(), id);
215 //______________________________________________________________________________________________
216 void AliPreprocessor::Log(const char* message)
218 // Adds a log message to the Shuttle log of this preprocessor
220 // The call is delegated to AliShuttleInterface
222 fShuttle->Log(GetName(), message);
225 //______________________________________________________________________________________________
226 const char* AliPreprocessor::GetRunParameter(const char* param)
228 // Return run parameter read from run logbook
230 // The call is delegated to AliShuttleInterface
232 return fShuttle->GetRunParameter(param);
235 //______________________________________________________________________________________________
236 AliCDBEntry* AliPreprocessor::GetFromOCDB(const char* pathLevel2, const char* pathLevel3)
238 // Return object from OCDB valid for current run
240 // The call is delegated to AliShuttleInterface
242 const char* offlineDetName = AliShuttleInterface::GetOfflineDetName(GetName());
243 if (!offlineDetName) return 0;
245 return dynamic_cast<AliCDBEntry*>
246 (fShuttle->GetFromOCDB(AliCDBPath(offlineDetName, pathLevel2, pathLevel3)));
249 //______________________________________________________________________________________________
250 const char* AliPreprocessor::GetRunType()
252 // Return run type string read from "run type" logbook
254 // The call is delegated to AliShuttleInterface
256 return fShuttle->GetRunType(GetName());