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 //MI fRandom = new TRandom();
24 fNstrips = seg->Npx();
26 fInvalidP = new TArrayS();
27 fInvalidN = new TArrayS();
29 Int_t npar=resp->NDetParam();
31 Warning("AliITSdcsSSD","I need 6 parameters ");
35 Float_t *detpar= new Float_t[npar];
36 resp->GetDetParam(detpar);
38 fNInvalid = detpar[0];
41 fCouplingPR = detpar[2];
42 fCouplingPL = detpar[3];
43 fCouplingNR = detpar[4];
44 fCouplingNL = detpar[5];
47 char opt[30],dummy[20];
48 resp->ParamOptions(opt,dummy);
49 if (strstr(opt,"SetInvalid")) SetInvalidMC(fNInvalid,fISigma);
54 //_____________________________________________________________________
57 AliITSdcsSSD::~AliITSdcsSSD() {
63 //__________________________________________________________________________
64 AliITSdcsSSD::AliITSdcsSSD(const AliITSdcsSSD &source){
66 if(&source == this) return;
67 this->fCouplingPR = source.fCouplingPR;
68 this->fCouplingPL = source.fCouplingPL;
69 this->fCouplingNR = source.fCouplingNR;
70 this->fCouplingNL = source.fCouplingNL;
71 this->fNstrips = source.fNstrips;
72 this->fNInvalid = source.fNInvalid;
73 this->fISigma = source.fISigma;
74 this->fInvalidP = source.fInvalidP;
75 this->fInvalidN = source.fInvalidN;
76 this->fRandom = source.fRandom;
80 //_________________________________________________________________________
82 AliITSdcsSSD::operator=(const AliITSdcsSSD &source) {
83 // Assignment operator
84 if(&source == this) return *this;
85 this->fCouplingPR = source.fCouplingPR;
86 this->fCouplingPL = source.fCouplingPL;
87 this->fCouplingNR = source.fCouplingNR;
88 this->fCouplingNL = source.fCouplingNL;
89 this->fNstrips = source.fNstrips;
90 this->fNInvalid = source.fNInvalid;
91 this->fISigma = source.fISigma;
92 this->fInvalidP = source.fInvalidP;
93 this->fInvalidN = source.fInvalidN;
94 this->fRandom = source.fRandom;
98 //_____________________________________________________________________
100 // Methods for creating invalid strips
101 //_____________________________________________________________________
105 void AliITSdcsSSD::SetInvalidMC(Float_t mean, Float_t sigma) {
107 SetInvalidParam(mean, sigma);
111 //_____________________________________________________________________
113 void AliITSdcsSSD::SetInvalidMC() {
120 pside = (Int_t)fRandom->Gaus(fNInvalid, fISigma);
121 nside = (Int_t)fRandom->Gaus(fNInvalid, fISigma);
123 fInvalidP->Set(pside);
124 fInvalidN->Set(nside);
126 for(i=0 ;i<pside; i++) {
127 strip = (Int_t)(fRandom->Rndm() * fNstrips);
128 fInvalidP->AddAt(strip, i);
131 for(i=0 ;i<nside; i++) {
132 strip = (Int_t)(fRandom->Rndm() * fNstrips);
133 fInvalidN->AddAt(strip, i);
137 //_____________________________________________________________________
140 void AliITSdcsSSD::SetInvalidParam(Float_t mean, Float_t sigma) {
145 fNInvalid = (fNInvalid<0)? 0 : fNInvalid;
146 fNInvalid = (fNInvalid>fNstrips)? fNstrips: fNInvalid;
148 fISigma = (fISigma < 0)? 0 : fISigma;
149 fISigma = (fISigma > fNstrips/10) ? fNstrips/10 : fISigma;
153 //_____________________________________________________________________
156 void AliITSdcsSSD::GetInvalidParam(Float_t &mean, Float_t &sigma) {
164 //_____________________________________________________________________
166 // Methods for accessing to invalid strips
167 //_____________________________________________________________________
171 Bool_t AliITSdcsSSD::IsValidP(Int_t strip) {
173 Int_t nElem = fInvalidP->GetSize();
174 //printf("IsValidP: nElem %d\n",nElem);
175 for(Int_t i = 0; i<nElem; i++)
176 if(fInvalidP->At(i) == strip) return kFALSE;
180 //_____________________________________________________________________
182 Bool_t AliITSdcsSSD::IsValidN(Int_t strip) {
184 Int_t nElem = fInvalidN->GetSize();
185 //printf("IsValidN: nElem %d\n",nElem);
186 for(Int_t i = 0; i<nElem; i++)
187 if(fInvalidN->At(i) == strip) return kFALSE;
191 //_____________________________________________________________________
194 TArrayS* AliITSdcsSSD::GetInvalidP() {
199 TArrayS* AliITSdcsSSD::GetInvalidN() {
204 Int_t AliITSdcsSSD::GetNInvalidP(){
205 // get numeber of invalid P
206 return fInvalidP->GetSize();
209 Int_t AliITSdcsSSD::GetNInvalidN() {
210 // // get number of invalid N
211 return fInvalidN->GetSize();
214 //_____________________________________________________________________