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