4 #include "AliITSdcsSSD.h"
5 #include "AliITSresponseSSD.h"
6 #include "AliITSsegmentationSSD.h"
11 //_____________________________________________________________________
13 // Constructor and Destructor
14 //_____________________________________________________________________
17 AliITSdcsSSD::AliITSdcsSSD(AliITSsegmentation *seg, AliITSresponse *resp)
21 fRandom = new TRandom();
23 fNstrips = seg->Npx();
25 fInvalidP = new TArrayS();
26 fInvalidN = new TArrayS();
28 Int_t npar=resp->NDetParam();
30 Warning("AliITSdcsSSD","I need 6 parameters ");
34 Float_t *detpar= new Float_t[npar];
35 resp->GetDetParam(detpar);
37 fNInvalid = detpar[0];
40 fCouplingPR = detpar[2];
41 fCouplingPL = detpar[3];
42 fCouplingNR = detpar[4];
43 fCouplingNL = detpar[5];
46 char opt[30],dummy[20];
47 resp->ParamOptions(opt,dummy);
48 if (strstr(opt,"SetInvalid")) SetInvalidMC(fNInvalid,fISigma);
53 //_____________________________________________________________________
56 AliITSdcsSSD::~AliITSdcsSSD() {
62 //__________________________________________________________________________
63 AliITSdcsSSD::AliITSdcsSSD(const AliITSdcsSSD &source){
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;
79 //_________________________________________________________________________
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;
97 //_____________________________________________________________________
99 // Methods for creating invalid strips
100 //_____________________________________________________________________
104 void AliITSdcsSSD::SetInvalidMC(Float_t mean, Float_t sigma) {
106 SetInvalidParam(mean, sigma);
110 //_____________________________________________________________________
112 void AliITSdcsSSD::SetInvalidMC() {
119 pside = (Int_t)fRandom->Gaus(fNInvalid, fISigma);
120 nside = (Int_t)fRandom->Gaus(fNInvalid, fISigma);
122 fInvalidP->Set(pside);
123 fInvalidN->Set(nside);
125 for(i=0 ;i<pside; i++) {
126 strip = (Int_t)(fRandom->Rndm() * fNstrips);
127 fInvalidP->AddAt(strip, i);
130 for(i=0 ;i<nside; i++) {
131 strip = (Int_t)(fRandom->Rndm() * fNstrips);
132 fInvalidN->AddAt(strip, i);
136 //_____________________________________________________________________
139 void AliITSdcsSSD::SetInvalidParam(Float_t mean, Float_t sigma) {
144 fNInvalid = (fNInvalid<0)? 0 : fNInvalid;
145 fNInvalid = (fNInvalid>fNstrips)? fNstrips: fNInvalid;
147 fISigma = (fISigma < 0)? 0 : fISigma;
148 fISigma = (fISigma > fNstrips/10) ? fNstrips/10 : fISigma;
152 //_____________________________________________________________________
155 void AliITSdcsSSD::GetInvalidParam(Float_t &mean, Float_t &sigma) {
163 //_____________________________________________________________________
165 // Methods for accessing to invalid strips
166 //_____________________________________________________________________
170 Bool_t AliITSdcsSSD::IsValidP(Int_t strip) {
172 Int_t nElem = fInvalidP->GetSize();
173 //printf("IsValidP: nElem %d\n",nElem);
174 for(Int_t i = 0; i<nElem; i++)
175 if(fInvalidP->At(i) == strip) return kFALSE;
179 //_____________________________________________________________________
181 Bool_t AliITSdcsSSD::IsValidN(Int_t strip) {
183 Int_t nElem = fInvalidN->GetSize();
184 //printf("IsValidN: nElem %d\n",nElem);
185 for(Int_t i = 0; i<nElem; i++)
186 if(fInvalidN->At(i) == strip) return kFALSE;
190 //_____________________________________________________________________
193 TArrayS* AliITSdcsSSD::GetInvalidP() {
198 TArrayS* AliITSdcsSSD::GetInvalidN() {
203 Int_t AliITSdcsSSD::GetNInvalidP(){
204 // get numeber of invalid P
205 return fInvalidP->GetSize();
208 Int_t AliITSdcsSSD::GetNInvalidN() {
209 // // get number of invalid N
210 return fInvalidN->GetSize();
213 //_____________________________________________________________________