]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDCommonParam.cxx
update of the calibration task by Raphaelle
[u/mrichter/AliRoot.git] / TRD / AliTRDCommonParam.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
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  **************************************************************************/
15
16 /* $Id$ */
17
18 ///////////////////////////////////////////////////////////////////////////////
19 //                                                                           //
20 // Class containing constant common parameters                               //
21 //                                                                           //
22 // Request an instance with AliTRDCommonParam::Instance()                    //
23 // Then request the needed values                                            //
24 //                                                                           //
25 ///////////////////////////////////////////////////////////////////////////////
26
27 #include <TObjArray.h>
28
29 #include "AliTracker.h"
30 #include "AliRun.h"
31
32 #include "AliTRDCommonParam.h"
33
34 ClassImp(AliTRDCommonParam)
35
36 AliTRDCommonParam *AliTRDCommonParam::fgInstance = 0;
37 Bool_t AliTRDCommonParam::fgTerminated = kFALSE;
38
39 //_ singleton implementation __________________________________________________
40 AliTRDCommonParam* AliTRDCommonParam::Instance()
41 {
42   //
43   // Singleton implementation
44   // Returns an instance of this class, it is created if neccessary
45   // 
46   
47   if (fgTerminated != kFALSE) {
48     return 0;
49   }
50
51   if (fgInstance == 0) {
52     fgInstance = new AliTRDCommonParam();
53   }  
54
55   return fgInstance;
56
57 }
58
59 //_____________________________________________________________________________
60 void AliTRDCommonParam::Terminate()
61 {
62   //
63   // Singleton implementation
64   // Deletes the instance of this class and sets the terminated flag,
65   // instances cannot be requested anymore
66   // This function can be called several times.
67   //
68   
69   fgTerminated = kTRUE;
70   
71   if (fgInstance != 0) {
72     delete fgInstance;
73     fgInstance = 0;
74   }
75
76 }
77
78 //_____________________________________________________________________________
79 AliTRDCommonParam::AliTRDCommonParam()
80   :TObject()
81   ,fExBOn(kFALSE)
82   ,fSamplingFrequency(0.0)
83 {
84   //
85   // Default constructor
86   //
87   
88   Init();
89
90 }
91
92 //_____________________________________________________________________________
93 AliTRDCommonParam::AliTRDCommonParam(TRootIoCtor *)
94   :TObject()
95   ,fExBOn(0)
96   ,fSamplingFrequency(0.0)
97 {
98   //
99   // IO constructor
100   //
101
102 }
103
104 //_____________________________________________________________________________
105 void AliTRDCommonParam::Init()
106 {
107   //
108   // Initialization
109   //
110   
111   // E x B effects
112   fExBOn             = kTRUE;
113
114   // Sampling Frequency in MHz
115   fSamplingFrequency = 10.0;
116
117   for (Int_t i = 0; i < kNsector; i++) {
118     fSMstatus[i] = 1;
119   }
120
121 }
122
123 //_____________________________________________________________________________
124 AliTRDCommonParam::~AliTRDCommonParam() 
125 {
126   //
127   // Destructor
128   //
129   
130 }
131
132 //_____________________________________________________________________________
133 AliTRDCommonParam::AliTRDCommonParam(const AliTRDCommonParam &p)
134   :TObject(p)
135   ,fExBOn(p.fExBOn)
136   ,fSamplingFrequency(p.fSamplingFrequency)
137 {
138   //
139   // Copy constructor
140   //
141
142 }
143
144 //_____________________________________________________________________________
145 AliTRDCommonParam &AliTRDCommonParam::operator=(const AliTRDCommonParam &p)
146 {
147   //
148   // Assignment operator
149   //
150
151   if (this != &p) {
152     ((AliTRDCommonParam &) p).Copy(*this);
153   }
154
155   return *this;
156
157 }
158
159 //_____________________________________________________________________________
160 void AliTRDCommonParam::Copy(TObject &p) const
161 {
162   //
163   // Copy function
164   //
165   
166   AliTRDCommonParam *target = dynamic_cast<AliTRDCommonParam*> (&p);
167   if (!target) {
168     return;
169   }  
170
171   target->fExBOn             = fExBOn;
172   target->fSamplingFrequency = fSamplingFrequency;
173
174 }