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 p, Int_t c)
91 // Constructor that initializes a given pad plane type
94 fGeo = new AliTRDgeometry();
108 // The pad plane parameter
121 fTiltingAngle = -2.0;
132 fTiltingAngle = -2.0;
169 fTiltingAngle = -2.0;
180 fTiltingAngle = -2.0;
217 fTiltingAngle = -2.0;
228 fTiltingAngle = -2.0;
258 // Store tilting angle as tangens
260 fTiltingTan = TMath::Tan(TMath::Pi()/180.0 * fTiltingAngle);
263 // The positions of the borders of the pads
267 fPadRow = new Double_t[fNrows];
268 Double_t row = fGeo->GetChamberLength(p,0)
269 + fGeo->GetChamberLength(p,1)
270 + fGeo->GetChamberLength(p,2) / 2.0
273 for (Int_t ic = 0; ic < c; ic++) {
274 row -= fGeo->GetChamberLength(p,ic);
276 for (Int_t ir = 0; ir < fNrows; ir++) {
289 fPadCol = new Double_t[fNcols];
290 Double_t col = fGeo->GetChamberWidth(p) / 2.0
293 for (Int_t ic = 0; ic < fNcols; ic++) {
306 //_____________________________________________________________________________
307 AliTRDpadPlane::AliTRDpadPlane(const AliTRDpadPlane &p)
314 ,fLengthRim(p.fLengthRim)
315 ,fWidthRim(p.fLengthRim)
316 ,fLengthOPad(p.fLengthOPad)
317 ,fWidthOPad(p.fWidthOPad)
318 ,fLengthIPad(p.fLengthIPad)
319 ,fWidthIPad(p.fWidthIPad)
320 ,fRowSpacing(p.fRowSpacing)
321 ,fColSpacing(p.fColSpacing)
324 ,fTiltingAngle(p.fTiltingAngle)
325 ,fTiltingTan(p.fTiltingTan)
330 // AliTRDpadPlane copy constructor
335 if (((AliTRDpadPlane &) p).fPadRow) {
336 delete [] ((AliTRDpadPlane &) p).fPadRow;
338 ((AliTRDpadPlane &) p).fPadRow = new Double_t[fNrows];
339 for (iBin = 0; iBin < fNrows; iBin++) {
340 ((AliTRDpadPlane &) p).fPadRow[iBin] = fPadRow[iBin];
343 if (((AliTRDpadPlane &) p).fPadCol) {
344 delete [] ((AliTRDpadPlane &) p).fPadCol;
346 ((AliTRDpadPlane &) p).fPadCol = new Double_t[fNrows];
347 for (iBin = 0; iBin < fNrows; iBin++) {
348 ((AliTRDpadPlane &) p).fPadCol[iBin] = fPadCol[iBin];
353 //_____________________________________________________________________________
354 AliTRDpadPlane::~AliTRDpadPlane()
357 // AliTRDpadPlane destructor
377 //_____________________________________________________________________________
378 AliTRDpadPlane &AliTRDpadPlane::operator=(const AliTRDpadPlane &p)
381 // Assignment operator
385 ((AliTRDpadPlane &) p).Copy(*this);
392 //_____________________________________________________________________________
393 void AliTRDpadPlane::Copy(TObject &p) const
401 ((AliTRDpadPlane &) p).fGeo = 0;
403 ((AliTRDpadPlane &) p).fPla = fPla;
404 ((AliTRDpadPlane &) p).fCha = fCha;
406 ((AliTRDpadPlane &) p).fLength = fLength;
407 ((AliTRDpadPlane &) p).fWidth = fWidth;
408 ((AliTRDpadPlane &) p).fLengthRim = fLengthRim;
409 ((AliTRDpadPlane &) p).fWidthRim = fWidthRim;
410 ((AliTRDpadPlane &) p).fLengthOPad = fLengthOPad;
411 ((AliTRDpadPlane &) p).fWidthOPad = fWidthOPad;
412 ((AliTRDpadPlane &) p).fLengthIPad = fLengthIPad;
413 ((AliTRDpadPlane &) p).fWidthIPad = fWidthIPad;
415 ((AliTRDpadPlane &) p).fRowSpacing = fRowSpacing;
416 ((AliTRDpadPlane &) p).fColSpacing = fColSpacing;
418 ((AliTRDpadPlane &) p).fNrows = fNrows;
419 ((AliTRDpadPlane &) p).fNcols = fNcols;
421 ((AliTRDpadPlane &) p).fTiltingAngle = fTiltingAngle;
422 ((AliTRDpadPlane &) p).fTiltingTan = fTiltingTan;
424 if (((AliTRDpadPlane &) p).fPadRow) {
425 delete [] ((AliTRDpadPlane &) p).fPadRow;
427 ((AliTRDpadPlane &) p).fPadRow = new Double_t[fNrows];
428 for (iBin = 0; iBin < fNrows; iBin++) {
429 ((AliTRDpadPlane &) p).fPadRow[iBin] = fPadRow[iBin];
432 if (((AliTRDpadPlane &) p).fPadCol) {
433 delete [] ((AliTRDpadPlane &) p).fPadCol;
435 ((AliTRDpadPlane &) p).fPadCol = new Double_t[fNrows];
436 for (iBin = 0; iBin < fNrows; iBin++) {
437 ((AliTRDpadPlane &) p).fPadCol[iBin] = fPadCol[iBin];
444 //_____________________________________________________________________________
445 Int_t AliTRDpadPlane::GetPadRowNumber(Double_t z) const
448 // Finds the pad row number for a given global z-position
456 if ((z > GetRow0() ) ||
466 while (nabove - nbelow > 1) {
467 middle = (nabove + nbelow) / 2;
468 if (z == fPadRow[middle-1]) {
471 if (z > fPadRow[middle-1]) {
486 //_____________________________________________________________________________
487 Int_t AliTRDpadPlane::GetPadColNumber(Double_t rphi
488 , Double_t /*rowOffset*/) const
491 // Finds the pad column number for a given global rphi-position
499 if ((rphi > GetCol0() ) ||
500 (rphi < GetColEnd())) {
509 while (nabove - nbelow > 1) {
510 middle = (nabove + nbelow) / 2;
511 if (rphi == fPadCol[middle-1]) {
514 if (rphi > fPadCol[middle-1]) {