]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/programs/runit.cxx
bugfix: component base class overrode data type of output blocks (introduced with...
[u/mrichter/AliRoot.git] / HLT / programs / runit.cxx
1 // $Id$
2
3 // Author: Constantin Loizides <loizides@ikf.uni-frankfurt.de>
4 //*-- Copyright &copy ALICE HLT Group
5
6
7 /**
8  Example program how to run the "standalone" clusterfinder.
9
10  Important: give patch=-1 for one-patch slices.
11 */
12
13
14 #include "AliHLTStandardIncludes.h"
15
16 #include "AliHLTLogging.h"
17 #include "AliHLTLogger.h"
18 #include "AliHLTRootTypes.h"
19 #include "AliHLTTransform.h"
20 #include "AliHLTClustFinderNew.h"
21 #include "AliHLTMemHandler.h"
22 #include "AliHLTSpacePointData.h"
23
24 #if __GNUC__ == 3
25 using namespace std;
26 #else
27 #include <stream.h>
28 #endif
29
30 #include <libgen.h>
31
32 #define MAXCLUSTER 25000
33
34 int main(Int_t argc,Char_t **argv)
35 {
36   Int_t slice=0;
37   Int_t patch=0;
38   Int_t fm=4;
39   Int_t th=10;
40   Bool_t de=kFALSE;
41
42   AliHLTLogger l;
43   l.Set(AliHLTLogger::kAll);
44   l.UseStderr();
45   //l.UseStdout();
46   //l.UseStream();
47
48   if(argc<2){
49     cout<<"Usage: runit datafile [slice] [patch] [match] [threshold] [deconv]"<<endl;
50     return -1;
51   }
52   if (argc>2) {
53     slice=atoi(argv[2]);
54   }
55   if (argc>3) {
56     patch=atoi(argv[3]);
57   }
58   if (argc>4) {
59     fm=atoi(argv[4]);
60   }
61   if (argc>5) {
62     th=atoi(argv[5]);
63   }
64   if (argc>6) {
65     de=kTRUE;
66   }
67
68   AliHLTDigitRowData *digits = 0;
69   unsigned int nrows=0;
70   
71   //reading transformer init file
72   Char_t fname[1024];
73   strcpy(fname,argv[1]);
74   AliHLTTransform::Init(dirname(fname)); 
75   strcpy(fname,argv[1]);
76
77   //Does all the file/data handling  
78   AliHLTMemHandler file; 
79
80   //Give slice and patch information (see filename convention)
81   if((patch>=0)&&(patch<6)) file.Init(slice,patch);
82   else {
83     Int_t srows[2]={0,AliHLTTransform::GetLastRow(5)};
84     patch=0;
85     file.Init(slice,patch,srows);
86   }
87
88   //Open the data file:
89   if(!file.SetBinaryInput(fname))
90     {
91       cerr<<"Error opening file "<<fname<<endl;
92       return -1;
93     }
94
95   //Store the data in memory, and get the pointer to it:
96   digits = file.CompBinary2Memory(nrows);
97   file.CloseBinaryInput();
98
99   //The cluster finder itself.
100   AliHLTClustFinderNew cf; 
101
102   //Init cluster finder
103   cf.InitSlice(slice,patch,0,nrows-1,MAXCLUSTER);
104   cf.SetMatchWidth(fm);
105   cf.SetThreshold(th);
106   //cf.SetXYError(0.2);
107   //cf.SetZError(0.3);
108   cf.SetSTDOutput(kTRUE);
109   cf.SetCalcErr(kTRUE);
110   cf.SetDeconv(de); //standard is false
111
112   //Allocate memory to store found spacepoints 
113   AliHLTMemHandler fpoints;
114   AliHLTSpacePointData *points=(AliHLTSpacePointData*)fpoints.Allocate(MAXCLUSTER*sizeof(AliHLTSpacePointData));
115   cf.SetOutputArray(points);
116
117   //Give the data pointer to the cluster finder
118   cf.Read(nrows,digits);
119
120   //Start processing:
121   cf.ProcessDigits();
122
123   exit(0);
124 }