]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSdcsSSD.cxx
Correct the number of buspatches for station 1 & 2 and for R2 & R3 type slat (Christian)
[u/mrichter/AliRoot.git] / ITS / AliITSdcsSSD.cxx
CommitLineData
92c19c36 1#include <TRandom.h>
2#include <TArrayS.h>
b0f5e3fc 3
4#include "AliITSdcsSSD.h"
5#include "AliITSresponseSSD.h"
6#include "AliITSsegmentationSSD.h"
7d62fb64 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///////////////////////////////////////////////////////////////////////////
b0f5e3fc 23
24ClassImp(AliITSdcsSSD)
25
b0f5e3fc 26// Constructor and Destructor
46e97372 27//______________________________________________________________________
28AliITSdcsSSD::AliITSdcsSSD(){
29 // Default Constructor
b0f5e3fc 30
46e97372 31 fInvalidP = 0;
32 fInvalidN = 0;
33}
34//______________________________________________________________________
35AliITSdcsSSD::AliITSdcsSSD(AliITSsegmentation *seg, AliITSresponse *resp){
36 // Standard constructor
b0f5e3fc 37
aacedc3e 38 fNstrips =(Float_t) (((AliITSsegmentationSSD*)seg)->Npx());
b0f5e3fc 39
40 fInvalidP = new TArrayS();
41 fInvalidN = new TArrayS();
42
aacedc3e 43 Int_t npar=((AliITSresponseSSD*)resp)->NDetParam();
b0f5e3fc 44 if (npar < 6) {
46e97372 45 Warning("AliITSdcsSSD","I need 6 parameters ");
46 npar=6;
47 } // end if
b0f5e3fc 48
aacedc3e 49 Double_t *detpar= new Double_t[npar];
50 ((AliITSresponseSSD*)resp)->GetDetParam(detpar);
b0f5e3fc 51
52 fNInvalid = detpar[0];
46e97372 53 fISigma = detpar[1];
b0f5e3fc 54
55 fCouplingPR = detpar[2];
56 fCouplingPL = detpar[3];
57 fCouplingNR = detpar[4];
46e97372 58 fCouplingNL = detpar[5];
b0f5e3fc 59
e8189707 60 char opt[30],dummy[20];
aacedc3e 61 ((AliITSresponseSSD*)resp)->ParamOptions(opt,dummy);
b0f5e3fc 62 if (strstr(opt,"SetInvalid")) SetInvalidMC(fNInvalid,fISigma);
63
e8189707 64 delete [] detpar;
b0f5e3fc 65}
46e97372 66//______________________________________________________________________
b0f5e3fc 67AliITSdcsSSD::~AliITSdcsSSD() {
46e97372 68 // destructor
69
b0f5e3fc 70 delete fInvalidP;
71 delete fInvalidN;
72}
46e97372 73//______________________________________________________________________
ac74f489 74AliITSdcsSSD::AliITSdcsSSD(const AliITSdcsSSD &source) : TObject(source){
46e97372 75 // Copy Constructor
76
77 if(&source == this) return;
b0f5e3fc 78
46e97372 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}
b0f5e3fc 91//_________________________________________________________________________
46e97372 92AliITSdcsSSD& 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;
b0f5e3fc 108}
b0f5e3fc 109//_____________________________________________________________________
110//
111// Methods for creating invalid strips
112//_____________________________________________________________________
b0f5e3fc 113void AliITSdcsSSD::SetInvalidMC(Float_t mean, Float_t sigma) {
46e97372 114 // set invalid MC
115
b0f5e3fc 116 SetInvalidParam(mean, sigma);
117 SetInvalidMC();
118}
46e97372 119//______________________________________________________________________
b0f5e3fc 120void AliITSdcsSSD::SetInvalidMC() {
46e97372 121 // set invalid MC
b0f5e3fc 122 Int_t pside;
123 Int_t nside;
124 Int_t i;
125 Int_t strip;
126
46e97372 127 pside = (Int_t)gRandom->Gaus(fNInvalid, fISigma);
128 nside = (Int_t)gRandom->Gaus(fNInvalid, fISigma);
b0f5e3fc 129
130 fInvalidP->Set(pside);
131 fInvalidN->Set(nside);
132
133 for(i=0 ;i<pside; i++) {
46e97372 134 strip = (Int_t)(gRandom->Rndm() * fNstrips);
b0f5e3fc 135 fInvalidP->AddAt(strip, i);
46e97372 136 } // end for i
b0f5e3fc 137
138 for(i=0 ;i<nside; i++) {
46e97372 139 strip = (Int_t)(gRandom->Rndm() * fNstrips);
b0f5e3fc 140 fInvalidN->AddAt(strip, i);
46e97372 141 } // end for i
b0f5e3fc 142}
46e97372 143//______________________________________________________________________
b0f5e3fc 144void AliITSdcsSSD::SetInvalidParam(Float_t mean, Float_t sigma) {
46e97372 145 // set invalid param
146
b0f5e3fc 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}
46e97372 156//______________________________________________________________________
7d62fb64 157void AliITSdcsSSD::GetInvalidParam(Float_t &mean, Float_t &sigma) const {
46e97372 158 // get invalid param
159
b0f5e3fc 160 mean = fNInvalid;
161 sigma = fISigma;
b0f5e3fc 162}
b0f5e3fc 163//_____________________________________________________________________
164//
165// Methods for accessing to invalid strips
166//_____________________________________________________________________
b0f5e3fc 167Bool_t AliITSdcsSSD::IsValidP(Int_t strip) {
46e97372 168 // isvalidP
b0f5e3fc 169 Int_t nElem = fInvalidP->GetSize();
46e97372 170
171 for(Int_t i = 0; i<nElem; i++) if(fInvalidP->At(i) == strip) return kFALSE;
b0f5e3fc 172 return kTRUE;
173}
46e97372 174//______________________________________________________________________
b0f5e3fc 175Bool_t AliITSdcsSSD::IsValidN(Int_t strip) {
46e97372 176 // is valid N
b0f5e3fc 177 Int_t nElem = fInvalidN->GetSize();
46e97372 178
179 for(Int_t i = 0; i<nElem; i++) if(fInvalidN->At(i) == strip) return kFALSE;
b0f5e3fc 180 return kTRUE;
181}
46e97372 182//______________________________________________________________________
b0f5e3fc 183TArrayS* AliITSdcsSSD::GetInvalidP() {
46e97372 184 // get invalid P
185
b0f5e3fc 186 return fInvalidP;
187}
46e97372 188//______________________________________________________________________
b0f5e3fc 189TArrayS* AliITSdcsSSD::GetInvalidN() {
46e97372 190 // get invalid N
191
b0f5e3fc 192 return fInvalidN;
193}
46e97372 194//______________________________________________________________________
b0f5e3fc 195Int_t AliITSdcsSSD::GetNInvalidP(){
46e97372 196 // get numeber of invalid P
197
b0f5e3fc 198 return fInvalidP->GetSize();
199}
46e97372 200//______________________________________________________________________
b0f5e3fc 201Int_t AliITSdcsSSD::GetNInvalidN() {
46e97372 202 // get number of invalid N
203
b0f5e3fc 204 return fInvalidN->GetSize();
205}
b0f5e3fc 206//_____________________________________________________________________
207
208
209
210
211