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 p, Int_t c)
93 // Constructor that initializes a given pad plane type
96 fGeo = new AliTRDgeometry();
110 // The pad plane parameter
123 fTiltingAngle = -2.0;
134 fTiltingAngle = -2.0;
171 fTiltingAngle = -2.0;
182 fTiltingAngle = -2.0;
219 fTiltingAngle = -2.0;
230 fTiltingAngle = -2.0;
260 // Store tilting angle as tangens
262 fTiltingTan = TMath::Tan(TMath::Pi()/180.0 * fTiltingAngle);
265 // The positions of the borders of the pads
269 fPadRow = new Double_t[fNrows];
270 Double_t row = fGeo->GetChamberLength(p,c) / 2.0
273 for (Int_t ir = 0; ir < fNrows; ir++) {
286 fPadCol = new Double_t[fNcols];
287 Double_t col = fGeo->GetChamberWidth(p) / 2.0
290 for (Int_t ic = 0; ic < fNcols; ic++) {
300 // Calculate the offset to translate from the local ROC system into
301 // the local supermodule system, which is used for clusters
302 Double_t rowTmp = fGeo->GetChamberLength(p,0)
303 + fGeo->GetChamberLength(p,1)
304 + fGeo->GetChamberLength(p,2) / 2.0;
305 for (Int_t ic = 0; ic < c; ic++) {
306 rowTmp -= fGeo->GetChamberLength(p,ic);
308 fPadRowSMOffset = rowTmp - fGeo->GetChamberLength(p,c)/2.0;
312 //_____________________________________________________________________________
313 AliTRDpadPlane::AliTRDpadPlane(const AliTRDpadPlane &p)
320 ,fLengthRim(p.fLengthRim)
321 ,fWidthRim(p.fLengthRim)
322 ,fLengthOPad(p.fLengthOPad)
323 ,fWidthOPad(p.fWidthOPad)
324 ,fLengthIPad(p.fLengthIPad)
325 ,fWidthIPad(p.fWidthIPad)
326 ,fRowSpacing(p.fRowSpacing)
327 ,fColSpacing(p.fColSpacing)
330 ,fTiltingAngle(p.fTiltingAngle)
331 ,fTiltingTan(p.fTiltingTan)
334 ,fPadRowSMOffset(p.fPadRowSMOffset)
337 // AliTRDpadPlane copy constructor
342 if (((AliTRDpadPlane &) p).fPadRow) {
343 delete [] ((AliTRDpadPlane &) p).fPadRow;
345 ((AliTRDpadPlane &) p).fPadRow = new Double_t[fNrows];
346 for (iBin = 0; iBin < fNrows; iBin++) {
347 ((AliTRDpadPlane &) p).fPadRow[iBin] = fPadRow[iBin];
350 if (((AliTRDpadPlane &) p).fPadCol) {
351 delete [] ((AliTRDpadPlane &) p).fPadCol;
353 ((AliTRDpadPlane &) p).fPadCol = new Double_t[fNrows];
354 for (iBin = 0; iBin < fNrows; iBin++) {
355 ((AliTRDpadPlane &) p).fPadCol[iBin] = fPadCol[iBin];
360 //_____________________________________________________________________________
361 AliTRDpadPlane::~AliTRDpadPlane()
364 // AliTRDpadPlane destructor
384 //_____________________________________________________________________________
385 AliTRDpadPlane &AliTRDpadPlane::operator=(const AliTRDpadPlane &p)
388 // Assignment operator
392 ((AliTRDpadPlane &) p).Copy(*this);
399 //_____________________________________________________________________________
400 void AliTRDpadPlane::Copy(TObject &p) const
408 ((AliTRDpadPlane &) p).fGeo = 0;
410 ((AliTRDpadPlane &) p).fPla = fPla;
411 ((AliTRDpadPlane &) p).fCha = fCha;
413 ((AliTRDpadPlane &) p).fLength = fLength;
414 ((AliTRDpadPlane &) p).fWidth = fWidth;
415 ((AliTRDpadPlane &) p).fLengthRim = fLengthRim;
416 ((AliTRDpadPlane &) p).fWidthRim = fWidthRim;
417 ((AliTRDpadPlane &) p).fLengthOPad = fLengthOPad;
418 ((AliTRDpadPlane &) p).fWidthOPad = fWidthOPad;
419 ((AliTRDpadPlane &) p).fLengthIPad = fLengthIPad;
420 ((AliTRDpadPlane &) p).fWidthIPad = fWidthIPad;
422 ((AliTRDpadPlane &) p).fRowSpacing = fRowSpacing;
423 ((AliTRDpadPlane &) p).fColSpacing = fColSpacing;
425 ((AliTRDpadPlane &) p).fNrows = fNrows;
426 ((AliTRDpadPlane &) p).fNcols = fNcols;
428 ((AliTRDpadPlane &) p).fTiltingAngle = fTiltingAngle;
429 ((AliTRDpadPlane &) p).fTiltingTan = fTiltingTan;
431 ((AliTRDpadPlane &) p).fPadRowSMOffset = fPadRowSMOffset;
433 if (((AliTRDpadPlane &) p).fPadRow) {
434 delete [] ((AliTRDpadPlane &) p).fPadRow;
436 ((AliTRDpadPlane &) p).fPadRow = new Double_t[fNrows];
437 for (iBin = 0; iBin < fNrows; iBin++) {
438 ((AliTRDpadPlane &) p).fPadRow[iBin] = fPadRow[iBin];
441 if (((AliTRDpadPlane &) p).fPadCol) {
442 delete [] ((AliTRDpadPlane &) p).fPadCol;
444 ((AliTRDpadPlane &) p).fPadCol = new Double_t[fNrows];
445 for (iBin = 0; iBin < fNrows; iBin++) {
446 ((AliTRDpadPlane &) p).fPadCol[iBin] = fPadCol[iBin];
453 //_____________________________________________________________________________
454 Int_t AliTRDpadPlane::GetPadRowNumber(Double_t z) const
457 // Finds the pad row number for a given z-position in local supermodule system
465 if ((z > GetRow0() ) ||
475 while (nabove - nbelow > 1) {
476 middle = (nabove + nbelow) / 2;
477 if (z == (fPadRow[middle-1] + fPadRowSMOffset)) {
480 if (z > (fPadRow[middle-1] + fPadRowSMOffset)) {
495 //_____________________________________________________________________________
496 Int_t AliTRDpadPlane::GetPadRowNumberROC(Double_t z) const
499 // Finds the pad row number for a given z-position in local ROC system
507 if ((z > GetRow0ROC() ) ||
508 (z < GetRowEndROC())) {
517 while (nabove - nbelow > 1) {
518 middle = (nabove + nbelow) / 2;
519 if (z == fPadRow[middle-1]) {
522 if (z > fPadRow[middle-1]) {
537 //_____________________________________________________________________________
538 Int_t AliTRDpadPlane::GetPadColNumber(Double_t rphi) const
541 // Finds the pad column number for a given global rphi-position
549 if ((rphi > GetCol0() ) ||
550 (rphi < GetColEnd())) {
559 while (nabove - nbelow > 1) {
560 middle = (nabove + nbelow) / 2;
561 if (rphi == fPadCol[middle-1]) {
564 if (rphi > fPadCol[middle-1]) {