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 /* $Id: AliTRDtrackletGTU.cxx 28397 2008-09-02 09:33:00Z cblume $ */
18 ////////////////////////////////////////////////////////////////////////////
22 // Author: J. Klein (Jochen.Klein@cern.ch) //
24 ////////////////////////////////////////////////////////////////////////////
29 #include "AliTRDtrackletGTU.h"
30 #include "AliTRDtrackletWord.h"
31 #include "AliTRDtrackletMCM.h"
33 #include "AliTRDgtuParam.h"
34 #include "AliTRDgeometry.h"
35 #include "AliTRDpadPlane.h"
37 ClassImp(AliTRDtrackletGTU)
39 AliTRDtrackletBase* AliTRDtrackletGTU::fgkDummyTracklet = new AliTRDtrackletWord(0);
41 AliTRDtrackletGTU::AliTRDtrackletGTU() :
43 fGtuParam(AliTRDgtuParam::Instance()),
44 fTracklet(0x0), //fgkDummyTracklet),
52 // ctor for any tracklet deriving from AliTRDtrackletBase
54 fSubChannel = new Int_t[fGtuParam->GetNZChannels()];
55 for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++)
59 AliTRDtrackletGTU::AliTRDtrackletGTU(AliTRDtrackletBase *tracklet) :
60 AliTRDtrackletBase(*tracklet),
61 fGtuParam(AliTRDgtuParam::Instance()),
70 // ctor for any tracklet deriving from AliTRDtrackletBase
72 fSubChannel = new Int_t[fGtuParam->GetNZChannels()];
73 for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++)
76 if ( fTracklet->IsA() == TClass::GetClass("AliTRDtrackletMCM")) {
77 AliDebug(5,Form("label from mcm tracklet: %i", ((AliTRDtrackletMCM*) fTracklet)->GetLabel()));
81 AliTRDtrackletGTU::AliTRDtrackletGTU(const AliTRDtrackletGTU& tracklet) :
82 AliTRDtrackletBase(tracklet),
83 fGtuParam(AliTRDgtuParam::Instance()),
84 fTracklet(tracklet.fTracklet),
86 fAssignedZ(tracklet.fAssignedZ),
87 fAlpha(tracklet.fAlpha),
88 fYProj(tracklet.fYProj),
89 fYPrime(tracklet.fYPrime),
90 fIndex(tracklet.fIndex)
94 fSubChannel = new Int_t[fGtuParam->GetNZChannels()];
95 for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++)
96 fSubChannel[zch] = tracklet.fSubChannel[zch];
99 AliTRDtrackletGTU& AliTRDtrackletGTU::operator=(const AliTRDtrackletGTU &rhs)
101 // assignment operator
104 fTracklet = rhs.fTracklet;
105 for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++)
106 fSubChannel[zch] = rhs.fSubChannel[zch];
108 fYPrime = rhs.fYPrime;
111 fAssignedZ = rhs.fAssignedZ;
117 AliTRDtrackletGTU::~AliTRDtrackletGTU()
121 delete [] fSubChannel;
125 Int_t AliTRDtrackletGTU::Compare(const TObject *o) const {
126 // sorting w. r. t. Z, Y if no z-channel assigned (as needed in input unit)
127 // otherwise w. r. t. Z, Y_proj
128 // must be changed to Z-channel, Y_proj
134 if (!o->InheritsFrom("AliTRDtrackletGTU")) {
135 AliError("Cannot compare to object not deriving from AliTRDtrackletGTU");
140 if ( GetZbin() < ((AliTRDtrackletGTU*) o)->GetZbin())
142 else if (GetZbin() > ((AliTRDtrackletGTU*) o)->GetZbin())
145 if (GetYbin() < ((AliTRDtrackletGTU*) o)->GetYbin())
147 else if (GetYbin() > ((AliTRDtrackletGTU*) o)->GetYbin())
153 // sorting should be according to zsubindex, not to Z !!!
154 // therefore this depends on the zch
155 if (GetZbin() < ((AliTRDtrackletGTU*) o)->GetZbin())
157 else if (GetZbin() > ((AliTRDtrackletGTU*) o)->GetZbin())
160 if (GetYProj() < ((AliTRDtrackletGTU*) o)->GetYProj())
162 else if (GetYProj() > ((AliTRDtrackletGTU*) o)->GetYProj())
169 void AliTRDtrackletGTU::SetSubChannel(Int_t zch, Int_t subch)
171 // set the subchannel in the given z-channel
173 fSubChannel[zch] = subch;
176 Int_t AliTRDtrackletGTU::GetSubChannel(Int_t zch) const
178 // get the subchannel in the given z-channel
179 return fSubChannel[zch];
182 Int_t AliTRDtrackletGTU::GetLabel() const
184 // get the MC label for the tracklet, -1 if none
186 if ( fTracklet->IsA() == TClass::GetClass("AliTRDtrackletMCM"))
187 return ((AliTRDtrackletMCM*) fTracklet)->GetLabel();
193 Float_t AliTRDtrackletGTU::GetPhysX(Int_t layer)
195 // get the x-position (in the local system) assuming the tracklet is in the given layer
196 return fGtuParam->GetGeo()->GetTime0(layer);
199 Float_t AliTRDtrackletGTU::GetPhysY()
202 return GetYbin() * 0.0160;
205 Float_t AliTRDtrackletGTU::GetPhysAlpha()
207 return GetAlpha() * 0.01; // wrong factor!
210 Float_t AliTRDtrackletGTU::GetPhysZ(Int_t stack, Int_t layer)
212 return fGtuParam->GetGeo()->GetPadPlane(layer, stack)->GetRowPos(GetZbin()); // not the middle of a pad!