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];
44 char opt[30],dummy[20];
45 resp->ParamOptions(opt,dummy);
46 if (strstr(opt,"SetInvalid")) SetInvalidMC(fNInvalid,fISigma);
51 //_____________________________________________________________________
54 AliITSdcsSSD::~AliITSdcsSSD() {
60 //__________________________________________________________________________
61 AliITSdcsSSD::AliITSdcsSSD(const AliITSdcsSSD &source){
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;
77 //_________________________________________________________________________
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;
95 //_____________________________________________________________________
97 // Methods for creating invalid strips
98 //_____________________________________________________________________
102 void AliITSdcsSSD::SetInvalidMC(Float_t mean, Float_t sigma) {
104 SetInvalidParam(mean, sigma);
108 //_____________________________________________________________________
110 void AliITSdcsSSD::SetInvalidMC() {
117 pside = (Int_t)fRandom->Gaus(fNInvalid, fISigma);
118 nside = (Int_t)fRandom->Gaus(fNInvalid, fISigma);
120 fInvalidP->Set(pside);
121 fInvalidN->Set(nside);
123 for(i=0 ;i<pside; i++) {
124 strip = (Int_t)(fRandom->Rndm() * fNstrips);
125 fInvalidP->AddAt(strip, i);
128 for(i=0 ;i<nside; i++) {
129 strip = (Int_t)(fRandom->Rndm() * fNstrips);
130 fInvalidN->AddAt(strip, i);
134 //_____________________________________________________________________
137 void AliITSdcsSSD::SetInvalidParam(Float_t mean, Float_t sigma) {
142 fNInvalid = (fNInvalid<0)? 0 : fNInvalid;
143 fNInvalid = (fNInvalid>fNstrips)? fNstrips: fNInvalid;
145 fISigma = (fISigma < 0)? 0 : fISigma;
146 fISigma = (fISigma > fNstrips/10) ? fNstrips/10 : fISigma;
150 //_____________________________________________________________________
153 void AliITSdcsSSD::GetInvalidParam(Float_t &mean, Float_t &sigma) {
161 //_____________________________________________________________________
163 // Methods for accessing to invalid strips
164 //_____________________________________________________________________
168 Bool_t AliITSdcsSSD::IsValidP(Int_t strip) {
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;
177 //_____________________________________________________________________
179 Bool_t AliITSdcsSSD::IsValidN(Int_t strip) {
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;
188 //_____________________________________________________________________
191 TArrayS* AliITSdcsSSD::GetInvalidP() {
196 TArrayS* AliITSdcsSSD::GetInvalidN() {
201 Int_t AliITSdcsSSD::GetNInvalidP(){
202 // get numeber of invalid P
203 return fInvalidP->GetSize();
206 Int_t AliITSdcsSSD::GetNInvalidN() {
207 // // get number of invalid N
208 return fInvalidN->GetSize();
211 //_____________________________________________________________________