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()
40 // see header file for class documentation
42 // refer to README to build package
44 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
47 AliHLTTRDEsdWriterComponent::AliHLTTRDEsdWriterComponent(const AliHLTTRDEsdWriterComponent&)
54 AliHLTTRDEsdWriterComponent& AliHLTTRDEsdWriterComponent::operator=(const AliHLTTRDEsdWriterComponent&)
59 void AliHLTTRDEsdWriterComponent::GetInputDataTypes( vector<AliHLTComponent_DataType>& list)
61 // Get the list of input data
62 list.clear(); // We do not have any requirements for our input data type(s).
63 list.push_back( AliHLTTRDDefinitions::fgkTRDSATracksDataType );
66 AliHLTTRDEsdWriterComponent::~AliHLTTRDEsdWriterComponent()
68 // see header file for class documentation
71 int AliHLTTRDEsdWriterComponent::InitWriter()
73 // see header file for class documentation
75 fESD = new AliESDEvent;
77 fESD->CreateStdContent();
78 fTree = new TTree("esdTree", "Tree with HLT ESD objects");
80 fESD->WriteToTree(fTree);
89 int AliHLTTRDEsdWriterComponent::CloseWriter()
91 // see header file for class documentation
94 WriteObject(kAliHLTVoidEventID, fTree);
99 HLTWarning("not initialized");
101 iResult=AliHLTRootFileWriterComponent::CloseWriter();
105 int AliHLTTRDEsdWriterComponent::DumpEvent( const AliHLTComponentEventData& evtData,
106 const AliHLTComponentBlockData* blocks,
107 AliHLTComponentTriggerData& trigData )
109 // see header file for class documentation
113 AliHLTUInt32_t fDblock_Specification = 0;
115 //implement a usage of the following
116 // AliHLTUInt32_t triggerDataStructSize = trigData.fStructSize;
117 // AliHLTUInt32_t triggerDataSize = trigData.fDataSize;
118 // void *triggerData = trigData.fData;
119 Logging( kHLTLogDebug, "HLT::TRDEsdWriter::DumpEvent", "Trigger data received",
120 "Struct size %d Data size %d Data location 0x%x", trigData.fStructSize, trigData.fDataSize, (UInt_t*)trigData.fData);
122 //AliHLTComponentBlockData *dblock = (AliHLTComponentBlockData *)GetFirstInputBlock( AliHLTTRDDefinitions::fgkTRDSAEsdDataType );
123 AliHLTComponentBlockData *dblock = (AliHLTComponentBlockData *)GetFirstInputBlock( AliHLTTRDDefinitions::fgkTRDSATracksDataType );
126 fDblock_Specification = dblock->fSpecification;
130 Logging( kHLTLogWarning, "HLT::TRDEsdWriter::DumpEvent", "DATAIN", "First Input Block not found! 0x%x", dblock);
135 TObject *tobjin = (TObject *)GetFirstInputObject( AliHLTTRDDefinitions::fgkTRDSATracksDataType, "AliESDtrack", ibForce);
136 Logging( kHLTLogInfo, "HLT::TRDEsdWriter::DumpEvent", "1stBLOCK", "Pointer = 0x%x", tobjin);
138 AliESDtrack* track = (AliESDtrack *)tobjin;
141 Logging( kHLTLogWarning, "HLT::TRDEsdWriter::DumpEvent", "DATAIN", "First Input Block not a ESDtrack! 0x%x", tobjin);
150 //Logging( kHLTLogInfo, "HLT::TRDEsdWriter::DumpEvent", "Track found", "0x%x", track);
151 Logging( kHLTLogInfo, "HLT::TRDEsdWriter::DumpEvent", "DONE", "Track %d 0x%x Pt %1.2f", nTracks, track, track->Pt());
152 fESD->AddTrack(track);
158 tobjin = (TObject *)GetNextInputObject( ibForce );
159 //Logging( kHLTLogInfo, "HLT::TRDEsdWriter::DumpEvent", "nextBLOCK", "Pointer = 0x%x", tobjin);
160 track = (AliESDtrack *)tobjin;
163 Logging( kHLTLogInfo, "HLT::TRDEsdWriter::DumpEvent", "Fill", "Ntracks: %d", nTracks);
170 int AliHLTTRDEsdWriterComponent::ScanArgument(int argc, const char** argv)
172 // see header file for class documentation
173 int iResult=AliHLTRootFileWriterComponent::ScanArgument(argc, argv);