ClassImp(AliHLTModulePreprocessor)
+AliHLTModulePreprocessor::AliHLTModulePreprocessor()
+ :
+ fpInterface(NULL),
+ fActiveDetectors(0)
+{
+ // see header file for class documentation
+ // or
+ // refer to README to build package
+ // or
+ // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+AliHLTModulePreprocessor::~AliHLTModulePreprocessor()
+{
+ // see header file for function documentation
+}
+
const Int_t AliHLTModulePreprocessor::kNDetectors = 21;
const char* AliHLTModulePreprocessor::fgkDetectorName[kNDetectors] =
"HLT"
};
-AliHLTModulePreprocessor::AliHLTModulePreprocessor()
- :
- fpInterface(NULL),
- fActiveDetectors(0)
-{
- // see header file for class documentation
- // or
- // refer to README to build package
- // or
- // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
-}
-
-AliHLTModulePreprocessor::~AliHLTModulePreprocessor()
-{
- // see header file for function documentation
-}
-
void AliHLTModulePreprocessor::SetShuttleInterface(AliHLTShuttleInterface* pInterface)
{
assert(fpInterface==NULL || fpInterface==pInterface || pInterface==NULL);
/** ROOT macro for the implementation of ROOT specific class methods */
ClassImp(AliHLTSystem)
-AliHLTSystem::AliHLTSystem()
+AliHLTSystem::AliHLTSystem(AliHLTComponentLogSeverity loglevel)
:
fpComponentHandler(new AliHLTComponentHandler()),
fpConfigurationHandler(new AliHLTConfigurationHandler()),
fChains(),
fStopwatches(new TObjArray),
fEventCount(-1),
- fGoodEvents(-1),
- bWriteGlobalEsd(false)
+ fGoodEvents(-1)
{
// see header file for class documentation
// or
if (fgNofInstances++>0)
HLTWarning("multiple instances of AliHLTSystem, you should not use more than one at a time");
- SetGlobalLoggingLevel(kHLTLogDefault);
- SetFrameworkLog(kHLTLogDefault);
+ SetGlobalLoggingLevel(loglevel);
+ SetFrameworkLog(loglevel);
if (fpComponentHandler) {
AliHLTComponentEnvironment env;
memset(&env, 0, sizeof(AliHLTComponentEnvironment));
// TTree::Fill in AliReconstruction, furthermore, the wrong ESD is passed
// by the framework
AliESDEvent* pMasterESD=NULL;
- if (bWriteGlobalEsd) pMasterESD=esd;
+ pMasterESD=esd;
for (iResult=pHLTOUT->SelectFirstDataBlock();
iResult>=0;
iResult=pHLTOUT->SelectNextDataBlock()) {
HLTWarning("wrong argument for option \'libmode=\', use \'static\' or \'dynamic\'");
}
}
- } else if (token.Contains("globalesd")) {
- bWriteGlobalEsd=true;
} else if (token.BeginsWith("lib") && token.EndsWith(".so")) {
libs+=token;
libs+=" ";
class AliHLTSystem : public AliHLTLogging {
public:
/** default constructor */
- AliHLTSystem();
+ AliHLTSystem(AliHLTComponentLogSeverity loglevel=kHLTLogDefault);
/** destructor */
virtual ~AliHLTSystem();
/** number of events processed successfully */
int fGoodEvents; //!transient
- /** switch whether to write to the global hltesd or not
- * since this causes a crash outside the HLT code this
- * can be enabled by the 'globalesd' argument
- */
- bool bWriteGlobalEsd; //!transient
-
/** array of default libraries */
static const char* fgkHLTDefaultLibs[]; //!transient
- ClassDef(AliHLTSystem, 6);
+ ClassDef(AliHLTSystem, 7);
};
#endif
ALIROOT_LIBS=
fi
+ dnl
+ dnl ESD copy function added May 9 2008 rev 25667
+ dnl
+ have_esd_copy=no
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliESDEvent.h>],
+ [AliESDEvent esd1;
+ AliESDEvent esd2;
+ esd2=esd1;])],
+ [AC_DEFINE(HAVE_ESD_COPY)
+ have_esd_copy=yes],
+ [])
+ AC_MSG_CHECKING(for ESD assignment operator)
+ AC_MSG_RESULT([$have_esd_copy])
+
dnl
dnl required header files and libraries for modules
dnl
[have_alitpc=no
ALITPC_LIBS= ])
fi
- AC_MSG_RESULT($have_alitpc)
+ AC_MSG_RESULT([$have_alitpc])
fi
AC_CHECK_HEADERS([AliTPCCalibPulser.h], [], [AC_DEFINE(HAVE_NOT_ALITPCCALIBPULSER)])
AC_CHECK_HEADERS([AliTPCCalibPedestal.h], [], [AC_DEFINE(HAVE_NOT_ALITPCCALIBPEDESTAL)])
fESDs.push_back(newEntry);
}
if (tgtesd) {
+#ifdef HAVE_ESD_COPY
+ *tgtesd=*pESD;
+#else
TTree* pTmpTree=AliHLTEsdManager::EmbedIntoTree(pESD);
if (pTmpTree) {
tgtesd->ReadFromTree(pTmpTree);
} else {
iResult=-ENOMEM;
}
+#endif
} else {
entry=Find(dt);
if (entry) {
:
fName(),
fDirectory(),
- fDt(dt)
+ fDt(dt),
+ fpFile(NULL),
+ fpTree(NULL),
+ fpEsd(NULL)
{
// see header file for class documentation
}
int AliHLTEsdManager::AliHLTEsdListEntry::WriteESD(AliESDEvent* pSrcESD, int eventno)
{
+ // see header file for class documentation
+ int iResult=0;
+#ifdef HAVE_ESD_COPY
+ if (fName.IsNull()) {
+ // this is the first event, create the file name
+ TString origin;
+ origin.Insert(0, fDt.fOrigin, kAliHLTComponentDataTypefOriginSize);
+ origin.Remove(TString::kTrailing, ' ');
+ origin.ToUpper();
+ fName="";
+ if (!fDirectory.IsNull()) {
+ fName+=fDirectory; fName+="/";
+ }
+ fName+="AliHLT"; fName+=origin;
+ if (fDt!=kAliHLTDataTypeESDObject &&
+ fDt!=kAliHLTDataTypeESDTree) {
+
+ HLTWarning("non-standard ESD type %s", AliHLTComponent::DataType2Text(fDt).c_str());
+ TString id;
+ id.Insert(0, fDt.fID, kAliHLTComponentDataTypefIDsize);
+ id.Remove(TString::kTrailing, ' ');
+ id.ToUpper();
+ fName+="_"; fName+=id; fName+=".root";
+ } else {
+ fName+="ESDs.root";
+ }
+
+ fpFile=new TFile(fName, "RECREATE");
+ fpTree=new TTree("esdTree", "Tree with HLT ESD objects");
+ fpEsd=new AliESDEvent;
+ if (fpEsd) {
+ fpEsd->CreateStdContent();
+ if (fpTree) {
+ fpEsd->WriteToTree(fpTree);
+ }
+ }
+ }
+
+ if (fpFile && fpTree && fpEsd) {
+ // synchronize and add empty events
+ fpEsd->Reset();
+ int nofCurrentEvents=fpTree->GetEntries();
+ if (nofCurrentEvents<eventno) {
+ iResult=1; // indicate tree to be written
+ HLTDebug("adding %d empty events to file %s", eventno-nofCurrentEvents, fName.Data());
+ for (int i=nofCurrentEvents; i<eventno; i++) {
+ fpTree->Fill();
+ }
+ }
+
+ if (iResult>=0 && pSrcESD) {
+ *fpEsd=*pSrcESD;
+ fpTree->Fill();
+ iResult=1; // indicate tree to be written
+ }
+
+ if (iResult>0) {
+ fpFile->cd();
+ fpTree->GetUserInfo()->Add(fpEsd);
+ fpTree->Write(fpTree->GetName(),TObject::kOverwrite);
+ fpTree->GetUserInfo()->Clear();
+ }
+ }
+#else //HAVE_ESD_COPY
+ // this is the old workaround, necessary for older AliRoot versions
+ // version<=v4-12-Release
+
// we need to copy the ESD, I did not find an approptiate
// method, the workaround is to save the ESD in a temporary
// tree, read the content back into the ESD structure
// We use temporary files for the new event to be copied into the
// existing tree.
//
- int iResult=0;
if (fName.IsNull()) {
// this is the first event, create the file on disk and write ESD
TString origin;
// there have been problems with the memory consumption when using
// TChain::Merge
- //chain.Merge(tgtName);
- TFile tgtFile(tgtName, "RECREATE");
- TTree* pTgtTree=new TTree("esdTree", "Tree with HLT ESD objects");
- AliESDEvent* pTgtESD=new AliESDEvent;
- if (pTgtTree && pTgtESD) {
- pTgtESD->ReadFromTree(&chain);
- pTgtESD->WriteToTree(pTgtTree);
-
- int nofEvents=chain.GetEntries();
- for (int event=0; event<nofEvents; event++) {
- chain.GetEntry(event);
- pTgtTree->Fill();
- }
-
- pTgtTree->GetUserInfo()->Add(pTgtESD);
- tgtFile.cd();
- pTgtTree->Write();
- pTgtTree->GetUserInfo()->Clear();
- } else {
- iResult=-ENOMEM;
- }
-
- if (pTgtTree) delete pTgtTree;
- if (pTgtESD) delete pTgtESD;
- tgtFile.Close();
+ // but using a separate loop soemtimes crashes in AliESDEvent::ReadFromTree
+ // since this is for backward compatiblity only, we take the TChain::Merge
+ chain.Merge(tgtName);
+// TFile tgtFile(tgtName, "RECREATE");
+// TTree* pTgtTree=new TTree("esdTree", "Tree with HLT ESD objects");
+// AliESDEvent* pTgtESD=new AliESDEvent;
+// if (pTgtTree && pTgtESD) {
+// pTgtESD->ReadFromTree(&chain);
+// pTgtESD->WriteToTree(pTgtTree);
+
+// int nofEvents=chain.GetEntries();
+// for (int event=0; event<nofEvents; event++) {
+// chain.GetEntry(event);
+// pTgtTree->Fill();
+// }
+
+// pTgtTree->GetUserInfo()->Add(pTgtESD);
+// tgtFile.cd();
+// pTgtTree->Write();
+// pTgtTree->GetUserInfo()->Clear();
+// } else {
+// iResult=-ENOMEM;
+// }
+
+// if (pTgtTree) delete pTgtTree;
+// if (pTgtESD) delete pTgtESD;
+// tgtFile.Close();
// rename the merged file to the original file
TString shellcmd="mv ";
gSystem->Exec(shellcmd);
}
}
+#endif //HAVE_ESD_COPY
return iResult;
}
/**
* @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.
+ *
+ * @ingroup alihlt_out
*/
class AliHLTEsdManager : public AliHLTLogging {
public:
TString fDirectory; //!transient
/** data type of the corresponding block */
AliHLTComponentDataType fDt; //!transient
+ /** the root file for this esd */
+ TFile* fpFile; //!transient
+ /** the tree for this esd */
+ TTree* fpTree; //!transient
+ /** the esd to fill into the tree */
+ AliESDEvent* fpEsd; //!transient
};
typedef vector<AliHLTEsdListEntry*> AliHLTEsdPList;
/** target directory */
TString fDirectory; //!transient
- ClassDef(AliHLTEsdManager, 0)
+ ClassDef(AliHLTEsdManager, 1)
};
#endif