2 #include "AliITSdcsSSD.h"
3 #include "AliITSresponseSSD.h"
4 #include "AliITSsegmentationSSD.h"
9 //_____________________________________________________________________
11 // Constructor and Destructor
12 //_____________________________________________________________________
15 AliITSdcsSSD::AliITSdcsSSD(AliITSsegmentation *seg, AliITSresponse *resp)
19 fRandom = new TRandom();
21 fNstrips = seg->Npx();
23 fInvalidP = new TArrayS();
24 fInvalidN = new TArrayS();
26 Int_t npar=resp->NDetParam();
28 Warning("AliITSdcsSSD","I need 6 parameters ");
32 Float_t *detpar = new Float_t [npar];
33 resp->GetDetParam(detpar);
35 fNInvalid = detpar[0];
38 fCouplingPR = detpar[2];
39 fCouplingPL = detpar[3];
40 fCouplingNR = detpar[4];
41 fCouplingNL = detpar[5];
45 resp->ParamOptions(opt,dummy);
46 if (strstr(opt,"SetInvalid")) SetInvalidMC(fNInvalid,fISigma);
52 //_____________________________________________________________________
55 AliITSdcsSSD::~AliITSdcsSSD() {
61 //__________________________________________________________________________
62 AliITSdcsSSD::AliITSdcsSSD(const AliITSdcsSSD &source){
64 if(&source == this) return;
65 this->fCouplingPR = source.fCouplingPR;
66 this->fCouplingPL = source.fCouplingPL;
67 this->fCouplingNR = source.fCouplingNR;
68 this->fCouplingNL = source.fCouplingNL;
69 this->fNstrips = source.fNstrips;
70 this->fNInvalid = source.fNInvalid;
71 this->fISigma = source.fISigma;
72 this->fInvalidP = source.fInvalidP;
73 this->fInvalidN = source.fInvalidN;
74 this->fRandom = source.fRandom;
78 //_________________________________________________________________________
80 AliITSdcsSSD::operator=(const AliITSdcsSSD &source) {
81 // Assignment operator
82 if(&source == this) return *this;
83 this->fCouplingPR = source.fCouplingPR;
84 this->fCouplingPL = source.fCouplingPL;
85 this->fCouplingNR = source.fCouplingNR;
86 this->fCouplingNL = source.fCouplingNL;
87 this->fNstrips = source.fNstrips;
88 this->fNInvalid = source.fNInvalid;
89 this->fISigma = source.fISigma;
90 this->fInvalidP = source.fInvalidP;
91 this->fInvalidN = source.fInvalidN;
92 this->fRandom = source.fRandom;
96 //_____________________________________________________________________
98 // Methods for creating invalid strips
99 //_____________________________________________________________________
103 void AliITSdcsSSD::SetInvalidMC(Float_t mean, Float_t sigma) {
105 SetInvalidParam(mean, sigma);
109 //_____________________________________________________________________
111 void AliITSdcsSSD::SetInvalidMC() {
118 pside = (Int_t)fRandom->Gaus(fNInvalid, fISigma);
119 nside = (Int_t)fRandom->Gaus(fNInvalid, fISigma);
121 fInvalidP->Set(pside);
122 fInvalidN->Set(nside);
124 for(i=0 ;i<pside; i++) {
125 strip = (Int_t)(fRandom->Rndm() * fNstrips);
126 fInvalidP->AddAt(strip, i);
129 for(i=0 ;i<nside; i++) {
130 strip = (Int_t)(fRandom->Rndm() * fNstrips);
131 fInvalidN->AddAt(strip, i);
135 //_____________________________________________________________________
138 void AliITSdcsSSD::SetInvalidParam(Float_t mean, Float_t sigma) {
143 fNInvalid = (fNInvalid<0)? 0 : fNInvalid;
144 fNInvalid = (fNInvalid>fNstrips)? fNstrips: fNInvalid;
146 fISigma = (fISigma < 0)? 0 : fISigma;
147 fISigma = (fISigma > fNstrips/10) ? fNstrips/10 : fISigma;
151 //_____________________________________________________________________
154 void AliITSdcsSSD::GetInvalidParam(Float_t &mean, Float_t &sigma) {
162 //_____________________________________________________________________
164 // Methods for accessing to invalid strips
165 //_____________________________________________________________________
169 Bool_t AliITSdcsSSD::IsValidP(Int_t strip) {
171 Int_t nElem = fInvalidP->GetSize();
173 for(i = 0; i<nElem; i++)
174 if(fInvalidP->At(i) == strip) return kFALSE;
178 //_____________________________________________________________________
180 Bool_t AliITSdcsSSD::IsValidN(Int_t strip) {
182 Int_t nElem = fInvalidN->GetSize();
184 for(i = 0; i<nElem; i++)
185 if(fInvalidN->At(i) == strip) return kFALSE;
189 //_____________________________________________________________________
192 TArrayS* AliITSdcsSSD::GetInvalidP() {
197 TArrayS* AliITSdcsSSD::GetInvalidN() {
202 Int_t AliITSdcsSSD::GetNInvalidP(){
203 // get numeber of invalid P
204 return fInvalidP->GetSize();
207 Int_t AliITSdcsSSD::GetNInvalidN() {
208 // // get number of invalid N
209 return fInvalidN->GetSize();
212 //_____________________________________________________________________