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