]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - ITS/AliITSdcsSSD.cxx
Anode numbering adapted to hardware channel numbering + Code cleanup of segmentation...
[u/mrichter/AliRoot.git] / ITS / AliITSdcsSSD.cxx
... / ...
CommitLineData
1#include <TRandom.h>
2#include <TArrayS.h>
3
4#include "AliITSdcsSSD.h"
5#include "AliITSCalibrationSSD.h"
6#include "AliITSresponseSSD.h"
7#include "AliITSsegmentationSSD.h"
8///////////////////////////////////////////////////////////////////////////
9// //
10// Class AliITSdcsSSD //
11// describes Detector Control System parameters for one SSD module. //
12// //
13// This class stores parametrers such as gain, threshold //
14// capacitive coupling. //
15// //
16// Class takes care of invalid strip menagement during //
17// simulation and runtime //
18// //
19// //
20// created at: Warsaw University of Technology //
21// ver. 1.0 WARSAW, 23.12.1999 //
22// //
23///////////////////////////////////////////////////////////////////////////
24
25ClassImp(AliITSdcsSSD)
26
27// Constructor and Destructor
28//______________________________________________________________________
29 AliITSdcsSSD::AliITSdcsSSD():
30fCouplingPR(0),
31fCouplingPL(0),
32fCouplingNR(0),
33fCouplingNL(0),
34fNstrips(0),
35fNInvalid(0),
36fISigma(0),
37fInvalidP(0),
38fInvalidN(0){
39 // Default Constructor
40
41}
42//______________________________________________________________________
43AliITSdcsSSD::AliITSdcsSSD(AliITSsegmentation *seg, AliITSCalibration *resp):
44fCouplingPR(0),
45fCouplingPL(0),
46fCouplingNR(0),
47fCouplingNL(0),
48fNstrips(0),
49fNInvalid(0),
50fISigma(0),
51fInvalidP(0),
52fInvalidN(0){
53 // Standard constructor
54
55 fNstrips =(Float_t) (((AliITSsegmentationSSD*)seg)->Npx());
56
57 fInvalidP = new TArrayS();
58 fInvalidN = new TArrayS();
59
60 Int_t npar=((AliITSCalibrationSSD*)resp)->NDetParam();
61 if (npar < 6) {
62 Warning("AliITSdcsSSD","I need 6 parameters ");
63 npar=6;
64 } // end if
65
66 Double_t *detpar= new Double_t[npar];
67 resp->GetDetParam(detpar);
68
69 fNInvalid = detpar[0];
70 fISigma = detpar[1];
71
72 fCouplingPR = detpar[2];
73 fCouplingPL = detpar[3];
74 fCouplingNR = detpar[4];
75 fCouplingNL = detpar[5];
76
77 char opt[30],dummy[20];
78 ((AliITSCalibrationSSD*)resp)->GetParamOptions(opt,dummy);
79 if (strstr(opt,"SetInvalid")) SetInvalidMC(fNInvalid,fISigma);
80
81 delete [] detpar;
82}
83//______________________________________________________________________
84AliITSdcsSSD::~AliITSdcsSSD() {
85 // destructor
86
87 delete fInvalidP;
88 delete fInvalidN;
89}
90//______________________________________________________________________
91AliITSdcsSSD::AliITSdcsSSD(const AliITSdcsSSD &source) : TObject(source),
92fCouplingPR(source.fCouplingPR),
93fCouplingPL(source.fCouplingPL),
94fCouplingNR(source.fCouplingNR),
95fCouplingNL(source.fCouplingNL),
96fNstrips(source.fNstrips),
97fNInvalid(source.fNInvalid),
98fISigma(source.fISigma),
99fInvalidP(source.fInvalidP),
100fInvalidN(source.fInvalidN){
101 // Copy Constructor
102
103}
104//_________________________________________________________________________
105AliITSdcsSSD& AliITSdcsSSD::operator=(const AliITSdcsSSD &source) {
106 // Assignment operator
107
108 if(&source == this) return *this;
109
110 this->fCouplingPR = source.fCouplingPR;
111 this->fCouplingPL = source.fCouplingPL;
112 this->fCouplingNR = source.fCouplingNR;
113 this->fCouplingNL = source.fCouplingNL;
114 this->fNstrips = source.fNstrips;
115 this->fNInvalid = source.fNInvalid;
116 this->fISigma = source.fISigma;
117 this->fInvalidP = source.fInvalidP;
118 this->fInvalidN = source.fInvalidN;
119
120 return *this;
121}
122//_____________________________________________________________________
123//
124// Methods for creating invalid strips
125//_____________________________________________________________________
126void AliITSdcsSSD::SetInvalidMC(Float_t mean, Float_t sigma) {
127 // set invalid MC
128
129 SetInvalidParam(mean, sigma);
130 SetInvalidMC();
131}
132//______________________________________________________________________
133void AliITSdcsSSD::SetInvalidMC() {
134 // set invalid MC
135 Int_t pside;
136 Int_t nside;
137 Int_t i;
138 Int_t strip;
139
140 pside = (Int_t)gRandom->Gaus(fNInvalid, fISigma);
141 nside = (Int_t)gRandom->Gaus(fNInvalid, fISigma);
142
143 fInvalidP->Set(pside);
144 fInvalidN->Set(nside);
145
146 for(i=0 ;i<pside; i++) {
147 strip = (Int_t)(gRandom->Rndm() * fNstrips);
148 fInvalidP->AddAt(strip, i);
149 } // end for i
150
151 for(i=0 ;i<nside; i++) {
152 strip = (Int_t)(gRandom->Rndm() * fNstrips);
153 fInvalidN->AddAt(strip, i);
154 } // end for i
155}
156//______________________________________________________________________
157void AliITSdcsSSD::SetInvalidParam(Float_t mean, Float_t sigma) {
158 // set invalid param
159
160 fNInvalid = mean;
161 fISigma = sigma;
162
163 fNInvalid = (fNInvalid<0)? 0 : fNInvalid;
164 fNInvalid = (fNInvalid>fNstrips)? fNstrips: fNInvalid;
165
166 fISigma = (fISigma < 0)? 0 : fISigma;
167 fISigma = (fISigma > fNstrips/10) ? fNstrips/10 : fISigma;
168}
169//______________________________________________________________________
170void AliITSdcsSSD::GetInvalidParam(Float_t &mean, Float_t &sigma) const {
171 // get invalid param
172
173 mean = fNInvalid;
174 sigma = fISigma;
175}
176//_____________________________________________________________________
177//
178// Methods for accessing to invalid strips
179//_____________________________________________________________________
180Bool_t AliITSdcsSSD::IsValidP(Int_t strip) {
181 // isvalidP
182 Int_t nElem = fInvalidP->GetSize();
183
184 for(Int_t i = 0; i<nElem; i++) if(fInvalidP->At(i) == strip) return kFALSE;
185 return kTRUE;
186}
187//______________________________________________________________________
188Bool_t AliITSdcsSSD::IsValidN(Int_t strip) {
189 // is valid N
190 Int_t nElem = fInvalidN->GetSize();
191
192 for(Int_t i = 0; i<nElem; i++) if(fInvalidN->At(i) == strip) return kFALSE;
193 return kTRUE;
194}
195//______________________________________________________________________
196TArrayS* AliITSdcsSSD::GetInvalidP() {
197 // get invalid P
198
199 return fInvalidP;
200}
201//______________________________________________________________________
202TArrayS* AliITSdcsSSD::GetInvalidN() {
203 // get invalid N
204
205 return fInvalidN;
206}
207//______________________________________________________________________
208Int_t AliITSdcsSSD::GetNInvalidP(){
209 // get numeber of invalid P
210
211 return fInvalidP->GetSize();
212}
213//______________________________________________________________________
214Int_t AliITSdcsSSD::GetNInvalidN() {
215 // get number of invalid N
216
217 return fInvalidN->GetSize();
218}
219//_____________________________________________________________________
220
221
222
223
224