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