Line data Source code
1 : // $Id$
2 :
3 : //**************************************************************************
4 : //* This file is property of and copyright by the ALICE HLT Project *
5 : //* ALICE Experiment at CERN, All rights reserved. *
6 : //* *
7 : //* Primary Authors: *
8 : //* for The ALICE HLT Project. *
9 : //* *
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 : //**************************************************************************
18 :
19 : /** @file AliHLTTRDOfflineClusterizerComponent.cxx
20 : @author Theodor Rascanu
21 : @date
22 : @brief Processes digits (with MC) and raw data (without MC). For debug purposes only
23 : */
24 :
25 : // see header file for class documentation //
26 : // or //
27 : // refer to README to build package //
28 : // or //
29 : // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt //
30 :
31 : #include "AliHLTTRDOfflineClusterizerComponent.h"
32 : #include "AliHLTTRDDefinitions.h"
33 : #include "AliHLTTRDClusterizer.h"
34 : #include "AliHLTTRDUtils.h"
35 : #include "AliCDBManager.h"
36 : #include "TTree.h"
37 : #include "TClonesArray.h"
38 : #include "TObjString.h"
39 :
40 6 : ClassImp(AliHLTTRDOfflineClusterizerComponent)
41 :
42 : AliHLTTRDOfflineClusterizerComponent::AliHLTTRDOfflineClusterizerComponent()
43 3 : :AliHLTTRDClusterizerComponent()
44 15 : {
45 : // Default constructor
46 6 : }
47 :
48 : AliHLTTRDOfflineClusterizerComponent::~AliHLTTRDOfflineClusterizerComponent()
49 12 : {
50 : // Destructor
51 : // Work is Done in DoDeInit()
52 12 : }
53 :
54 : AliHLTComponent* AliHLTTRDOfflineClusterizerComponent::Spawn()
55 : {
56 : // Spawn function, return new instance of this class
57 0 : return new AliHLTTRDOfflineClusterizerComponent;
58 0 : };
59 :
60 : const char* AliHLTTRDOfflineClusterizerComponent::GetComponentID()
61 : {
62 : // Return the component ID const char *
63 108 : return "TRDOfflineClusterizer"; // The ID of this component
64 : }
65 :
66 : void AliHLTTRDOfflineClusterizerComponent::GetInputDataTypes( vector<AliHLTComponent_DataType>& list)
67 : {
68 : // Get the list of input data
69 0 : list.clear();
70 0 : AliHLTTRDClusterizerComponent::GetInputDataTypes(list);
71 0 : list.push_back(AliHLTTRDDefinitions::fgkDigitsDataType);
72 0 : }
73 :
74 : AliHLTComponentDataType AliHLTTRDOfflineClusterizerComponent::GetOutputDataType()
75 : {
76 : // Get the output data type
77 0 : return kAliHLTMultipleDataType;
78 : }
79 :
80 : int AliHLTTRDOfflineClusterizerComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
81 : {
82 : // Get the output data types
83 0 : tgtList.clear();
84 0 : AliHLTTRDClusterizerComponent::GetOutputDataTypes(tgtList);
85 0 : tgtList.push_back(AliHLTTRDDefinitions::fgkHiLvlClusterDataType);
86 0 : return tgtList.size();
87 : }
88 :
89 : void AliHLTTRDOfflineClusterizerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
90 : {
91 : // Get the output data size
92 0 : AliHLTTRDClusterizerComponent::GetOutputDataSize(constBase, inputMultiplier);
93 0 : constBase += 500;
94 0 : inputMultiplier *= 10;
95 0 : }
96 :
97 : int AliHLTTRDOfflineClusterizerComponent::SetParams()
98 : {
99 0 : int iResult = AliHLTTRDClusterizerComponent::SetParams();
100 :
101 : // here we need the coordinate transformation as we want to ship full flavoured clusters
102 : #ifndef HAVE_NOT_ALITRD_CLUSTERIZER_r42837
103 0 : fClusterizer->SetSkipTransform(kFALSE);
104 : #endif
105 0 : return iResult;
106 : }
107 :
108 :
109 : int AliHLTTRDOfflineClusterizerComponent::DoEvent(const AliHLTComponent_EventData& evtData, const AliHLTComponent_BlockData* blocks,
110 : AliHLTComponent_TriggerData& trigData, AliHLTUInt8_t* outputPtr,
111 : AliHLTUInt32_t& size, vector<AliHLTComponent_BlockData>& outputBlocks )
112 : {
113 0 : if(!IsDataEvent())return 0;
114 :
115 0 : if(!GetFirstInputBlock(AliHLTTRDDefinitions::fgkDigitsDataType))
116 0 : return AliHLTTRDClusterizerComponent::DoEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks );
117 :
118 : AliHLTUInt32_t offset = 0;
119 :
120 0 : for(const TObject *iter = GetFirstInputObject(AliHLTTRDDefinitions::fgkDigitsDataType); iter; iter = GetNextInputObject())
121 : {
122 0 : AliTRDclusterizer* clusterizer = new AliTRDclusterizer("TRDCclusterizer", "TRDCclusterizer");
123 0 : clusterizer->SetReconstructor(fReconstructor);
124 0 : clusterizer->SetUseLabels(kTRUE);
125 :
126 0 : TTree* digitsTree = dynamic_cast<TTree*>(const_cast<TObject*>(iter));
127 0 : clusterizer->ReadDigits(digitsTree);
128 0 : clusterizer->MakeClusters();
129 0 : TClonesArray* clusterArray = clusterizer->RecPoints();
130 0 : clusterizer->SetClustersOwner(kFALSE);
131 :
132 0 : AliHLTUInt32_t spec = GetSpecification(iter);
133 0 : if(fHighLevelOutput){
134 0 : if(fEmulateHLTClusters){
135 : TClonesArray* temp = clusterArray;
136 0 : clusterArray = new TClonesArray(*temp);
137 0 : temp->Delete();
138 0 : delete temp;
139 0 : AliHLTTRDUtils::EmulateHLTClusters(clusterArray);
140 0 : }
141 0 : TObjString strg;
142 0 : strg.String() += clusterizer->GetNTimeBins();
143 0 : PushBack(clusterArray, AliHLTTRDDefinitions::fgkHiLvlClusterDataType, spec);
144 0 : PushBack(&strg, AliHLTTRDDefinitions::fgkHiLvlClusterDataType, spec);
145 0 : } else {
146 0 : Int_t nTimeBins = clusterizer->GetNTimeBins();
147 0 : Int_t addedSize = AliHLTTRDUtils::AddClustersToOutput(clusterArray, outputPtr+offset, nTimeBins);
148 :
149 0 : AliHLTComponentBlockData bd;
150 0 : FillBlockData( bd );
151 0 : bd.fOffset = offset;
152 0 : bd.fSize = addedSize;
153 0 : bd.fSpecification = spec;
154 0 : bd.fDataType = AliHLTTRDDefinitions::fgkClusterDataType;
155 0 : outputBlocks.push_back( bd );
156 : 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);
157 0 : offset += addedSize;
158 0 : }
159 0 : clusterArray->Delete();
160 0 : delete clusterArray;
161 0 : delete clusterizer;
162 : }
163 :
164 : return 0;
165 :
166 0 : }
|