]>
Commit | Line | Data |
---|---|---|
2f3824aa | 1 | // $Id$ |
2 | ||
3e87ef69 | 3 | // Author: Constantin Loizides <loizides@ikf.uni-frankfurt.de> |
02f030e3 | 4 | //*-- Copyright © ALICE HLT Group |
5 | ||
2f3824aa | 6 | |
d5e6cede | 7 | /** |
8 | Example program how to run the "standalone" clusterfinder. | |
9 | ||
10 | Important: give patch=-1 for one-patch slices. | |
11 | */ | |
12 | ||
9579103e | 13 | |
4aa41877 | 14 | #include "AliHLTStandardIncludes.h" |
2f3824aa | 15 | |
4aa41877 | 16 | #include "AliHLTLogging.h" |
17 | #include "AliHLTLogger.h" | |
18 | #include "AliHLTRootTypes.h" | |
19 | #include "AliHLTTransform.h" | |
20 | #include "AliHLTClustFinderNew.h" | |
21 | #include "AliHLTMemHandler.h" | |
22 | #include "AliHLTSpacePointData.h" | |
3e87ef69 | 23 | |
0bd0c1ef | 24 | #if __GNUC__ == 3 |
3e87ef69 | 25 | using namespace std; |
26 | #else | |
27 | #include <stream.h> | |
28 | #endif | |
29 | ||
30 | #include <libgen.h> | |
3539d83a | 31 | |
d5e6cede | 32 | #define MAXCLUSTER 25000 |
9579103e | 33 | |
3e87ef69 | 34 | int main(Int_t argc,Char_t **argv) |
3539d83a | 35 | { |
6f9dd32b | 36 | Int_t slice=0; |
37 | Int_t patch=0; | |
b9ab3030 | 38 | Int_t fm=4; |
39 | Int_t th=10; | |
d5e6cede | 40 | Bool_t de=kFALSE; |
6f9dd32b | 41 | |
4aa41877 | 42 | AliHLTLogger l; |
43 | l.Set(AliHLTLogger::kAll); | |
2f3824aa | 44 | l.UseStderr(); |
b9ab3030 | 45 | //l.UseStdout(); |
46 | //l.UseStream(); | |
6f9dd32b | 47 | |
48 | if(argc<2){ | |
d5e6cede | 49 | cout<<"Usage: runit datafile [slice] [patch] [match] [threshold] [deconv]"<<endl; |
6f9dd32b | 50 | return -1; |
51 | } | |
52 | if (argc>2) { | |
53 | slice=atoi(argv[2]); | |
54 | } | |
55 | if (argc>3) { | |
56 | patch=atoi(argv[3]); | |
57 | } | |
b9ab3030 | 58 | if (argc>4) { |
59 | fm=atoi(argv[4]); | |
60 | } | |
61 | if (argc>5) { | |
62 | th=atoi(argv[5]); | |
63 | } | |
d5e6cede | 64 | if (argc>6) { |
65 | de=kTRUE; | |
66 | } | |
9579103e | 67 | |
4aa41877 | 68 | AliHLTDigitRowData *digits = 0; |
b9ab3030 | 69 | unsigned int nrows=0; |
3539d83a | 70 | |
d5e6cede | 71 | //reading transformer init file |
6f9dd32b | 72 | Char_t fname[1024]; |
73 | strcpy(fname,argv[1]); | |
4aa41877 | 74 | AliHLTTransform::Init(dirname(fname)); |
6f9dd32b | 75 | strcpy(fname,argv[1]); |
76 | ||
9579103e | 77 | //Does all the file/data handling |
4aa41877 | 78 | AliHLTMemHandler file; |
3539d83a | 79 | |
6f9dd32b | 80 | //Give slice and patch information (see filename convention) |
81 | if((patch>=0)&&(patch<6)) file.Init(slice,patch); | |
82 | else { | |
4aa41877 | 83 | Int_t srows[2]={0,AliHLTTransform::GetLastRow(5)}; |
b9ab3030 | 84 | patch=0; |
85 | file.Init(slice,patch,srows); | |
6f9dd32b | 86 | } |
87 | ||
3539d83a | 88 | //Open the data file: |
6f9dd32b | 89 | if(!file.SetBinaryInput(fname)) |
3539d83a | 90 | { |
6f9dd32b | 91 | cerr<<"Error opening file "<<fname<<endl; |
3539d83a | 92 | return -1; |
93 | } | |
94 | ||
9579103e | 95 | //Store the data in memory, and get the pointer to it: |
b9ab3030 | 96 | digits = file.CompBinary2Memory(nrows); |
9579103e | 97 | file.CloseBinaryInput(); |
98 | ||
9579103e | 99 | //The cluster finder itself. |
4aa41877 | 100 | AliHLTClustFinderNew cf; |
9579103e | 101 | |
102 | //Init cluster finder | |
b9ab3030 | 103 | cf.InitSlice(slice,patch,0,nrows-1,MAXCLUSTER); |
104 | cf.SetMatchWidth(fm); | |
105 | cf.SetThreshold(th); | |
de4bbf7d | 106 | //cf.SetXYError(0.2); |
107 | //cf.SetZError(0.3); | |
47c84a2b | 108 | cf.SetSTDOutput(kTRUE); |
de4bbf7d | 109 | cf.SetCalcErr(kTRUE); |
d5e6cede | 110 | cf.SetDeconv(de); //standard is false |
9579103e | 111 | |
3539d83a | 112 | //Allocate memory to store found spacepoints |
4aa41877 | 113 | AliHLTMemHandler fpoints; |
114 | AliHLTSpacePointData *points=(AliHLTSpacePointData*)fpoints.Allocate(MAXCLUSTER*sizeof(AliHLTSpacePointData)); | |
3539d83a | 115 | cf.SetOutputArray(points); |
116 | ||
3539d83a | 117 | //Give the data pointer to the cluster finder |
b9ab3030 | 118 | cf.Read(nrows,digits); |
9579103e | 119 | |
3539d83a | 120 | //Start processing: |
121 | cf.ProcessDigits(); | |
b9ab3030 | 122 | |
123 | exit(0); | |
3539d83a | 124 | } |