]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDcluster.cxx
Move pad planes from AliTRDCommomParam to AliTRDgeometry
[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
46d29e70 27ClassImp(AliTRDcluster)
bdb68f8c 28
6d50f529 29//___________________________________________________________________________
30AliTRDcluster::AliTRDcluster()
31 :AliCluster()
32 ,fDetector(0)
6d50f529 33 ,fTimeBin(0)
34 ,fQ(0)
35 ,fNPads(0)
36 ,fCenter(0)
524fc8fa 37 ,fPad(0)
6d50f529 38{
bdb68f8c 39 //
a6dd11e9 40 // Default constructor
bdb68f8c 41 //
6d50f529 42
43 for (Int_t i = 0; i < 7; i++) {
44 fSignals[i] = 0;
45 }
46
bdb68f8c 47}
6d50f529 48
bbf92647 49//_____________________________________________________________________________
6d50f529 50AliTRDcluster::AliTRDcluster(const AliTRDcluster &c)
51 :AliCluster()
52 ,fDetector(c.fDetector)
6d50f529 53 ,fTimeBin(c.fTimeBin)
54 ,fQ(c.fQ)
55 ,fNPads(c.fNPads)
56 ,fCenter(c.fCenter)
524fc8fa 57 ,fPad(c.fPad)
bbf92647 58{
59 //
60 // Copy constructor
61 //
62
75fb37cc 63 SetLabel(c.GetLabel(0),0);
64 SetLabel(c.GetLabel(1),1);
65 SetLabel(c.GetLabel(2),2);
6d50f529 66
75fb37cc 67 SetY(c.GetY());
68 SetZ(c.GetZ());
69 SetSigmaY2(c.GetSigmaY2());
70 SetSigmaZ2(c.GetSigmaZ2());
6d50f529 71
72 for (Int_t i = 0; i < 7; i++) {
73 fSignals[i] = c.fSignals[i];
74 }
75
a2b90f83 76}
77
a2b90f83 78//_____________________________________________________________________________
79void AliTRDcluster::AddTrackIndex(Int_t *track)
80{
81 //
82 // Adds track index. Currently assumed that track is an array of
83 // size 9, and up to 3 track indexes are stored in fTracks[3].
84 // Indexes are sorted according to:
85 // 1) index of max number of appearances is stored first
86 // 2) if two or more indexes appear equal number of times, the lowest
87 // ones are stored first;
88 //
bbf92647 89
88cb7938 90 const Int_t kSize = 9;
6d50f529 91 Int_t entries[kSize][2];
a2b90f83 92
6d50f529 93 Int_t i = 0;
94 Int_t j = 0;
95 Int_t k = 0;
96 Int_t index;
88cb7938 97 Bool_t indexAdded;
a2b90f83 98
6d50f529 99 for (i = 0; i < kSize; i++) {
100 entries[i][0] = -1;
101 entries[i][1] = 0;
5443e65e 102 }
a2b90f83 103
6d50f529 104 for (k = 0; k < kSize; k++) {
105
106 index = track[k];
107 indexAdded = kFALSE;
108
109 j = 0;
a2b90f83 110 if (index >= 0) {
6d50f529 111 while ((!indexAdded) && (j < kSize)) {
112 if ((entries[j][0] == index) ||
113 (entries[j][1] == 0)) {
114 entries[j][0] = index;
115 entries[j][1] = entries[j][1] + 1;
116 indexAdded = kTRUE;
a2b90f83 117 }
118 j++;
119 }
120 }
6d50f529 121
122 }
123
124 // Sort by number of appearances and index value
125 Int_t swap = 1;
126 Int_t tmp0;
127 Int_t tmp1;
128 while (swap > 0) {
129 swap = 0;
130 for (i = 0; i < (kSize - 1); i++) {
131 if ((entries[i][0] >= 0) &&
132 (entries[i+1][0] >= 0)) {
a2b90f83 133 if ((entries[i][1] < entries[i+1][1]) ||
134 ((entries[i][1] == entries[i+1][1]) &&
6d50f529 135 (entries[i][0] > entries[i+1][0]))) {
136 tmp0 = entries[i][0];
137 tmp1 = entries[i][1];
138 entries[i][0] = entries[i+1][0];
139 entries[i][1] = entries[i+1][1];
140 entries[i+1][0] = tmp0;
141 entries[i+1][1] = tmp1;
142 swap++;
a2b90f83 143 }
144 }
145 }
5443e65e 146 }
a2b90f83 147
6d50f529 148 // Set track indexes
149 for (i = 0; i < 3; i++) {
150 SetLabel(entries[i][0],i);
151 }
a2b90f83 152
153 return;
46d29e70 154
5443e65e 155}
46d29e70 156
6d50f529 157//_____________________________________________________________________________
158void AliTRDcluster::SetSignals(Short_t *signals)
159{
bdb68f8c 160 //
6d50f529 161 // Write signals in the cluster
bdb68f8c 162 //
6d50f529 163
164 for (Int_t i = 0; i < 7; i++) {
165 fSignals[i] = signals[i];
166 }
167
bdb68f8c 168}
169
6d50f529 170//_____________________________________________________________________________
bdb68f8c 171Float_t AliTRDcluster::GetSumS() const
172{
173 //
6d50f529 174 // Returns the total charge from a not unfolded cluster
bdb68f8c 175 //
6d50f529 176
177 Float_t sum = 0.0;
178 for (Int_t i = 0; i < 7; i++) {
179 sum += fSignals[i];
bdb68f8c 180 }
6d50f529 181
182 return sum;
bdb68f8c 183
184}