1 /**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * ALICE Experiment at CERN, All rights reserved. *
5 * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
6 * for The ALICE HLT Project. *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
17 /** @file AliHLTTRDEsdWriterComponent.cxx
18 @author Mateusz Ploskon
20 @brief Writer component to store tracks of the HLT TRD
23 #include "AliHLTTRDEsdWriterComponent.h"
24 #include "AliESDEvent.h"
25 #include "AliESDtrack.h"
27 #include "AliHLTTRDDefinitions.h"
29 /** global instance for component registration */
30 AliHLTTRDEsdWriterComponent gTRDEsdWriter;
32 /** ROOT macro for the implementation of ROOT specific class methods */
33 ClassImp(AliHLTTRDEsdWriterComponent)
35 AliHLTTRDEsdWriterComponent::AliHLTTRDEsdWriterComponent()
37 AliHLTRootFileWriterComponent(),
41 // see header file for class documentation
43 // refer to README to build package
45 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
48 AliHLTTRDEsdWriterComponent::AliHLTTRDEsdWriterComponent(const AliHLTTRDEsdWriterComponent&)
50 AliHLTRootFileWriterComponent(),
56 AliHLTTRDEsdWriterComponent& AliHLTTRDEsdWriterComponent::operator=(const AliHLTTRDEsdWriterComponent&)
61 void AliHLTTRDEsdWriterComponent::GetInputDataTypes( vector<AliHLTComponent_DataType>& list)
63 // Get the list of input data
64 list.clear(); // We do not have any requirements for our input data type(s).
65 list.push_back( AliHLTTRDDefinitions::fgkTRDSATracksDataType );
68 AliHLTTRDEsdWriterComponent::~AliHLTTRDEsdWriterComponent()
70 // see header file for class documentation
73 int AliHLTTRDEsdWriterComponent::InitWriter()
75 // see header file for class documentation
77 fESD = new AliESDEvent;
79 fESD->CreateStdContent();
80 fTree = new TTree("esdTree", "Tree with HLT ESD objects");
82 fESD->WriteToTree(fTree);
91 int AliHLTTRDEsdWriterComponent::CloseWriter()
93 // see header file for class documentation
96 WriteObject(kAliHLTVoidEventID, fTree);
101 HLTWarning("not initialized");
103 iResult=AliHLTRootFileWriterComponent::CloseWriter();
107 int AliHLTTRDEsdWriterComponent::DumpEvent( const AliHLTComponentEventData& /*evtData*/,
108 const AliHLTComponentBlockData* /*blocks*/,
109 AliHLTComponentTriggerData& trigData )
111 // see header file for class documentation
115 AliHLTUInt32_t fDblock_Specification = 0;
117 //implement a usage of the following
118 // AliHLTUInt32_t triggerDataStructSize = trigData.fStructSize;
119 // AliHLTUInt32_t triggerDataSize = trigData.fDataSize;
120 // void *triggerData = trigData.fData;
121 Logging( kHLTLogDebug, "HLT::TRDEsdWriter::DumpEvent", "Trigger data received",
122 "Struct size %d Data size %d Data location 0x%x", trigData.fStructSize, trigData.fDataSize, (UInt_t*)trigData.fData);
124 //AliHLTComponentBlockData *dblock = (AliHLTComponentBlockData *)GetFirstInputBlock( AliHLTTRDDefinitions::fgkTRDSAEsdDataType );
125 AliHLTComponentBlockData *dblock = (AliHLTComponentBlockData *)GetFirstInputBlock( AliHLTTRDDefinitions::fgkTRDSATracksDataType );
128 fDblock_Specification = dblock->fSpecification;
132 Logging( kHLTLogWarning, "HLT::TRDEsdWriter::DumpEvent", "DATAIN", "First Input Block not found! 0x%x", dblock);
137 TObject *tobjin = (TObject *)GetFirstInputObject( AliHLTTRDDefinitions::fgkTRDSATracksDataType, "AliESDtrack", ibForce);
138 Logging( kHLTLogInfo, "HLT::TRDEsdWriter::DumpEvent", "1stBLOCK", "Pointer = 0x%x", tobjin);
140 AliESDtrack* track = (AliESDtrack *)tobjin;
143 Logging( kHLTLogWarning, "HLT::TRDEsdWriter::DumpEvent", "DATAIN", "First Input Block not a ESDtrack! 0x%x", tobjin);
152 //Logging( kHLTLogInfo, "HLT::TRDEsdWriter::DumpEvent", "Track found", "0x%x", track);
153 Logging( kHLTLogInfo, "HLT::TRDEsdWriter::DumpEvent", "DONE", "Track %d 0x%x Pt %1.2f", nTracks, track, track->Pt());
154 fESD->AddTrack(track);
160 tobjin = (TObject *)GetNextInputObject( ibForce );
161 //Logging( kHLTLogInfo, "HLT::TRDEsdWriter::DumpEvent", "nextBLOCK", "Pointer = 0x%x", tobjin);
162 track = (AliESDtrack *)tobjin;
165 Logging( kHLTLogInfo, "HLT::TRDEsdWriter::DumpEvent", "Fill", "Ntracks: %d", nTracks);
172 int AliHLTTRDEsdWriterComponent::ScanArgument(int argc, const char** argv)
174 // see header file for class documentation
175 int iResult=AliHLTRootFileWriterComponent::ScanArgument(argc, argv);