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