]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSdcsSSD.cxx
EffC++ warnings corrected.
[u/mrichter/AliRoot.git] / ITS / AliITSdcsSSD.cxx
1 #include <TRandom.h>
2 #include <TArrayS.h>
3
4 #include "AliITSdcsSSD.h"
5 #include "AliITSCalibrationSSD.h"
6 #include "AliITSresponseSSD.h"
7 #include "AliITSsegmentationSSD.h"
8 ///////////////////////////////////////////////////////////////////////////
9 //                                                                       //
10 //  Class AliITSdcsSSD                                                   //
11 //  describes Detector Control System parameters for one SSD module.     //
12 //                                                                       //
13 //  This class stores parametrers such as gain, threshold                //
14 //  capacitive coupling.                                                 //
15 //                                                                       //
16 //  Class takes care of invalid strip menagement during                  //
17 //  simulation and runtime                                               //
18 //                                                                       //
19 //                                                                       //
20 //  created at: Warsaw University of Technology                          //
21 //  ver. 1.0    WARSAW, 23.12.1999                                       //
22 //                                                                       //
23 ///////////////////////////////////////////////////////////////////////////
24
25 ClassImp(AliITSdcsSSD)
26
27 // Constructor and Destructor
28 //______________________________________________________________________
29 AliITSdcsSSD::AliITSdcsSSD(){
30     // Default Constructor
31
32     fInvalidP = 0;
33     fInvalidN = 0;
34 }
35 //______________________________________________________________________
36 AliITSdcsSSD::AliITSdcsSSD(AliITSsegmentation *seg, AliITSCalibration *resp){
37     // Standard constructor
38
39     fNstrips =(Float_t) (((AliITSsegmentationSSD*)seg)->Npx());
40     
41     fInvalidP = new TArrayS();
42     fInvalidN = new TArrayS();
43
44     Int_t npar=((AliITSCalibrationSSD*)resp)->NDetParam();
45     if (npar < 6) {
46         Warning("AliITSdcsSSD","I need 6 parameters ");
47         npar=6;
48     } // end if
49
50     Double_t *detpar= new Double_t[npar];
51     resp->GetDetParam(detpar);
52
53     fNInvalid = detpar[0];
54     fISigma   = detpar[1];
55
56     fCouplingPR = detpar[2];
57     fCouplingPL = detpar[3];
58     fCouplingNR = detpar[4];
59     fCouplingNL = detpar[5];
60
61     char opt[30],dummy[20];
62     ((AliITSCalibrationSSD*)resp)->GetParamOptions(opt,dummy);
63     if (strstr(opt,"SetInvalid")) SetInvalidMC(fNInvalid,fISigma);
64
65     delete [] detpar;
66 }
67 //______________________________________________________________________
68 AliITSdcsSSD::~AliITSdcsSSD() {
69     // destructor
70
71     delete fInvalidP;
72     delete fInvalidN;
73 }
74 //______________________________________________________________________
75 AliITSdcsSSD::AliITSdcsSSD(const AliITSdcsSSD &source) : TObject(source){
76     //     Copy Constructor 
77
78     if(&source == this) return;
79
80     this->fCouplingPR = source.fCouplingPR;
81     this->fCouplingPL = source.fCouplingPL;
82     this->fCouplingNR = source.fCouplingNR;
83     this->fCouplingNL = source.fCouplingNL;
84     this->fNstrips = source.fNstrips;
85     this->fNInvalid = source.fNInvalid;
86     this->fISigma = source.fISigma;
87     this->fInvalidP = source.fInvalidP;
88     this->fInvalidN = source.fInvalidN;
89
90     return;
91 }
92 //_________________________________________________________________________
93 AliITSdcsSSD& AliITSdcsSSD::operator=(const AliITSdcsSSD &source) {
94     //    Assignment operator
95
96     if(&source == this) return *this;
97
98     this->fCouplingPR = source.fCouplingPR;
99     this->fCouplingPL = source.fCouplingPL;
100     this->fCouplingNR = source.fCouplingNR;
101     this->fCouplingNL = source.fCouplingNL;
102     this->fNstrips = source.fNstrips;
103     this->fNInvalid = source.fNInvalid;
104     this->fISigma = source.fISigma;
105     this->fInvalidP = source.fInvalidP;
106     this->fInvalidN = source.fInvalidN;
107
108     return *this;
109 }
110 //_____________________________________________________________________
111 //
112 //  Methods for creating invalid strips
113 //_____________________________________________________________________
114 void AliITSdcsSSD::SetInvalidMC(Float_t mean, Float_t sigma) {
115     // set invalid MC
116
117     SetInvalidParam(mean, sigma);
118     SetInvalidMC();
119 }
120 //______________________________________________________________________
121 void AliITSdcsSSD::SetInvalidMC() {
122     // set invalid MC
123     Int_t pside;
124     Int_t nside;
125     Int_t i;
126     Int_t strip;
127
128     pside = (Int_t)gRandom->Gaus(fNInvalid, fISigma);
129     nside = (Int_t)gRandom->Gaus(fNInvalid, fISigma);
130     
131     fInvalidP->Set(pside);
132     fInvalidN->Set(nside);
133      
134     for(i=0 ;i<pside; i++) {
135        strip = (Int_t)(gRandom->Rndm() * fNstrips);
136        fInvalidP->AddAt(strip, i); 
137     } // end for i
138     
139     for(i=0 ;i<nside; i++) {
140        strip = (Int_t)(gRandom->Rndm() * fNstrips);
141        fInvalidN->AddAt(strip, i); 
142     } // end for i
143 }
144 //______________________________________________________________________
145 void AliITSdcsSSD::SetInvalidParam(Float_t mean, Float_t sigma) {
146     // set invalid param
147
148     fNInvalid = mean;
149     fISigma = sigma;
150
151     fNInvalid = (fNInvalid<0)? 0 : fNInvalid;
152     fNInvalid = (fNInvalid>fNstrips)? fNstrips: fNInvalid;
153     
154     fISigma = (fISigma < 0)? 0 : fISigma;
155     fISigma = (fISigma > fNstrips/10) ? fNstrips/10 : fISigma;
156 }
157 //______________________________________________________________________
158 void AliITSdcsSSD::GetInvalidParam(Float_t &mean, Float_t &sigma) const {
159     // get invalid param
160
161     mean = fNInvalid;
162     sigma = fISigma;
163 }
164 //_____________________________________________________________________
165 //
166 //  Methods for accessing to invalid strips
167 //_____________________________________________________________________
168 Bool_t AliITSdcsSSD::IsValidP(Int_t strip) {
169     // isvalidP
170     Int_t nElem = fInvalidP->GetSize();
171
172     for(Int_t i = 0; i<nElem; i++) if(fInvalidP->At(i) == strip) return kFALSE;
173     return kTRUE;
174 }
175 //______________________________________________________________________
176 Bool_t AliITSdcsSSD::IsValidN(Int_t strip) {
177     // is valid N
178     Int_t nElem = fInvalidN->GetSize();
179
180     for(Int_t i = 0; i<nElem; i++) if(fInvalidN->At(i) == strip) return kFALSE;
181     return kTRUE;
182 }
183 //______________________________________________________________________
184 TArrayS* AliITSdcsSSD::GetInvalidP() {
185     // get invalid P
186
187     return fInvalidP;
188 }
189 //______________________________________________________________________
190 TArrayS* AliITSdcsSSD::GetInvalidN() {
191     // get invalid N
192
193     return fInvalidN;
194 }
195 //______________________________________________________________________
196 Int_t AliITSdcsSSD::GetNInvalidP(){
197     // get numeber of invalid P
198
199     return fInvalidP->GetSize();
200 }
201 //______________________________________________________________________
202 Int_t AliITSdcsSSD::GetNInvalidN() {
203     // get number of invalid N
204
205     return fInvalidN->GetSize();
206 }
207 //_____________________________________________________________________
208
209
210
211
212