]>
Commit | Line | Data |
---|---|---|
73abe331 | 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.1.1 2005/09/12 22:11:40 byordano | |
19 | SHUTTLE package | |
20 | ||
21 | Revision 1.2 2005/08/29 21:15:47 byordano | |
22 | some docs added | |
23 | ||
24 | */ | |
25 | ||
26 | // Description: | |
27 | // This class is the CDBPreProcessor interface, | |
28 | // supposed to be implemented by any detector | |
29 | // interested in immediate processing of data | |
30 | // which is retrieved from DCS. | |
31 | // For every particular run set of aliases and | |
32 | // their corespoding value sets are returned. | |
33 | // Usage schema: | |
34 | // 1) virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime) | |
35 | // This method is called at the begining of data retrieval. | |
36 | // run: run number | |
37 | // startTime: when the run started | |
38 | // endTime: when the run finished | |
39 | // | |
40 | // 2) virtual void Process(const char* alias, TList& valueSet, | |
41 | // Bool_t hasError) | |
42 | // | |
43 | // This method is called for every particular alias which the detector | |
44 | // is registered in the configuration (see AliShuttleConfig). | |
45 | // alias: alias name | |
46 | // valueSet: collection of AliDCSValue | |
47 | // hasError: flag indicating if some error has happened during | |
48 | // the retrieaval of the data for this alias. | |
49 | // | |
50 | // 3) virtual void Finalize() | |
51 | // This method is called after the last alias has been processed. | |
52 | // | |
53 | ||
54 | ||
55 | #include "AliCDBPreProcessor.h" | |
56 | ||
57 | #include "AliShuttle.h" | |
58 | #include "AliLog.h" | |
59 | ||
60 | ClassImp(AliCDBPreProcessor) | |
61 | ||
62 | AliCDBPreProcessor::AliCDBPreProcessor(const char* detector): | |
63 | TNamed(detector, "") | |
64 | { | |
65 | SetTitle(Form("AliCDBPreProcessor for %s subdetector.", detector)); | |
66 | } | |
67 | ||
68 | AliCDBPreProcessor::~AliCDBPreProcessor() { | |
69 | ||
70 | } | |
71 | ||
72 | Int_t AliCDBPreProcessor::GetRun() const { | |
73 | // | |
74 | // Returns current run number. | |
75 | // | |
76 | ||
77 | if (!fShuttle) { | |
78 | AliError(Form("Not registered AliCDBPreProcessor: %s", | |
79 | GetName())); | |
80 | return -1; | |
81 | } | |
82 | ||
83 | return fShuttle->GetCurrentRun(); | |
84 | } | |
85 | ||
86 | UInt_t AliCDBPreProcessor::GetStartTime() const { | |
87 | // | |
88 | // Returns currernt run start time. | |
89 | // | |
90 | if (!fShuttle) { | |
91 | AliError(Form("Not registered AliCDBPreProcessor: %s", | |
92 | GetName())); | |
93 | return 0; | |
94 | } | |
95 | ||
96 | return fShuttle->GetCurrentStartTime(); | |
97 | } | |
98 | ||
99 | UInt_t AliCDBPreProcessor::GetEndTime() const { | |
100 | // | |
101 | // Returns current run end time. | |
102 | // | |
103 | if (!fShuttle) { | |
104 | AliError(Form("Not registered AliCDBPreProcessor: %s", | |
105 | GetName())); | |
106 | return 0; | |
107 | } | |
108 | ||
109 | return fShuttle->GetCurrentEndTime(); | |
110 | } | |
111 | ||
112 | Bool_t AliCDBPreProcessor::Store(const char* specType, TObject* object, | |
113 | AliCDBMetaData* metaData) | |
114 | { | |
115 | // | |
116 | // Store object and metaData into the default AliCDBStorage. | |
117 | // Storage path: <detector>/DCS/<specType> | |
118 | // | |
119 | ||
120 | if (!fShuttle) { | |
121 | AliError(Form("Not registered AliCDBPreProcessor: %s", | |
122 | GetName())); | |
123 | return kFALSE; | |
124 | } | |
125 | ||
126 | return fShuttle->Store(GetName(), specType, object, metaData); | |
127 | } | |
128 |