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