#include "TObjArray.h"
#include "TStreamerInfo.h"
#include "TList.h"
+#include "TFile.h"
+
+#include "AliCDBStorage.h"
+#include "AliCDBManager.h"
+#include "AliCDBPath.h"
+#include "AliCDBId.h"
+#include "AliCDBMetaData.h"
+#include "AliCDBEntry.h"
/** ROOT macro for the implementation of ROOT specific class methods */
ClassImp(AliHLTRootSchemaEvolutionComponent)
, fFlags(0)
, fpStreamerInfos(NULL)
, fFXSPrescaler(0)
+ , fFileName()
{
// see header file for class documentation
// or
int AliHLTRootSchemaEvolutionComponent::DoDeinit()
{
// see header file for class documentation
+ if (fFileName.IsNull()==0) {
+ WriteToFile(fFileName, fpStreamerInfos);
+ fFileName.Clear();
+ }
+
if (fpStreamerInfos) {
fpStreamerInfos->Clear();
delete fpStreamerInfos;
(TestBits(kHLTOUTatEOR) && eventType==gkAliEventTypeEndOfRun)) {
PushBack(fpStreamerInfos, kAliHLTDataTypeStreamerInfo);
}
+ }
- if (TestBits(kFXS) && eventType==gkAliEventTypeEndOfRun) {
- // push to FXS, needs to be implemented in the base class
- }
+ if (TestBits(kFXS) && eventType==gkAliEventTypeEndOfRun) {
+ // push to FXS, needs to be implemented in the base class
+ }
+
+ if (fFileName.IsNull()==0 && eventType==gkAliEventTypeEndOfRun) {
+ WriteToFile(fFileName, fpStreamerInfos);
+ fFileName.Clear();
}
return iResult;
}
return 1;
}
+
+ // -file=<filename>
+ if (argument.Contains("-file=")) {
+ argument.ReplaceAll("-file=", "");
+ if (!argument.IsNull()) {
+ fFileName=argument;
+ } else {
+ HLTError("argument -file= expects file name");
+ return -EINVAL;
+ }
+ return 1;
+ }
return iResult;
}
+
+int AliHLTRootSchemaEvolutionComponent::WriteToFile(const char* filename, const TObjArray* infos) const
+{
+ // write aray of streamer infos to file
+ if (!filename || !infos) return -EINVAL;
+
+ TFile out(filename, "RECREATE");
+ if (out.IsZombie()) {
+ HLTError("failed to open file %s", filename);
+ return -EBADF;
+ }
+
+ const char* entrypath="HLT/Calib/StreamerInfo";
+ int version = -1;
+ AliCDBStorage* store = AliCDBManager::Instance()->GetDefaultStorage();
+ if (store) {
+ version = store->GetLatestVersion(entrypath, GetRunNo());
+ }
+ version++;
+
+ AliCDBPath cdbPath(entrypath);
+ AliCDBId cdbId(cdbPath, GetRunNo(), AliCDBRunRange::Infinity(), version, 0);
+ AliCDBMetaData* cdbMetaData=new AliCDBMetaData;
+ cdbMetaData->SetResponsible("ALICE HLT");
+ cdbMetaData->SetComment("Streamer info for HLTOUT payload");
+ AliCDBEntry* entry=new AliCDBEntry(infos->Clone(), cdbId, cdbMetaData, kTRUE);
+
+ out.cd();
+ entry->Write();
+ // this is a small memory leak
+ // seg fault in ROOT object handling if the two objects are deleted
+ // investigate later
+ //delete entry;
+ //delete cdbMetaData;
+ out.Close();
+
+ return 0;
+}
*/
#include "AliHLTProcessor.h"
+#include "TString.h"
class TObjArray;
* \li -hltout<=[all,first,eor,off]> <br>
* push streamer info to output, the streamer info is stored in the
* events in all, the first, and/or the EOR.
+ * \li -file=<filename> <br>
+ * write to file at EOR
*
* <h2>Configuration:</h2>
* <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
void SetBits(AliHLTUInt32_t b) {fFlags|=b;}
void ClearBits(AliHLTUInt32_t b) {fFlags&=~b;}
bool TestBits(AliHLTUInt32_t b) {return (fFlags&b) != 0;}
+ int WriteToFile(const char* filename, const TObjArray* infos) const;
private:
/** copy constructor prohibited */
AliHLTUInt32_t fFXSPrescaler; //! prescalar for the publishing to FXS
+ TString fFileName; //! file name for dump at EOR
+
static const char* fgkConfigurationObject; //! configuration object
- ClassDef(AliHLTRootSchemaEvolutionComponent, 1) // ROOT schema evolution component
+ ClassDef(AliHLTRootSchemaEvolutionComponent, 2) // ROOT schema evolution component
};
#endif