3 ///////////////////////////////////////////////////////////////////////////////
5 // class for HLT reconstruction //
6 // <Cvetan.Cheshkov@cern.ch> //
7 // <loizides@ikf.uni-frankfurt.de> //
8 ///////////////////////////////////////////////////////////////////////////////
11 #include <TObjString.h>
12 #include "AliHLTReconstructor.h"
14 #include "AliHLTSystem.h"
16 ClassImp(AliHLTReconstructor)
18 AliHLTReconstructor::AliHLTReconstructor()
26 AliHLTReconstructor::~AliHLTReconstructor()
35 void AliHLTReconstructor::Init()
37 // init the reconstructor
38 if (!fpSystem) fpSystem=new AliHLTSystem;
40 AliError("can not create AliHLTSystem object");
43 if (fpSystem->CheckStatus(AliHLTSystem::kError)) {
44 AliError("HLT system in error state");
48 // the options scan has been moved to AliHLTSystem, the old code
49 // here is kept to be able to run an older version of the HLT code
50 // with newer AliRoot versions.
52 TString option = GetOption();
53 TObjArray* pTokens=option.Tokenize(" ");
56 int iEntries=pTokens->GetEntries();
57 for (int i=0; i<iEntries; i++) {
58 TString token=(((TObjString*)pTokens->At(i))->GetString());
59 if (token.Contains("loglevel=")) {
60 TString param=token.ReplaceAll("loglevel=", "");
61 if (param.IsDigit()) {
62 fpSystem->SetGlobalLoggingLevel((AliHLTComponentLogSeverity)param.Atoi());
63 } else if (param.BeginsWith("0x") &&
64 param.Replace(0,2,"",0).IsHex()) {
66 sscanf(param.Data(),"%x", &severity);
67 fpSystem->SetGlobalLoggingLevel((AliHLTComponentLogSeverity)severity);
69 AliWarning("wrong parameter for option \'loglevel=\', (hex) number expected");
71 } else if (token.Contains("alilog=off")) {
72 fpSystem->SwitchAliLog(0);
73 } else if (token.BeginsWith("lib") && token.EndsWith(".so")) {
77 if (option.Length()>0) option+=" ";
85 (!fpSystem->CheckStatus(AliHLTSystem::kLibrariesLoaded)) &&
86 (fpSystem->LoadComponentLibraries(libs.Data())<0)) {
87 AliError("error while loading HLT libraries");
91 if (!fpSystem->CheckStatus(AliHLTSystem::kReady)) {
92 typedef int (*AliHLTSystemSetOptions)(AliHLTSystem* pInstance, const char* options);
93 gSystem->Load("libHLTinterface.so");
94 AliHLTSystemSetOptions pFunc=(AliHLTSystemSetOptions)(gSystem->DynFindSymbol("libHLTinterface.so", "AliHLTSystemSetOptions"));
96 if ((pFunc)(fpSystem, option.Data())<0) {
97 AliError("error setting options for HLT system");
100 } else if (option.Length()>0) {
101 AliError(Form("version of HLT system does not support the options \'%s\'", option.Data()));
104 if ((fpSystem->Configure())<0) {
105 AliError("error during HLT system configuration");
111 void AliHLTReconstructor::Reconstruct(AliRawReader* /*rawReader*/, TTree* /*clustersTree*/) const
113 // reconstruction of real data without writing of ESD
115 // all reconstruction has been moved to FillESD
118 // if (fpSystem->CheckStatus(AliHLTSystem::kError)) {
119 // AliError("HLT system in error state");
122 // if ((iResult=fpSystem->Reconstruct(1, NULL, rawReader))>=0) {
127 void AliHLTReconstructor::FillESD(AliRawReader* rawReader, TTree* /*clustersTree*/,
128 AliESDEvent* esd) const
130 // reconstruct real data and fill ESD
133 if (fpSystem->CheckStatus(AliHLTSystem::kError)) {
134 AliError("HLT system in error state");
137 if (!fpSystem->CheckStatus(AliHLTSystem::kReady)) {
138 AliError("HLT system in wrong state");
141 if ((iResult=fpSystem->Reconstruct(1, NULL, rawReader))>=0) {
142 fpSystem->FillESD(-1, NULL, esd);
147 void AliHLTReconstructor::Reconstruct(TTree* /*digitsTree*/, TTree* /*clustersTree*/) const
149 // reconstruct simulated data
151 // all reconstruction has been moved to FillESD
152 //AliReconstructor::Reconstruct(digitsTree,clustersTree);
155 void AliHLTReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree, AliESDEvent* esd) const
157 // reconstruct simulated data and fill ESD
159 // later this is the place to extract the simulated HLT data
160 // for now it's only an user failure condition as he tries to run HLT reconstruction
162 TString option = GetOption();
163 if (!option.IsNull()) {
164 AliWarning(Form("HLT reconstruction of simulated data takes place in AliSimulation\n"
165 " /*** run macro *****************************************/\n"
166 " AliSimulation sim;\n"
167 " sim.SetRunHLT(\"%s\");\n"
168 " sim.SetRunGeneration(kFALSE);\n"
169 " sim.SetMakeDigits(\"\");\n"
170 " sim.SetMakeSDigits(\"\");\n"
171 " sim.SetMakeDigitsFromHits(\"\");\n"
173 " /*********************************************************/", option.Data()));
175 AliReconstructor::FillESD(digitsTree,clustersTree,esd);