]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSdcsSSD.cxx
Removal of useless dependencies via forward declarations
[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
21 fRandom = new TRandom();
22
23 fNstrips = seg->Npx();
24
25 fInvalidP = new TArrayS();
26 fInvalidN = new TArrayS();
27
28 Int_t npar=resp->NDetParam();
29 if (npar < 6) {
30 Warning("AliITSdcsSSD","I need 6 parameters ");
31 npar=6;
32 }
33
e8189707 34 Float_t *detpar= new Float_t[npar];
b0f5e3fc 35 resp->GetDetParam(detpar);
36
37 fNInvalid = detpar[0];
38 fISigma = detpar[1];
39
40 fCouplingPR = detpar[2];
41 fCouplingPL = detpar[3];
42 fCouplingNR = detpar[4];
43 fCouplingNL = detpar[5];
44
45
e8189707 46 char opt[30],dummy[20];
b0f5e3fc 47 resp->ParamOptions(opt,dummy);
48 if (strstr(opt,"SetInvalid")) SetInvalidMC(fNInvalid,fISigma);
49
e8189707 50 delete [] detpar;
b0f5e3fc 51}
52
53//_____________________________________________________________________
54
55
56AliITSdcsSSD::~AliITSdcsSSD() {
57 // destructor
58 delete fInvalidP;
59 delete fInvalidN;
60}
61
62//__________________________________________________________________________
63AliITSdcsSSD::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//_________________________________________________________________________
80AliITSdcsSSD&
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
104void AliITSdcsSSD::SetInvalidMC(Float_t mean, Float_t sigma) {
105 // set invalid MC
106 SetInvalidParam(mean, sigma);
107 SetInvalidMC();
108}
109
110//_____________________________________________________________________
111
112void 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
139void 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
155void 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
170Bool_t AliITSdcsSSD::IsValidP(Int_t strip) {
171 // isvalidP
172 Int_t nElem = fInvalidP->GetSize();
e8189707 173 //printf("IsValidP: nElem %d\n",nElem);
174 for(Int_t i = 0; i<nElem; i++)
b0f5e3fc 175 if(fInvalidP->At(i) == strip) return kFALSE;
176 return kTRUE;
177}
178
179//_____________________________________________________________________
180
181Bool_t AliITSdcsSSD::IsValidN(Int_t strip) {
182 // is valid N
183 Int_t nElem = fInvalidN->GetSize();
e8189707 184 //printf("IsValidN: nElem %d\n",nElem);
185 for(Int_t i = 0; i<nElem; i++)
b0f5e3fc 186 if(fInvalidN->At(i) == strip) return kFALSE;
187 return kTRUE;
188}
189
190//_____________________________________________________________________
191
192
193TArrayS* AliITSdcsSSD::GetInvalidP() {
194 // get invalid P
195 return fInvalidP;
196}
197
198TArrayS* AliITSdcsSSD::GetInvalidN() {
199 // get invalid N
200 return fInvalidN;
201}
202
203Int_t AliITSdcsSSD::GetNInvalidP(){
204 // get numeber of invalid P
205 return fInvalidP->GetSize();
206}
207
208Int_t AliITSdcsSSD::GetNInvalidN() {
209 // // get number of invalid N
210 return fInvalidN->GetSize();
211}
212
213//_____________________________________________________________________
214
215
216
217
218
219
220