still keep old AliCFGrid implementation in AliCFContainer's example, for the moment
[u/mrichter/AliRoot.git] / HLT / rec / AliHLTPreprocessor.cxx
CommitLineData
33cc944d 1// $Id$
2
3/**************************************************************************
4 * This file is property of and copyright by the ALICE HLT Project *
5 * ALICE Experiment at CERN, All rights reserved. *
6 * *
7 * Primary Authors: Sebastian Bablok <Sebastian.Bablok@ift.uib.no> *
8 * Kenneth Aamodt *
9 * for The ALICE HLT Project. *
10 * *
11 * Permission to use, copy, modify and distribute this software and its *
12 * documentation strictly for non-commercial purposes is hereby granted *
13 * without fee, provided that the above copyright notice appears in all *
14 * copies and that both the copyright notice and this permission notice *
15 * appear in the supporting documentation. The authors make no claims *
16 * about the suitability of this software for any purpose. It is *
17 * provided "as is" without express or implied warranty. *
18 **************************************************************************/
19
20/**
21 * @file AliHLTPreprocessor.cxx
22 * @author Kenneth Aamodt, Sebastian Bablok
23 * @date 2007-12-06
24 * @brief Implementation of the HLT preprocessor (used by the Offline Shuttle)
25 */
26
27// see header file for class documentation
28// or
29// refer to README to build package
30// or
31// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
32
33#include "AliHLTPreprocessor.h"
34
35//#include <AliCDBMetaData.h>
36//#include <AliCDBEntry.h>
37
38#include <AliCDBMetaData.h>
39
40
41#include <TObjString.h>
42#include <TString.h>
43#include <TList.h>
44#include <TFile.h>
45
46
47ClassImp(AliHLTPreprocessor)
48
33cc944d 49AliHLTPreprocessor::AliHLTPreprocessor(AliShuttleInterface* shuttle)
50 :
51 AliPreprocessor(fgkHLTPreproc, shuttle),
52 fRun(0),
53 fStartTime(0),
54 fEndTime(0)
55{
56// see header file for class documentation
57// or
58// refer to README to build package
59// or
60// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
61}
62
e962f438 63const Int_t AliHLTPreprocessor::fgkHuffmanTablesNum = 6;
64
65const char* AliHLTPreprocessor::fgkHLTPreproc = "HLT";
66
67const char* AliHLTPreprocessor::fgkHuffmanFileBase = "huffmanData_";
68
69const char* AliHLTPreprocessor::fgkHuffmanFileDetector = "TPC_"; // at the moment only one
70
71const char* AliHLTPreprocessor::fgkTempHistoFileName = "HLTTemperatureHistograms.root";
33cc944d 72
73AliHLTPreprocessor::~AliHLTPreprocessor() {
74// see header file for function documentation
75}
76
77void AliHLTPreprocessor::Initialize(Int_t run, UInt_t startTime,
78 UInt_t endTime) {
79// see header file for function documentation
80 fRun = run;
81 fStartTime = startTime;
82 fEndTime = endTime;
83
84 TString msg("Preprocessor for HLT initialized for run: ");
85 msg += run;
86// Log(msg.Data());
87}
88
89
90UInt_t AliHLTPreprocessor::Process(TMap* dcsAliasMap) {
91// see header file for function documentation
92 UInt_t retVal = 0;
93// const char* localFileName = 0;
94
95 if (!GetHLTStatus()) {
96 return 0;
97 }
98
99 // get Huffman tables
100 for (Int_t i = 0; i < fgkHuffmanTablesNum; i++) {
101 TString runNumberString;
102 runNumberString.Form("%08d", fRun);
103 TString filename(fgkHuffmanFileBase);
104 filename += fgkHuffmanFileDetector;
105 filename += runNumberString;
106 filename += "_0x23000";
107 filename += i;
108 filename += "0";
109 filename += i;
110 filename += ".root";
111
112 //spec 0x23000Y0Y -> huffmanData_<detector>_<runnumber>_<specification>.root
113 TList* HLTlist = GetFileSources(kHLT, filename.Data());
114 if (!HLTlist) {
115 Log("Missing list for the HLT");
116 continue;
117 }
118
119 if (HLTlist->GetSize() != 1) {
120 Log(Form("Problem on the size of the list: %d (HLT)",
121 HLTlist->GetSize()));
122 continue;
123 }
124
125 TObjString* location = (TObjString*) HLTlist->At(0);
126 if (location == 0) {
127 Log("Error in location HLT list.");
128 continue;
129 }
130 TString localFileName = GetFile(kHLT, filename.Data(),
131 location->String().Data());
132
133/*
134 TFile localFile(localFileName);
135
136 AliCDBMetaData meta("Jennifer Wagner");
137 TString name("huffmanData_");
138 name += kDetector;
139 name += "Patch_";
140 name += i;
141
142 if (!(Store("CalibTPC", name.Data(), (TObject*) &localFile, &meta, 0, kTRUE))) {
143*/
144 if (!(StoreReferenceFile(localFileName.Data(), filename.Data()))) {
145 TString msg("Storing of object '");
146 msg += filename;
147 msg += "' to Reference Storage failed!";
148 Log(msg.Data());
149 retVal = 1;
150 // I think this is then really an error and should return an error code
151 }
152 }
153
154 // get Temp Histogram map
155 TList* HLTlist = GetFileSources(kHLT, fgkTempHistoFileName);
156 if (!HLTlist) {
157 Log("Missing list for the HLT");
158 return 0;
159 }
160
161 if (HLTlist->GetSize() != 1) {
162 Log(Form("Problem on the size of the list: %d (HLT)", HLTlist->GetSize()));
163 return 0;
164 }
165
166 TObjString* location = (TObjString*) HLTlist->At(0);
167 if (location == 0) {
168 Log("Error in location HLT list.");
169 return 0;
170 }
171 TString localFileName = GetFile(kHLT, fgkTempHistoFileName,
172 location->String().Data());
173/*
174 TFile localFile(localFileName);
175 AliCDBMetaData meta("Sebastian Bablok");
176
177 if (!(Store("Calib", kTempHistoFileName, (TObject*) &localFile, &meta, 0, kTRUE))) {
178*/
179 if (!(StoreReferenceFile(localFileName.Data(), fgkTempHistoFileName))) {
180 TString msg("Storing of object '");
181 msg += fgkTempHistoFileName;
182 msg += "' to Reference Storage failed!";
183 Log(msg.Data());
184 retVal = 1;
185 // I think this is then really an error and should return an error code
186 }
187
188 return retVal;
189}
190
191
192Bool_t AliHLTPreprocessor::ProcessDCS() {
193// see header file for function documentation
194 return kFALSE;
195}
196