3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE HLT Project *
5 //* ALICE Experiment at CERN, All rights reserved. *
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 AliHLTTRDOfflineClusterizerComponent.cxx
25 // see header file for class documentation //
27 // refer to README to build package //
29 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt //
31 #include "AliHLTTRDOfflineClusterizerComponent.h"
32 #include "AliHLTTRDDefinitions.h"
33 #include "AliHLTTRDClusterizer.h"
34 #include "AliHLTTRDUtils.h"
35 #include "AliCDBManager.h"
37 #include "TClonesArray.h"
38 #include "TObjString.h"
40 ClassImp(AliHLTTRDOfflineClusterizerComponent)
42 AliHLTTRDOfflineClusterizerComponent::AliHLTTRDOfflineClusterizerComponent()
43 :AliHLTTRDClusterizerComponent()
44 ,fOffClusterizer(NULL)
46 // Default constructor
49 AliHLTTRDOfflineClusterizerComponent::~AliHLTTRDOfflineClusterizerComponent()
52 // Work is Done in DoDeInit()
55 AliHLTComponent* AliHLTTRDOfflineClusterizerComponent::Spawn()
57 // Spawn function, return new instance of this class
58 return new AliHLTTRDOfflineClusterizerComponent;
61 const char* AliHLTTRDOfflineClusterizerComponent::GetComponentID()
63 // Return the component ID const char *
64 return "TRDOfflineClusterizer"; // The ID of this component
67 void AliHLTTRDOfflineClusterizerComponent::GetInputDataTypes( vector<AliHLTComponent_DataType>& list)
69 // Get the list of input data
71 AliHLTTRDClusterizerComponent::GetInputDataTypes(list);
72 list.push_back(AliHLTTRDDefinitions::fgkDigitsDataType);
75 AliHLTComponentDataType AliHLTTRDOfflineClusterizerComponent::GetOutputDataType()
77 // Get the output data type
78 return kAliHLTMultipleDataType;
81 int AliHLTTRDOfflineClusterizerComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
83 // Get the output data types
85 AliHLTTRDClusterizerComponent::GetOutputDataTypes(tgtList);
86 tgtList.push_back(AliHLTTRDDefinitions::fgkHiLvlClusterDataType);
87 return tgtList.size();
90 void AliHLTTRDOfflineClusterizerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
92 // Get the output data size
93 AliHLTTRDClusterizerComponent::GetOutputDataSize(constBase, inputMultiplier);
95 inputMultiplier *= 10;
98 int AliHLTTRDOfflineClusterizerComponent::DoInit( int argc, const char** argv )
101 iResult=AliHLTTRDClusterizerComponent::DoInit(argc, argv);
106 int AliHLTTRDOfflineClusterizerComponent::DoEvent(const AliHLTComponent_EventData& evtData, const AliHLTComponent_BlockData* blocks,
107 AliHLTComponent_TriggerData& trigData, AliHLTUInt8_t* outputPtr,
108 AliHLTUInt32_t& size, vector<AliHLTComponent_BlockData>& outputBlocks )
110 if ( GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR ) )
113 if(!GetFirstInputBlock(AliHLTTRDDefinitions::fgkDigitsDataType))
114 return AliHLTTRDClusterizerComponent::DoEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks );
116 AliHLTUInt32_t offset = 0;
118 for(const TObject *iter = GetFirstInputObject(AliHLTTRDDefinitions::fgkDigitsDataType); iter; iter = GetNextInputObject())
120 AliTRDclusterizer* clusterizer = new AliTRDclusterizer("TRDCclusterizer", "TRDCclusterizer");
121 clusterizer->SetReconstructor(fReconstructor);
122 clusterizer->SetUseLabels(kTRUE);
124 TTree* digitsTree = dynamic_cast<TTree*>(const_cast<TObject*>(iter));
125 clusterizer->ReadDigits(digitsTree);
126 clusterizer->MakeClusters();
127 TClonesArray* clusterArray = clusterizer->RecPoints();
128 clusterizer->SetClustersOwner(kFALSE);
130 if(fHighLevelOutput){
131 if(fEmulateHLTClusters){
132 TClonesArray* temp = clusterArray;
133 clusterArray = new TClonesArray(*temp);
136 AliHLTTRDUtils::EmulateHLTClusters(clusterArray);
139 strg.String() += clusterizer->GetNTimeBins();
140 PushBack(clusterArray, AliHLTTRDDefinitions::fgkHiLvlClusterDataType, 0);
141 PushBack(&strg, AliHLTTRDDefinitions::fgkHiLvlClusterDataType, 0);
143 Int_t nTimeBins = clusterizer->GetNTimeBins();
144 Int_t addedSize = AliHLTTRDUtils::AddClustersToOutput(clusterArray, outputPtr+offset, nTimeBins);
146 AliHLTComponentBlockData bd;
149 bd.fSize = addedSize;
150 bd.fSpecification = 1;
151 bd.fDataType = AliHLTTRDDefinitions::fgkClusterDataType;
152 outputBlocks.push_back( bd );
153 HLTDebug( "BD ptr 0x%x, offset %i, size %i, dataType %s, spec 0x%x ", bd.fPtr, bd.fOffset, bd.fSize, DataType2Text(bd.fDataType).c_str(), bd.fSpecification);
156 clusterArray->Delete();