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