+ AliHLTSystem* pSystem=GetInstance();
+ if (pSystem) {
+ if (pSystem->CheckStatus(AliHLTSystem::kError)) {
+ AliError("HLT system in error state");
+ return;
+ }
+ if (!pSystem->CheckStatus(AliHLTSystem::kReady)) {
+ AliError("HLT system in wrong state");
+ return;
+ }
+
+ AliHLTOUTDigitReader* pHLTOUT=new AliHLTOUTDigitReader(esd->GetEventNumberInFile(), fpEsdManager);
+ if (pHLTOUT) {
+ ProcessHLTOUT(pHLTOUT, esd);
+ delete pHLTOUT;
+ } else {
+ AliError("error creating HLTOUT handler");
+ }
+ }
+}
+
+void AliHLTReconstructor::ProcessHLTOUT(AliHLTOUT* pHLTOUT, AliESDEvent* esd, bool bVerbose) const
+{
+ // treatment of simulated or real HLTOUT data
+ if (!pHLTOUT) return;
+ AliHLTSystem* pSystem=GetInstance();
+ if (!pSystem) {
+ AliError("error getting HLT system instance");
+ return;
+ }
+
+ if (pHLTOUT->Init()<0) {
+ AliError("error : initialization of HLTOUT handler failed");
+ return;
+ }
+
+ if (bVerbose)
+ PrintHLTOUTContent(pHLTOUT);
+
+ if (fFctProcessHLTOUT) {
+ typedef int (*AliHLTSystemProcessHLTOUT)(AliHLTSystem* pInstance, AliHLTOUT* pHLTOUT, AliESDEvent* esd);
+ AliHLTSystemProcessHLTOUT pFunc=(AliHLTSystemProcessHLTOUT)fFctProcessHLTOUT;
+ if ((pFunc)(pSystem, pHLTOUT, esd)<0) {
+ AliError("error processing HLTOUT");
+ }
+ }
+ pHLTOUT->Reset();
+}
+
+void AliHLTReconstructor::ProcessHLTOUT(const char* digitFile, AliESDEvent* pEsd) const
+{
+ // debugging/helper function to examine simulated data
+ if (!digitFile) return;
+
+ // read the number of events
+ TFile f(digitFile);
+ if (f.IsZombie()) return;
+ TTree* pTree=NULL;
+ f.GetObject("rawhltout", pTree);
+ if (!pTree) {
+ AliWarning(Form("can not find tree rawhltout in file %s", digitFile));
+ return ;
+ }
+ int nofEvents=pTree->GetEntries();
+ f.Close();
+ //delete pTree; OF COURSE NOT! its an object in the file
+ pTree=NULL;
+
+ for (int event=0; event<nofEvents; event++) {
+ AliHLTOUTDigitReader* pHLTOUT=new AliHLTOUTDigitReader(event, fpEsdManager, digitFile);
+ if (pHLTOUT) {
+ AliInfo(Form("event %d", event));
+ ProcessHLTOUT(pHLTOUT, pEsd, true);
+ delete pHLTOUT;
+ } else {
+ AliError("error creating HLTOUT handler");
+ }
+ }
+}
+
+void AliHLTReconstructor::ProcessHLTOUT(AliRawReader* pRawReader, AliESDEvent* pEsd) const
+{
+ // debugging/helper function to examine simulated or real HLTOUT data
+ if (!pRawReader) return;
+
+ pRawReader->RewindEvents();
+ for (int event=0; pRawReader->NextEvent(); event++) {
+ AliHLTOUTRawReader* pHLTOUT=new AliHLTOUTRawReader(pRawReader, event, fpEsdManager);
+ if (pHLTOUT) {
+ AliInfo(Form("event %d", event));
+ ProcessHLTOUT(pHLTOUT, pEsd, true);
+ delete pHLTOUT;
+ } else {
+ AliError("error creating HLTOUT handler");
+ }
+ }
+}
+
+void AliHLTReconstructor::PrintHLTOUTContent(AliHLTOUT* pHLTOUT) const
+{
+ // print the block specifications of the HLTOUT data blocks
+ if (!pHLTOUT) return;
+ int iResult=0;
+
+ for (iResult=pHLTOUT->SelectFirstDataBlock();
+ iResult>=0;
+ iResult=pHLTOUT->SelectNextDataBlock()) {
+ AliHLTComponentDataType dt=kAliHLTVoidDataType;
+ AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
+ pHLTOUT->GetDataBlockDescription(dt, spec);
+ const AliHLTUInt8_t* pBuffer=NULL;
+ AliHLTUInt32_t size=0;
+ if (pHLTOUT->GetDataBuffer(pBuffer, size)>=0) {
+ pHLTOUT->ReleaseDataBuffer(pBuffer);
+ pBuffer=NULL; // just a dummy
+ }
+ AliInfo(Form(" %s 0x%x: size %d", AliHLTComponent::DataType2Text(dt).c_str(), spec, size));
+ }