]>
Commit | Line | Data |
---|---|---|
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" | |
b9ab3030 | 12 | #include "AliL3Logger.h" |
3539d83a | 13 | |
b9ab3030 | 14 | #define MAXCLUSTER 15000 |
9579103e | 15 | /** |
16 | Example program how to run the "standalone" clusterfinder. | |
b9ab3030 | 17 | |
18 | Import: give patch=-1 for one-patch slices. | |
9579103e | 19 | */ |
20 | ||
3539d83a | 21 | int main(int argc,char **argv) |
22 | { | |
6f9dd32b | 23 | Int_t slice=0; |
24 | Int_t patch=0; | |
b9ab3030 | 25 | Int_t fm=4; |
26 | Int_t th=10; | |
6f9dd32b | 27 | |
b9ab3030 | 28 | //AliL3Logger l; |
29 | //l.Set(AliL3Logger::kAll); | |
30 | //l.UseStdout(); | |
31 | //l.UseStream(); | |
6f9dd32b | 32 | |
33 | if(argc<2){ | |
b9ab3030 | 34 | cout<<"Usage: runit datafile [slice] [patch] [match] [threshold]"<<endl; |
6f9dd32b | 35 | return -1; |
36 | } | |
37 | if (argc>2) { | |
38 | slice=atoi(argv[2]); | |
39 | } | |
40 | if (argc>3) { | |
41 | patch=atoi(argv[3]); | |
42 | } | |
b9ab3030 | 43 | if (argc>4) { |
44 | fm=atoi(argv[4]); | |
45 | } | |
46 | if (argc>5) { | |
47 | th=atoi(argv[5]); | |
48 | } | |
9579103e | 49 | |
3539d83a | 50 | AliL3DigitRowData *digits = 0; |
b9ab3030 | 51 | unsigned int nrows=0; |
3539d83a | 52 | |
6f9dd32b | 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 | ||
9579103e | 59 | //Does all the file/data handling |
60 | AliL3MemHandler file; | |
3539d83a | 61 | |
6f9dd32b | 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}; | |
b9ab3030 | 66 | patch=0; |
67 | file.Init(slice,patch,srows); | |
6f9dd32b | 68 | } |
69 | ||
3539d83a | 70 | //Open the data file: |
6f9dd32b | 71 | if(!file.SetBinaryInput(fname)) |
3539d83a | 72 | { |
6f9dd32b | 73 | cerr<<"Error opening file "<<fname<<endl; |
3539d83a | 74 | return -1; |
75 | } | |
76 | ||
9579103e | 77 | //Store the data in memory, and get the pointer to it: |
b9ab3030 | 78 | digits = file.CompBinary2Memory(nrows); |
9579103e | 79 | file.CloseBinaryInput(); |
80 | ||
9579103e | 81 | //The cluster finder itself. |
82 | AliL3ClustFinderNew cf; | |
83 | ||
84 | //Init cluster finder | |
b9ab3030 | 85 | cf.InitSlice(slice,patch,0,nrows-1,MAXCLUSTER); |
86 | cf.SetMatchWidth(fm); | |
87 | cf.SetThreshold(th); | |
de4bbf7d | 88 | //cf.SetXYError(0.2); |
89 | //cf.SetZError(0.3); | |
47c84a2b | 90 | cf.SetSTDOutput(kTRUE); |
de4bbf7d | 91 | cf.SetCalcErr(kTRUE); |
9579103e | 92 | |
47c84a2b | 93 | //Switch off deconvolution: |
6f9dd32b | 94 | cf.SetDeconv(kFALSE); |
47c84a2b | 95 | |
3539d83a | 96 | //Allocate memory to store found spacepoints |
97 | AliL3MemHandler fpoints; | |
b9ab3030 | 98 | AliL3SpacePointData *points=(AliL3SpacePointData*)fpoints.Allocate(MAXCLUSTER*sizeof(AliL3SpacePointData)); |
3539d83a | 99 | cf.SetOutputArray(points); |
100 | ||
3539d83a | 101 | //Give the data pointer to the cluster finder |
b9ab3030 | 102 | cf.Read(nrows,digits); |
9579103e | 103 | |
3539d83a | 104 | //Start processing: |
105 | cf.ProcessDigits(); | |
b9ab3030 | 106 | |
107 | exit(0); | |
3539d83a | 108 | } |