]>
Commit | Line | Data |
---|---|---|
0af7cb2e | 1 | // $Id$ |
2 | ||
4de61263 | 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 | //************************************************************************** | |
0af7cb2e | 18 | |
19 | /** @file AliHLTTRDClusterizerComponent.cxx | |
4de61263 | 20 | @author |
0af7cb2e | 21 | @date |
4de61263 | 22 | @brief A TRDClusterizer processing component for the HLT. |
23 | */ | |
0af7cb2e | 24 | |
c7500dae | 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 | ||
0af7cb2e | 31 | #if __GNUC__ >= 3 |
32 | using namespace std; | |
33 | #endif | |
34 | ||
051a0e2d | 35 | #include "TTree.h" |
36 | #include "TFile.h" | |
37 | #include "TBranch.h" | |
38 | ||
0af7cb2e | 39 | #include "AliHLTTRDClusterizerComponent.h" |
40 | #include "AliHLTTRDDefinitions.h" | |
d679dd6c | 41 | #include "AliHLTTRDCluster.h" |
0af7cb2e | 42 | |
886e8d3d | 43 | #include "AliGeomManager.h" |
44 | #include "AliTRDReconstructor.h" | |
0af7cb2e | 45 | #include "AliCDBManager.h" |
775f67d7 | 46 | #include "AliCDBStorage.h" |
b32b76cb | 47 | #include "AliCDBEntry.h" |
dc2e6604 | 48 | #include "AliHLTTRDClusterizer.h" |
519f385f | 49 | #include "AliTRDrecoParam.h" |
50 | #include "AliTRDrawStreamBase.h" | |
d679dd6c | 51 | #include "AliTRDcluster.h" |
519f385f | 52 | |
0af7cb2e | 53 | #include "AliRawReaderMemory.h" |
54 | ||
d679dd6c | 55 | #ifdef HAVE_VALGRIND_CALLGRIND_H |
56 | #include <valgrind/callgrind.h> | |
57 | #else | |
e3e5ac39 | 58 | #define CALLGRIND_START_INSTRUMENTATION do { } while (0) |
59 | #define CALLGRIND_STOP_INSTRUMENTATION do { } while (0) | |
d679dd6c | 60 | #endif |
61 | ||
0af7cb2e | 62 | #include <cstdlib> |
63 | #include <cerrno> | |
64 | #include <string> | |
65 | ||
18ada816 | 66 | ClassImp(AliHLTTRDClusterizerComponent) |
3b021c25 | 67 | |
d679dd6c | 68 | AliHLTTRDClusterizerComponent::AliHLTTRDClusterizerComponent(): |
69 | AliHLTProcessor(), | |
775f67d7 | 70 | fOutputPercentage(500), |
71 | fOutputConst(0), | |
d679dd6c | 72 | fClusterizer(NULL), |
73 | fRecoParam(NULL), | |
d679dd6c | 74 | fMemReader(NULL), |
b32b76cb | 75 | fReconstructor(NULL), |
76 | fRecoParamType(-1), | |
77 | fRecoDataType(-1), | |
78 | fRawDataVersion(2), | |
79 | fyPosMethod(1), | |
80 | fgeometryFileName(""), | |
81 | fProcessTracklets(kFALSE), | |
b3182b67 | 82 | fHLTstreamer(kFALSE) |
0af7cb2e | 83 | { |
3b021c25 | 84 | // Default constructor |
051a0e2d | 85 | |
0af7cb2e | 86 | } |
87 | ||
88 | AliHLTTRDClusterizerComponent::~AliHLTTRDClusterizerComponent() | |
89 | { | |
3b021c25 | 90 | // Destructor |
886e8d3d | 91 | // Work is Done in DoDeInit() |
0af7cb2e | 92 | } |
d679dd6c | 93 | |
d679dd6c | 94 | |
0af7cb2e | 95 | const char* AliHLTTRDClusterizerComponent::GetComponentID() |
96 | { | |
3b021c25 | 97 | // Return the component ID const char * |
0af7cb2e | 98 | return "TRDClusterizer"; // The ID of this component |
99 | } | |
100 | ||
101 | void AliHLTTRDClusterizerComponent::GetInputDataTypes( vector<AliHLTComponent_DataType>& list) | |
102 | { | |
3b021c25 | 103 | // Get the list of input data |
0af7cb2e | 104 | list.clear(); // We do not have any requirements for our input data type(s). |
775f67d7 | 105 | list.push_back( (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTRD) ); |
0af7cb2e | 106 | } |
107 | ||
108 | AliHLTComponent_DataType AliHLTTRDClusterizerComponent::GetOutputDataType() | |
109 | { | |
3b021c25 | 110 | // Get the output data type |
775f67d7 | 111 | return kAliHLTMultipleDataType; |
0af7cb2e | 112 | } |
113 | ||
775f67d7 | 114 | int AliHLTTRDClusterizerComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList) |
115 | { | |
116 | // Get the output data type | |
117 | tgtList.clear(); | |
118 | tgtList.push_back(AliHLTTRDDefinitions::fgkClusterDataType); | |
119 | tgtList.push_back(AliHLTTRDDefinitions::fgkMCMtrackletDataType); | |
120 | return tgtList.size(); | |
121 | } | |
122 | ||
123 | ||
0af7cb2e | 124 | void AliHLTTRDClusterizerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) |
125 | { | |
3b021c25 | 126 | // Get the output data size |
775f67d7 | 127 | constBase = fOutputConst; |
0af7cb2e | 128 | inputMultiplier = ((double)fOutputPercentage)/100.0; |
129 | } | |
130 | ||
0af7cb2e | 131 | AliHLTComponent* AliHLTTRDClusterizerComponent::Spawn() |
132 | { | |
3b021c25 | 133 | // Spawn function, return new instance of this class |
0af7cb2e | 134 | return new AliHLTTRDClusterizerComponent; |
135 | }; | |
136 | ||
137 | int AliHLTTRDClusterizerComponent::DoInit( int argc, const char** argv ) | |
138 | { | |
139 | // perform initialization. We check whether our relative output size is specified in the arguments. | |
b32b76cb | 140 | int iResult=0; |
519f385f | 141 | |
0d66dbf5 | 142 | fReconstructor = new AliTRDReconstructor(); |
b32b76cb | 143 | HLTDebug("TRDReconstructor at 0x%x", fReconstructor); |
144 | ||
145 | TString configuration=""; | |
146 | TString argument=""; | |
147 | for (int i=0; i<argc && iResult>=0; i++) { | |
148 | argument=argv[i]; | |
149 | if (!configuration.IsNull()) configuration+=" "; | |
150 | configuration+=argument; | |
e3e5ac39 | 151 | } |
775f67d7 | 152 | |
b32b76cb | 153 | if (!configuration.IsNull()) { |
154 | iResult=Configure(configuration.Data()); | |
155 | } else { | |
156 | iResult=Reconfigure(NULL, NULL); | |
157 | } | |
519f385f | 158 | |
b32b76cb | 159 | if(!fClusterizer){ |
160 | HLTFatal("Clusterizer was not initialized!"); | |
775f67d7 | 161 | return -1; |
162 | } | |
051a0e2d | 163 | |
4de61263 | 164 | if(iResult<0) return iResult; |
165 | ||
b32b76cb | 166 | fMemReader = new AliRawReaderMemory; |
9aea5deb | 167 | fClusterizer->SetReconstructor(fReconstructor); |
56397b53 | 168 | fClusterizer->SetUseLabels(kFALSE); |
775f67d7 | 169 | |
170 | if(fReconstructor->IsProcessingTracklets()) | |
171 | fOutputConst = fClusterizer->GetTrMemBlockSize(); | |
4de61263 | 172 | |
173 | return iResult; | |
0af7cb2e | 174 | } |
175 | ||
176 | int AliHLTTRDClusterizerComponent::DoDeinit() | |
177 | { | |
3b021c25 | 178 | // Deinitialization of the component |
179 | delete fMemReader; | |
180 | fMemReader = 0; | |
181 | delete fClusterizer; | |
182 | fClusterizer = 0; | |
9aea5deb | 183 | |
184 | fReconstructor->SetClusters(0x0); | |
0d66dbf5 | 185 | delete fReconstructor; |
186 | fReconstructor = 0x0; | |
0af7cb2e | 187 | return 0; |
188 | ||
519f385f | 189 | if (fRecoParam) |
190 | { | |
191 | HLTDebug("Deleting fRecoParam"); | |
192 | delete fRecoParam; | |
193 | fRecoParam = 0; | |
194 | } | |
0af7cb2e | 195 | } |
196 | ||
886e8d3d | 197 | int AliHLTTRDClusterizerComponent::DoEvent( const AliHLTComponentEventData& evtData, |
198 | const AliHLTComponentBlockData* blocks, | |
199 | AliHLTComponent_TriggerData& /*trigData*/, | |
d679dd6c | 200 | AliHLTUInt8_t* outputPtr, |
a28bfa0d | 201 | AliHLTUInt32_t& size, |
d679dd6c | 202 | vector<AliHLTComponent_BlockData>& outputBlocks ) |
0af7cb2e | 203 | { |
3b021c25 | 204 | // Process an event |
775f67d7 | 205 | |
206 | if (evtData.fEventID == 1) | |
207 | CALLGRIND_START_INSTRUMENTATION; | |
208 | ||
209 | HLTDebug( "NofBlocks %i", evtData.fBlockCnt ); | |
0af7cb2e | 210 | // Process an event |
d679dd6c | 211 | AliHLTUInt32_t totalSize = 0, offset = 0; |
0af7cb2e | 212 | |
051a0e2d | 213 | //implement a usage of the following |
519f385f | 214 | // AliHLTUInt32_t triggerDataStructSize = trigData.fStructSize; |
215 | // AliHLTUInt32_t triggerDataSize = trigData.fDataSize; | |
216 | // void *triggerData = trigData.fData; | |
886e8d3d | 217 | //HLTDebug( "Trigger data received. Struct size %d Data size %d Data location 0x%x", trigData.fStructSize, trigData.fDataSize, (UInt_t*)trigData.fData); |
051a0e2d | 218 | |
0af7cb2e | 219 | // Loop over all input blocks in the event |
886e8d3d | 220 | AliHLTComponentDataType expectedDataType = (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTRD); |
775f67d7 | 221 | for ( UInt_t iBlock = 0; iBlock < evtData.fBlockCnt; iBlock++ ) |
222 | { | |
223 | const AliHLTComponentBlockData &block = blocks[iBlock]; | |
519f385f | 224 | // lets not use the internal TRD data types here : AliHLTTRDDefinitions::fgkDDLRawDataType |
225 | // which is depreciated - we use HLT global defs instead | |
d679dd6c | 226 | // if ( block.fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTRD) ) |
227 | AliHLTComponentDataType inputDataType = block.fDataType; | |
886e8d3d | 228 | if ( inputDataType != expectedDataType) |
0af7cb2e | 229 | { |
775f67d7 | 230 | HLTDebug( "Block # %i/%i; Event 0x%08LX (%Lu) Wrong received datatype: %s - required datatype: %s; Skipping", |
231 | iBlock, evtData.fBlockCnt, | |
9aea5deb | 232 | evtData.fEventID, evtData.fEventID, |
233 | DataType2Text(inputDataType).c_str(), | |
234 | DataType2Text(expectedDataType).c_str()); | |
0af7cb2e | 235 | continue; |
236 | } | |
9aea5deb | 237 | else |
238 | { | |
775f67d7 | 239 | HLTDebug("We get the right data type: Block # %i/%i; Event 0x%08LX (%Lu) Received datatype: %s; Block Size: %i", |
240 | iBlock, evtData.fBlockCnt, | |
241 | evtData.fEventID, evtData.fEventID, | |
242 | DataType2Text(inputDataType).c_str(), | |
243 | block.fSize); | |
9aea5deb | 244 | } |
245 | ||
4de61263 | 246 | #ifndef NDEBUG |
247 | unsigned long constBase; | |
248 | double inputMultiplier; | |
249 | GetOutputDataSize(constBase,inputMultiplier); | |
250 | if(size<(constBase+block.fSize*inputMultiplier)){ | |
251 | HLTWarning("Memory Block given might be too small: %i < %i; Event %Lu", size, constBase+block.fSize*inputMultiplier, evtData.fEventID); | |
252 | } | |
253 | #endif | |
254 | ||
255 | // fMemReader->Reset(); | |
d679dd6c | 256 | fMemReader->SetMemory((UChar_t*) block.fPtr, block.fSize); |
886e8d3d | 257 | |
d679dd6c | 258 | AliHLTUInt32_t spec = block.fSpecification; |
886e8d3d | 259 | |
260 | Int_t id = 1024; | |
261 | ||
b3182b67 | 262 | for ( Int_t ii = 0; ii < 18 ; ii++ ) { |
b32b76cb | 263 | if ( spec & 0x1 ) { |
886e8d3d | 264 | id += ii; |
265 | break; | |
266 | } | |
267 | spec = spec >> 1 ; | |
268 | } | |
886e8d3d | 269 | |
d679dd6c | 270 | fMemReader->SetEquipmentID( id ); |
271 | ||
775f67d7 | 272 | fClusterizer->SetMemBlock(outputPtr+offset); |
886e8d3d | 273 | Bool_t iclustered = fClusterizer->Raw2ClustersChamber(fMemReader); |
274 | if (iclustered == kTRUE) | |
0af7cb2e | 275 | { |
886e8d3d | 276 | HLTDebug( "Clustered successfully"); |
277 | } | |
278 | else | |
279 | { | |
280 | HLTError("Clustering ERROR"); | |
0af7cb2e | 281 | return -1; |
282 | } | |
519f385f | 283 | |
d679dd6c | 284 | // put the tree into output |
886e8d3d | 285 | //fcTree->Print(); |
dc2e6604 | 286 | |
775f67d7 | 287 | AliHLTUInt32_t addedSize; |
288 | if(fReconstructor->IsProcessingTracklets()){ | |
289 | addedSize = fClusterizer->GetAddedTrSize(); | |
290 | totalSize += fClusterizer->GetTrMemBlockSize(); //if IsProcessingTracklets() is enabled we always reserve a data block of size GetTrMemBlockSize() for the tracklets | |
dc2e6604 | 291 | if (addedSize > 0){ |
292 | // Using low-level interface | |
293 | // with interface classes | |
dc2e6604 | 294 | if ( totalSize > size ) |
0134491a | 295 | { |
dc2e6604 | 296 | HLTError("Too much data; Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.", |
297 | totalSize, size ); | |
298 | return EMSGSIZE; | |
0134491a | 299 | } |
775f67d7 | 300 | |
dc2e6604 | 301 | // Fill block |
302 | AliHLTComponentBlockData bd; | |
303 | FillBlockData( bd ); | |
304 | bd.fOffset = offset; | |
305 | bd.fSize = addedSize; | |
ff350753 | 306 | bd.fSpecification = block.fSpecification; |
775f67d7 | 307 | bd.fDataType = AliHLTTRDDefinitions::fgkMCMtrackletDataType; |
dc2e6604 | 308 | outputBlocks.push_back( bd ); |
18ada816 | 309 | HLTDebug( "BD fPtr 0x%x, fOffset %i, size %i, dataType %s, spec 0x%x ", bd.fPtr, bd.fOffset, bd.fSize, DataType2Text(bd.fDataType).c_str(), spec); |
0134491a | 310 | } |
775f67d7 | 311 | offset = totalSize; |
312 | } | |
313 | ||
314 | addedSize = fClusterizer->GetAddedClSize(); | |
315 | if (addedSize > 0){ | |
316 | // Using low-level interface | |
317 | // with interface classes | |
318 | totalSize += addedSize; | |
319 | if ( totalSize > size ) | |
320 | { | |
321 | HLTError("Too much data; Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.", | |
322 | totalSize, size ); | |
323 | return EMSGSIZE; | |
324 | } | |
325 | ||
326 | // Fill block | |
327 | AliHLTComponentBlockData bd; | |
328 | FillBlockData( bd ); | |
329 | bd.fOffset = offset; | |
330 | bd.fSize = addedSize; | |
ff350753 | 331 | bd.fSpecification = block.fSpecification; |
775f67d7 | 332 | bd.fDataType = AliHLTTRDDefinitions::fgkClusterDataType; |
333 | outputBlocks.push_back( bd ); | |
334 | HLTDebug( "BD fPtr 0x%x, fOffset %i, size %i, dataType %s, spec 0x%x ", bd.fPtr, bd.fOffset, bd.fSize, DataType2Text(bd.fDataType).c_str(), spec); | |
335 | offset = totalSize; | |
336 | ||
337 | } | |
338 | else | |
060f29ad | 339 | HLTDebug("Array of clusters is empty!"); |
dc2e6604 | 340 | } |
d679dd6c | 341 | fReconstructor->SetClusters(0x0); |
b39f18ce | 342 | |
d679dd6c | 343 | size = totalSize; |
344 | HLTDebug("Event is done. size written to the output is %i", size); | |
345 | return 0; | |
346 | } | |
347 | ||
d679dd6c | 348 | void AliHLTTRDClusterizerComponent::PrintObject( TClonesArray* inClustersArray) |
349 | { | |
350 | AliTRDcluster* cluster=0x0; | |
9aea5deb | 351 | |
d679dd6c | 352 | for (Int_t i=0; i < inClustersArray->GetEntriesFast(); i++){ |
353 | cluster = dynamic_cast<AliTRDcluster*>(inClustersArray->At(i)); | |
354 | HLTDebug("cluster[%i]",i); | |
355 | HLTDebug(" PadCol = %i; PadRow = %i; PadTime = %i", cluster->GetPadCol(), cluster->GetPadRow(), cluster->GetPadTime()); | |
356 | HLTDebug(" Detector = %i, Amplitude = %f, Center = %f", cluster->GetDetector(), cluster->GetQ(), cluster->GetCenter()); | |
357 | HLTDebug(" LocalTimeBin = %i; NPads = %i; maskedPosition: %s, status: %s", cluster->GetLocalTimeBin(), cluster->GetNPads(),cluster->GetPadMaskedPosition(),cluster->GetPadMaskedPosition()); | |
358 | } | |
9aea5deb | 359 | |
0af7cb2e | 360 | } |
b32b76cb | 361 | |
362 | int AliHLTTRDClusterizerComponent::Configure(const char* arguments){ | |
363 | int iResult=0; | |
364 | if (!arguments) return iResult; | |
365 | ||
366 | TString allArgs=arguments; | |
367 | TString argument; | |
368 | int bMissingParam=0; | |
369 | ||
370 | TObjArray* pTokens=allArgs.Tokenize(" "); | |
371 | if (pTokens) { | |
372 | for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) { | |
373 | argument=((TObjString*)pTokens->At(i))->GetString(); | |
374 | if (argument.IsNull()) continue; | |
375 | ||
4de61263 | 376 | if (argument.CompareTo("output_percentage")==0) { |
b32b76cb | 377 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; |
378 | HLTInfo("Setting output percentage to: %s", ((TObjString*)pTokens->At(i))->GetString().Data()); | |
379 | fOutputPercentage=((TObjString*)pTokens->At(i))->GetString().Atoi(); | |
380 | continue; | |
381 | } | |
382 | else if (argument.CompareTo("-geometry")==0) { | |
383 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
384 | HLTInfo("Setting geometry to: %s", ((TObjString*)pTokens->At(i))->GetString().Data()); | |
385 | fgeometryFileName=((TObjString*)pTokens->At(i))->GetString(); | |
386 | continue; | |
387 | } | |
388 | if (argument.CompareTo("-lowflux")==0) { | |
389 | fRecoParamType = 0; | |
390 | HLTInfo("Low flux reconstruction selected"); | |
391 | continue; | |
392 | } | |
393 | if (argument.CompareTo("-highflux")==0) { | |
394 | fRecoParamType = 1; | |
395 | HLTInfo("High flux reconstruction selected"); | |
396 | continue; | |
397 | } | |
398 | if (argument.CompareTo("-cosmics")==0) { | |
399 | fRecoParamType = 2; | |
400 | HLTInfo("Cosmics reconstruction selected"); | |
401 | continue; | |
402 | } | |
403 | if (argument.CompareTo("-simulation")==0) { | |
404 | fRecoDataType = 0; | |
405 | HLTInfo("Awaiting simulated data"); | |
406 | continue; | |
407 | } | |
408 | if (argument.CompareTo("-experiment")==0) { | |
409 | fRecoDataType = 1; | |
410 | HLTInfo("Awaiting real data"); | |
411 | continue; | |
412 | } | |
413 | if (argument.CompareTo("-processTracklets")==0) { | |
414 | fProcessTracklets = kTRUE; | |
415 | HLTInfo("Processing L1 Tracklets"); | |
416 | continue; | |
417 | } | |
418 | if (argument.CompareTo("-noZS")==0) { | |
419 | fOutputPercentage = 100; | |
420 | HLTInfo("Awaiting non zero surpressed data"); | |
421 | continue; | |
422 | } | |
423 | if (argument.CompareTo("-faststreamer")==0) { | |
424 | fHLTstreamer = kTRUE; | |
425 | HLTInfo("Useing fast raw streamer"); | |
426 | continue; | |
427 | } | |
428 | else if (argument.CompareTo("-rawver")==0) { | |
429 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
430 | HLTInfo("Raw data version is: %s", ((TObjString*)pTokens->At(i))->GetString().Data()); | |
431 | fRawDataVersion=((TObjString*)pTokens->At(i))->GetString().Atoi(); | |
432 | continue; | |
433 | } | |
434 | else if (argument.CompareTo("-yPosMethod")==0) { | |
435 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
436 | TString toCompareTo=((TObjString*)pTokens->At(i))->GetString(); | |
437 | if (toCompareTo.CompareTo("COG")==0){ | |
438 | HLTInfo("Setting yPosMethod method to: %s", toCompareTo.Data()); | |
439 | fyPosMethod=0; | |
440 | } | |
441 | else if (toCompareTo.CompareTo("LUT")==0){ | |
442 | HLTInfo("Setting yPosMethod method to: %s", toCompareTo.Data()); | |
443 | fyPosMethod=1; | |
444 | } | |
445 | else if (toCompareTo.CompareTo("Gauss")==0){ | |
446 | HLTInfo("Setting yPosMethod method to: %s", toCompareTo.Data()); | |
447 | fyPosMethod=2; | |
448 | } | |
449 | else { | |
450 | HLTError("unknown argument for yPosMethod: %s", toCompareTo.Data()); | |
451 | iResult=-EINVAL; | |
452 | break; | |
453 | } | |
454 | continue; | |
455 | } | |
456 | ||
457 | else { | |
458 | HLTError("unknown argument: %s", argument.Data()); | |
459 | iResult=-EINVAL; | |
460 | break; | |
461 | } | |
462 | } | |
463 | delete pTokens; | |
464 | } | |
465 | if (bMissingParam) { | |
466 | HLTError("missing parameter for argument %s", argument.Data()); | |
467 | iResult=-EINVAL; | |
468 | } | |
469 | if(iResult>=0){ | |
b32b76cb | 470 | iResult=SetParams(); |
471 | } | |
472 | return iResult; | |
473 | } | |
474 | ||
475 | int AliHLTTRDClusterizerComponent::SetParams() | |
476 | { | |
477 | Int_t iResult=0; | |
478 | if(!AliCDBManager::Instance()->IsDefaultStorageSet()){ | |
4de61263 | 479 | HLTError("DefaultStorage is not set in CDBManager"); |
b32b76cb | 480 | return -EINVAL; |
481 | } | |
482 | if(AliCDBManager::Instance()->GetRun()<0){ | |
483 | HLTError("Run Number is not set in CDBManager"); | |
484 | return -EINVAL; | |
485 | } | |
486 | HLTInfo("CDB default storage: %s; RunNo: %i", (AliCDBManager::Instance()->GetDefaultStorage()->GetBaseFolder()).Data(), AliCDBManager::Instance()->GetRun()); | |
487 | ||
488 | if(!AliGeomManager::GetGeometry()){ | |
1eedaf94 | 489 | if(fgeometryFileName.CompareTo("")==0 || !TFile::Open(fgeometryFileName.Data())){ |
b32b76cb | 490 | HLTInfo("Loading standard geometry file"); |
491 | AliGeomManager::LoadGeometry(); | |
492 | }else{ | |
493 | HLTWarning("Loading NON-standard geometry file"); | |
494 | AliGeomManager::LoadGeometry(fgeometryFileName.Data()); | |
495 | } | |
496 | if(!AliGeomManager::GetGeometry()){ | |
4de61263 | 497 | HLTError("Could not load geometry"); |
b32b76cb | 498 | return -EINVAL; |
499 | } | |
500 | } | |
501 | else{ | |
502 | HLTInfo("Geometry Already Loaded!"); | |
503 | } | |
504 | ||
060f29ad | 505 | TString recoOptions="hlt,!cw,sl_cl_0"; |
b32b76cb | 506 | |
507 | switch(fRecoDataType){ | |
508 | case 0: recoOptions += ",tc"; break; | |
509 | case 1: recoOptions += ",!tc"; break; | |
510 | } | |
511 | switch(fyPosMethod){ | |
512 | case 0: recoOptions += ",!gs,!lut"; break; | |
513 | case 1: recoOptions += ",!gs,lut"; break; | |
514 | case 2: recoOptions += ",gs,!lut"; break; | |
515 | } | |
516 | if(fProcessTracklets) recoOptions += ",tp"; | |
517 | else recoOptions += ",!tp"; | |
518 | ||
519 | ||
520 | if (fRecoParamType == 0) | |
521 | { | |
522 | HLTDebug("Low flux params init."); | |
523 | fRecoParam = AliTRDrecoParam::GetLowFluxParam(); | |
524 | } | |
525 | ||
526 | if (fRecoParamType == 1) | |
527 | { | |
528 | HLTDebug("High flux params init."); | |
529 | fRecoParam = AliTRDrecoParam::GetHighFluxParam(); | |
530 | } | |
531 | ||
532 | if (fRecoParamType == 2) | |
533 | { | |
534 | HLTDebug("Cosmic Test params init."); | |
535 | fRecoParam = AliTRDrecoParam::GetCosmicTestParam(); | |
536 | } | |
537 | ||
538 | if (fRecoParam == 0) | |
539 | { | |
540 | HLTError("No reco params initialized. Sniffing big trouble!"); | |
541 | return -EINVAL; | |
542 | } | |
543 | ||
a2fbb6ec | 544 | fRecoParam->SetStreamLevel(AliTRDrecoParam::kClusterizer, 0); |
b32b76cb | 545 | fReconstructor->SetRecoParam(fRecoParam); |
b32b76cb | 546 | |
547 | HLTDebug("Reconstructor options are: %s",recoOptions.Data()); | |
548 | fReconstructor->SetOption(recoOptions.Data()); | |
549 | ||
550 | if (fRecoDataType < 0 || fRecoDataType > 1) | |
551 | { | |
552 | HLTWarning("No data type selected. Use -simulation or -experiment flag. Defaulting to simulation."); | |
553 | fRecoDataType = 0; | |
554 | } | |
555 | ||
556 | if (fRecoDataType == 0) | |
557 | { | |
558 | AliTRDrawStreamBase::SetRawStreamVersion(AliTRDrawStreamBase::kTRDsimStream); | |
559 | HLTDebug("Data type expected is SIMULATION!"); | |
560 | } | |
561 | ||
562 | if (fRecoDataType == 1) | |
563 | { | |
564 | AliTRDrawStreamBase::SetRawStreamVersion(AliTRDrawStreamBase::kTRDrealStream); | |
565 | HLTDebug("Data type expected is EXPERIMENT!"); | |
566 | } | |
567 | ||
568 | if (fHLTstreamer) | |
569 | { | |
570 | AliTRDrawStreamBase::SetRawStreamVersion("FAST"); | |
571 | HLTDebug("fast rawstreamer used"); | |
572 | } | |
573 | ||
574 | if(!fClusterizer){ | |
575 | fClusterizer = new AliHLTTRDClusterizer("TRDCclusterizer", "TRDCclusterizer"); | |
576 | HLTDebug("TRDClusterizer at 0x%x", fClusterizer); | |
577 | } | |
578 | ||
579 | fClusterizer->SetRawVersion(fRawDataVersion); | |
580 | ||
581 | return iResult; | |
582 | } | |
583 | ||
b32b76cb | 584 | int AliHLTTRDClusterizerComponent::Reconfigure(const char* cdbEntry, const char* chainId) |
585 | { | |
586 | // see header file for class documentation | |
587 | ||
588 | int iResult=0; | |
589 | const char* path="HLT/ConfigTRD/ClusterizerComponent"; | |
590 | const char* defaultNotify=""; | |
591 | if (cdbEntry) { | |
592 | path=cdbEntry; | |
593 | defaultNotify=" (default)"; | |
594 | } | |
595 | if (path) { | |
596 | HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>"); | |
597 | AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/); | |
598 | if (pEntry) { | |
599 | TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject()); | |
600 | if (pString) { | |
601 | HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data()); | |
602 | iResult=Configure(pString->GetString().Data()); | |
603 | } else { | |
604 | HLTError("configuration object \"%s\" has wrong type, required TObjString", path); | |
605 | } | |
606 | } else { | |
607 | HLTError("cannot fetch object \"%s\" from CDB", path); | |
608 | } | |
609 | } | |
610 | ||
611 | return iResult; | |
612 | } |