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