]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/programs/runit.cxx
Coding violation fixes.
[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 "AliL3StandardIncludes.h"
15
16 #include "AliL3Logging.h"
17 #include "AliL3Logger.h"
18 #include "AliL3RootTypes.h"
19 #include "AliL3Transform.h"
20 #include "AliL3ClustFinderNew.h"
21 #include "AliL3MemHandler.h"
22 #include "AliL3SpacePointData.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   AliL3Logger l;
43   l.Set(AliL3Logger::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   AliL3DigitRowData *digits = 0;
69   unsigned int nrows=0;
70   
71   //reading transformer init file
72   Char_t fname[1024];
73   strcpy(fname,argv[1]);
74   AliL3Transform::Init(dirname(fname)); 
75   strcpy(fname,argv[1]);
76
77   //Does all the file/data handling  
78   AliL3MemHandler 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,AliL3Transform::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   AliL3ClustFinderNew 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   AliL3MemHandler fpoints;
114   AliL3SpacePointData *points=(AliL3SpacePointData*)fpoints.Allocate(MAXCLUSTER*sizeof(AliL3SpacePointData));
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 }