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 ///////////////////////////////////////////////////////////////////////////////
31 #include "AliTRDpadPlane.h"
32 #include "AliTRDgeometry.h"
34 ClassImp(AliTRDpadPlane)
36 //_____________________________________________________________________________
37 AliTRDpadPlane::AliTRDpadPlane()
60 // Default constructor
65 //_____________________________________________________________________________
66 AliTRDpadPlane::AliTRDpadPlane(Int_t p, Int_t c)
89 // Constructor that initializes a given pad plane type
92 fGeo = new AliTRDgeometry();
106 // The pad plane parameter
119 fTiltingAngle = -2.0;
130 fTiltingAngle = -2.0;
167 fTiltingAngle = -2.0;
178 fTiltingAngle = -2.0;
215 fTiltingAngle = -2.0;
226 fTiltingAngle = -2.0;
256 // Store tilting angle as tangens
258 fTiltingTan = TMath::Tan(TMath::Pi()/180.0 * fTiltingAngle);
261 // The positions of the borders of the pads
265 fPadRow = new Double_t[fNrows];
266 Double_t row = fGeo->GetChamberLength(p,0)
267 + fGeo->GetChamberLength(p,1)
268 + fGeo->GetChamberLength(p,2) / 2.0
271 for (Int_t ic = 0; ic < c; ic++) {
272 row -= fGeo->GetChamberLength(p,ic);
274 for (Int_t ir = 0; ir < fNrows; ir++) {
287 fPadCol = new Double_t[fNcols];
288 Double_t col = fGeo->GetChamberWidth(p) / 2.0
291 for (Int_t ic = 0; ic < fNcols; ic++) {
304 //_____________________________________________________________________________
305 AliTRDpadPlane::AliTRDpadPlane(const AliTRDpadPlane &p)
312 ,fLengthRim(p.fLengthRim)
313 ,fWidthRim(p.fLengthRim)
314 ,fLengthOPad(p.fLengthOPad)
315 ,fWidthOPad(p.fWidthOPad)
316 ,fLengthIPad(p.fLengthIPad)
317 ,fWidthIPad(p.fWidthIPad)
318 ,fRowSpacing(p.fRowSpacing)
319 ,fColSpacing(p.fColSpacing)
322 ,fTiltingAngle(p.fTiltingAngle)
323 ,fTiltingTan(p.fTiltingTan)
328 // AliTRDpadPlane copy constructor
333 if (((AliTRDpadPlane &) p).fPadRow) {
334 delete [] ((AliTRDpadPlane &) p).fPadRow;
336 ((AliTRDpadPlane &) p).fPadRow = new Double_t[fNrows];
337 for (iBin = 0; iBin < fNrows; iBin++) {
338 ((AliTRDpadPlane &) p).fPadRow[iBin] = fPadRow[iBin];
341 if (((AliTRDpadPlane &) p).fPadCol) {
342 delete [] ((AliTRDpadPlane &) p).fPadCol;
344 ((AliTRDpadPlane &) p).fPadCol = new Double_t[fNrows];
345 for (iBin = 0; iBin < fNrows; iBin++) {
346 ((AliTRDpadPlane &) p).fPadCol[iBin] = fPadCol[iBin];
351 //_____________________________________________________________________________
352 AliTRDpadPlane::~AliTRDpadPlane()
355 // AliTRDpadPlane destructor
375 //_____________________________________________________________________________
376 AliTRDpadPlane &AliTRDpadPlane::operator=(const AliTRDpadPlane &p)
379 // Assignment operator
383 ((AliTRDpadPlane &) p).Copy(*this);
390 //_____________________________________________________________________________
391 void AliTRDpadPlane::Copy(TObject &p) const
399 ((AliTRDpadPlane &) p).fGeo = 0;
401 ((AliTRDpadPlane &) p).fPla = fPla;
402 ((AliTRDpadPlane &) p).fCha = fCha;
404 ((AliTRDpadPlane &) p).fLength = fLength;
405 ((AliTRDpadPlane &) p).fWidth = fWidth;
406 ((AliTRDpadPlane &) p).fLengthRim = fLengthRim;
407 ((AliTRDpadPlane &) p).fWidthRim = fWidthRim;
408 ((AliTRDpadPlane &) p).fLengthOPad = fLengthOPad;
409 ((AliTRDpadPlane &) p).fWidthOPad = fWidthOPad;
410 ((AliTRDpadPlane &) p).fLengthIPad = fLengthIPad;
411 ((AliTRDpadPlane &) p).fWidthIPad = fWidthIPad;
413 ((AliTRDpadPlane &) p).fRowSpacing = fRowSpacing;
414 ((AliTRDpadPlane &) p).fColSpacing = fColSpacing;
416 ((AliTRDpadPlane &) p).fNrows = fNrows;
417 ((AliTRDpadPlane &) p).fNcols = fNcols;
419 ((AliTRDpadPlane &) p).fTiltingAngle = fTiltingAngle;
420 ((AliTRDpadPlane &) p).fTiltingTan = fTiltingTan;
422 if (((AliTRDpadPlane &) p).fPadRow) {
423 delete [] ((AliTRDpadPlane &) p).fPadRow;
425 ((AliTRDpadPlane &) p).fPadRow = new Double_t[fNrows];
426 for (iBin = 0; iBin < fNrows; iBin++) {
427 ((AliTRDpadPlane &) p).fPadRow[iBin] = fPadRow[iBin];
430 if (((AliTRDpadPlane &) p).fPadCol) {
431 delete [] ((AliTRDpadPlane &) p).fPadCol;
433 ((AliTRDpadPlane &) p).fPadCol = new Double_t[fNrows];
434 for (iBin = 0; iBin < fNrows; iBin++) {
435 ((AliTRDpadPlane &) p).fPadCol[iBin] = fPadCol[iBin];
442 //_____________________________________________________________________________
443 Int_t AliTRDpadPlane::GetPadRowNumber(Double_t z) const
446 // Finds the pad row number for a given global z-position
454 if ((z > GetRow0() ) ||
464 while (nabove - nbelow > 1) {
465 middle = (nabove + nbelow) / 2;
466 if (z == fPadRow[middle-1]) {
469 if (z > fPadRow[middle-1]) {
484 //_____________________________________________________________________________
485 Int_t AliTRDpadPlane::GetPadColNumber(Double_t rphi
486 , Double_t /*rowOffset*/) const
489 // Finds the pad column number for a given global rphi-position
497 if ((rphi > GetCol0() ) ||
498 (rphi < GetColEnd())) {
507 while (nabove - nbelow > 1) {
508 middle = (nabove + nbelow) / 2;
509 if (rphi == fPadCol[middle-1]) {
512 if (rphi > fPadCol[middle-1]) {