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 ");
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);
50 //_____________________________________________________________________
53 AliITSdcsSSD::~AliITSdcsSSD() {
59 //__________________________________________________________________________
60 AliITSdcsSSD::AliITSdcsSSD(const AliITSdcsSSD &source){
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;
76 //_________________________________________________________________________
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;
94 //_____________________________________________________________________
96 // Methods for creating invalid strips
97 //_____________________________________________________________________
101 void AliITSdcsSSD::SetInvalidMC(Float_t mean, Float_t sigma) {
103 SetInvalidParam(mean, sigma);
107 //_____________________________________________________________________
109 void AliITSdcsSSD::SetInvalidMC() {
116 pside = (Int_t)fRandom->Gaus(fNInvalid, fISigma);
117 nside = (Int_t)fRandom->Gaus(fNInvalid, fISigma);
119 fInvalidP->Set(pside);
120 fInvalidN->Set(nside);
122 for(i=0 ;i<pside; i++) {
123 strip = (Int_t)(fRandom->Rndm() * fNstrips);
124 fInvalidP->AddAt(strip, i);
127 for(i=0 ;i<nside; i++) {
128 strip = (Int_t)(fRandom->Rndm() * fNstrips);
129 fInvalidN->AddAt(strip, i);
133 //_____________________________________________________________________
136 void AliITSdcsSSD::SetInvalidParam(Float_t mean, Float_t sigma) {
141 fNInvalid = (fNInvalid<0)? 0 : fNInvalid;
142 fNInvalid = (fNInvalid>fNstrips)? fNstrips: fNInvalid;
144 fISigma = (fISigma < 0)? 0 : fISigma;
145 fISigma = (fISigma > fNstrips/10) ? fNstrips/10 : fISigma;
149 //_____________________________________________________________________
152 void AliITSdcsSSD::GetInvalidParam(Float_t &mean, Float_t &sigma) {
160 //_____________________________________________________________________
162 // Methods for accessing to invalid strips
163 //_____________________________________________________________________
167 Bool_t AliITSdcsSSD::IsValidP(Int_t strip) {
169 Int_t nElem = fInvalidP->GetSize();
171 for(i = 0; i<nElem; i++)
172 if(fInvalidP->At(i) == strip) return kFALSE;
176 //_____________________________________________________________________
178 Bool_t AliITSdcsSSD::IsValidN(Int_t strip) {
180 Int_t nElem = fInvalidN->GetSize();
182 for(i = 0; i<nElem; i++)
183 if(fInvalidN->At(i) == strip) return kFALSE;
187 //_____________________________________________________________________
190 TArrayS* AliITSdcsSSD::GetInvalidP() {
195 TArrayS* AliITSdcsSSD::GetInvalidN() {
200 Int_t AliITSdcsSSD::GetNInvalidP(){
201 // get numeber of invalid P
202 return fInvalidP->GetSize();
205 Int_t AliITSdcsSSD::GetNInvalidN() {
206 // // get number of invalid N
207 return fInvalidN->GetSize();
210 //_____________________________________________________________________