]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/pendolino/PredictionProcessor/HLT/AliHLTPredicProcTempMonitor.h
7f6d2189447407d8812cbc23af8c7b1d0ca04b76
[u/mrichter/AliRoot.git] / HLT / pendolino / PredictionProcessor / HLT / AliHLTPredicProcTempMonitor.h
1 //-*- Mode: C++ -*-
2 // $Id$
3
4 #ifndef ALI_HLT_PREDICT_PROC_TEMP_MONITOR_H
5 #define ALI_HLT_PREDICT_PROC_TEMP_MONITOR_H
6 //* This file is property of and copyright by the ALICE HLT Project        * 
7 //* ALICE Experiment at CERN, All rights reserved.                         *
8 //* See cxx source for full Copyright notice                               *
9
10 /** @file   AliHLTPredicProcTempMonitor.h
11     @author Sebastian Bablok
12     @date   
13     @brief  
14 */
15
16 #include "AliHLTPredictionProcessorInterface.h"
17
18 #include <TObjString.h>
19
20
21 /**
22  * Implementation of an AliHLTPredictionProcessor for monitoring DCS 
23  * Temperatur values inside the HLT. 
24  *
25  * @author Sebastian Bablok
26  * @author Gaute Oevrebekk (extention for B-Field)
27  *
28  * @date 2007-12-03
29  * @date 2008-03-04
30  */
31 class AliHLTPredicProcTempMonitor : public AliHLTPredictionProcessorInterface {
32     public:
33
34                 /** Static const defining path part 2 */
35                 static const TString kPath2; // defining path part 2
36                 /** Static const defining path part 3 */
37                 static const TString kPath3; //defining path part 3
38                 /** Static const defining creator of HCDB object */
39                 static const TString kCreator; // defining creator of HCDB object
40                 /** Static const defining comment for HCDB object */
41                 static const TString kComment; // defining comment for HCDB object
42                 /** Static const defining aliroot version */
43                 static const TString kAliRootVersion; // defining aliroot version
44                 /** Static const defining error ret val for storage error */
45                 static const UInt_t kUnableToStoreObject; // defining error ret val for storage error
46 //              static const TString kAmandaTempSensor;
47         
48                 /**
49                  * Constructor for AliHLTPredictionProcessorDummy
50                  *
51                  * @param detector string defining the detector to which the 
52                  *                      PredictionProcessor belongs to
53                  * @param pendolino pointer to the hosting pendolino (derived from 
54                  *                      AliShuttleInterface)
55                  */
56                 AliHLTPredicProcTempMonitor(const char* detector, 
57                                                 AliHLTPendolino* pendolino);
58
59                 /**
60                  * Destructor for AliHLTPredictionProcessorDummy
61                  */
62                 virtual ~AliHLTPredicProcTempMonitor();
63                 
64                 /**
65                  * Pure virtual function to force the Prediction Processor to implement
66                  * a function to flag that prediction making is required.
67                  * This function is called by the Pendolino before the fetched DCS data
68                  * is handed in for (prediction) processing.
69                  *
70                  * @param doPrediction if true, prediction making shall be switched on,
71                  *                      if false, switched off.
72                  * 
73                  * @return 0 on success; a value greater than 0 refers to an error
74                  */
75                 virtual UInt_t makePrediction(Bool_t doPrediction = true);
76
77                 /**
78                  * Pure Virtual function, implemented in the detector specific 
79                  * PredictionProcessors to initialize them.
80                  *
81                  * @param run run number
82                  * @param startTime start time of data
83                  * @param endTime end time of data
84                  */
85                 virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
86
87                 /**
88                  * Function called by the Pendolino for each participating subdetector
89                  * producing the required condition settings. This includes the 
90                  * encoding of a prediction to the values due to the fact, that only 
91                  * data up to now can be fetched from DCS (the latest data can also be 
92                  * up to 2 min old until it is received on HLT side). To write the data
93                  * to the HCDB, the detector specific implementation of this class has 
94                  * to call the appropriated storing function provided by the interface.
95                  *
96                  * @param dcsAliasMap the map containing aliases and corresponding DCS
97                  *                      values and timestamps
98                  *
99                  * @return 0 on success; a value greater than 0 refers to an error
100                  */
101                 virtual UInt_t Process(TMap* dcsAliasMap);
102
103                 /**
104                  * Indicates if DCS data shall be processed.
105                  * NOTE: should always return true, since it is used as prediction 
106                  * processor, which will only process DCS data
107                  *
108                  * @return true if DCS data can be processed, else false. Note: if false
109                  *                              the Pendolino would stop, so make sure that it is true.
110                  */
111                 virtual Bool_t ProcessDCS();
112
113         /**
114          * Function to let the PredictionProcessor produce dummy input data,
115          * that can be used in Pendolino tests, where no DCS Archieve DB is
116          * contacted. This function is called by the Pendolino, the result is
117          * given back to the PredictionProcessor via the Process(...) call.
118          * Since the DCSMaps requested from DCS are detector specific, the
119          * PredictionProcessor should know, how the maps look like, that it
120          * expects.
121          * NOTE: The clean - up (delete) of the TMap will be performed by the
122          * Pendolino after the usage. The PredictionProcessor has never to
123          * call delete on the returned TMap pointer.
124          *
125          * @param aliasName optional parameter, that can be given in order to
126          *          create a DCSMap for dedicated aliases. For a general test
127          *          this paramter should be empty. If more than one alias name
128          *          shall be specified, they are separated by blanks " ".
129          *
130          * @return DCSMap containing dummy data for testing the Pendolino.
131          */
132         virtual TMap* produceTestData(TString aliasName = "");
133
134
135         protected:
136                 
137                 /**
138                  * Function to extract the B-Field from the DCS map.
139                  *
140                  * @param dcsAliasMap the DCS map, containing the AliDCSValues
141                  *
142                  * @return 0 in case of success, else an error code
143                  */
144                 UInt_t ExtractBField(TMap* dcsAliasMap);
145
146                 /**
147                  * Function to extract a float AliDCSValue by its name from the DCS map
148                  *
149                  * @param dcsAliasMap the DCS value map
150                  * @param stringId the name of the desired AliDCSValue - float
151                  * @param value pointer to a float, where the extratced value shall be stored
152                  *                              (out parameter)
153                  * 
154                  * @return true in case of success, else false
155                  */
156                 Bool_t GetSensorValue(TMap* dcsAliasMap, const char* stringId, 
157                                                 Float_t* value);
158                 
159         private:
160                 /**
161                  * Disabled Copy constructor 
162                  * (parent class is disabled so derived class does the same)
163                  */
164                 AliHLTPredicProcTempMonitor(
165                                                 const AliHLTPredicProcTempMonitor& predictPro);
166
167                 /**
168                  * Disabled Assignment operator
169                  * (parent class is disabled so derived class does the same)
170                  */
171                 AliHLTPredicProcTempMonitor& operator=(
172                                                 const AliHLTPredicProcTempMonitor& rhs);
173
174
175                 /**
176                  * Function to extract the actual values from the DCSMap
177                  *
178                  * @param inputMap pointer to the DCSMap as input
179                  * @param outputMap pointer to the Map where to store the extracted 
180                  *                      values
181                  *
182                  * @return true in case of success, else false
183                  */
184 //              Bool_t extractTempvalues(TMap* inputMap, TMap* outputMap);
185
186                 /**
187                  * Stores if prediction shall be made
188                  */
189                 Bool_t fPredict;  // flag for prediction making
190
191                 /**
192                  * Stores the run number
193                  */
194                 Int_t fRun;  //  Stores the run number
195         
196                 /**
197                  * Stores the start time of the to process DCS data
198                  */     
199                 UInt_t fStartTime; // Stores the start time of the to process DCS data
200         
201                 /**
202                  * Stores the end time of the to process DCS data
203                  */     
204                 UInt_t fEndTime;  // Stores the end time of the to process DCS data
205
206                 /**
207                  * Stores the extracted B-Field in a TObjString
208                  */
209                 TObjString fBField;  // Stores the extracted B-Field in a TObjString
210
211                 /** ClassDef of AliHLTPredicProcTempMonitor for AliRoot */
212                 ClassDef(AliHLTPredicProcTempMonitor, 4);
213         
214 };
215
216
217 inline Bool_t AliHLTPredicProcTempMonitor::ProcessDCS() {
218         // indicates if DCS values are processed; always true
219         return true;
220 }
221
222 #endif
223
224