]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliPreprocessor.cxx
Record changes.
[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$
4426d64a 18Revision 1.7 2006/11/06 14:24:21 jgrosseo
19reading of run parameters from the logbook
20online offline naming conversion
21
1b82b32d 22Revision 1.6 2006/10/02 12:57:48 jgrosseo
23Small interface change of function StoreReferenceData in Shuttle
24
3c78eaa5 25Revision 1.5 2006/09/04 17:42:34 hristov
26Changes required by Effective C++
27
fe12e09c 28Revision 1.4 2006/08/08 14:20:49 jgrosseo
29Update to shuttle classes (Alberto)
30
31- Possibility to set the full object's path in the Preprocessor's and
32Shuttle'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
36data in a dedicated CDB storage.
37
84090f85 38Revision 1.3 2006/07/11 12:42:43 jgrosseo
39adding parameters for extended validity range of data produced by preprocessor
40
17111222 41Revision 1.2 2006/06/06 16:36:49 jgrosseo
42minor changes in AliShuttleInterface and AliPreprocessor
43
b88146b7 44Revision 1.1 2006/06/02 14:14:36 hristov
45Separate library for CDB (Jan)
46
57459306 47Revision 1.2 2006/03/07 07:52:34 hristov
48New version (B.Yordanov)
49
50Revision 1.3 2005/11/17 17:47:34 byordano
51TList changed to TObjArray
52
53Revision 1.2 2005/11/17 14:43:22 byordano
54import to local CVS
55
56Revision 1.1.1.1 2005/10/28 07:33:58 hristov
57Initial import as subdirectory in AliRoot
58
59Revision 1.1.1.1 2005/09/12 22:11:40 byordano
60SHUTTLE package
61
62Revision 1.2 2005/08/29 21:15:47 byordano
63some docs added
64
65*/
66
67// Description:
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.
74// Usage schema:
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.
77// run: run number
78// startTime: when the run started
79// endTime: when the run finished
80//
81// 2) virtual void Process()
82//
83// This method is called and passed a list of retrieved values from DCS
84//
85//
86
87
88#include "AliPreprocessor.h"
89
90#include <TString.h>
91#include <TList.h>
92#include <TMap.h>
93
94#include "AliLog.h"
95#include "AliCDBMetaData.h"
96#include "AliCDBStorage.h"
97#include "AliCDBId.h"
98#include "AliCDBPath.h"
4426d64a 99#include "AliCDBEntry.h"
57459306 100#include "AliShuttleInterface.h"
101
102ClassImp(AliPreprocessor)
103
84090f85 104//______________________________________________________________________________________________
57459306 105AliPreprocessor::AliPreprocessor(const char* detector, AliShuttleInterface* shuttle) :
106 TNamed(detector, ""),
fe12e09c 107 fRun(-1),
108 fStartTime(0),
109 fEndTime(0),
57459306 110 fShuttle(shuttle)
111{
112 SetTitle(Form("AliPreprocessor for %s subdetector.", detector));
113
114 if (!fShuttle)
b88146b7 115 {
57459306 116 AliFatal("Initialized without Shuttle instance.");
b88146b7 117 return;
118 }
119
120 fShuttle->RegisterPreprocessor(this);
57459306 121}
122
84090f85 123//______________________________________________________________________________________________
57459306 124AliPreprocessor::~AliPreprocessor()
125{
126}
127
84090f85 128//______________________________________________________________________________________________
57459306 129void AliPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
130{
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
133 // function
134
135 fRun = run;
136 fStartTime = startTime;
137 fEndTime = endTime;
138}
139
84090f85 140//______________________________________________________________________________________________
141UInt_t AliPreprocessor::Store(const char* pathLevel2, const char* pathLevel3, TObject* object,
142 AliCDBMetaData* metaData, Int_t validityStart, Bool_t validityInfinite)
143{
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!
147 //
148 // This function should be called at the end of the preprocessor cycle
149 //
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
1b82b32d 152 // by the Preprocessor and converted to the Offline name. Thus the object's path is "DET/level2/level3"
84090f85 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
159 //
160 // The call is delegated to AliShuttleInterface
161
1b82b32d 162 const char* offlineDetName = AliShuttleInterface::GetOfflineDetName(GetName());
163 if(!offlineDetName) return 0;
164
165 return fShuttle->Store(AliCDBPath(offlineDetName, pathLevel2, pathLevel3), object,
84090f85 166 metaData, validityStart, validityInfinite);
167}
168
169//______________________________________________________________________________________________
170UInt_t AliPreprocessor::StoreReferenceData(const char* pathLevel2, const char* pathLevel3, TObject* object,
3c78eaa5 171 AliCDBMetaData* metaData)
57459306 172{
84090f85 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!
175 //
57459306 176 // This function should be called at the end of the preprocessor cycle
177 //
17111222 178 // The parameters are
84090f85 179 // 1, 2) the 2nd and 3rd level of the object's path. The first level is the detector name which is provided
1b82b32d 180 // by the Preprocessor and converted to the Offline name. Thus the object's path is "DET/level2/level3"
84090f85 181 // 3) the object to be stored
182 // 4) the metaData to be associated with the object
17111222 183 //
57459306 184 // The call is delegated to AliShuttleInterface
185
1b82b32d 186 const char* offlineDetName = AliShuttleInterface::GetOfflineDetName(GetName());
187 if(!offlineDetName) return 0;
188
189 return fShuttle->StoreReferenceData(AliCDBPath(offlineDetName, pathLevel2, pathLevel3), object,
3c78eaa5 190 metaData);
57459306 191}
192
84090f85 193//______________________________________________________________________________________________
57459306 194const char* AliPreprocessor::GetFile(Int_t system, const char* id, const char* source)
195{
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.
199 //
200 // The call is delegated to AliShuttleInterface
201
202 return fShuttle->GetFile(system, GetName(), id, source);
203}
204
84090f85 205//______________________________________________________________________________________________
57459306 206TList* AliPreprocessor::GetFileSources(Int_t system, const char* id)
207{
208 // Returns a list of sources in a given system that saved a file with the given id
209 //
210 // The call is delegated to AliShuttleInterface
211
212 return fShuttle->GetFileSources(system, GetName(), id);
213}
214
84090f85 215//______________________________________________________________________________________________
57459306 216void AliPreprocessor::Log(const char* message)
217{
218 // Adds a log message to the Shuttle log of this preprocessor
219 //
220 // The call is delegated to AliShuttleInterface
221
222 fShuttle->Log(GetName(), message);
223}
1b82b32d 224
225//______________________________________________________________________________________________
226const char* AliPreprocessor::GetRunParameter(const char* param)
227{
228 // Return run parameter read from run logbook
229 //
230 // The call is delegated to AliShuttleInterface
231
232 return fShuttle->GetRunParameter(param);
233}
4426d64a 234
235//______________________________________________________________________________________________
236AliCDBEntry* AliPreprocessor::GetFromOCDB(const char* pathLevel2, const char* pathLevel3)
237{
238 // Return object from OCDB valid for current run
239 //
240 // The call is delegated to AliShuttleInterface
241
242 const char* offlineDetName = AliShuttleInterface::GetOfflineDetName(GetName());
243 if (!offlineDetName) return 0;
244
245 return dynamic_cast<AliCDBEntry*>
246 (fShuttle->GetFromOCDB(AliCDBPath(offlineDetName, pathLevel2, pathLevel3)));
247}
5c957e4a 248
249//______________________________________________________________________________________________
250const char* AliPreprocessor::GetRunType()
251{
252 // Return run type string read from "run type" logbook
253 //
254 // The call is delegated to AliShuttleInterface
255
256 return fShuttle->GetRunType(GetName());
257}