1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 ////////////////////////////////////////////////////////////////////////////
18 // Reconstruction QA //
20 // Authors: Yvonne C. Pachmayer <pachmay@physi.uni-heidelberg.de> //
22 ////////////////////////////////////////////////////////////////////////////
25 #define AliTrackletsinTRD_cxx
26 #include "AliTrackletsinTRD.h"
31 void AliTrackletsinTRD::Loop()
33 // In a ROOT session, you can do:
34 // Root > .L AliTrackletsinTRD.C
35 // Root > AliTrackletsinTRD t
36 // Root > t.GetEntry(12); // Fill t data members with entry number 12
37 // Root > t.Show(); // Show values of entry 12
38 // Root > t.Show(16); // Read and show values of entry 16
39 // Root > t.Loop(); // Loop on all entries
42 // This is the loop skeleton where:
43 // jentry is the global entry number in the chain
44 // ientry is the entry number in the current Tree
45 // Note that the argument to GetEntry must be:
46 // jentry for TChain::GetEntry
47 // ientry for TTree::GetEntry and TBranch::GetEntry
49 // To read only selected branches, Insert statements like:
51 // fChain->SetBranchStatus("*",0); // disable all branches
52 // fChain->SetBranchStatus("branchname",1); // activate branchname
53 // METHOD2: replace line
54 // fChain->GetEntry(jentry); //read all branches
55 //by b_branchname->GetEntry(ientry); //read only this branch
57 gROOT->SetStyle("Plain");
58 gStyle->SetPalette(1);
61 if (fChain == 0) return;
63 // open run loader and load gAlice, kinematics and header
64 AliRunLoader* runLoader = AliRunLoader::Open("galice.root");
67 printf("Error: readKine:\nGetting run loader from file \"%s\" failed", filename);
71 runLoader->LoadHeader();
72 runLoader->LoadRecPoints("TRD");
73 TObjArray *module = new TObjArray();
75 runLoader->CdGAFile();
77 Int_t nEvents = runLoader->GetNumberOfEvents();
78 const Int_t nEventsarray=nEvents;
79 AliTRDcluster *cls = 0;
81 Double_t x_clus[540][90];
82 Double_t y_clus[540][90];
84 for(Int_t ev = 0; ev < nEvents - 1; ev++)
86 TTree *tree = runLoader->GetTreeR("TRD", 0);
87 tree->SetBranchAddress("TRDcluster", &module);
89 int N = tree->GetEntries(); // number of chamber, max 540
90 // Check number of clusters
91 for(Int_t ind = 0; ind < N; ind++)
94 Int_t m = module->GetEntries();
96 for (Int_t j = 0; j < m; j++) // loop over clusters of one chamber
99 if (cls != 0) delete cls;
100 cls = (AliTRDcluster*)module->At(j);
101 x_clus[ind][j]=cls->GetX();
102 y_clus[ind][j]=cls->GetY();
109 // loop over debug file and analysis
111 Float_t xbmin = 0., xbmax = 380.;
112 /* // histogram for debugging purpose
113 Int_t nxbins = 3000, nybins = 280;
114 Float_t ybmin = -70., ybmax = 70.;
115 hxy = new TH2F("hxy",";x;y",nxbins,xbmin,xbmax,nybins,ybmin,ybmax);
118 Long64_t nentries = fChain->GetEntriesFast();
120 Long64_t nbytes = 0, nb = 0;
124 for (Long64_t jentry=0; jentry<nentries;jentry++) {
125 Long64_t ientry = LoadTree(jentry);
126 if (ientry < 0) break;
127 nb = fChain->GetEntry(jentry); nbytes += nb;
128 xpos[flayer]=fxtrack;
129 ypos[flayer]=fytrack;
134 Float_t x[6]= {xpos[0],xpos[1],xpos[2],xpos[3],xpos[4],xpos[5]};
135 Float_t y[6]= {ypos[0],ypos[1],ypos[2],ypos[3],ypos[4],ypos[5]};
137 gxy = new TGraph(6,x,y);
139 TF1 *f1 = new TF1("f1","pol1",xbmin,xbmax);
141 // resulting function: y=ax+b --> x*f1->GetParameter(1)+f1->GetParameter(0)
143 // graph and fit plotting only for checking
145 c1 = new TCanvas("c1","hough Transform",0,0,800,800);
148 gxy->SetMarkerStyle(3);
155 if(feventcounter==ev)
157 for(Int_t b=0;b<540;b++)
161 Int_t counter_distcalc;
162 Float_t distance_sum=0;
164 for(Int_t c=0;c<90;c++)
174 // Function to calculate the distance of a point to the above fitted function
175 Double_t distance = 0;
176 if((TMath::Sqrt(f1->GetParameter(1)*f1->GetParameter(1)+1))!=0) distance=TMath::Abs(f1->GetParameter(1)*px-py+f1->GetParameter(0))/(TMath::Sqrt(f1->GetParameter(1)*f1->GetParameter(1)+1));
177 // if(distance<10) cout << eventcounter << " " << b << " " << c << " " << distance << endl;
178 if(distance>0.6 && distance<=2)
181 distance_sum+=distance;
186 if(counter_distcalc!=0)
188 // these are tracks which have additional clusters close by: 0.6 < distance <= 2
192 // these are good tracks no additional clusters close by
193 cout <<" good tracks " << endl;
202 } // end of 5 layer loop
208 } // end loop over debug file and analysis
210 runLoader->GetNextEvent();