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