]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/programs/runit.cxx
0304fac37fa756d8d2ad83a8dcde820f5b9f11c7
[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
13 /**
14  Example program how to run the "standalone" clusterfinder.
15 */
16
17 int main(int argc,char **argv)
18 {
19   Int_t slice=0;
20   Int_t patch=0;
21
22   /*
23     AliL3Logger l;
24     l.Set(AliL3Logger::kAll);
25     l.UseStdout();
26     //l.UseStream();
27   */
28
29   if(argc<2){
30     cout<<"Usage: runit datafile [slice] [patch]"<<endl;
31     return -1;
32   }
33   if (argc>2) {
34     slice=atoi(argv[2]);
35   }
36   if (argc>3) {
37     patch=atoi(argv[3]);
38   }
39
40   AliL3DigitRowData *digits = 0;
41   unsigned int ndigits=0;
42   
43   //Storing all specific quantities, needed by the Cluster Finder.
44   Char_t fname[1024];
45   strcpy(fname,argv[1]);
46   AliL3Transform::Init(dirname(fname)); 
47   strcpy(fname,argv[1]);
48
49   //Does all the file/data handling  
50   AliL3MemHandler file; 
51
52   //Give slice and patch information (see filename convention)
53   if((patch>=0)&&(patch<6)) file.Init(slice,patch);
54   else {
55     Int_t srows[2]={0,175};
56     file.Init(slice,0,srows);
57   }
58
59   //Open the data file:
60   if(!file.SetBinaryInput(fname))
61     {
62       cerr<<"Error opening file "<<fname<<endl;
63       return -1;
64     }
65
66   //Store the data in memory, and get the pointer to it:
67   digits = file.CompBinary2Memory(ndigits);
68   file.CloseBinaryInput();
69
70   //The cluster finder itself.
71   AliL3ClustFinderNew cf; 
72
73   //Init cluster finder
74   cf.InitSlice(0,0,0,ndigits-1,10000);
75   //cf.SetXYError(0.2);
76   //cf.SetZError(0.3);
77   cf.SetSTDOutput(kTRUE);
78   cf.SetCalcErr(kTRUE);
79
80   //Switch off deconvolution:
81   cf.SetDeconv(kFALSE);
82   
83   //Allocate memory to store found spacepoints 
84   AliL3MemHandler fpoints;
85   AliL3SpacePointData *points=(AliL3SpacePointData*)fpoints.Allocate(10000*sizeof(AliL3SpacePointData));
86   cf.SetOutputArray(points);
87
88   //Give the data pointer to the cluster finder
89   cf.Read(ndigits,digits);
90
91   //Start processing:
92   cf.ProcessDigits();
93   
94   return 0;
95 }