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