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 "AliTRDmcmTracklet.h"
32 #include "AliTRDtrackletMCM.h"
34 #include "AliTRDgtuParam.h"
35 #include "AliTRDgeometry.h"
36 #include "AliTRDpadPlane.h"
38 ClassImp(AliTRDtrackletGTU)
40 AliTRDtrackletBase* AliTRDtrackletGTU::fgkDummyTracklet = new AliTRDtrackletWord(0);
42 AliTRDtrackletGTU::AliTRDtrackletGTU() :
44 fGtuParam(AliTRDgtuParam::Instance()),
45 fTracklet(fgkDummyTracklet),
53 // ctor for any tracklet deriving from AliTRDtrackletBase
55 fSubChannel = new Int_t[fGtuParam->GetNZChannels()];
56 for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++)
60 AliTRDtrackletGTU::AliTRDtrackletGTU(AliTRDtrackletBase *tracklet) :
61 AliTRDtrackletBase(*tracklet),
62 fGtuParam(AliTRDgtuParam::Instance()),
71 // ctor for any tracklet deriving from AliTRDtrackletBase
73 fSubChannel = new Int_t[fGtuParam->GetNZChannels()];
74 for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++)
77 if ( fTracklet->IsA() == TClass::GetClass("AliTRDtrackletMCM")) {
78 AliInfo(Form("label from mcm tracklet: %i", ((AliTRDtrackletMCM*) fTracklet)->GetLabel()));
82 AliTRDtrackletGTU::AliTRDtrackletGTU(const AliTRDtrackletGTU& tracklet) :
83 AliTRDtrackletBase(tracklet),
84 fGtuParam(AliTRDgtuParam::Instance()),
85 fTracklet(tracklet.fTracklet),
87 fAssignedZ(tracklet.fAssignedZ),
88 fAlpha(tracklet.fAlpha),
89 fYProj(tracklet.fYProj),
90 fYPrime(tracklet.fYPrime),
91 fIndex(tracklet.fIndex)
95 fSubChannel = new Int_t[fGtuParam->GetNZChannels()];
96 for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++)
97 fSubChannel[zch] = tracklet.fSubChannel[zch];
100 AliTRDtrackletGTU& AliTRDtrackletGTU::operator=(const AliTRDtrackletGTU &rhs)
103 fTracklet = rhs.fTracklet;
104 for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++)
105 fSubChannel[zch] = rhs.fSubChannel[zch];
107 fYPrime = rhs.fYPrime;
110 fAssignedZ = rhs.fAssignedZ;
116 AliTRDtrackletGTU::~AliTRDtrackletGTU()
120 delete [] fSubChannel;
123 Int_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
132 if (!o->InheritsFrom("AliTRDtrackletGTU")) {
133 AliError("Cannot compare to object not deriving from AliTRDtrackletGTU");
138 if ( GetZbin() < ((AliTRDtrackletGTU*) o)->GetZbin())
140 else if (GetZbin() > ((AliTRDtrackletGTU*) o)->GetZbin())
143 if (GetYbin() < ((AliTRDtrackletGTU*) o)->GetYbin())
145 else if (GetYbin() > ((AliTRDtrackletGTU*) o)->GetYbin())
151 // sorting should be according to zsubindex, not to Z !!!
152 // therefore this depends on the zch
153 if (GetZbin() < ((AliTRDtrackletGTU*) o)->GetZbin())
155 else if (GetZbin() > ((AliTRDtrackletGTU*) o)->GetZbin())
158 if (GetYProj() < ((AliTRDtrackletGTU*) o)->GetYProj())
160 else if (GetYProj() > ((AliTRDtrackletGTU*) o)->GetYProj())
167 void AliTRDtrackletGTU::SetSubChannel(Int_t zch, Int_t subch)
169 // set the subchannel in the given z-channel
171 fSubChannel[zch] = subch;
174 Int_t AliTRDtrackletGTU::GetSubChannel(Int_t zch)
176 // get the subchannel in the given z-channel
177 return fSubChannel[zch];
180 Int_t AliTRDtrackletGTU::GetLabel() const
182 if ( fTracklet->IsA() == TClass::GetClass("AliTRDtrackletMCM"))
183 return ((AliTRDtrackletMCM*) fTracklet)->GetLabel();
189 Float_t AliTRDtrackletGTU::GetPhysX(Int_t layer)
191 // get the x-position (in the local system) assuming the tracklet is in the given layer
192 return fGtuParam->GetGeo()->GetTime0(layer);
195 Float_t AliTRDtrackletGTU::GetPhysY()
198 return GetYbin() * 0.0160;
201 Float_t AliTRDtrackletGTU::GetPhysAlpha()
203 return GetAlpha() * 0.01; // wrong factor!
206 Float_t AliTRDtrackletGTU::GetPhysZ(Int_t stack, Int_t layer)
208 return fGtuParam->GetGeo()->GetPadPlane(layer, stack)->GetRowPos(GetZbin()); // not the middle of a pad!