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