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