From: richterm Date: Thu, 18 Nov 2010 19:31:38 +0000 (+0000) Subject: adding support for custom tree names: option '-treename=name' X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=a7100c59d308c6a83f60532968014ec877a13606;hp=cce400da50e1bff5f6be575109b41468121e8951 adding support for custom tree names: option '-treename=name' effective for local storage of HLT ESD files --- diff --git a/HLT/rec/AliHLTEsdManagerImplementation.cxx b/HLT/rec/AliHLTEsdManagerImplementation.cxx index cc4f8cfa202..8565f9892df 100644 --- a/HLT/rec/AliHLTEsdManagerImplementation.cxx +++ b/HLT/rec/AliHLTEsdManagerImplementation.cxx @@ -52,6 +52,7 @@ AliHLTEsdManagerImplementation::AliHLTEsdManagerImplementation() : fESDs() , fDirectory() + , fTreeName() , fWriteLocal(false) { // see header file for class documentation @@ -91,6 +92,9 @@ int AliHLTEsdManagerImplementation::SetOption(const char* option) } else if (data.Contains("-directory=")) { data.ReplaceAll("-directory=", ""); SetDirectory(data.Data()); + } else if (data.Contains("-treename=")) { + data.ReplaceAll("-treename=", ""); + fTreeName=data; } else { HLTError("unknown argument %s", data.Data()); iResult=-EINVAL; @@ -155,6 +159,9 @@ int AliHLTEsdManagerImplementation::WriteESD(const AliHLTUInt8_t* pBuffer, AliHL if (!fDirectory.IsNull()) { entry->SetDirectory(fDirectory); } + if (!fTreeName.IsNull()) { + entry->SetTreeName(fTreeName); + } fESDs.push_back(entry); } } @@ -258,7 +265,8 @@ AliHLTEsdManagerImplementation::AliHLTEsdListEntry::AliHLTEsdListEntry(AliHLTCom fpFile(NULL), fpTree(NULL), fpEsd(NULL), - fPrefix() + fPrefix(), + fTreeName("esdTree") { // see header file for class documentation } @@ -311,7 +319,7 @@ int AliHLTEsdManagerImplementation::AliHLTEsdListEntry::WriteESD(AliESDEvent* pS } fpFile=new TFile(fName, "RECREATE"); - fpTree=new TTree("esdTree", "Tree with HLT ESD objects"); + fpTree=new TTree(fTreeName, "Tree with HLT ESD objects"); fpTree->SetDirectory(0); fpEsd=new AliESDEvent; if (fpEsd) { @@ -344,7 +352,7 @@ int AliHLTEsdManagerImplementation::AliHLTEsdListEntry::WriteESD(AliESDEvent* pS // the branch layout has been created earlier. // Create new tree with the additional branches, copy the entries // of the current tree into the new tree, and continue. - TTree* pNewTree=new TTree("esdTree", "Tree with HLT ESD objects"); + TTree* pNewTree=new TTree(fTreeName, "Tree with HLT ESD objects"); pNewTree->SetDirectory(0); AliESDEvent* readESD=new AliESDEvent; readESD->CreateStdContent(); diff --git a/HLT/rec/AliHLTEsdManagerImplementation.h b/HLT/rec/AliHLTEsdManagerImplementation.h index 18a03139ab5..14aec61c211 100644 --- a/HLT/rec/AliHLTEsdManagerImplementation.h +++ b/HLT/rec/AliHLTEsdManagerImplementation.h @@ -136,6 +136,11 @@ class AliHLTEsdManagerImplementation : public AliHLTEsdManager { */ void SetDirectory(const char* directory); + /** + * Set the tree name + */ + void SetTreeName(const char* treename) {fTreeName=treename;} + /** * Get name of the ESD file. */ @@ -170,6 +175,8 @@ class AliHLTEsdManagerImplementation : public AliHLTEsdManager { AliESDEvent* fpEsd; //!transient /** Prefix for generated ESD objects in the master ESD */ TString fPrefix; //!transient + /** name of the tree to be created */ + TString fTreeName; //!transient }; typedef vector AliHLTEsdPList; @@ -184,10 +191,12 @@ class AliHLTEsdManagerImplementation : public AliHLTEsdManager { /** target directory */ TString fDirectory; //!transient + /** target directory */ + TString fTreeName; //!transient /** write local files */ bool fWriteLocal; //!transient - ClassDef(AliHLTEsdManagerImplementation, 2) + ClassDef(AliHLTEsdManagerImplementation, 3) }; #endif