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 // Class containing constant common parameters //
22 // Request an instance with AliTRDCommonParam::Instance() //
23 // Then request the needed values //
25 ///////////////////////////////////////////////////////////////////////////////
27 #include <TObjArray.h>
29 #include "AliTracker.h"
32 #include "AliTRDCommonParam.h"
33 #include "AliTRDpadPlane.h"
36 ClassImp(AliTRDCommonParam)
38 AliTRDCommonParam *AliTRDCommonParam::fgInstance = 0;
39 Bool_t AliTRDCommonParam::fgTerminated = kFALSE;
41 //_ singleton implementation __________________________________________________
42 AliTRDCommonParam* AliTRDCommonParam::Instance()
45 // Singleton implementation
46 // Returns an instance of this class, it is created if neccessary
49 if (fgTerminated != kFALSE) {
53 if (fgInstance == 0) {
54 fgInstance = new AliTRDCommonParam();
61 //_____________________________________________________________________________
62 void AliTRDCommonParam::Terminate()
65 // Singleton implementation
66 // Deletes the instance of this class and sets the terminated flag,
67 // instances cannot be requested anymore
68 // This function can be called several times.
73 if (fgInstance != 0) {
80 //_____________________________________________________________________________
81 AliTRDCommonParam::AliTRDCommonParam()
87 // Default constructor
94 //_____________________________________________________________________________
95 void AliTRDCommonParam::Init()
104 // ----------------------------------------------------------------------------
106 // ----------------------------------------------------------------------------
108 fPadPlaneArray = new TObjArray(kNplan * kNcham);
110 for (Int_t iplan = 0; iplan < kNplan; iplan++) {
111 for (Int_t icham = 0; icham < kNcham; icham++) {
112 Int_t ipp = iplan + icham * kNplan;
113 fPadPlaneArray->AddAt(new AliTRDpadPlane(iplan,icham),ipp);
119 //_____________________________________________________________________________
120 AliTRDCommonParam::~AliTRDCommonParam()
126 if (fPadPlaneArray) {
127 fPadPlaneArray->Delete();
128 delete fPadPlaneArray;
134 //_____________________________________________________________________________
135 AliTRDCommonParam::AliTRDCommonParam(const AliTRDCommonParam &p)
146 //_____________________________________________________________________________
147 AliTRDCommonParam &AliTRDCommonParam::operator=(const AliTRDCommonParam &p)
150 // Assignment operator
154 ((AliTRDCommonParam &) p).Copy(*this);
161 //_____________________________________________________________________________
162 void AliTRDCommonParam::Copy(TObject &p) const
168 AliTRDCommonParam *target = dynamic_cast<AliTRDCommonParam*> (&p);
173 target->fExBOn = fExBOn;
177 //_____________________________________________________________________________
178 AliTRDpadPlane *AliTRDCommonParam::GetPadPlane(Int_t p, Int_t c) const
181 // Returns the pad plane for a given plane <p> and chamber <c> number
184 Int_t ipp = p + c * kNplan;
185 return ((AliTRDpadPlane *) fPadPlaneArray->At(ipp));
189 //_____________________________________________________________________________
190 Int_t AliTRDCommonParam::GetRowMax(Int_t p, Int_t c, Int_t /*s*/) const
193 // Returns the number of rows on the pad plane
196 return GetPadPlane(p,c)->GetNrows();
200 //_____________________________________________________________________________
201 Int_t AliTRDCommonParam::GetColMax(Int_t p) const
204 // Returns the number of rows on the pad plane
207 return GetPadPlane(p,0)->GetNcols();
211 //_____________________________________________________________________________
212 Double_t AliTRDCommonParam::GetRow0(Int_t p, Int_t c, Int_t /*s*/) const
215 // Returns the position of the border of the first pad in a row
218 return GetPadPlane(p,c)->GetRow0();
222 //_____________________________________________________________________________
223 Double_t AliTRDCommonParam::GetCol0(Int_t p) const
226 // Returns the position of the border of the first pad in a column
229 return GetPadPlane(p,0)->GetCol0();