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()
62 // Default constructor
67 //_____________________________________________________________________________
68 AliTRDpadPlane::AliTRDpadPlane(Int_t plane, Int_t chamber)
96 //_____________________________________________________________________________
97 AliTRDpadPlane::AliTRDpadPlane(const AliTRDpadPlane &p)
103 ,fLengthRim(p.fLengthRim)
104 ,fWidthRim(p.fLengthRim)
105 ,fLengthOPad(p.fLengthOPad)
106 ,fWidthOPad(p.fWidthOPad)
107 ,fLengthIPad(p.fLengthIPad)
108 ,fWidthIPad(p.fWidthIPad)
109 ,fRowSpacing(p.fRowSpacing)
110 ,fColSpacing(p.fColSpacing)
113 ,fTiltingAngle(p.fTiltingAngle)
114 ,fTiltingTan(p.fTiltingTan)
117 ,fPadRowSMOffset(p.fPadRowSMOffset)
120 // AliTRDpadPlane copy constructor
125 if (((AliTRDpadPlane &) p).fPadRow) {
126 delete [] ((AliTRDpadPlane &) p).fPadRow;
128 ((AliTRDpadPlane &) p).fPadRow = new Double_t[fNrows];
129 for (iBin = 0; iBin < fNrows; iBin++) {
130 ((AliTRDpadPlane &) p).fPadRow[iBin] = fPadRow[iBin];
133 if (((AliTRDpadPlane &) p).fPadCol) {
134 delete [] ((AliTRDpadPlane &) p).fPadCol;
136 ((AliTRDpadPlane &) p).fPadCol = new Double_t[fNrows];
137 for (iBin = 0; iBin < fNrows; iBin++) {
138 ((AliTRDpadPlane &) p).fPadCol[iBin] = fPadCol[iBin];
143 //_____________________________________________________________________________
144 AliTRDpadPlane::~AliTRDpadPlane()
147 // AliTRDpadPlane destructor
162 //_____________________________________________________________________________
163 AliTRDpadPlane &AliTRDpadPlane::operator=(const AliTRDpadPlane &p)
166 // Assignment operator
170 ((AliTRDpadPlane &) p).Copy(*this);
177 //_____________________________________________________________________________
178 void AliTRDpadPlane::Copy(TObject &p) const
186 ((AliTRDpadPlane &) p).fPla = fPla;
187 ((AliTRDpadPlane &) p).fCha = fCha;
189 ((AliTRDpadPlane &) p).fLength = fLength;
190 ((AliTRDpadPlane &) p).fWidth = fWidth;
191 ((AliTRDpadPlane &) p).fLengthRim = fLengthRim;
192 ((AliTRDpadPlane &) p).fWidthRim = fWidthRim;
193 ((AliTRDpadPlane &) p).fLengthOPad = fLengthOPad;
194 ((AliTRDpadPlane &) p).fWidthOPad = fWidthOPad;
195 ((AliTRDpadPlane &) p).fLengthIPad = fLengthIPad;
196 ((AliTRDpadPlane &) p).fWidthIPad = fWidthIPad;
198 ((AliTRDpadPlane &) p).fRowSpacing = fRowSpacing;
199 ((AliTRDpadPlane &) p).fColSpacing = fColSpacing;
201 ((AliTRDpadPlane &) p).fNrows = fNrows;
202 ((AliTRDpadPlane &) p).fNcols = fNcols;
204 ((AliTRDpadPlane &) p).fTiltingAngle = fTiltingAngle;
205 ((AliTRDpadPlane &) p).fTiltingTan = fTiltingTan;
207 ((AliTRDpadPlane &) p).fPadRowSMOffset = fPadRowSMOffset;
209 if (((AliTRDpadPlane &) p).fPadRow) {
210 delete [] ((AliTRDpadPlane &) p).fPadRow;
212 ((AliTRDpadPlane &) p).fPadRow = new Double_t[fNrows];
213 for (iBin = 0; iBin < fNrows; iBin++) {
214 ((AliTRDpadPlane &) p).fPadRow[iBin] = fPadRow[iBin];
217 if (((AliTRDpadPlane &) p).fPadCol) {
218 delete [] ((AliTRDpadPlane &) p).fPadCol;
220 ((AliTRDpadPlane &) p).fPadCol = new Double_t[fNrows];
221 for (iBin = 0; iBin < fNrows; iBin++) {
222 ((AliTRDpadPlane &) p).fPadCol[iBin] = fPadCol[iBin];
229 //_____________________________________________________________________________
230 Int_t AliTRDpadPlane::GetPadRowNumber(Double_t z) const
233 // Finds the pad row number for a given z-position in local supermodule system
241 if ((z > GetRow0() ) ||
251 while (nabove - nbelow > 1) {
252 middle = (nabove + nbelow) / 2;
253 if (z == (fPadRow[middle-1] + fPadRowSMOffset)) {
256 if (z > (fPadRow[middle-1] + fPadRowSMOffset)) {
271 //_____________________________________________________________________________
272 Int_t AliTRDpadPlane::GetPadRowNumberROC(Double_t z) const
275 // Finds the pad row number for a given z-position in local ROC system
283 if ((z > GetRow0ROC() ) ||
284 (z < GetRowEndROC())) {
293 while (nabove - nbelow > 1) {
294 middle = (nabove + nbelow) / 2;
295 if (z == fPadRow[middle-1]) {
298 if (z > fPadRow[middle-1]) {
313 //_____________________________________________________________________________
314 Int_t AliTRDpadPlane::GetPadColNumber(Double_t rphi) const
317 // Finds the pad column number for a given global rphi-position
325 if ((rphi > GetCol0() ) ||
326 (rphi < GetColEnd())) {
335 while (nabove - nbelow > 1) {
336 middle = (nabove + nbelow) / 2;
337 if (rphi == fPadCol[middle-1]) {
340 if (rphi > fPadCol[middle-1]) {