]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDcluster.cxx
Adding AliRieman fitter (M.Ivanov)
[u/mrichter/AliRoot.git] / TRD / AliTRDcluster.cxx
CommitLineData
46d29e70 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
88cb7938 16/* $Id$ */
b9d0a01d 17
88cb7938 18
19///////////////////////////////////////////////////////////////////////////////
20// //
21// TRD cluster //
22// //
23///////////////////////////////////////////////////////////////////////////////
46d29e70 24
25#include "AliTRDcluster.h"
46d29e70 26#include "AliTRDrecPoint.h"
27
46d29e70 28ClassImp(AliTRDcluster)
29
46d29e70 30//_____________________________________________________________________________
5443e65e 31 AliTRDcluster::AliTRDcluster(const AliTRDrecPoint &p):AliCluster()
46d29e70 32{
33 //
a2b90f83 34 // Constructor from AliTRDrecPoint
46d29e70 35 //
36
a2b90f83 37 fDetector = p.GetDetector();
38 fTimeBin = p.GetLocalTimeBin();
46d29e70 39
a2b90f83 40 fTracks[0] = p.GetTrackIndex(0);
41 fTracks[1] = p.GetTrackIndex(1);
42 fTracks[2] = p.GetTrackIndex(2);
46d29e70 43
a2b90f83 44 fQ = p.GetEnergy();
46d29e70 45
a2b90f83 46 fY = p.GetY();
47 fZ = p.GetZ();
48 fSigmaY2 = p.GetSigmaY2();
49 fSigmaZ2 = p.GetSigmaZ2();
46d29e70 50
bbf92647 51 fSigmaY2 = 0.2;
52 fSigmaZ2 = 5.;
4f1c04d3 53 fNPads =0;
54d12e2f 54 fCenter = 0;
bbf92647 55}
56
57//_____________________________________________________________________________
5443e65e 58AliTRDcluster::AliTRDcluster(const AliTRDcluster &c):AliCluster()
bbf92647 59{
60 //
61 // Copy constructor
62 //
63
5443e65e 64 fTracks[0] = c.GetLabel(0);
65 fTracks[1] = c.GetLabel(1);
66 fTracks[2] = c.GetLabel(2);
a2b90f83 67
5443e65e 68 fY = c.GetY();
69 fZ = c.GetZ();
70 fSigmaY2 = c.GetSigmaY2();
71 fSigmaZ2 = c.GetSigmaZ2();
a2b90f83 72
5443e65e 73 fDetector = c.GetDetector();
74 fTimeBin = c.GetLocalTimeBin();
75 fQ = c.GetQ();
4f1c04d3 76 fNPads = c.fNPads;
54d12e2f 77 fCenter = c.fCenter;
a2b90f83 78}
79
a2b90f83 80//_____________________________________________________________________________
81void AliTRDcluster::AddTrackIndex(Int_t *track)
82{
83 //
84 // Adds track index. Currently assumed that track is an array of
85 // size 9, and up to 3 track indexes are stored in fTracks[3].
86 // Indexes are sorted according to:
87 // 1) index of max number of appearances is stored first
88 // 2) if two or more indexes appear equal number of times, the lowest
89 // ones are stored first;
90 //
bbf92647 91
88cb7938 92 const Int_t kSize = 9;
a2b90f83 93
88cb7938 94 Int_t entries[kSize][2], i, j, index;
a2b90f83 95
88cb7938 96 Bool_t indexAdded;
a2b90f83 97
88cb7938 98 for (i=0; i<kSize; i++) {
a2b90f83 99 entries[i][0]=-1;
100 entries[i][1]=0;
5443e65e 101 }
a2b90f83 102
88cb7938 103 for (Int_t k=0; k<kSize; k++) {
a2b90f83 104 index=track[k];
88cb7938 105 indexAdded=kFALSE;
106 j=0;
a2b90f83 107 if (index >= 0) {
88cb7938 108 while ( (!indexAdded) && ( j < kSize ) ) {
a2b90f83 109 if ((entries[j][0]==index) || (entries[j][1]==0)) {
110 entries[j][0]=index;
111 entries[j][1]=entries[j][1]+1;
88cb7938 112 indexAdded=kTRUE;
a2b90f83 113 }
114 j++;
115 }
116 }
5443e65e 117 }
a2b90f83 118
119 // sort by number of appearances and index value
120 Int_t swap=1, tmp0, tmp1;
121 while ( swap > 0) {
122 swap=0;
88cb7938 123 for(i=0; i<(kSize-1); i++) {
a2b90f83 124 if ((entries[i][0] >= 0) && (entries[i+1][0] >= 0)) {
125 if ((entries[i][1] < entries[i+1][1]) ||
126 ((entries[i][1] == entries[i+1][1]) &&
127 (entries[i][0] > entries[i+1][0]))) {
128 tmp0=entries[i][0];
129 tmp1=entries[i][1];
130 entries[i][0]=entries[i+1][0];
131 entries[i][1]=entries[i+1][1];
132 entries[i+1][0]=tmp0;
133 entries[i+1][1]=tmp1;
134 swap++;
135 }
136 }
137 }
5443e65e 138 }
a2b90f83 139
140 // set track indexes
5443e65e 141 for(i=0; i<3; i++) SetLabel(entries[i][0],i);
a2b90f83 142
143 return;
46d29e70 144
5443e65e 145}
46d29e70 146