]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSdcsSSD.cxx
Updated for new ITS code.
[u/mrichter/AliRoot.git] / ITS / AliITSdcsSSD.cxx
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
32     Float_t detpar[npar];
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);
47
48 }
49
50 //_____________________________________________________________________
51
52
53 AliITSdcsSSD::~AliITSdcsSSD() {
54   // destructor
55     delete fInvalidP;
56     delete fInvalidN;
57 }
58
59 //__________________________________________________________________________
60 AliITSdcsSSD::AliITSdcsSSD(const AliITSdcsSSD &source){
61   //     Copy Constructor 
62   if(&source == this) return;
63   this->fCouplingPR = source.fCouplingPR;
64   this->fCouplingPL = source.fCouplingPL;
65   this->fCouplingNR = source.fCouplingNR;
66   this->fCouplingNL = source.fCouplingNL;
67   this->fNstrips = source.fNstrips;
68   this->fNInvalid = source.fNInvalid;
69   this->fISigma = source.fISigma;
70   this->fInvalidP = source.fInvalidP;
71   this->fInvalidN = source.fInvalidN;
72   this->fRandom = source.fRandom;
73   return;
74 }
75
76 //_________________________________________________________________________
77 AliITSdcsSSD& 
78   AliITSdcsSSD::operator=(const AliITSdcsSSD &source) {
79   //    Assignment operator
80   if(&source == this) return *this;
81   this->fCouplingPR = source.fCouplingPR;
82   this->fCouplingPL = source.fCouplingPL;
83   this->fCouplingNR = source.fCouplingNR;
84   this->fCouplingNL = source.fCouplingNL;
85   this->fNstrips = source.fNstrips;
86   this->fNInvalid = source.fNInvalid;
87   this->fISigma = source.fISigma;
88   this->fInvalidP = source.fInvalidP;
89   this->fInvalidN = source.fInvalidN;
90   this->fRandom = source.fRandom;
91   return *this;
92 }
93
94 //_____________________________________________________________________
95 //
96 //  Methods for creating invalid strips
97 //_____________________________________________________________________
98 //
99
100
101 void AliITSdcsSSD::SetInvalidMC(Float_t mean, Float_t sigma) {
102   // set invalid MC
103     SetInvalidParam(mean, sigma);
104     SetInvalidMC();
105 }
106
107 //_____________________________________________________________________
108
109 void AliITSdcsSSD::SetInvalidMC() {
110   // set invalid MC
111     Int_t pside;
112     Int_t nside;
113     Int_t i;
114     Int_t strip;
115
116     pside = (Int_t)fRandom->Gaus(fNInvalid, fISigma);
117     nside = (Int_t)fRandom->Gaus(fNInvalid, fISigma);
118     
119     fInvalidP->Set(pside);
120     fInvalidN->Set(nside);
121      
122     for(i=0 ;i<pside; i++) {
123        strip = (Int_t)(fRandom->Rndm() * fNstrips);
124        fInvalidP->AddAt(strip, i); 
125     }
126     
127     for(i=0 ;i<nside; i++) {
128        strip = (Int_t)(fRandom->Rndm() * fNstrips);
129        fInvalidN->AddAt(strip, i); 
130     }  
131 }
132
133 //_____________________________________________________________________
134
135
136 void AliITSdcsSSD::SetInvalidParam(Float_t mean, Float_t sigma) {
137   // set invalid param
138     fNInvalid = mean;
139     fISigma = sigma;
140
141     fNInvalid = (fNInvalid<0)? 0 : fNInvalid;
142     fNInvalid = (fNInvalid>fNstrips)? fNstrips: fNInvalid;
143     
144     fISigma = (fISigma < 0)? 0 : fISigma;
145     fISigma = (fISigma > fNstrips/10) ? fNstrips/10 : fISigma;
146 }
147
148
149 //_____________________________________________________________________
150
151
152 void AliITSdcsSSD::GetInvalidParam(Float_t &mean, Float_t &sigma) {
153   // get invalid param
154     mean = fNInvalid;
155     sigma = fISigma;
156
157 }
158
159
160 //_____________________________________________________________________
161 //
162 //  Methods for accessing to invalid strips
163 //_____________________________________________________________________
164 //
165
166
167 Bool_t AliITSdcsSSD::IsValidP(Int_t strip) {
168   // isvalidP
169     Int_t nElem = fInvalidP->GetSize();
170     Int_t i;
171     for(i = 0; i<nElem; i++)
172        if(fInvalidP->At(i) == strip) return kFALSE;
173     return kTRUE;
174 }
175
176 //_____________________________________________________________________
177
178 Bool_t AliITSdcsSSD::IsValidN(Int_t strip) {
179   // is valid N
180     Int_t nElem = fInvalidN->GetSize();
181     Int_t i;
182     for(i = 0; i<nElem; i++)
183        if(fInvalidN->At(i) == strip) return kFALSE;
184     return kTRUE;
185 }
186
187 //_____________________________________________________________________
188
189
190 TArrayS* AliITSdcsSSD::GetInvalidP() {
191   // get invalid P
192     return fInvalidP;
193 }
194
195 TArrayS* AliITSdcsSSD::GetInvalidN() {
196   // get invalid N
197     return fInvalidN;
198 }
199
200 Int_t AliITSdcsSSD::GetNInvalidP(){
201   // get numeber of invalid P    
202     return fInvalidP->GetSize();
203 }
204
205 Int_t AliITSdcsSSD::GetNInvalidN() {
206   // // get number of invalid N
207     return fInvalidN->GetSize();
208 }
209
210 //_____________________________________________________________________
211
212
213
214
215
216
217