]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/pendolino/MUON/AliHLTPredictionProcessorMTR.cxx
Bug fix: proper place to reinitialise the generic MC histos in the switch -> no crash...
[u/mrichter/AliRoot.git] / HLT / pendolino / MUON / AliHLTPredictionProcessorMTR.cxx
1 /**************************************************************************
2  * This file is property of and copyright by the ALICE HLT Project        * 
3  * All rights reserved.                                                   *
4  *                                                                        *
5  * Primary Authors:                                                       *
6  *   Artur Szostak <artursz@iafrica.com>                                  *
7  *                                                                        *
8  * Permission to use, copy, modify and distribute this software and its   *
9  * documentation strictly for non-commercial purposes is hereby granted   *
10  * without fee, provided that the above copyright notice appears in all   *
11  * copies and that both the copyright notice and this permission notice   *
12  * appear in the supporting documentation. The authors make no claims     *
13  * about the suitability of this software for any purpose. It is          * 
14  * provided "as is" without express or implied warranty.                  *
15  **************************************************************************/
16
17 /* $Id$ */
18
19 ///
20 ///  @file   AliHLTPredictionProcessorMTR.cxx
21 ///  @author Artur Szostak <artursz@iafrica.com>
22 ///  @date   
23 ///  @brief  Implementation of the AliHLTPredictionProcessorMTR class.
24 ///
25
26 #include "AliHLTPredictionProcessorMTR.h"
27 #include "AliCDBMetaData.h"
28 #include "AliCDBEntry.h"
29 #include <cstdlib>
30
31 #include <TTimeStamp.h>
32 #include <TObjString.h>
33 #include <TObjArray.h>
34 #include <AliDCSValue.h>
35
36 ClassImp(AliHLTPredictionProcessorMTR);
37
38
39 AliHLTPredictionProcessorMTR::AliHLTPredictionProcessorMTR(
40                 const char* detector, AliHLTPendolino* pendolino
41         ) :
42         AliHLTPredictionProcessorInterface(detector, pendolino),
43         fPredict(kTRUE)
44 {
45         /// The class constructor for the preprocessor.
46         /// @param detector  The detector name, which must be "MTR".
47         /// @param pendolino A valid pointer to the pendolino instance.
48         
49         if (strcmp(detector, "MTR") != 0)
50         {
51                 Log(Form("Warning: Setting the detector name to an incorrect value = '%s'."
52                     " It must be set to 'MTR'.", detector)
53                 );
54         }
55 }
56
57
58 AliHLTPredictionProcessorMTR::~AliHLTPredictionProcessorMTR()
59 {
60         /// Default destructor.
61 }
62
63
64 UInt_t AliHLTPredictionProcessorMTR::makePrediction(Bool_t doPrediction)
65 {
66         /// This function is called by the Pendolino before the fetched DCS data
67         /// is handed in for (prediction) processing.
68         ///
69         /// @param doPrediction If true then preprocessed data will be extrapolated
70         ///           to the current time. Otherwise no extrapolation will be
71         ///           performed if false. The default is to perform extrapolations.
72         ///
73         /// @return Currently always returns 0 for success.
74
75         fPredict = doPrediction;
76         return 0;
77 }
78
79
80 void AliHLTPredictionProcessorMTR::Initialize(
81                 Int_t run, UInt_t startTime, UInt_t endTime
82         )
83 {
84         /// Performs initialisation of the preprocessor.
85         /// At the moment just basic sanity checks are performed.
86         ///
87         /// @param run The current run number.
88         /// @param startTime The start time (earliest timestamp) of the data.
89         /// @param endTime The end time (latest timestamp) of the data.
90         
91         if (startTime > endTime)
92                 Log("Error: start time is greater than end time.");
93         
94         AliPreprocessor::Initialize(run, startTime, endTime);
95
96         if (fPredict)
97                 Log("Prediction is switched ON.");
98         else
99                 Log("Prediction is switched OFF.");
100 }
101
102
103 UInt_t AliHLTPredictionProcessorMTR::Process(TMap* /*dcsAliasMap*/)
104 {
105         /// Process the DCS values.
106         /// At the moment nothing is done here.
107         ///
108         /// @param dcsAliasMap The map containing aliases and corresponding DCS
109         ///                    values and timestamps
110         ///
111         /// @return At the moment 0 is always returned for success.
112         
113         Log("Processing MTR");
114         return 0;
115 }
116
117 TMap* AliHLTPredictionProcessorMTR::produceTestData(TString /*aliasName*/) {
118     TMap* resultMap = 0;
119
120     // here has to come real dummy data :-)
121     resultMap = new TMap();
122     TTimeStamp tt;
123         Float_t fval = 33.3;
124     TObjString* name = new TObjString("DummyData");
125     AliDCSValue* val = new AliDCSValue(fval, tt.GetTime());
126     TObjArray* arr = new TObjArray();
127     arr->Add(val);
128     resultMap->Add(name, arr);
129
130     return resultMap;
131 }
132
133