--- /dev/null
+// $Id$
+
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* *
+//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
+//* for The ALICE HLT Project. *
+//* *
+//* Permission to use, copy, modify and distribute this software and its *
+//* documentation strictly for non-commercial purposes is hereby granted *
+//* without fee, provided that the above copyright notice appears in all *
+//* copies and that both the copyright notice and this permission notice *
+//* appear in the supporting documentation. The authors make no claims *
+//* about the suitability of this software for any purpose. It is *
+//* provided "as is" without express or implied warranty. *
+//**************************************************************************
+
+/** @file AliHLTEsdManager.cxx
+ @author Matthias Richter
+ @date
+ @brief Manager for merging and writing of HLT ESDs
+*/
+
+#include "AliHLTEsdManager.h"
+#include "TSystem.h"
+#include "TClass.h"
+#include "TROOT.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTEsdManager)
+
+AliHLTEsdManager::AliHLTEsdManager()
+ :
+ AliHLTLogging()
+{
+ // see header file for class documentation
+ // or
+ // refer to README to build package
+ // or
+ // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+AliHLTEsdManager::~AliHLTEsdManager()
+{
+ // see header file for class documentation
+}
+
+const char* AliHLTEsdManager::fgkImplName="AliHLTEsdManagerImplementation";
+const char* AliHLTEsdManager::fgkImplLibrary="libHLTrec.so";
+
+
+AliHLTEsdManager* AliHLTEsdManager::New()
+{
+ // see header file for class documentation
+ int iLibResult=0;
+ AliHLTEsdManager* instance=NULL;
+ AliHLTLogging log;
+ TClass* pCl=NULL;
+ ROOT::NewFunc_t pNewFunc=NULL;
+ do {
+ pCl=TClass::GetClass(fgkImplName);
+ } while (!pCl && (iLibResult=gSystem->Load(fgkImplLibrary))==0);
+ if (iLibResult>=0) {
+ if (pCl && (pNewFunc=pCl->GetNew())!=NULL) {
+ void* p=(*pNewFunc)(NULL);
+ if (p) {
+ instance=reinterpret_cast<AliHLTEsdManager*>(p);
+ if (!instance) {
+ log.Logging(kHLTLogError, "AliHLTEsdManager::New", "ESD handling", "type cast to AliHLTEsdManager instance failed");
+ }
+ } else {
+ log.Logging(kHLTLogError, "AliHLTEsdManager::New", "ESD handling", "can not create AliHLTEsdManager instance from class descriptor");
+ }
+ delete pCl;
+ } else {
+ log.Logging(kHLTLogError, "AliHLTEsdManager::New", "ESD handling", "can not find AliHLTEsdManager class descriptor");
+ }
+ } else {
+ log.Logging(kHLTLogError, "AliHLTEsdManager::New", "ESD handling", "can not load libHLTrec library");
+ }
+ return instance;
+}
+
+void AliHLTEsdManager::Delete(AliHLTEsdManager* instance)
+{
+ // see header file for class documentation
+ if (!instance) return;
+
+ // check if the library is still there in order to have the
+ // destructor available
+ TClass* pCl=TClass::GetClass("AliHLTEsdManagerImlementation");
+ if (!pCl) return;
+ delete pCl;
+
+ delete instance;
+}
--- /dev/null
+//-*- Mode: C++ -*-
+// $Id$
+
+#ifndef ALIHLTESDMANAGER_H
+#define ALIHLTESDMANAGER_H
+//* This file is property of and copyright by the ALICE HLT Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* See cxx source for full Copyright notice *
+
+/** @file AliHLTEsdManager.h
+ @author Matthias Richter
+ @date
+ @brief Manager for merging and writing of HLT ESDs
+*/
+
+#include "AliHLTDataTypes.h"
+#include "AliHLTLogging.h"
+#include "TString.h"
+
+class AliESDEvent;
+
+/**
+ * @class AliHLTEsdManager
+ * Tool to write and merge HLT ESD objects.
+ *
+ * HLT components can produce ESD output. The ESD objects are sent via
+ * a TMessage like mechanism as part of the HLTOUT data. This class retrieves
+ * streamed AliESDEvent objects from an HLT output block. An ESD object can be
+ * copied to a global ESD provided by the caller or to files. The name of the
+ * ROOT files follows the scheme AliHLTDETESDs.root where DET denotes a detector.
+ * E.g. the ESD from a data block of type {ESD_TREE,TPC} will be added to the
+ * file AliHLTTPCESDs.root.
+ *
+ * For the sake of library (in)dependencies, the concrete implementation of
+ * the AliHLTEsdManager is separated from the libHLTbase class as this would
+ * introduce dependencies to AliRoot libraries. The user does not notice the
+ * handling apart from the fact that an instance can not be created and
+ * deleted directly. Instead
+ * <pre>
+ * AliHLTEsdManager* pManager=AliHLTEsdManager::New();
+ * // ....
+ * AliHLTEsdManager::Delete(pManager);
+ * </pre>
+ * must be used.
+ *
+ * @ingroup alihlt_aliroot_reconstruction
+ */
+class AliHLTEsdManager : public AliHLTLogging {
+ public:
+ /** create an instance of the manager */
+ static AliHLTEsdManager* New();
+ /** delete an instance of the manager */
+ static void Delete(AliHLTEsdManager* instance);
+
+ /**
+ * Convert data buffer to ESD.
+ * The buffer is supposed to describe a streamed AliESDEvent object.
+ * If no target object is specified, the ESD is written to a file AliHLTdetESDs.root,
+ * where 'det' is derived from the data type origin. Each time the function is invoked
+ * a new event is created. Dummy events are added if the previous events did not contain
+ *
+ * @param pBuffer [in] the data buffer
+ * @param size [in] data buffer size
+ * @param dt [in] data type of the block
+ * @param tgtesd [out] optional target
+ * @param eventno [in] optional event no
+ */
+ virtual int WriteESD(const AliHLTUInt8_t* pBuffer, AliHLTUInt32_t size, AliHLTComponentDataType dt,
+ AliESDEvent* tgtesd=NULL, int eventno=-1)=0;
+
+ /**
+ * Align all ESD to the same number of events.
+ * The function adds empty events to all ESD files if their event number
+ * does not match the specified one.
+ * @param eventno the desired event no
+ * @return neg. error code if failed
+ */
+ virtual int PadESDs(int eventno)=0;
+
+ /**
+ * Set the target directory for the ESD files.
+ */
+ virtual void SetDirectory(const char* directory)=0;
+
+ /**
+ * Get the list of the internally created files.
+ * Returns a blank separated list of the file names.
+ */
+ virtual TString GetFileNames(AliHLTComponentDataType dt=kAliHLTAnyDataType) const = 0;
+
+ protected:
+ /** constructor */
+ AliHLTEsdManager();
+ /** destructor */
+ virtual ~AliHLTEsdManager();
+
+ private:
+ /** copy constructor prohibited */
+ AliHLTEsdManager(const AliHLTEsdManager&);
+ /** assignment operator prohibited */
+ AliHLTEsdManager& operator=(const AliHLTEsdManager&);
+
+ /** the name of the actual implementation */
+ static const char* fgkImplName; //!
+
+ /** the library of the implementation */
+ static const char* fgkImplLibrary; //!
+
+ ClassDef(AliHLTEsdManager, 0)
+};
+
+#endif
AliHLTHOMERLibManager.h \
AliHLTHOMERBlockDesc.h \
AliHLTHOMERSourceDesc.h \
+ AliHLTEsdManager.h \
AliHLTOUT.h \
AliHLTOUTHomerBuffer.h \
AliHLTOUTHandler.h \
CLASS_HDRS:= AliHLTReconstructor.h \
AliRawReaderHLT.h \
AliHLTOUTHomerCollection.h \
- AliHLTEsdManager.h \
+ AliHLTEsdManagerImplementation.h \
AliHLTOUTDigitReader.h \
AliHLTOUTRawReader.h
//* provided "as is" without express or implied warranty. *
//**************************************************************************
-/** @file AliHLTEsdManager.cxx
+/** @file AliHLTEsdManagerImplementation.cxx
@author Matthias Richter
@date
@brief Manager for merging and writing of HLT ESDs
*/
-#include "AliHLTEsdManager.h"
+#include "AliHLTEsdManagerImplementation.h"
#include "AliHLTComponent.h"
#include "AliESDEvent.h"
#include "AliHLTMessage.h"
#include "TList.h"
/** ROOT macro for the implementation of ROOT specific class methods */
-ClassImp(AliHLTEsdManager)
+ClassImp(AliHLTEsdManagerImplementation)
-AliHLTEsdManager::AliHLTEsdManager()
+AliHLTEsdManagerImplementation::AliHLTEsdManagerImplementation()
:
fESDs(),
fDirectory()
// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
}
-AliHLTEsdManager::~AliHLTEsdManager()
+AliHLTEsdManagerImplementation::~AliHLTEsdManagerImplementation()
{
// see header file for class documentation
for (unsigned int i=0; i<fESDs.size(); i++) {
}
}
-AliHLTEsdManager::AliHLTEsdListEntry* AliHLTEsdManager::Find(AliHLTComponentDataType dt) const
+AliHLTEsdManagerImplementation::AliHLTEsdListEntry* AliHLTEsdManagerImplementation::Find(AliHLTComponentDataType dt) const
{
// see header file for class documentation
AliHLTEsdListEntry* pEntry=NULL;
return pEntry;
}
-int AliHLTEsdManager::WriteESD(const AliHLTUInt8_t* pBuffer, AliHLTUInt32_t size,
+int AliHLTEsdManagerImplementation::WriteESD(const AliHLTUInt8_t* pBuffer, AliHLTUInt32_t size,
AliHLTComponentDataType dt, AliESDEvent* tgtesd, int eventno)
{
// see header file for class documentation
return iResult;
}
-int AliHLTEsdManager::PadESDs(int eventno)
+int AliHLTEsdManagerImplementation::PadESDs(int eventno)
{
// see header file for class documentation
int iResult=0;
return iResult;
}
-void AliHLTEsdManager::SetDirectory(const char* directory)
+void AliHLTEsdManagerImplementation::SetDirectory(const char* directory)
{
// see header file for class documentation
if (!directory) return;
}
}
-TString AliHLTEsdManager::GetFileNames(AliHLTComponentDataType dt) const
+TString AliHLTEsdManagerImplementation::GetFileNames(AliHLTComponentDataType dt) const
{
TString result;
for (unsigned int i=0; i<fESDs.size(); i++) {
return result;
}
-TTree* AliHLTEsdManager::EmbedIntoTree(AliESDEvent* pESD, const char* name, const char* title)
+TTree* AliHLTEsdManagerImplementation::EmbedIntoTree(AliESDEvent* pESD, const char* name, const char* title)
{
// see header file for class documentation
int iResult=0;
return pTree;
}
-AliHLTEsdManager::AliHLTEsdListEntry::AliHLTEsdListEntry(AliHLTComponentDataType dt)
+AliHLTEsdManagerImplementation::AliHLTEsdListEntry::AliHLTEsdListEntry(AliHLTComponentDataType dt)
:
fName(),
fDirectory(),
// see header file for class documentation
}
-AliHLTEsdManager::AliHLTEsdListEntry::~AliHLTEsdListEntry()
+AliHLTEsdManagerImplementation::AliHLTEsdListEntry::~AliHLTEsdListEntry()
{
// see header file for class documentation
if (fpEsd) delete fpEsd;
fpFile=NULL;
}
-bool AliHLTEsdManager::AliHLTEsdListEntry::operator==(AliHLTComponentDataType dt) const
+bool AliHLTEsdManagerImplementation::AliHLTEsdListEntry::operator==(AliHLTComponentDataType dt) const
{
// see header file for class documentation
return fDt==dt;
}
-int AliHLTEsdManager::AliHLTEsdListEntry::WriteESD(AliESDEvent* pSrcESD, int eventno)
+int AliHLTEsdManagerImplementation::AliHLTEsdListEntry::WriteESD(AliESDEvent* pSrcESD, int eventno)
{
// see header file for class documentation
int iResult=0;
return iResult;
}
-TString AliHLTEsdManager::AliHLTEsdListEntry::WriteTempFile(AliESDEvent* pESD) const
+TString AliHLTEsdManagerImplementation::AliHLTEsdListEntry::WriteTempFile(AliESDEvent* pESD) const
{
// see header file for class documentation
int iResult=0;
TFile file(tmpfilename, "RECREATE");
if (!file.IsZombie()) {
- TTree* pTree=AliHLTEsdManager::EmbedIntoTree(pESD);
+ TTree* pTree=AliHLTEsdManagerImplementation::EmbedIntoTree(pESD);
if (pTree) {
file.cd();
if (pTree->Write()>0) {
return tmpfilename;
}
-void AliHLTEsdManager::AliHLTEsdListEntry::SetDirectory(const char* directory)
+void AliHLTEsdManagerImplementation::AliHLTEsdListEntry::SetDirectory(const char* directory)
{
// see header file for class documentation
if (!directory) return;
fDirectory=directory;
}
-void AliHLTEsdManager::AliHLTEsdListEntry::Delete()
+void AliHLTEsdManagerImplementation::AliHLTEsdListEntry::Delete()
{
// see header file for class documentation
if (fName.IsNull()) return;
fName="";
}
-const char* AliHLTEsdManager::AliHLTEsdListEntry::GetFileName() const
+const char* AliHLTEsdManagerImplementation::AliHLTEsdListEntry::GetFileName() const
{
// see header file for class documentation
return fName.Data();
//-*- Mode: C++ -*-
// $Id$
-#ifndef ALIHLTESDMANAGER_H
-#define ALIHLTESDMANAGER_H
+#ifndef ALIHLTESDMANAGERIMPLEMENTATION_H
+#define ALIHLTESDMANAGERIMPLEMENTATION_H
//* This file is property of and copyright by the ALICE HLT Project *
//* ALICE Experiment at CERN, All rights reserved. *
//* See cxx source for full Copyright notice *
-/** @file AliHLTEsdManager.h
+/** @file AliHLTEsdManagerImplementation.h
@author Matthias Richter
@date
- @brief Manager for merging and writing of HLT ESDs
+ @brief Implementation of the AliHLTEsdManager
*/
-#include "AliHLTDataTypes.h"
-#include "AliHLTLogging.h"
+#include "AliHLTEsdManager.h"
#include "TString.h"
#include <vector>
class TFile;
/**
- * @class AliHLTEsdManager
- * Tool to write and merge HLT ESD objects.
+ * @class AliHLTEsdManagerImplementation
+ * Implementation of the AliHLTEsdManager.
*
- * HLT components can produce ESD output. The ESD objects are sent via
- * a TMessage like mechanism as part of the HLTOUT data. This class retrieves
- * streamed AliESDEvent objects from an HLT output block. An ESD object can be
- * copied to a global ESD provided by the caller or to files. The name of the
- * ROOT files follows the scheme AliHLTDETESDs.root where DET denotes a detector.
- * E.g. the ESD from a data block of type {ESD_TREE,TPC} will be added to the
- * file AliHLTTPCESDs.root.
+ * For the sake of library (in)dependencies, the concrete implementation of
+ * the AliHLTEsdManager is separated from the libHLTbase class as this would
+ * introduce dependencies to AliRoot libraries. See AliHLTEsdManager for
+ * usage.
*
* @ingroup alihlt_aliroot_reconstruction
*/
-class AliHLTEsdManager : public AliHLTLogging {
+class AliHLTEsdManagerImplementation : public AliHLTEsdManager {
public:
/** constructor */
- AliHLTEsdManager();
+ AliHLTEsdManagerImplementation();
/** destructor */
- virtual ~AliHLTEsdManager();
+ virtual ~AliHLTEsdManagerImplementation();
/**
* Convert data buffer to ESD.
private:
/** copy constructor prohibited */
- AliHLTEsdManager(const AliHLTEsdManager&);
+ AliHLTEsdManagerImplementation(const AliHLTEsdManagerImplementation&);
/** assignment operator prohibited */
- AliHLTEsdManager& operator=(const AliHLTEsdManager&);
+ AliHLTEsdManagerImplementation& operator=(const AliHLTEsdManagerImplementation&);
class AliHLTEsdListEntry : public AliHLTLogging {
public:
/** target directory */
TString fDirectory; //!transient
- ClassDef(AliHLTEsdManager, 1)
+ ClassDef(AliHLTEsdManagerImplementation, 1)
};
#endif
}
}
- if (fpEsdManager) delete fpEsdManager;
+ if (fpEsdManager) AliHLTEsdManager::Delete(fpEsdManager);
fpEsdManager=NULL;
}
gSystem->Load("libHLTinterface.so");
fFctProcessHLTOUT=gSystem->DynFindSymbol("libHLTinterface.so", "AliHLTSystemProcessHLTOUT");
- fpEsdManager=new AliHLTEsdManager;
+ fpEsdManager=AliHLTEsdManager::New();
}
void AliHLTReconstructor::Reconstruct(AliRawReader* /*rawReader*/, TTree* /*clustersTree*/) const