]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDtrackletGTU.cxx
Fix aborting error
[u/mrichter/AliRoot.git] / TRD / AliTRDtrackletGTU.cxx
CommitLineData
52c19022 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
16/* $Id: AliTRDtrackletGTU.cxx 28397 2008-09-02 09:33:00Z cblume $ */
17
18////////////////////////////////////////////////////////////////////////////
19// //
20// GTU tracklet //
21// //
22// Author: J. Klein (Jochen.Klein@cern.ch) //
23// //
24////////////////////////////////////////////////////////////////////////////
25
26#include "TMath.h"
4cc89512 27#include "TClass.h"
52c19022 28
29#include "AliTRDtrackletGTU.h"
30#include "AliTRDtrackletWord.h"
4cc89512 31#include "AliTRDtrackletMCM.h"
52c19022 32#include "AliLog.h"
33#include "AliTRDgtuParam.h"
34#include "AliTRDgeometry.h"
35#include "AliTRDpadPlane.h"
36
37ClassImp(AliTRDtrackletGTU)
38
39AliTRDtrackletBase* AliTRDtrackletGTU::fgkDummyTracklet = new AliTRDtrackletWord(0);
40
41AliTRDtrackletGTU::AliTRDtrackletGTU() :
42 AliTRDtrackletBase(),
43 fGtuParam(AliTRDgtuParam::Instance()),
80f93426 44 fTracklet(0x0), //fgkDummyTracklet),
52c19022 45 fSubChannel(0x0),
46 fAssignedZ(kFALSE),
47 fAlpha(0),
48 fYProj(0),
49 fYPrime(0),
50 fIndex(0)
51{
52 // ctor for any tracklet deriving from AliTRDtrackletBase
53
54 fSubChannel = new Int_t[fGtuParam->GetNZChannels()];
55 for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++)
56 fSubChannel[zch] = 0;
57}
58
59AliTRDtrackletGTU::AliTRDtrackletGTU(AliTRDtrackletBase *tracklet) :
60 AliTRDtrackletBase(*tracklet),
61 fGtuParam(AliTRDgtuParam::Instance()),
62 fTracklet(0x0),
63 fSubChannel(0x0),
64 fAssignedZ(kFALSE),
65 fAlpha(0),
66 fYProj(0),
67 fYPrime(0),
68 fIndex(0)
69{
70 // ctor for any tracklet deriving from AliTRDtrackletBase
71
72 fSubChannel = new Int_t[fGtuParam->GetNZChannels()];
73 for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++)
74 fSubChannel[zch] = 0;
75 fTracklet = tracklet;
4cc89512 76 if ( fTracklet->IsA() == TClass::GetClass("AliTRDtrackletMCM")) {
c8b1590d 77 AliDebug(5,Form("label from mcm tracklet: %i", ((AliTRDtrackletMCM*) fTracklet)->GetLabel()));
4cc89512 78 }
52c19022 79}
80
81AliTRDtrackletGTU::AliTRDtrackletGTU(const AliTRDtrackletGTU& tracklet) :
82 AliTRDtrackletBase(tracklet),
83 fGtuParam(AliTRDgtuParam::Instance()),
84 fTracklet(tracklet.fTracklet),
85 fSubChannel(0x0),
86 fAssignedZ(tracklet.fAssignedZ),
87 fAlpha(tracklet.fAlpha),
88 fYProj(tracklet.fYProj),
89 fYPrime(tracklet.fYPrime),
90 fIndex(tracklet.fIndex)
91{
92 // copy ctor
93
94 fSubChannel = new Int_t[fGtuParam->GetNZChannels()];
95 for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++)
96 fSubChannel[zch] = tracklet.fSubChannel[zch];
97}
98
99AliTRDtrackletGTU& AliTRDtrackletGTU::operator=(const AliTRDtrackletGTU &rhs)
100{
101 if (&rhs != this) {
102 fTracklet = rhs.fTracklet;
103 for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++)
104 fSubChannel[zch] = rhs.fSubChannel[zch];
105 fIndex = rhs.fIndex;
106 fYPrime = rhs.fYPrime;
107 fYProj = rhs.fYProj;
108 fAlpha = rhs.fAlpha;
109 fAssignedZ = rhs.fAssignedZ;
110 }
111
112 return *this;
113}
114
115AliTRDtrackletGTU::~AliTRDtrackletGTU()
116{
117 // dtor
118 if (fSubChannel)
119 delete [] fSubChannel;
80f93426 120 fTracklet = 0x0;
52c19022 121}
122
123Int_t AliTRDtrackletGTU::Compare(const TObject *o) const {
124 // sorting w. r. t. Z, Y if no z-channel assigned (as needed in input unit)
125 // otherwise w. r. t. Z, Y_proj
126 // must be changed to Z-channel, Y_proj
127 // will be changed
128
129 if (!o)
130 return 0;
131
132 if (!o->InheritsFrom("AliTRDtrackletGTU")) {
133 AliError("Cannot compare to object not deriving from AliTRDtrackletGTU");
134 return 0;
135 }
136
137 if (!fAssignedZ) {
138 if ( GetZbin() < ((AliTRDtrackletGTU*) o)->GetZbin())
139 return -1;
140 else if (GetZbin() > ((AliTRDtrackletGTU*) o)->GetZbin())
141 return 1;
142 else
143 if (GetYbin() < ((AliTRDtrackletGTU*) o)->GetYbin())
144 return -1;
145 else if (GetYbin() > ((AliTRDtrackletGTU*) o)->GetYbin())
146 return 1;
147 else
148 return 0;
149 }
150 else {
151 // sorting should be according to zsubindex, not to Z !!!
152 // therefore this depends on the zch
153 if (GetZbin() < ((AliTRDtrackletGTU*) o)->GetZbin())
154 return -1;
155 else if (GetZbin() > ((AliTRDtrackletGTU*) o)->GetZbin())
156 return 1;
157 else
158 if (GetYProj() < ((AliTRDtrackletGTU*) o)->GetYProj())
159 return -1;
160 else if (GetYProj() > ((AliTRDtrackletGTU*) o)->GetYProj())
161 return 1;
162 else
163 return 0;
164 }
165}
166
167void AliTRDtrackletGTU::SetSubChannel(Int_t zch, Int_t subch)
168{
169 // set the subchannel in the given z-channel
170 fAssignedZ = kTRUE;
171 fSubChannel[zch] = subch;
172}
173
174Int_t AliTRDtrackletGTU::GetSubChannel(Int_t zch)
175{
176 // get the subchannel in the given z-channel
177 return fSubChannel[zch];
178}
179
4cc89512 180Int_t AliTRDtrackletGTU::GetLabel() const
181{
182 if ( fTracklet->IsA() == TClass::GetClass("AliTRDtrackletMCM"))
183 return ((AliTRDtrackletMCM*) fTracklet)->GetLabel();
184 else
185 return -1;
186}
187
52c19022 188/*
189Float_t AliTRDtrackletGTU::GetPhysX(Int_t layer)
190{
191 // get the x-position (in the local system) assuming the tracklet is in the given layer
192 return fGtuParam->GetGeo()->GetTime0(layer);
193}
194
195Float_t AliTRDtrackletGTU::GetPhysY()
196{
197 //
198 return GetYbin() * 0.0160;
199}
200
201Float_t AliTRDtrackletGTU::GetPhysAlpha()
202{
203 return GetAlpha() * 0.01; // wrong factor!
204}
205
206Float_t AliTRDtrackletGTU::GetPhysZ(Int_t stack, Int_t layer)
207{
208 return fGtuParam->GetGeo()->GetPadPlane(layer, stack)->GetRowPos(GetZbin()); // not the middle of a pad!
209}
210*/