]>
Commit | Line | Data |
---|---|---|
5f2721d5 | 1 | |
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: Gaute Øvrebekk <st05886@alf.uib.no> * | |
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 AliHLTITSClusterFinderSSDComponent.cxx | |
20 | @author Gaute Øvrebekk <st05886@alf.uib.no> | |
21 | @date | |
22 | @brief Component to run offline clusterfinder for SSD | |
23 | */ | |
24 | ||
25 | #if __GNUC__>= 3 | |
26 | using namespace std; | |
27 | #endif | |
28 | ||
29 | #include "AliHLTITSClusterFinderSSDComponent.h" | |
30 | ||
31 | #include "AliCDBEntry.h" | |
32 | #include "AliCDBManager.h" | |
33 | #include "AliHLTDataTypes.h" | |
34 | #include "AliITSgeomTGeo.h" | |
35 | #include "AliITSRecPoint.h" | |
36 | ||
37 | #include <cstdlib> | |
38 | #include <cerrno> | |
39 | #include "TString.h" | |
40 | #include "TObjString.h" | |
41 | #include <sys/time.h> | |
42 | ||
43 | /** ROOT macro for the implementation of ROOT specific class methods */ | |
44 | ClassImp(AliHLTITSClusterFinderSSDComponent); | |
45 | ||
46 | AliHLTITSClusterFinderSSDComponent::AliHLTITSClusterFinderSSDComponent() | |
47 | : | |
48 | fNModules(1698), | |
49 | fClusterFinder(NULL), | |
50 | fRawReader(NULL), | |
51 | fDettype(NULL), | |
52 | fClusters(NULL), | |
53 | fcal(NULL), | |
54 | fgeom(NULL), | |
55 | fgeomInit(NULL){ | |
56 | //fRawReaderOff(NULL), | |
57 | //fRawStream(NULL), | |
58 | //fNModules(AliITSgeomTGeo::GetNModules()), | |
59 | //fNModules(AliITSDetTupeRec::fgkDefaultNModulesSSD), | |
60 | ||
61 | ||
62 | ||
63 | // see header file for class documentation | |
64 | // or | |
65 | // refer to README to build package | |
66 | // or | |
67 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
68 | } | |
69 | ||
70 | AliHLTITSClusterFinderSSDComponent::~AliHLTITSClusterFinderSSDComponent() { | |
71 | // see header file for class documentation | |
72 | } | |
73 | ||
74 | // Public functions to implement AliHLTComponent's interface. | |
75 | // These functions are required for the registration process | |
76 | ||
77 | const char* AliHLTITSClusterFinderSSDComponent::GetComponentID() | |
78 | { | |
79 | // see header file for class documentation | |
80 | ||
81 | return "ITSClusterFinderSSD"; | |
82 | } | |
83 | ||
84 | void AliHLTITSClusterFinderSSDComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) { | |
85 | // see header file for class documentation | |
86 | list.clear(); | |
87 | list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginITSSSD ); | |
88 | ||
89 | } | |
90 | ||
91 | AliHLTComponentDataType AliHLTITSClusterFinderSSDComponent::GetOutputDataType() { | |
92 | // see header file for class documentation | |
93 | return kAliHLTDataTypeTObjArray; | |
94 | } | |
95 | ||
96 | void AliHLTITSClusterFinderSSDComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) { | |
97 | // see header file for class documentation | |
98 | ||
99 | constBase = 0; | |
100 | inputMultiplier = 0.3; | |
101 | } | |
102 | ||
103 | AliHLTComponent* AliHLTITSClusterFinderSSDComponent::Spawn() { | |
104 | // see header file for class documentation | |
105 | return new AliHLTITSClusterFinderSSDComponent(); | |
106 | } | |
107 | ||
108 | Int_t AliHLTITSClusterFinderSSDComponent::DoInit( int /*argc*/, const char** /*argv*/ ) { | |
109 | // see header file for class documentation | |
110 | ||
111 | if ( fClusterFinder ) | |
112 | return EINPROGRESS; | |
113 | ||
114 | fClusters = new TClonesArray*[fNModules]; | |
115 | for (Int_t iModule = 0; iModule < fNModules; iModule++) { | |
116 | fClusters[iModule] = NULL; | |
117 | } | |
118 | ||
119 | fcal = new AliITSCalibrationSSD(); | |
120 | //fgeomInit = new AliITSInitGeometry(kvSSD02,2); | |
121 | fgeomInit = new AliITSInitGeometry(kvPPRasymmFMD,2); | |
122 | fgeom = fgeomInit->CreateAliITSgeom(); | |
123 | ||
124 | //set dettype | |
125 | fDettype = new AliITSDetTypeRec(); | |
126 | fDettype->SetITSgeom(fgeom); | |
127 | for (Int_t iModule = 0; iModule < fNModules; iModule++) { | |
128 | fDettype->SetCalibrationModel(iModule,fcal); | |
129 | } | |
130 | ||
131 | fClusterFinder = new AliITSClusterFinderV2SSD(fDettype); | |
132 | ||
133 | if ( fRawReader ) | |
134 | return EINPROGRESS; | |
135 | ||
136 | fRawReader = new AliRawReaderMemory(); | |
137 | ||
138 | return 0; | |
139 | } | |
140 | ||
141 | Int_t AliHLTITSClusterFinderSSDComponent::DoDeinit() { | |
142 | // see header file for class documentation | |
143 | ||
144 | if ( fRawReader ) | |
145 | delete fRawReader; | |
146 | fRawReader = NULL; | |
147 | ||
148 | if ( fClusterFinder ) | |
149 | delete fClusterFinder; | |
150 | fClusterFinder = NULL; | |
151 | ||
152 | return 0; | |
153 | } | |
154 | ||
155 | Int_t AliHLTITSClusterFinderSSDComponent::DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& /*trigData*/) | |
156 | { // see header file for class documentation | |
157 | ||
158 | // -- Iterator over Data Blocks -- | |
159 | const AliHLTComponentBlockData* iter = NULL; | |
160 | ||
161 | if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )){ | |
162 | return 0; | |
163 | } | |
164 | ||
165 | if (!IsDataEvent()) return 0; | |
166 | ||
167 | if ( evtData.fBlockCnt<=0 ) | |
168 | { | |
169 | Logging( kHLTLogWarning, "HLT::ITSClusterFinderSSD::DoEvent", "DoEvent", "no blocks in event" ); | |
170 | return 0; | |
171 | } | |
172 | ||
173 | // -- Loop over blocks | |
174 | for ( iter = GetFirstInputBlock(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginITSSSD); iter != NULL; iter = GetNextInputBlock() ) { | |
175 | ||
176 | // -- Debug output of datatype -- | |
177 | HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", | |
178 | evtData.fEventID, evtData.fEventID, | |
179 | DataType2Text(iter->fDataType).c_str(), | |
180 | DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginITSSSD).c_str()); | |
181 | ||
182 | // -- Check for the correct data type | |
183 | if ( iter->fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginITSSSD) ) //Add SSD to data origin???????? | |
184 | continue; | |
185 | ||
186 | // -- Set RawReader | |
187 | //fRawReader->SetMemory( (UChar_t*) iter->fPtr, iter->fSize ); | |
188 | ||
189 | // -- Get equipment ID out of specification | |
190 | AliHLTUInt32_t spec = iter->fSpecification; | |
191 | ||
192 | if(spec>0x00040000){ | |
193 | HLTDebug("The Spec is to high for ITS SSD"); | |
194 | } | |
195 | ||
196 | Int_t id = 0; //what should be here, 512??? | |
197 | for ( Int_t ii = 1; ii < 16 ; ii++ ) { //number of ddl's | |
198 | if ( spec & 0x00000001 ) { | |
199 | id += ii; | |
200 | break; | |
201 | } | |
202 | spec = spec >> 1 ; | |
203 | } | |
204 | ||
205 | // -- Set equipment ID to the raw reader | |
206 | ||
207 | if(!fRawReader->AddBuffer((UChar_t*) iter->fPtr, iter->fSize, id)){ | |
208 | HLTWarning("Could not add buffer"); | |
209 | } | |
210 | ||
211 | fClusterFinder->RawdataToClusters(fRawReader,fClusters); | |
212 | ||
213 | /* | |
214 | for(int i=0;i<fNModules;i++){ | |
215 | if(fClusters[i] != NULL){ | |
216 | for(int j=0;j<fClusters[i]->GetEntries();j++){ | |
217 | AliITSRecPoint *recpoint = (AliITSRecPoint*) fClusters[i]->At(j); | |
218 | cout<<"Cluster: X: "<<recpoint->GetX()<<" Y: "<<recpoint->GetY()<<" Z: "<<recpoint->GetZ()<<endl; | |
219 | } | |
220 | } | |
221 | } | |
222 | */ | |
223 | ||
224 | PushBack(*fClusters,kAliHLTDataTypeTObjArray|kAliHLTDataOriginITSSSD,iter->fSpecification); | |
225 | ||
226 | /* | |
227 | for(int i=0;i<fNModules;i++){ | |
228 | if(fClusters[i] != NULL){ | |
229 | PushBack(fClusters[i],kAliHLTDataTypeTObjArray|kAliHLTDataOriginITSSSD,iter->fSpecification); | |
230 | } | |
231 | } | |
232 | */ | |
233 | ||
234 | /* | |
235 | for (Int_t iModule = 0; iModule < fNModules; iModule++) { | |
236 | fClusters[iModule] = NULL; | |
237 | } | |
238 | */ | |
239 | fRawReader->ClearBuffers(); | |
240 | ||
241 | } // for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) { | |
242 | ||
243 | //fClusterFinder->RawdataToClusters(fRawReader,&fClusters); | |
244 | ||
245 | //PushBack( (TObject**) fClusters,kAliHLTDataTypeTObjArray,0x00000000); | |
246 | ||
247 | return 0; | |
248 | } |