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