3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE HLT Project *
5 //* ALICE Experiment at CERN, All rights reserved. *
7 //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 //* for The ALICE HLT Project. *
10 //* Permission to use, copy, modify and distribute this software and its *
11 //* documentation strictly for non-commercial purposes is hereby granted *
12 //* without fee, provided that the above copyright notice appears in all *
13 //* copies and that both the copyright notice and this permission notice *
14 //* appear in the supporting documentation. The authors make no claims *
15 //* about the suitability of this software for any purpose. It is *
16 //* provided "as is" without express or implied warranty. *
17 //**************************************************************************
19 /** @file AliHLTEsdCollectorComponent.cxx
20 @author Matthias Richter
22 @brief Base class for writer components to store data in a ROOT file
26 #include "AliHLTEsdCollectorComponent.h"
27 #include "AliHLTEsdManager.h"
30 /** ROOT macro for the implementation of ROOT specific class methods */
31 ClassImp(AliHLTEsdCollectorComponent)
33 AliHLTEsdCollectorComponent::AliHLTEsdCollectorComponent()
38 // see header file for class documentation
40 // refer to README to build package
42 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
44 // all event go into the same file, but there are individual files for
45 // different data blocks
46 SetMode(kConcatenateEvents);
49 AliHLTEsdCollectorComponent::~AliHLTEsdCollectorComponent()
51 // see header file for class documentation
54 int AliHLTEsdCollectorComponent::InitWriter()
56 // see header file for class documentation
59 // choose .root as default extension
60 if (GetExtension().IsNull()) SetExtension("root");
62 if ((fpManager=AliHLTEsdManager::New())) {
63 fpManager->SetDirectory(GetDirectory().Data());
65 HLTError("can not find AliHLTEsdManager class descriptor");
72 int AliHLTEsdCollectorComponent::CloseWriter()
74 // see header file for class documentation
75 if (fpManager!=NULL) {
76 AliHLTEsdManager::Delete(fpManager);
82 int AliHLTEsdCollectorComponent::DumpEvent( const AliHLTComponentEventData& /*evtData*/,
83 const AliHLTComponentBlockData* /*blocks*/,
84 AliHLTComponentTriggerData& /*trigData*/ )
86 // see header file for class documentation
88 if (!fpManager) return -ENODEV;
90 for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock();
92 pBlock=GetNextInputBlock()) {
93 if (pBlock->fDataType!=kAliHLTDataTypeESDObject &&
94 pBlock->fDataType!=kAliHLTDataTypeESDTree) continue;
95 HLTInfo("writing ESD, data type %s", (DataType2Text(pBlock->fDataType).c_str()));
96 iResult=fpManager->WriteESD(reinterpret_cast<const AliHLTUInt8_t*>(pBlock->fPtr),
97 pBlock->fSize, pBlock->fDataType, NULL, GetEventCount());
102 int AliHLTEsdCollectorComponent::ScanArgument(int /*argc*/, const char** /*argv*/)
104 // see header file for class documentation
105 // no other arguments known