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