3 /**************************************************************************
4 * This file is property of and copyright by the ALICE HLT Project *
5 * ALICE Experiment at CERN, All rights reserved. *
7 * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 * for The ALICE HLT Project. *
10 * Permission to use, copy, modify and distribute this software and its *
11 * documentation strictly for non-commercial purposes is hereby granted *
12 * without fee, provided that the above copyright notice appears in all *
13 * copies and that both the copyright notice and this permission notice *
14 * appear in the supporting documentation. The authors make no claims *
15 * about the suitability of this software for any purpose. It is *
16 * provided "as is" without express or implied warranty. *
17 **************************************************************************/
19 /** @file AliHLTReconstructor.cxx
20 @author Matthias Richter
22 @brief Binding class for HLT reconstruction in AliRoot. */
25 #include <TObjString.h>
26 #include "AliHLTReconstructor.h"
28 #include "AliHLTSystem.h"
30 ClassImp(AliHLTReconstructor)
32 AliHLTReconstructor::AliHLTReconstructor()
40 AliHLTReconstructor::~AliHLTReconstructor()
45 AliDebug(0, Form("delete HLT system: status %#x", fpSystem->GetStatusFlags()));
46 if (fpSystem->CheckStatus(AliHLTSystem::kReady)) {
47 // send specific 'event' to execute the stop sequence
48 fpSystem->Reconstruct(0, NULL, NULL);
55 void AliHLTReconstructor::Init()
57 // init the reconstructor
58 if (!fpSystem) fpSystem=new AliHLTSystem;
60 AliError("can not create AliHLTSystem object");
63 if (fpSystem->CheckStatus(AliHLTSystem::kError)) {
64 AliError("HLT system in error state");
68 // the options scan has been moved to AliHLTSystem, the old code
69 // here is kept to be able to run an older version of the HLT code
70 // with newer AliRoot versions.
72 TString option = GetOption();
73 TObjArray* pTokens=option.Tokenize(" ");
76 int iEntries=pTokens->GetEntries();
77 for (int i=0; i<iEntries; i++) {
78 TString token=(((TObjString*)pTokens->At(i))->GetString());
79 if (token.Contains("loglevel=")) {
80 TString param=token.ReplaceAll("loglevel=", "");
81 if (param.IsDigit()) {
82 fpSystem->SetGlobalLoggingLevel((AliHLTComponentLogSeverity)param.Atoi());
83 } else if (param.BeginsWith("0x") &&
84 param.Replace(0,2,"",0).IsHex()) {
86 sscanf(param.Data(),"%x", &severity);
87 fpSystem->SetGlobalLoggingLevel((AliHLTComponentLogSeverity)severity);
89 AliWarning("wrong parameter for option \'loglevel=\', (hex) number expected");
91 } else if (token.Contains("alilog=off")) {
92 fpSystem->SwitchAliLog(0);
93 } else if (token.BeginsWith("lib") && token.EndsWith(".so")) {
97 if (option.Length()>0) option+=" ";
104 if (!libs.IsNull() &&
105 (!fpSystem->CheckStatus(AliHLTSystem::kLibrariesLoaded)) &&
106 (fpSystem->LoadComponentLibraries(libs.Data())<0)) {
107 AliError("error while loading HLT libraries");
111 if (!fpSystem->CheckStatus(AliHLTSystem::kReady)) {
112 typedef int (*AliHLTSystemSetOptions)(AliHLTSystem* pInstance, const char* options);
113 gSystem->Load("libHLTinterface.so");
114 AliHLTSystemSetOptions pFunc=(AliHLTSystemSetOptions)(gSystem->DynFindSymbol("libHLTinterface.so", "AliHLTSystemSetOptions"));
116 if ((pFunc)(fpSystem, option.Data())<0) {
117 AliError("error setting options for HLT system");
120 } else if (option.Length()>0) {
121 AliError(Form("version of HLT system does not support the options \'%s\'", option.Data()));
124 if ((fpSystem->Configure())<0) {
125 AliError("error during HLT system configuration");
131 void AliHLTReconstructor::Reconstruct(AliRawReader* /*rawReader*/, TTree* /*clustersTree*/) const
133 // reconstruction of real data without writing of ESD
135 // all reconstruction has been moved to FillESD
138 // if (fpSystem->CheckStatus(AliHLTSystem::kError)) {
139 // AliError("HLT system in error state");
142 // if ((iResult=fpSystem->Reconstruct(1, NULL, rawReader))>=0) {
147 void AliHLTReconstructor::FillESD(AliRawReader* rawReader, TTree* /*clustersTree*/,
148 AliESDEvent* esd) const
150 // reconstruct real data and fill ESD
153 if (fpSystem->CheckStatus(AliHLTSystem::kError)) {
154 AliError("HLT system in error state");
157 if (!fpSystem->CheckStatus(AliHLTSystem::kReady)) {
158 AliError("HLT system in wrong state");
161 if ((iResult=fpSystem->Reconstruct(1, NULL, rawReader))>=0) {
162 fpSystem->FillESD(-1, NULL, esd);
167 void AliHLTReconstructor::Reconstruct(TTree* /*digitsTree*/, TTree* /*clustersTree*/) const
169 // reconstruct simulated data
171 // all reconstruction has been moved to FillESD
172 //AliReconstructor::Reconstruct(digitsTree,clustersTree);
175 void AliHLTReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree, AliESDEvent* esd) const
177 // reconstruct simulated data and fill ESD
179 // later this is the place to extract the simulated HLT data
180 // for now it's only an user failure condition as he tries to run HLT reconstruction
182 TString option = GetOption();
183 if (!option.IsNull()) {
184 AliWarning(Form("HLT reconstruction of simulated data takes place in AliSimulation\n"
185 " /*** run macro *****************************************/\n"
186 " AliSimulation sim;\n"
187 " sim.SetRunHLT(\"%s\");\n"
188 " sim.SetRunGeneration(kFALSE);\n"
189 " sim.SetMakeDigits(\"\");\n"
190 " sim.SetMakeSDigits(\"\");\n"
191 " sim.SetMakeDigitsFromHits(\"\");\n"
193 " /*********************************************************/", option.Data()));
195 AliReconstructor::FillESD(digitsTree,clustersTree,esd);