]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TRD/AliHLTTRDClusterizerComponent.cxx
removing obsolete include files for AliTRDraw(Fast)Stream (Theo)
[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 #include "AliHLTTRDUtils.h"
43
44 #include "AliGeomManager.h"
45 #include "AliTRDReconstructor.h"
46 #include "AliCDBManager.h"
47 #include "AliCDBStorage.h"
48 #include "AliCDBEntry.h"
49 #include "AliTRDrecoParam.h"
50 #include "AliTRDrawStreamBase.h"
51 #include "AliTRDcluster.h"
52
53 #include "AliRawReaderMemory.h"
54
55 #ifdef HAVE_VALGRIND_CALLGRIND_H
56 #include <valgrind/callgrind.h>
57 #else
58 #define CALLGRIND_START_INSTRUMENTATION (void)0
59 #define CALLGRIND_STOP_INSTRUMENTATION (void)0
60 #endif
61
62 #include <cstdlib>
63 #include <cerrno>
64 #include <string>
65
66 ClassImp(AliHLTTRDClusterizerComponent)
67    
68 AliHLTTRDClusterizerComponent::AliHLTTRDClusterizerComponent()
69 : AliHLTProcessor(),
70   fOutputPercentage(100),
71   fOutputConst(0),
72   fClusterizer(NULL),
73   fRecoParam(NULL),
74   fMemReader(NULL),
75   fReconstructor(NULL),
76   fRecoParamType(-1),
77   fRecoDataType(-1),
78   fRawDataVersion(2),
79   fyPosMethod(1),
80   fgeometryFileName(""),
81   fProcessTracklets(kFALSE),
82   fHLTstreamer(kTRUE),
83   fTC(kFALSE),
84   fHLTflag(kTRUE),
85   fHighLevelOutput(kFALSE),
86   fEmulateHLTClusters(kFALSE)
87 {
88   // Default constructor
89
90 }
91
92 AliHLTTRDClusterizerComponent::~AliHLTTRDClusterizerComponent()
93 {
94   // Destructor
95   // Work is Done in DoDeInit()
96 }
97
98
99 const char* AliHLTTRDClusterizerComponent::GetComponentID()
100 {
101   // Return the component ID const char *
102   return "TRDClusterizer"; // The ID of this component
103 }
104
105 void AliHLTTRDClusterizerComponent::GetInputDataTypes( vector<AliHLTComponent_DataType>& list)
106 {
107   // Get the list of input data
108   list.clear(); // We do not have any requirements for our input data type(s).
109   list.push_back(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTRD);
110 }
111
112 AliHLTComponentDataType AliHLTTRDClusterizerComponent::GetOutputDataType()
113 {
114   // Get the output data type
115   return kAliHLTMultipleDataType;
116 }
117
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
128 void AliHLTTRDClusterizerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
129 {
130   // Get the output data size
131   constBase = fOutputConst;
132   inputMultiplier = ((double)fOutputPercentage)*4/100.0;
133 }
134
135 AliHLTComponent* AliHLTTRDClusterizerComponent::Spawn()
136 {
137   // Spawn function, return new instance of this class
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.
144   int iResult=0;
145   
146   fReconstructor = new AliTRDReconstructor();
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;
155   }
156
157   if (!configuration.IsNull()) {
158     iResult=Configure(configuration.Data());
159   } else {
160     iResult=Reconfigure(NULL, NULL);
161   }
162
163   if(!fClusterizer){
164     HLTFatal("Clusterizer was not initialized!");
165     return -1;
166   }
167
168   if(iResult<0) return iResult;
169
170   fMemReader = new AliRawReaderMemory;
171   fClusterizer->SetReconstructor(fReconstructor);
172   fClusterizer->SetUseLabels(kFALSE);
173
174   if(fReconstructor->IsProcessingTracklets())
175     fOutputConst = fClusterizer->GetTrMemBlockSize();
176
177   return iResult;
178 }
179
180 int AliHLTTRDClusterizerComponent::DoDeinit()
181 {
182   // Deinitialization of the component
183   delete fMemReader;
184   fMemReader = 0;
185   delete fClusterizer;
186   fClusterizer = 0;
187   
188   fReconstructor->SetClusters(0x0);
189   delete fReconstructor;
190   fReconstructor = 0x0;
191   return 0;
192
193   if (fRecoParam)
194     {
195       HLTDebug("Deleting fRecoParam");
196       delete fRecoParam;
197       fRecoParam = 0;
198     }
199 }
200
201 int AliHLTTRDClusterizerComponent::DoEvent( const AliHLTComponentEventData& evtData, 
202                                             const AliHLTComponentBlockData* blocks, 
203                                             AliHLTComponent_TriggerData& /*trigData*/, 
204                                             AliHLTUInt8_t* outputPtr, 
205                                             AliHLTUInt32_t& size, 
206                                             vector<AliHLTComponent_BlockData>& outputBlocks )
207 {
208   // Process an event
209
210   if (evtData.fEventID == 10)
211     CALLGRIND_START_INSTRUMENTATION;
212
213   HLTDebug( "NofBlocks %i", evtData.fBlockCnt );
214   // Process an event
215   AliHLTUInt32_t totalSize = 0, offset = 0;
216
217   //implement a usage of the following
218   //   AliHLTUInt32_t triggerDataStructSize = trigData.fStructSize;
219   //   AliHLTUInt32_t triggerDataSize = trigData.fDataSize;
220   //   void *triggerData = trigData.fData;
221   //HLTDebug( "Trigger data received. Struct size %d Data size %d Data location 0x%x", trigData.fStructSize, trigData.fDataSize, (UInt_t*)trigData.fData);
222
223   // Loop over all input blocks in the event
224   AliHLTComponentDataType expectedDataType = (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTRD);
225   for ( UInt_t iBlock = 0; iBlock < evtData.fBlockCnt; iBlock++ )
226     {      
227       const AliHLTComponentBlockData &block = blocks[iBlock];
228       // lets not use the internal TRD data types here : AliHLTTRDDefinitions::fgkDDLRawDataType
229       // which is depreciated - we use HLT global defs instead
230       //      if ( block.fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTRD) )
231       AliHLTComponentDataType inputDataType = block.fDataType;
232       if ( inputDataType != expectedDataType)
233         {
234           HLTDebug( "Block # %i/%i; Event 0x%08LX (%Lu) Wrong received datatype: %s - required datatype: %s; Skipping",
235                     iBlock, evtData.fBlockCnt,
236                     evtData.fEventID, evtData.fEventID, 
237                     DataType2Text(inputDataType).c_str(), 
238                     DataType2Text(expectedDataType).c_str());
239           if(block.fDataType == kAliHLTDataTypeEOR)
240             CALLGRIND_STOP_INSTRUMENTATION;
241           continue;
242         }
243       else 
244         {
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);
250         }
251       
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();
262       fMemReader->SetMemory((UChar_t*) block.fPtr, block.fSize);
263
264       AliHLTUInt32_t spec = block.fSpecification;
265       
266       Int_t id = AliHLTTRDUtils::GetSM(spec) + 1024;
267
268       fMemReader->SetEquipmentID(id);
269       
270       fClusterizer->SetMemBlock(outputPtr+offset);
271       Bool_t bclustered = fClusterizer->Raw2ClustersChamber(fMemReader);
272       if(bclustered)
273         {
274           HLTDebug("Clustered successfully");
275         }
276       else
277         {
278           HLTError("Clustering ERROR");
279           return -1;
280         }
281
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
286         if (addedSize > 0){
287           // Using low-level interface 
288           // with interface classes
289           if ( totalSize > size )
290             {
291               HLTError("Too much data; Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
292                        totalSize, size );
293               return EMSGSIZE;
294             }
295
296           // Fill block 
297           AliHLTComponentBlockData bd;
298           FillBlockData( bd );
299           bd.fOffset = offset;
300           bd.fSize = addedSize;
301           bd.fSpecification = block.fSpecification;
302           bd.fDataType = AliHLTTRDDefinitions::fgkMCMtrackletDataType;
303           outputBlocks.push_back( bd );
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);
305         }
306         offset = totalSize;
307       }
308
309       addedSize = fClusterizer->GetAddedClSize();
310       if (addedSize > 0){
311         
312         Int_t* nTimeBins = (Int_t*)(outputPtr+offset+fClusterizer->GetAddedClSize());
313         *nTimeBins = fClusterizer->GetNTimeBins();
314         addedSize += sizeof(*nTimeBins);
315
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           }
323
324         // Fill block 
325         AliHLTComponentBlockData bd;
326         FillBlockData( bd );
327         bd.fOffset = offset;
328         bd.fSize = addedSize;
329         bd.fSpecification = block.fSpecification;
330         bd.fDataType = AliHLTTRDDefinitions::fgkClusterDataType;
331         outputBlocks.push_back( bd );
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);
333         offset = totalSize;
334       }
335       else{
336         HLTDebug("Array of clusters is empty!");
337       }
338     }
339   fReconstructor->SetClusters(0x0);
340
341   size = totalSize;
342   HLTDebug("Event is done. size written to the output is %i", size);
343   return 0;
344 }
345
346 void AliHLTTRDClusterizerComponent::PrintObject( TClonesArray* inClustersArray)
347 {
348   AliTRDcluster* cluster=0x0;
349   
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   }
357   
358 }
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       
374       if (argument.CompareTo("output_percentage")==0) {
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       } 
386       else if (argument.CompareTo("-lowflux")==0) {
387         fRecoParamType = 0;
388         HLTInfo("Low flux reconstruction selected");
389         continue;
390       }
391       else if (argument.CompareTo("-highflux")==0) {
392         fRecoParamType = 1;
393         HLTInfo("High flux reconstruction selected");
394         continue;
395       }
396       else if (argument.CompareTo("-cosmics")==0) {
397         fRecoParamType = 2;
398         HLTInfo("Cosmics reconstruction selected");
399         continue;
400       }
401       else if (argument.CompareTo("-simulation")==0) {
402         fRecoDataType = 0;
403         HLTInfo("Awaiting simulated data");
404         continue;
405       }
406       else if (argument.CompareTo("-experiment")==0) {
407         fRecoDataType = 1;
408         HLTInfo("Awaiting real data");
409         continue;
410       }
411       else if (argument.CompareTo("-processTracklets")==0) {
412         fProcessTracklets = kTRUE;
413         HLTInfo("Writing L1 tracklets to output");
414         continue;
415       }
416       else if (argument.CompareTo("-noZS")==0) {
417         fOutputPercentage = 10;
418         HLTInfo("Awaiting non zero surpressed data");
419         continue;
420       }
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       }
439       else if (argument.CompareTo("-faststreamer")==0) {
440         fHLTstreamer = kTRUE;
441         HLTInfo("Useing fast raw streamer");
442         continue;
443       }
444       else if (argument.CompareTo("-nofaststreamer")==0) {
445         fHLTstreamer = kFALSE;
446         HLTInfo("Don't use fast raw streamer");
447         continue;
448       }
449       else if (argument.CompareTo("-tailcancellation")==0) {
450         fTC = kTRUE;
451         HLTInfo("Useing tailcancellation");
452         continue;
453       }
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       } 
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       }
478       else if (argument.CompareTo("-emulateHLToutput")==0) {
479         if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
480         TString toCompareTo=((TObjString*)pTokens->At(i))->GetString();
481         if (toCompareTo.CompareTo("yes")==0){
482           HLTWarning("Setting emulateHLToutput to: %s", toCompareTo.Data());
483           fEmulateHLTClusters=kTRUE;
484         }
485         else if (toCompareTo.CompareTo("no")==0){
486           HLTInfo("Setting emulateHLToutput to: %s", toCompareTo.Data());
487           fEmulateHLTClusters=kFALSE;
488         }
489         else {
490           HLTError("unknown argument for emulateHLToutput: %s", toCompareTo.Data());
491           iResult=-EINVAL;
492           break;
493         }
494         continue;
495       }
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;
517       }
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){
532     iResult=SetParams();
533   }
534   return iResult;
535 }
536
537 int AliHLTTRDClusterizerComponent::SetParams()
538 {
539   Int_t iResult=0;
540   if(!AliCDBManager::Instance()->IsDefaultStorageSet()){
541     HLTError("DefaultStorage is not set in CDBManager");
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()){
551     if(fgeometryFileName.CompareTo("")==0 || !TFile::Open(fgeometryFileName.Data())){
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()){
559       HLTError("Could not load geometry");
560       return -EINVAL;
561     }
562     HLTInfo("Applying Alignment from CDB object");
563     AliGeomManager::ApplyAlignObjsFromCDB("TRD");
564   }
565   else{
566     HLTInfo("Geometry Already Loaded!");
567   }
568
569   if(fReconstructor->GetRecoParam()){
570     fRecoParam = new AliTRDrecoParam(*fReconstructor->GetRecoParam());
571     HLTInfo("RecoParam already set!");
572   }else{
573     if(fRecoParamType == 0){
574       HLTDebug("Low flux params init.");
575       fRecoParam = AliTRDrecoParam::GetLowFluxParam();
576     }
577     if(fRecoParamType == 1){
578       HLTDebug("High flux params init.");
579       fRecoParam = AliTRDrecoParam::GetHighFluxParam();
580     }
581     if(fRecoParamType == 2){
582       HLTDebug("Cosmic Test params init.");
583       fRecoParam = AliTRDrecoParam::GetCosmicTestParam();
584     }
585   }
586
587   if (!fRecoParam)
588     {
589       HLTError("No reco params initialized. Sniffing big trouble!");
590       return -EINVAL;
591     }
592
593   // backward compatibility to AliTRDrecoParam < r34995
594 # ifndef HAVE_NOT_ALITRDRECOPARAM_r34995
595 #   define AliTRDRecoParamSetTailCancelation(b) fRecoParam->SetTailCancelation(b)
596 #   define AliTRDRecoParamSetGAUS(b) fRecoParam->SetGAUS(b)
597 #   define AliTRDRecoParamSetLUT(b) fRecoParam->SetLUT(b)
598 # else
599 #   define AliTRDRecoParamSetTailCancelation(b) fRecoParam->SetTailCancelation()
600 #   define AliTRDRecoParamSetGAUS(b) fRecoParam->SetGAUS()
601 #   define AliTRDRecoParamSetLUT(b) fRecoParam->SetLUT()
602 # endif
603
604   if(fTC){fRecoParam->SetTailCancelation(kTRUE); HLTDebug("Enableing Tail Cancelation"); }
605   else{fRecoParam->SetTailCancelation(kFALSE); HLTDebug("Disableing Tail Cancelation"); }
606
607   switch(fyPosMethod){
608   case 0: AliTRDRecoParamSetGAUS(kFALSE); AliTRDRecoParamSetLUT(kFALSE); break;
609   case 1: AliTRDRecoParamSetGAUS(kFALSE); AliTRDRecoParamSetLUT(kTRUE); break;
610   case 2: AliTRDRecoParamSetGAUS(kTRUE); AliTRDRecoParamSetLUT(kFALSE); break;
611   }
612
613   fRecoParam->SetStreamLevel(AliTRDrecoParam::kClusterizer, 0);
614   fReconstructor->SetRecoParam(fRecoParam);
615
616   TString recoOptions="!cw";
617   if(fHLTflag)
618     recoOptions += ",hlt";
619   if(fProcessTracklets) recoOptions += ",tp";
620   else  recoOptions += ",!tp";
621
622   HLTDebug("Reconstructor options are: %s",recoOptions.Data());
623   fReconstructor->SetOption(recoOptions.Data());
624
625   if (fRecoDataType < 0 || fRecoDataType > 1)
626     {
627       HLTWarning("No data type selected. Use -simulation or -experiment flag. Defaulting to simulation.");
628       fRecoDataType = 0;
629     }
630
631   if (fRecoDataType == 0)
632     {
633       AliTRDrawStreamBase::SetRawStreamVersion(AliTRDrawStreamBase::kTRDsimStream);
634       HLTDebug("Data type expected is SIMULATION!");
635     }
636
637   if (fRecoDataType == 1)
638     {
639       AliTRDrawStreamBase::SetRawStreamVersion(AliTRDrawStreamBase::kTRDrealStream);
640       HLTDebug("Data type expected is EXPERIMENT!");
641     }
642
643   if (fHLTstreamer)
644     {
645       AliTRDrawStreamBase::SetRawStreamVersion("FAST");
646       HLTDebug("fast rawstreamer used");  
647     }
648
649   if(!fClusterizer){
650     fClusterizer = new AliHLTTRDClusterizer("TRDCclusterizer", "TRDCclusterizer");  
651     HLTDebug("TRDClusterizer at 0x%x", fClusterizer);
652   }
653
654   fClusterizer->SetRawVersion(fRawDataVersion);
655
656   return iResult;
657 }
658
659 int AliHLTTRDClusterizerComponent::Reconfigure(const char* cdbEntry, const char* chainId)
660 {
661   // see header file for class documentation
662
663   int iResult=0;
664   const char* path="HLT/ConfigTRD/ClusterizerComponent";
665   const char* defaultNotify="";
666   if (cdbEntry) {
667     path=cdbEntry;
668     defaultNotify=" (default)";
669   }
670   if (path) {
671     HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
672     AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
673     if (pEntry) {
674       TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
675       if (pString) {
676         HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
677         iResult=Configure(pString->GetString().Data());
678       } else {
679         HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
680       }
681     } else {
682       HLTError("cannot fetch object \"%s\" from CDB", path);
683     }
684   }
685
686   return iResult;
687 }