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. //
27 ///////////////////////////////////////////////////////////////////////////////
29 #include "AliTRDpadPlane.h"
30 #include "AliTRDgeometry.h"
32 ClassImp(AliTRDpadPlane)
34 //_____________________________________________________________________________
35 AliTRDpadPlane::AliTRDpadPlane()
58 // Default constructor
63 //_____________________________________________________________________________
64 AliTRDpadPlane::AliTRDpadPlane(Int_t p, Int_t c)
87 // Constructor that initializes a given pad plane type
90 fGeo = new AliTRDgeometry();
104 // The pad plane parameter
117 fTiltingAngle = -2.0;
128 fTiltingAngle = -2.0;
165 fTiltingAngle = -2.0;
176 fTiltingAngle = -2.0;
213 fTiltingAngle = -2.0;
224 fTiltingAngle = -2.0;
254 // Store tilting angle as tangens
256 fTiltingTan = TMath::Tan(TMath::Pi()/180.0 * fTiltingAngle);
259 // The positions of the borders of the pads
263 fPadRow = new Double_t[fNrows];
264 Double_t row = fGeo->GetChamberLength(p,0)
265 + fGeo->GetChamberLength(p,1)
266 + fGeo->GetChamberLength(p,2) / 2.0
269 for (Int_t ic = 0; ic < c; ic++) {
270 row -= fGeo->GetChamberLength(p,ic);
272 for (Int_t ir = 0; ir < fNrows; ir++) {
285 fPadCol = new Double_t[fNcols];
286 Double_t col = fGeo->GetChamberWidth(p) / 2.0
289 for (Int_t ic = 0; ic < fNcols; ic++) {
302 //_____________________________________________________________________________
303 AliTRDpadPlane::AliTRDpadPlane(const AliTRDpadPlane &p)
310 ,fLengthRim(p.fLengthRim)
311 ,fWidthRim(p.fLengthRim)
312 ,fLengthOPad(p.fLengthOPad)
313 ,fWidthOPad(p.fWidthOPad)
314 ,fLengthIPad(p.fLengthIPad)
315 ,fWidthIPad(p.fWidthIPad)
316 ,fRowSpacing(p.fRowSpacing)
317 ,fColSpacing(p.fColSpacing)
320 ,fTiltingAngle(p.fTiltingAngle)
321 ,fTiltingTan(p.fTiltingTan)
326 // AliTRDpadPlane copy constructor
331 if (((AliTRDpadPlane &) p).fPadRow) {
332 delete [] ((AliTRDpadPlane &) p).fPadRow;
334 ((AliTRDpadPlane &) p).fPadRow = new Double_t[fNrows];
335 for (iBin = 0; iBin < fNrows; iBin++) {
336 ((AliTRDpadPlane &) p).fPadRow[iBin] = fPadRow[iBin];
339 if (((AliTRDpadPlane &) p).fPadCol) {
340 delete [] ((AliTRDpadPlane &) p).fPadCol;
342 ((AliTRDpadPlane &) p).fPadCol = new Double_t[fNrows];
343 for (iBin = 0; iBin < fNrows; iBin++) {
344 ((AliTRDpadPlane &) p).fPadCol[iBin] = fPadCol[iBin];
349 //_____________________________________________________________________________
350 AliTRDpadPlane::~AliTRDpadPlane()
353 // AliTRDpadPlane destructor
373 //_____________________________________________________________________________
374 AliTRDpadPlane &AliTRDpadPlane::operator=(const AliTRDpadPlane &p)
377 // Assignment operator
381 ((AliTRDpadPlane &) p).Copy(*this);
388 //_____________________________________________________________________________
389 void AliTRDpadPlane::Copy(TObject &p) const
397 ((AliTRDpadPlane &) p).fGeo = 0;
399 ((AliTRDpadPlane &) p).fPla = fPla;
400 ((AliTRDpadPlane &) p).fCha = fCha;
402 ((AliTRDpadPlane &) p).fLength = fLength;
403 ((AliTRDpadPlane &) p).fWidth = fWidth;
404 ((AliTRDpadPlane &) p).fLengthRim = fLengthRim;
405 ((AliTRDpadPlane &) p).fWidthRim = fWidthRim;
406 ((AliTRDpadPlane &) p).fLengthOPad = fLengthOPad;
407 ((AliTRDpadPlane &) p).fWidthOPad = fWidthOPad;
408 ((AliTRDpadPlane &) p).fLengthIPad = fLengthIPad;
409 ((AliTRDpadPlane &) p).fWidthIPad = fWidthIPad;
411 ((AliTRDpadPlane &) p).fRowSpacing = fRowSpacing;
412 ((AliTRDpadPlane &) p).fColSpacing = fColSpacing;
414 ((AliTRDpadPlane &) p).fNrows = fNrows;
415 ((AliTRDpadPlane &) p).fNcols = fNcols;
417 ((AliTRDpadPlane &) p).fTiltingAngle = fTiltingAngle;
418 ((AliTRDpadPlane &) p).fTiltingTan = fTiltingTan;
420 if (((AliTRDpadPlane &) p).fPadRow) {
421 delete [] ((AliTRDpadPlane &) p).fPadRow;
423 ((AliTRDpadPlane &) p).fPadRow = new Double_t[fNrows];
424 for (iBin = 0; iBin < fNrows; iBin++) {
425 ((AliTRDpadPlane &) p).fPadRow[iBin] = fPadRow[iBin];
428 if (((AliTRDpadPlane &) p).fPadCol) {
429 delete [] ((AliTRDpadPlane &) p).fPadCol;
431 ((AliTRDpadPlane &) p).fPadCol = new Double_t[fNrows];
432 for (iBin = 0; iBin < fNrows; iBin++) {
433 ((AliTRDpadPlane &) p).fPadCol[iBin] = fPadCol[iBin];
440 //_____________________________________________________________________________
441 Int_t AliTRDpadPlane::GetPadRowNumber(Double_t z) const
444 // Finds the pad row number for a given global z-position
452 if ((z > GetRow0() ) ||
462 while (nabove - nbelow > 1) {
463 middle = (nabove + nbelow) / 2;
464 if (z == fPadRow[middle-1]) {
467 if (z > fPadRow[middle-1]) {
482 //_____________________________________________________________________________
483 Int_t AliTRDpadPlane::GetPadColNumber(Double_t rphi
484 , Double_t /*rowOffset*/) const
487 // Finds the pad column number for a given global rphi-position
495 if ((rphi > GetCol0() ) ||
496 (rphi < GetColEnd())) {
505 while (nabove - nbelow > 1) {
506 middle = (nabove + nbelow) / 2;
507 if (rphi == fPadCol[middle-1]) {
510 if (rphi > fPadCol[middle-1]) {