3 #include "AliL3StandardIncludes.h"
4 #include "AliL3RootTypes.h"
6 #include "AliL3Transform.h"
7 #include "AliL3RawDataFileHandler.h"
8 #include "AliL3SpacePointData.h"
9 #include "AliL3ClustFinderNew.h"
10 #include "AliL3ConfMapper.h"
11 #include "AliL3Vertex.h"
12 #include "AliL3MemHandler.h"
13 #include "AliL3Logging.h"
14 #include "AliL3TrackArray.h"
15 #include "AliL3Track.h"
19 #include <TApplication.h>
21 #include <TPaletteAxis.h>
35 //This program does the clusterfinding and the tracking.
36 int main(Int_t argc,Char_t **argv){
38 //Display all clusters.
45 cout<<"Usage: tpcbeamtestdisplay filename path_to_files"<<endl;
49 sprintf(cfile,"%s",argv[1]);
50 sprintf(path,"%s",argv[2]);
53 //displaying the tracks:
55 AliL3MemHandler *clusterfile = new AliL3MemHandler();
56 sprintf(fname,"%s/%s-points_0_-1.raw",path,cfile);
57 cout<<"file: "<<fname<<endl;
58 if(!clusterfile->SetBinaryInput(fname)){
59 cout<<"file: "<<fname<<" can not be set as binary input!"<<endl;
60 LOG(AliL3Log::kError,"AliL3Evaluation::Setup","File Open")
61 <<"Inputfile "<<fname<<" does not exist"<<ENDLOG;
65 clusterfile->SetBinaryInput(fname);
66 AliL3SpacePointData *fClusters = new AliL3SpacePointData();
67 memset(fClusters,0,sizeof(AliL3SpacePointData*));
68 fClusters = (AliL3SpacePointData*)clusterfile->Allocate();
69 clusterfile->Binary2Memory(fNcl,fClusters);
70 clusterfile->CloseBinaryInput();
71 TApplication theApp("App", &argc, argv);
72 TCanvas *c1 = new TCanvas("c1","",900,700);
78 AliL3SpacePointData *points = fClusters;
79 TH2F *clusters = new TH2F("clusters","",65,-1,64,77,17,94);
81 cout<<"no points"<<endl;
83 // cout<<"number of points: "<<npoints<<endl;
84 for(Int_t i=0; i<npoints; i++){
85 float x_tmp = points[i].fX;
86 float y_tmp = points[i].fY;
87 // cout<<"x: "<<x_tmp<<" y: "<<y_tmp<<endl;
88 clusters->Fill(x_tmp,y_tmp,1);
90 TH2F *nothing = new TH2F(cfile,"",65,-1,64,77,17,94);
91 // nothing->SetName("Test");
92 //Adding a regression method to calculate the line parameters.
93 float *x=new float[npoints];
94 float *y=new float[npoints];
98 Int_t numofXYPoints=npoints;
108 for(Int_t i=0; i<npoints; i++){
113 sumXtimesY+=x[i]*y[i];
114 sumXsquare+=x[i]*x[i];
115 sumYsquare+=y[i]*y[i];
120 if(numofXYPoints*sumXsquare-sumX*sumX!=0)
121 xyParamB=(numofXYPoints*sumXtimesY-sumX*sumY)/(numofXYPoints*sumXsquare-sumX*sumX);
123 cout<<"Divident is zero calculating the xParamB, numofXYPoints*sumXsquare-sumX*sumX=0"<<endl;
125 xyParamA=(sumY-xyParamB*sumX)/numofXYPoints;
127 cout<<"Divident is zero calculating the xParamA, numofXYPoints=0"<<endl;
129 //cout<<"y= a + bx : "<<"y= "<<xyParamA<<" + "<<xyParamB<<" x"<<endl;
131 TF1 *line = new TF1("line","[0]+[1]*x",0,63);
132 line->SetParameters(xyParamA,xyParamB);
133 TLine *leftline= new TLine(0,(0-AliL3Transform::GetNPads(0)/2+55),0,AliL3Transform::GetNPads(0)-(AliL3Transform::GetNPads(0)/2)+55);
134 TLine *rightline=new TLine(63,(0-AliL3Transform::GetNPads(63)/2+55),63,AliL3Transform::GetNPads(63)-(AliL3Transform::GetNPads(63)/2)+55);
135 TLine *upperline=new TLine(0,(AliL3Transform::GetNPads(0)-AliL3Transform::GetNPads(0)/2+55),63,AliL3Transform::GetNPads(63)-(AliL3Transform::GetNPads(63)/2)+55);
136 TLine *underline=new TLine(0,(0-AliL3Transform::GetNPads(0)/2+55),63,0-(AliL3Transform::GetNPads(63)/2)+55);
138 nothing->Draw("colz");
139 nothing->SetXTitle("Padrows");
140 nothing->SetYTitle("Pads");
141 clusters->SetMarkerStyle(22);
142 clusters->Draw("same");
145 line->SetLineColor(2);
146 leftline->Draw("same");
147 leftline->SetLineWidth(2);
148 rightline->Draw("same");
149 rightline->SetLineWidth(2);
150 upperline->Draw("same");
151 upperline->SetLineWidth(2);
152 underline->Draw("same");
153 underline->SetLineWidth(2);
156 c1->SetFillColor(10);