X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=HLT%2FBASE%2FAliHLTSystem.cxx;h=1508db209f9c1522796a31a9e3e29177a347a0fb;hb=820b4d9ec8aaaa083ffa8d6753d1c2b767c6ef3f;hp=36e8bee29ea35e88e4d7d55d154e5f56c84dcb1b;hpb=4403fb6907326043dd4a3b9232344bc44bbcac88;p=u%2Fmrichter%2FAliRoot.git diff --git a/HLT/BASE/AliHLTSystem.cxx b/HLT/BASE/AliHLTSystem.cxx index 36e8bee29ea..1508db209f9 100644 --- a/HLT/BASE/AliHLTSystem.cxx +++ b/HLT/BASE/AliHLTSystem.cxx @@ -89,6 +89,8 @@ AliHLTSystem::AliHLTSystem(AliHLTComponentLogSeverity loglevel, const char* name fpEsdHandlers(NULL), fpProprietaryHandlers(NULL), fpHLTOUTTask(NULL), + fpHLTOUT(NULL), + fHLTOUTUse(0), fpControlTask(NULL), fName(name) , fECSParams() @@ -132,7 +134,7 @@ AliHLTSystem::~AliHLTSystem() { // see header file for class documentation fgNofInstances--; - CleanHLTOUT(); + CleanupHLTOUTHandlers(); CleanTaskList(); if (fpConfigurationHandler) { fpConfigurationHandler->Destroy(); @@ -651,6 +653,9 @@ int AliHLTSystem::StopTasks() lnk = lnk->Next(); } PrintBenchmarking(fStopwatches, 1 /*clean*/); + if (fEventCount!=fGoodEvents) { + HLTError("%d out of %d event(s) failed", fEventCount-fGoodEvents, fEventCount); + } ClearStatusFlags(kStarted); return iResult; } @@ -734,7 +739,7 @@ int AliHLTSystem::DeinitTasks() return iResult; } -int AliHLTSystem::CleanHLTOUT() +int AliHLTSystem::CleanupHLTOUTHandlers() { // see header file for class documentation if (fpChainHandlers) { @@ -814,7 +819,7 @@ int AliHLTSystem::Reconstruct(int nofEvents, AliRunLoader* runLoader, if (!CheckStatus(kError)) { StopTasks(); DeinitTasks(); - CleanHLTOUT(); + CleanupHLTOUTHandlers(); } } else { if ((iResult=AliHLTOfflineInterface::SetParamsToComponents(runLoader, rawReader))>=0) { @@ -839,6 +844,25 @@ int AliHLTSystem::Reconstruct(int nofEvents, AliRunLoader* runLoader, if ((iResult=Run(nofEvents, 0, trgMask, timestamp, eventtype))<0) SetStatusFlags(kError); } } + + // add the current HLTOUT task to the collection + if (fpHLTOUTTask) { + AliHLTOUT* pTask=dynamic_cast(fpHLTOUTTask); + if (pTask && (iResult=pTask->Init())>=0) { + if (pTask->GetNofDataBlocks()>0) { + AliHLTOUT* pHLTOUT=RequestHLTOUT(); + if (pHLTOUT) { + pHLTOUT->AddSubCollection(pTask); + ReleaseHLTOUT(pHLTOUT); + } else { + HLTWarning("no HLTOUT instance available, output blocks of the chain are ignored"); + } + } + } else { + HLTWarning("can not initialize HLTOUT sub collection %s for reconstruction chain (%d), data blocks are lost", pTask?fpHLTOUTTask->GetName():"nil", iResult); + iResult=0; + } + } } else { HLTError("wrong state %#x, required flags %#x", GetStatusFlags(), kReady); } @@ -870,20 +894,6 @@ int AliHLTSystem::ProcessHLTOUT(AliHLTOUT* pHLTOUT, AliESDEvent* esd) if (!pHLTOUT) return -EINVAL; HLTDebug("processing %d HLT data blocks", pHLTOUT->GetNofDataBlocks()); - // add the current HLTOUT task to the collection - if (fpHLTOUTTask) { - AliHLTOUT* pTask=dynamic_cast(fpHLTOUTTask); - if (pTask && (iResult=pTask->Init())>=0) { - if (pTask->GetNofDataBlocks()>0) { - pHLTOUT->AddSubCollection(pTask); - } - } else { - HLTWarning("can not initialize HLTOUT sub collection %s for reconstruction chain (%d), data blocks are lost", pTask?fpHLTOUTTask->GetName():"nil", iResult); - iResult=0; - } - } - - // // process all kChain handlers first // @@ -1081,7 +1091,7 @@ int AliHLTSystem::LoadComponentLibraries(const char* libraries) if (pTokens) { int iEntries=pTokens->GetEntriesFast(); for (int i=0; i=0; i++) { - iResult=fpComponentHandler->LoadLibrary((((TObjString*)pTokens->At(i))->GetString()).Data()); + iResult=fpComponentHandler->LoadLibrary((((TObjString*)pTokens->At(i))->String()).Data()); } delete pTokens; } @@ -1154,7 +1164,7 @@ int AliHLTSystem::ScanOptions(const char* options) if (pTokens) { int iEntries=pTokens->GetEntriesFast(); for (int i=0; iAt(i))->GetString()); + TString token=(((TObjString*)pTokens->At(i))->String()); if (token.Contains("loglevel=")) { TString param=token.ReplaceAll("loglevel=", ""); if (param.IsDigit()) { @@ -1181,37 +1191,54 @@ int AliHLTSystem::ScanOptions(const char* options) } } else if (token.Contains("alilog=off")) { SwitchAliLog(0); - } else if (token.Contains("config=")) { - TString param=token.ReplaceAll("config=", ""); - Int_t error=0; - if (token.EndsWith(".xml", TString::kIgnoreCase)) { - Int_t filesize = 0; - AliHLTOnlineConfiguration conf; - filesize = conf.LoadConfiguration(param.Data()); - if (filesize <= 0) { - HLTError("can not load config \'%s\'", param.Data()); - iResult=-EBADF; - } else { - error = conf.Parse(); - if (error==0) { - fChains = conf.GetDefaultChains(); - libs = conf.GetComponentLibraries(); - libs += " "; - SetStatusFlags(kConfigurationLoaded); + } else if (token.Contains("config=") || token.Contains("run-online-config")) { + if (!CheckStatus(kConfigurationLoaded)) { + Int_t error=0; + AliHLTOnlineConfiguration* pConf = NULL; + if (token.Contains("run-online-config")) { + AliCDBEntry* pEntry=AliHLTMisc::Instance().LoadOCDBEntry("HLT/Calib/OnlineConfig"); + if (pEntry) { + TObject* pObject=AliHLTMisc::Instance().ExtractObject(pEntry); + if (pObject && pObject->IsA() == AliHLTOnlineConfiguration::Class()) + pConf = (AliHLTOnlineConfiguration*)pObject; + } + } + if (token.Contains("config=")) { + TString param=token.ReplaceAll("config=", ""); + if (token.EndsWith(".xml", TString::kIgnoreCase)) { + Int_t filesize = 0; + pConf = new AliHLTOnlineConfiguration; + filesize = pConf->LoadConfiguration(param.Data()); + if (filesize <= 0) { + HLTError("cannot load config \'%s\'", param.Data()); + iResult=-EBADF; + } } else { - HLTError("can not parse config \'%s\'", param.Data()); - iResult=-EBADF; + gROOT->Macro(param.Data(), &error); + if (error==0) { + SetStatusFlags(kConfigurationLoaded); + } else { + HLTError("cannot execute macro \'%s\'", param.Data()); + iResult=-EBADF; + } } } - } else { - gROOT->Macro(param.Data(), &error); - if (error==0) { - SetStatusFlags(kConfigurationLoaded); - } else { - HLTError("can not execute macro \'%s\'", param.Data()); - iResult=-EBADF; + if (pConf) { + error = pConf->Parse(); + if (error==0) { + fChains = pConf->GetDefaultChains(); + libs = pConf->GetComponentLibraries(); + libs += " "; + SetStatusFlags(kConfigurationLoaded); + } else { + HLTError("cannot parse online configuration"); + iResult=-EBADF; + } } - } + delete pConf; pConf=NULL; + } else { + HLTWarning("HLT options has both a config file and run-online-config set"); + } } else if (token.Contains("chains=")) { TString param=token.ReplaceAll("chains=", ""); fChains=param.ReplaceAll(",", " "); @@ -1236,7 +1263,7 @@ int AliHLTSystem::ScanOptions(const char* options) // separated HLTOUTComponents for digit and raw data. All others indicate // HLTOUTComponent type 'global' where the data generation is steered from global // flags - fUseHLTOUTComponentTypeGlobal=token.CompareTo("hltout-mode=split")==1; + fUseHLTOUTComponentTypeGlobal=token.CompareTo("hltout-mode=split")!=0; } else if (token.BeginsWith("lib") && token.EndsWith(".so")) { libs+=token; libs+=" "; @@ -1321,7 +1348,7 @@ int AliHLTSystem::LoadConfigurations(AliRawReader* rawReader, AliRunLoader* runl TObjArray* pTokens=dependencies.Tokenize(" "); if (pTokens) { for (int n=0; nGetEntriesFast(); n++) { - TString module=((TObjString*)pTokens->At(n))->GetString(); + TString module=((TObjString*)pTokens->At(n))->String(); HLTDebug(" checking %s", module.Data()); module.ReplaceAll("libAliHLT", ""); module.ReplaceAll(".so", ""); @@ -1400,7 +1427,7 @@ int AliHLTSystem::BuildTaskListsFromReconstructionChains(AliRawReader* rawReader if (pTokens) { int iEntries=pTokens->GetEntriesFast(); for (int i=0; i=0; i++) { - const char* pCID=((TObjString*)pTokens->At(i))->GetString().Data(); + const char* pCID=((TObjString*)pTokens->At(i))->String().Data(); AliHLTConfiguration* pConf=fpConfigurationHandler->FindConfiguration(pCID); if (pConf) { iResult=BuildTaskList(pConf); @@ -1504,7 +1531,7 @@ int AliHLTSystem::AddHLTOUTTask(const char* hltoutchains) if (pTokens) { int iEntries=pTokens->GetEntriesFast(); for (int i=0; i=0; i++) { - const char* token=((TObjString*)pTokens->At(i))->GetString().Data(); + const char* token=((TObjString*)pTokens->At(i))->String().Data(); AliHLTConfiguration* pConf=fpConfigurationHandler->FindConfiguration(token); if (pConf) { TString cid=pConf->GetComponentID(); @@ -1617,3 +1644,46 @@ int AliHLTSystem::LoggingVarargs(AliHLTComponentLogSeverity severity, return iResult; } + +int AliHLTSystem::InitHLTOUT(AliHLTOUT* instance) +{ + // Init the HLTOUT instance for the current event. + // The instance can be used by other classes to get hold on the data + // from HLTOUT. + if (!instance) return -EINVAL; + if (fpHLTOUT && fpHLTOUT!=instance) return -EBUSY; + fpHLTOUT=instance; + return 0; +} + +int AliHLTSystem::InvalidateHLTOUT(AliHLTOUT** target) +{ + // Clear the HLTOUT instance. + int iResult=0; + if (fHLTOUTUse>0) { + HLTWarning("HLTOUT instance still in use, potential problem due to invalid pointer ahead"); + fHLTOUTUse=0; + iResult=-EBUSY; + } + if (target) *target=fpHLTOUT; + fpHLTOUT=NULL; + return iResult; +} + +AliHLTOUT* AliHLTSystem::RequestHLTOUT() +{ + // Get the HLTOUT instance. + // User method for processing classes. To be released after use. + if (!fpHLTOUT) return NULL; + fHLTOUTUse++; + return fpHLTOUT; +} + +int AliHLTSystem::ReleaseHLTOUT(const AliHLTOUT* instance) +{ + // Release the HLTOUT instance after use. + if (!instance) return -EINVAL; + if (instance!=fpHLTOUT) return -ENOENT; + fHLTOUTUse--; + return 0; +}