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 AliHLTReconstruction.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()
49 void AliHLTReconstructor::Init()
51 // init the reconstructor
52 if (!fpSystem) fpSystem=new AliHLTSystem;
54 AliError("can not create AliHLTSystem object");
57 if (fpSystem->CheckStatus(AliHLTSystem::kError)) {
58 AliError("HLT system in error state");
62 // the options scan has been moved to AliHLTSystem, the old code
63 // here is kept to be able to run an older version of the HLT code
64 // with newer AliRoot versions.
66 TString option = GetOption();
67 TObjArray* pTokens=option.Tokenize(" ");
70 int iEntries=pTokens->GetEntries();
71 for (int i=0; i<iEntries; i++) {
72 TString token=(((TObjString*)pTokens->At(i))->GetString());
73 if (token.Contains("loglevel=")) {
74 TString param=token.ReplaceAll("loglevel=", "");
75 if (param.IsDigit()) {
76 fpSystem->SetGlobalLoggingLevel((AliHLTComponentLogSeverity)param.Atoi());
77 } else if (param.BeginsWith("0x") &&
78 param.Replace(0,2,"",0).IsHex()) {
80 sscanf(param.Data(),"%x", &severity);
81 fpSystem->SetGlobalLoggingLevel((AliHLTComponentLogSeverity)severity);
83 AliWarning("wrong parameter for option \'loglevel=\', (hex) number expected");
85 } else if (token.Contains("alilog=off")) {
86 fpSystem->SwitchAliLog(0);
87 } else if (token.BeginsWith("lib") && token.EndsWith(".so")) {
91 if (option.Length()>0) option+=" ";
99 (!fpSystem->CheckStatus(AliHLTSystem::kLibrariesLoaded)) &&
100 (fpSystem->LoadComponentLibraries(libs.Data())<0)) {
101 AliError("error while loading HLT libraries");
105 if (!fpSystem->CheckStatus(AliHLTSystem::kReady)) {
106 typedef int (*AliHLTSystemSetOptions)(AliHLTSystem* pInstance, const char* options);
107 gSystem->Load("libHLTinterface.so");
108 AliHLTSystemSetOptions pFunc=(AliHLTSystemSetOptions)(gSystem->DynFindSymbol("libHLTinterface.so", "AliHLTSystemSetOptions"));
110 if ((pFunc)(fpSystem, option.Data())<0) {
111 AliError("error setting options for HLT system");
114 } else if (option.Length()>0) {
115 AliError(Form("version of HLT system does not support the options \'%s\'", option.Data()));
118 if ((fpSystem->Configure())<0) {
119 AliError("error during HLT system configuration");
125 void AliHLTReconstructor::Reconstruct(AliRawReader* /*rawReader*/, TTree* /*clustersTree*/) const
127 // reconstruction of real data without writing of ESD
129 // all reconstruction has been moved to FillESD
132 // if (fpSystem->CheckStatus(AliHLTSystem::kError)) {
133 // AliError("HLT system in error state");
136 // if ((iResult=fpSystem->Reconstruct(1, NULL, rawReader))>=0) {
141 void AliHLTReconstructor::FillESD(AliRawReader* rawReader, TTree* /*clustersTree*/,
142 AliESDEvent* esd) const
144 // reconstruct real data and fill ESD
147 if (fpSystem->CheckStatus(AliHLTSystem::kError)) {
148 AliError("HLT system in error state");
151 if (!fpSystem->CheckStatus(AliHLTSystem::kReady)) {
152 AliError("HLT system in wrong state");
155 if ((iResult=fpSystem->Reconstruct(1, NULL, rawReader))>=0) {
156 fpSystem->FillESD(-1, NULL, esd);
161 void AliHLTReconstructor::Reconstruct(TTree* /*digitsTree*/, TTree* /*clustersTree*/) const
163 // reconstruct simulated data
165 // all reconstruction has been moved to FillESD
166 //AliReconstructor::Reconstruct(digitsTree,clustersTree);
169 void AliHLTReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree, AliESDEvent* esd) const
171 // reconstruct simulated data and fill ESD
173 // later this is the place to extract the simulated HLT data
174 // for now it's only an user failure condition as he tries to run HLT reconstruction
176 TString option = GetOption();
177 if (!option.IsNull()) {
178 AliWarning(Form("HLT reconstruction of simulated data takes place in AliSimulation\n"
179 " /*** run macro *****************************************/\n"
180 " AliSimulation sim;\n"
181 " sim.SetRunHLT(\"%s\");\n"
182 " sim.SetRunGeneration(kFALSE);\n"
183 " sim.SetMakeDigits(\"\");\n"
184 " sim.SetMakeSDigits(\"\");\n"
185 " sim.SetMakeDigitsFromHits(\"\");\n"
187 " /*********************************************************/", option.Data()));
189 AliReconstructor::FillESD(digitsTree,clustersTree,esd);