Sample program to run VHDL cluster finder.
[u/mrichter/AliRoot.git] / HLT / programs / runit.cxx
CommitLineData
9579103e 1/* $Id$
2 Author: Constantin Loizides <loizides@ikf.physik.uni-frankfurt.de>
3*/
4
5#include <stream.h>
6#include <libgen.h>
6f9dd32b 7#include "AliL3RootTypes.h"
9579103e 8#include "AliL3Transform.h"
3539d83a 9#include "AliL3ClustFinderNew.h"
10#include "AliL3MemHandler.h"
11#include "AliL3SpacePointData.h"
12
9579103e 13/**
14 Example program how to run the "standalone" clusterfinder.
15*/
16
3539d83a 17int main(int argc,char **argv)
18{
6f9dd32b 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 }
9579103e 39
3539d83a 40 AliL3DigitRowData *digits = 0;
41 unsigned int ndigits=0;
42
6f9dd32b 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
9579103e 49 //Does all the file/data handling
50 AliL3MemHandler file;
3539d83a 51
6f9dd32b 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
3539d83a 59 //Open the data file:
6f9dd32b 60 if(!file.SetBinaryInput(fname))
3539d83a 61 {
6f9dd32b 62 cerr<<"Error opening file "<<fname<<endl;
3539d83a 63 return -1;
64 }
65
9579103e 66 //Store the data in memory, and get the pointer to it:
67 digits = file.CompBinary2Memory(ndigits);
68 file.CloseBinaryInput();
69
9579103e 70 //The cluster finder itself.
71 AliL3ClustFinderNew cf;
72
73 //Init cluster finder
74 cf.InitSlice(0,0,0,ndigits-1,10000);
de4bbf7d 75 //cf.SetXYError(0.2);
76 //cf.SetZError(0.3);
47c84a2b 77 cf.SetSTDOutput(kTRUE);
de4bbf7d 78 cf.SetCalcErr(kTRUE);
9579103e 79
47c84a2b 80 //Switch off deconvolution:
6f9dd32b 81 cf.SetDeconv(kFALSE);
47c84a2b 82
3539d83a 83 //Allocate memory to store found spacepoints
84 AliL3MemHandler fpoints;
85 AliL3SpacePointData *points=(AliL3SpacePointData*)fpoints.Allocate(10000*sizeof(AliL3SpacePointData));
86 cf.SetOutputArray(points);
87
3539d83a 88 //Give the data pointer to the cluster finder
89 cf.Read(ndigits,digits);
9579103e 90
3539d83a 91 //Start processing:
92 cf.ProcessDigits();
93
94 return 0;
95}