]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/programs/tpcbeamtesttracker.cxx
new AliSplineFit class. Performs recursive fits to data point arrays
[u/mrichter/AliRoot.git] / HLT / programs / tpcbeamtesttracker.cxx
1 // $Id$
2
3 #include "AliHLTStandardIncludes.h"
4 #include "AliHLTRootTypes.h"
5 #include "AliLevel3.h"
6 #include "AliHLTTransform.h"
7 #include "AliHLTRawDataFileHandler.h"
8 #include "AliHLTSpacePointData.h"
9 #include "AliHLTClustFinderNew.h"
10 #include "AliHLTConfMapper.h"
11 #include "AliHLTVertex.h"
12
13 #if __GNUC__== 3
14 using namespace std;
15 #else
16 #include <stream.h>
17 #include <string.h>
18 #include <stdlib.h>
19 #endif
20
21
22 #include <sys/stat.h>
23 struct stat stat_results;
24
25
26 //This program does the clusterfinding and the tracking.
27 int main(Int_t argc,Char_t **argv)
28 {
29
30   Char_t cfile[1024];
31   Char_t path[1024]; 
32   Int_t slice=0;
33   Int_t patch=-1;
34   
35   if(argc<3){
36     cout<<"Usage: tpcbeamtesttracker filename path_to_cosmics"<<endl;
37     return -1;
38   }
39   if (argc>2) {
40     sprintf(cfile,"%s",argv[1]);
41     sprintf(path,"%s",argv[2]);
42   }
43
44   AliHLTTransform::Init("./l3-cosmics-transform.config");
45   AliHLTTransform::SetZeroSup(5);
46   AliHLTRawDataFileHandler *f=new AliHLTRawDataFileHandler();
47
48   f->Init(slice,patch);
49   
50   f->SetMappingFile("remap.txt");
51   f->ReadMappingFile();
52
53   Char_t fname[1024];
54   Char_t pname[1024];
55
56   f->SetRawPedestalsInput("./pedout.out");
57   f->ReadRawPedestalsInput();
58   //f->SetPedVal(85);
59
60   sprintf(pname,"%s/%s",path,cfile);
61 #if 0
62   f->SetRawInput(pname);
63   f->ReadRawInput();
64 #else
65   if (stat(pname, &stat_results) != 0){
66     exit(1);
67   }
68   Char_t *t=new Char_t[stat_results.st_size];
69   ifstream *fin=new ifstream(pname,fstream::binary);
70   fin->read(t,stat_results.st_size);
71   delete fin;
72   f->ReadRawInputPointer(t);
73 #endif
74
75   UInt_t nrows;
76   AliHLTDigitRowData *data=(AliHLTDigitRowData*)f->RawData2Memory(nrows);
77
78   AliHLTMemHandler *out = new AliHLTMemHandler();
79   sprintf(fname,"./%s-digits_%d_%d.raw",cfile,slice,patch);
80   out->SetBinaryOutput(fname);
81   out->Memory2Binary(nrows,data);
82   out->CloseBinaryOutput();
83   out->Free();
84
85   AliHLTMemHandler *mem=new AliHLTMemHandler();
86
87   UInt_t maxclusters=100000;
88   UInt_t pointsize = maxclusters*sizeof(AliHLTSpacePointData);
89   AliHLTSpacePointData *points = (AliHLTSpacePointData*)mem->Allocate(pointsize);
90
91   Bool_t rawsp=kTRUE;
92   AliHLTClustFinderNew *cf = new AliHLTClustFinderNew();
93   cf->InitSlice(slice,patch,maxclusters);
94   cf->SetMatchWidth(10);
95   cf->SetSTDOutput(kTRUE);
96   cf->SetRawSP(rawsp);
97   cf->SetThreshold(10);
98   cf->SetDeconv(kFALSE);
99   cf->SetCalcErr(kTRUE);
100   cf->SetOutputArray(points);
101   cf->Read(nrows,data);
102   cf->ProcessDigits();
103   Int_t npoints = cf->GetNumberOfClusters();
104
105   sprintf(fname,"./%s-points_%d_%d.raw",cfile,slice,patch);
106   out->Transform(npoints,points,slice);
107   out->SetBinaryOutput(fname);
108   out->Memory2Binary(npoints,points);
109   out->CloseBinaryOutput();
110   out->Free();
111
112   delete out;
113   delete mem;
114   delete cf;
115   delete f;
116
117
118 }