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