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