updated
[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()),
44eafcf2 44 fTracklet(fgkDummyTracklet),
45 fTrackletESD(0x0),
059f00c5 46 fMCMtrackletIndex(-1),
52c19022 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
5f006bd7 55 for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++)
52c19022 56 fSubChannel[zch] = 0;
57}
58
59AliTRDtrackletGTU::AliTRDtrackletGTU(AliTRDtrackletBase *tracklet) :
60 AliTRDtrackletBase(*tracklet),
61 fGtuParam(AliTRDgtuParam::Instance()),
44eafcf2 62 fTracklet(fgkDummyTracklet),
63 fTrackletESD(0x0),
059f00c5 64 fMCMtrackletIndex(-1),
52c19022 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
5f006bd7 73 for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++)
52c19022 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
44eafcf2 81AliTRDtrackletGTU::AliTRDtrackletGTU(AliESDTrdTracklet *tracklet) :
82 AliTRDtrackletBase(),
83 fGtuParam(AliTRDgtuParam::Instance()),
84 fTracklet(fgkDummyTracklet),
85 fTrackletESD(tracklet),
059f00c5 86 fMCMtrackletIndex(-1), // has to be set via SetMCMtrackletIndex() separately
44eafcf2 87 fAssignedZ(kFALSE),
88 fAlpha(0),
89 fYProj(0),
90 fYPrime(0),
91 fIndex(0)
92{
93 // ctor for an AliESDTrdTracklet
94
95 for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++)
96 fSubChannel[zch] = 0;
97}
98
52c19022 99AliTRDtrackletGTU::AliTRDtrackletGTU(const AliTRDtrackletGTU& tracklet) :
100 AliTRDtrackletBase(tracklet),
101 fGtuParam(AliTRDgtuParam::Instance()),
5f006bd7 102 fTracklet(tracklet.fTracklet),
44eafcf2 103 fTrackletESD(tracklet.fTrackletESD),
059f00c5 104 fMCMtrackletIndex(tracklet.fMCMtrackletIndex),
52c19022 105 fAssignedZ(tracklet.fAssignedZ),
106 fAlpha(tracklet.fAlpha),
107 fYProj(tracklet.fYProj),
5f006bd7 108 fYPrime(tracklet.fYPrime),
52c19022 109 fIndex(tracklet.fIndex)
110{
111 // copy ctor
112
5f006bd7 113 for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++)
52c19022 114 fSubChannel[zch] = tracklet.fSubChannel[zch];
115}
116
117AliTRDtrackletGTU& AliTRDtrackletGTU::operator=(const AliTRDtrackletGTU &rhs)
118{
36dc3337 119 // assignment operator
120
52c19022 121 if (&rhs != this) {
122 fTracklet = rhs.fTracklet;
44eafcf2 123 fTrackletESD = rhs.fTrackletESD;
059f00c5 124 fMCMtrackletIndex = rhs.fMCMtrackletIndex;
5f006bd7 125 for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++)
52c19022 126 fSubChannel[zch] = rhs.fSubChannel[zch];
127 fIndex = rhs.fIndex;
128 fYPrime = rhs.fYPrime;
129 fYProj = rhs.fYProj;
130 fAlpha = rhs.fAlpha;
131 fAssignedZ = rhs.fAssignedZ;
132 }
5f006bd7 133
52c19022 134 return *this;
135}
136
5f006bd7 137AliTRDtrackletGTU::~AliTRDtrackletGTU()
52c19022 138{
139 // dtor
52c19022 140}
141
5f006bd7 142void AliTRDtrackletGTU::SetSubChannel(Int_t zch, Int_t subch)
52c19022 143{
144 // set the subchannel in the given z-channel
145 fAssignedZ = kTRUE;
146 fSubChannel[zch] = subch;
147}
148
36dc3337 149Int_t AliTRDtrackletGTU::GetSubChannel(Int_t zch) const
52c19022 150{
151 // get the subchannel in the given z-channel
152 return fSubChannel[zch];
153}
154
4cc89512 155Int_t AliTRDtrackletGTU::GetLabel() const
156{
36dc3337 157 // get the MC label for the tracklet, -1 if none
158
44eafcf2 159 if (fTrackletESD)
160 return fTrackletESD->GetLabel();
161 else if ( fTracklet->IsA() == TClass::GetClass("AliTRDtrackletMCM"))
162 return ((AliTRDtrackletMCM*) fTracklet)->GetLabel();
163 else
164 return -1;
4cc89512 165}
166
52c19022 167/*
5f006bd7 168Float_t AliTRDtrackletGTU::GetPhysX(Int_t layer)
52c19022 169{
170 // get the x-position (in the local system) assuming the tracklet is in the given layer
171 return fGtuParam->GetGeo()->GetTime0(layer);
172}
173
5f006bd7 174Float_t AliTRDtrackletGTU::GetPhysY()
52c19022 175{
5f006bd7 176 //
177 return GetYbin() * 0.0160;
52c19022 178}
179
5f006bd7 180Float_t AliTRDtrackletGTU::GetPhysAlpha()
52c19022 181{
182 return GetAlpha() * 0.01; // wrong factor!
183}
184
5f006bd7 185Float_t AliTRDtrackletGTU::GetPhysZ(Int_t stack, Int_t layer)
52c19022 186{
187 return fGtuParam->GetGeo()->GetPadPlane(layer, stack)->GetRowPos(GetZbin()); // not the middle of a pad!
188}
189*/