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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // Describes a pad plane of a TRD ROC //
22 // Contains the information on pad postions, pad dimensions, //
23 // tilting angle, etc. //
24 // It also provides methods to identify the current pad number from //
25 // global coordinates. //
26 // The numbering and coordinates should follow the official convention //
27 // (see David Emschermanns note on TRD convention //
29 ///////////////////////////////////////////////////////////////////////////////
33 #include "AliTRDpadPlane.h"
35 ClassImp(AliTRDpadPlane)
37 //_____________________________________________________________________________
38 AliTRDpadPlane::AliTRDpadPlane()
62 // Default constructor
67 //_____________________________________________________________________________
68 AliTRDpadPlane::AliTRDpadPlane(Int_t layer, Int_t stack)
97 //_____________________________________________________________________________
98 AliTRDpadPlane::AliTRDpadPlane(const AliTRDpadPlane &p)
104 ,fLengthRim(p.fLengthRim)
105 ,fWidthRim(p.fLengthRim)
106 ,fLengthOPad(p.fLengthOPad)
107 ,fWidthOPad(p.fWidthOPad)
108 ,fLengthIPad(p.fLengthIPad)
109 ,fWidthIPad(p.fWidthIPad)
110 ,fRowSpacing(p.fRowSpacing)
111 ,fColSpacing(p.fColSpacing)
114 ,fTiltingAngle(p.fTiltingAngle)
115 ,fTiltingTan(p.fTiltingTan)
118 ,fPadRowSMOffset(p.fPadRowSMOffset)
119 ,fAnodeWireOffset(p.fAnodeWireOffset)
122 // AliTRDpadPlane copy constructor
127 fPadRow = new Double_t[fNrows];
128 for (iBin = 0; iBin < fNrows; iBin++) {
129 fPadRow[iBin] = ((AliTRDpadPlane &) p).fPadRow[iBin];
132 fPadCol = new Double_t[fNrows];
133 for (iBin = 0; iBin < fNrows; iBin++) {
134 fPadCol[iBin] = ((AliTRDpadPlane &) p).fPadCol[iBin];
139 //_____________________________________________________________________________
140 AliTRDpadPlane::~AliTRDpadPlane()
143 // AliTRDpadPlane destructor
158 //_____________________________________________________________________________
159 AliTRDpadPlane &AliTRDpadPlane::operator=(const AliTRDpadPlane &p)
162 // Assignment operator
166 ((AliTRDpadPlane &) p).Copy(*this);
173 //_____________________________________________________________________________
174 void AliTRDpadPlane::Copy(TObject &p) const
182 ((AliTRDpadPlane &) p).fLayer = fLayer;
183 ((AliTRDpadPlane &) p).fStack = fStack;
185 ((AliTRDpadPlane &) p).fLength = fLength;
186 ((AliTRDpadPlane &) p).fWidth = fWidth;
187 ((AliTRDpadPlane &) p).fLengthRim = fLengthRim;
188 ((AliTRDpadPlane &) p).fWidthRim = fWidthRim;
189 ((AliTRDpadPlane &) p).fLengthOPad = fLengthOPad;
190 ((AliTRDpadPlane &) p).fWidthOPad = fWidthOPad;
191 ((AliTRDpadPlane &) p).fLengthIPad = fLengthIPad;
192 ((AliTRDpadPlane &) p).fWidthIPad = fWidthIPad;
194 ((AliTRDpadPlane &) p).fRowSpacing = fRowSpacing;
195 ((AliTRDpadPlane &) p).fColSpacing = fColSpacing;
197 ((AliTRDpadPlane &) p).fNrows = fNrows;
198 ((AliTRDpadPlane &) p).fNcols = fNcols;
200 ((AliTRDpadPlane &) p).fTiltingAngle = fTiltingAngle;
201 ((AliTRDpadPlane &) p).fTiltingTan = fTiltingTan;
203 ((AliTRDpadPlane &) p).fPadRowSMOffset = fPadRowSMOffset;
204 ((AliTRDpadPlane &) p).fAnodeWireOffset = fAnodeWireOffset;
206 if (((AliTRDpadPlane &) p).fPadRow) {
207 delete [] ((AliTRDpadPlane &) p).fPadRow;
209 ((AliTRDpadPlane &) p).fPadRow = new Double_t[fNrows];
210 for (iBin = 0; iBin < fNrows; iBin++) {
211 ((AliTRDpadPlane &) p).fPadRow[iBin] = fPadRow[iBin];
214 if (((AliTRDpadPlane &) p).fPadCol) {
215 delete [] ((AliTRDpadPlane &) p).fPadCol;
217 ((AliTRDpadPlane &) p).fPadCol = new Double_t[fNrows];
218 for (iBin = 0; iBin < fNrows; iBin++) {
219 ((AliTRDpadPlane &) p).fPadCol[iBin] = fPadCol[iBin];
226 //_____________________________________________________________________________
227 void AliTRDpadPlane::SetTiltingAngle(Double_t t)
230 // Set the tilting angle of the pads
234 fTiltingTan = TMath::Tan(TMath::Pi()/180.0 * fTiltingAngle);
238 //_____________________________________________________________________________
239 Int_t AliTRDpadPlane::GetPadRowNumber(Double_t z) const
242 // Finds the pad row number for a given z-position in local supermodule system
250 if ((z > GetRow0() ) ||
260 while (nabove - nbelow > 1) {
261 middle = (nabove + nbelow) / 2;
262 if (z == (fPadRow[middle-1] + fPadRowSMOffset)) {
265 if (z > (fPadRow[middle-1] + fPadRowSMOffset)) {
280 //_____________________________________________________________________________
281 Int_t AliTRDpadPlane::GetPadRowNumberROC(Double_t z) const
284 // Finds the pad row number for a given z-position in local ROC system
292 if ((z > GetRow0ROC() ) ||
293 (z < GetRowEndROC())) {
302 while (nabove - nbelow > 1) {
303 middle = (nabove + nbelow) / 2;
304 if (z == fPadRow[middle-1]) {
307 if (z > fPadRow[middle-1]) {
322 //_____________________________________________________________________________
323 Int_t AliTRDpadPlane::GetPadColNumber(Double_t rphi) const
326 // Finds the pad column number for a given rphi-position
334 if ((rphi < GetCol0() ) ||
335 (rphi > GetColEnd())) {
344 while (nabove - nbelow > 1) {
345 middle = (nabove + nbelow) / 2;
346 if (rphi == fPadCol[middle]) {
349 if (rphi > fPadCol[middle]) {