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