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