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