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"
34 #include "AliTRDgeometry.h"
36 ClassImp(AliTRDpadPlane)
38 //_____________________________________________________________________________
39 AliTRDpadPlane::AliTRDpadPlane()
63 // Default constructor
68 //_____________________________________________________________________________
69 AliTRDpadPlane::AliTRDpadPlane(Int_t layer, Int_t stack)
98 //_____________________________________________________________________________
99 AliTRDpadPlane::AliTRDpadPlane(const AliTRDpadPlane &p)
105 ,fLengthRim(p.fLengthRim)
106 ,fWidthRim(p.fLengthRim)
107 ,fLengthOPad(p.fLengthOPad)
108 ,fWidthOPad(p.fWidthOPad)
109 ,fLengthIPad(p.fLengthIPad)
110 ,fWidthIPad(p.fWidthIPad)
111 ,fRowSpacing(p.fRowSpacing)
112 ,fColSpacing(p.fColSpacing)
115 ,fTiltingAngle(p.fTiltingAngle)
116 ,fTiltingTan(p.fTiltingTan)
119 ,fPadRowSMOffset(p.fPadRowSMOffset)
120 ,fAnodeWireOffset(p.fAnodeWireOffset)
123 // AliTRDpadPlane copy constructor
128 if (((AliTRDpadPlane &) p).fPadRow) {
129 delete [] ((AliTRDpadPlane &) p).fPadRow;
131 ((AliTRDpadPlane &) p).fPadRow = new Double_t[fNrows];
132 for (iBin = 0; iBin < fNrows; iBin++) {
133 ((AliTRDpadPlane &) p).fPadRow[iBin] = fPadRow[iBin];
136 if (((AliTRDpadPlane &) p).fPadCol) {
137 delete [] ((AliTRDpadPlane &) p).fPadCol;
139 ((AliTRDpadPlane &) p).fPadCol = new Double_t[fNrows];
140 for (iBin = 0; iBin < fNrows; iBin++) {
141 ((AliTRDpadPlane &) p).fPadCol[iBin] = fPadCol[iBin];
146 //_____________________________________________________________________________
147 AliTRDpadPlane::~AliTRDpadPlane()
150 // AliTRDpadPlane destructor
165 //_____________________________________________________________________________
166 AliTRDpadPlane &AliTRDpadPlane::operator=(const AliTRDpadPlane &p)
169 // Assignment operator
173 ((AliTRDpadPlane &) p).Copy(*this);
180 //_____________________________________________________________________________
181 void AliTRDpadPlane::Copy(TObject &p) const
189 ((AliTRDpadPlane &) p).fLayer = fLayer;
190 ((AliTRDpadPlane &) p).fStack = fStack;
192 ((AliTRDpadPlane &) p).fLength = fLength;
193 ((AliTRDpadPlane &) p).fWidth = fWidth;
194 ((AliTRDpadPlane &) p).fLengthRim = fLengthRim;
195 ((AliTRDpadPlane &) p).fWidthRim = fWidthRim;
196 ((AliTRDpadPlane &) p).fLengthOPad = fLengthOPad;
197 ((AliTRDpadPlane &) p).fWidthOPad = fWidthOPad;
198 ((AliTRDpadPlane &) p).fLengthIPad = fLengthIPad;
199 ((AliTRDpadPlane &) p).fWidthIPad = fWidthIPad;
201 ((AliTRDpadPlane &) p).fRowSpacing = fRowSpacing;
202 ((AliTRDpadPlane &) p).fColSpacing = fColSpacing;
204 ((AliTRDpadPlane &) p).fNrows = fNrows;
205 ((AliTRDpadPlane &) p).fNcols = fNcols;
207 ((AliTRDpadPlane &) p).fTiltingAngle = fTiltingAngle;
208 ((AliTRDpadPlane &) p).fTiltingTan = fTiltingTan;
210 ((AliTRDpadPlane &) p).fPadRowSMOffset = fPadRowSMOffset;
211 ((AliTRDpadPlane &) p).fAnodeWireOffset = fAnodeWireOffset;
213 if (((AliTRDpadPlane &) p).fPadRow) {
214 delete [] ((AliTRDpadPlane &) p).fPadRow;
216 ((AliTRDpadPlane &) p).fPadRow = new Double_t[fNrows];
217 for (iBin = 0; iBin < fNrows; iBin++) {
218 ((AliTRDpadPlane &) p).fPadRow[iBin] = fPadRow[iBin];
221 if (((AliTRDpadPlane &) p).fPadCol) {
222 delete [] ((AliTRDpadPlane &) p).fPadCol;
224 ((AliTRDpadPlane &) p).fPadCol = new Double_t[fNrows];
225 for (iBin = 0; iBin < fNrows; iBin++) {
226 ((AliTRDpadPlane &) p).fPadCol[iBin] = fPadCol[iBin];
233 //_____________________________________________________________________________
234 void AliTRDpadPlane::SetTiltingAngle(Double_t t)
237 // Set the tilting angle of the pads
241 fTiltingTan = TMath::Tan(TMath::Pi()/180.0 * fTiltingAngle);
245 //_____________________________________________________________________________
246 Int_t AliTRDpadPlane::GetPadRowNumber(Double_t z) const
249 // Finds the pad row number for a given z-position in local supermodule system
257 if ((z > GetRow0() ) ||
267 while (nabove - nbelow > 1) {
268 middle = (nabove + nbelow) / 2;
269 if (z == (fPadRow[middle-1] + fPadRowSMOffset)) {
272 if (z > (fPadRow[middle-1] + fPadRowSMOffset)) {
287 //_____________________________________________________________________________
288 Int_t AliTRDpadPlane::GetPadRowNumberROC(Double_t z) const
291 // Finds the pad row number for a given z-position in local ROC system
299 if ((z > GetRow0ROC() ) ||
300 (z < GetRowEndROC())) {
309 while (nabove - nbelow > 1) {
310 middle = (nabove + nbelow) / 2;
311 if (z == fPadRow[middle-1]) {
314 if (z > fPadRow[middle-1]) {
329 //_____________________________________________________________________________
330 Int_t AliTRDpadPlane::GetPadColNumber(Double_t rphi) const
333 // Finds the pad column number for a given rphi-position
341 if ((rphi < GetCol0() ) ||
342 (rphi > GetColEnd())) {
351 while (nabove - nbelow > 1) {
352 middle = (nabove + nbelow) / 2;
353 if (rphi == fPadCol[middle]) {
356 if (rphi > fPadCol[middle]) {