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