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