]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSdcsSSD.cxx
Inverted logics (Panos)
[u/mrichter/AliRoot.git] / ITS / AliITSdcsSSD.cxx
CommitLineData
92c19c36 1#include <TRandom.h>
2#include <TArrayS.h>
b0f5e3fc 3
4#include "AliITSdcsSSD.h"
fcf95fc7 5#include "AliITSCalibrationSSD.h"
b0f5e3fc 6#include "AliITSresponseSSD.h"
7#include "AliITSsegmentationSSD.h"
7d62fb64 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///////////////////////////////////////////////////////////////////////////
b0f5e3fc 24
25ClassImp(AliITSdcsSSD)
26
b0f5e3fc 27// Constructor and Destructor
46e97372 28//______________________________________________________________________
7537d03c 29 AliITSdcsSSD::AliITSdcsSSD():
30fCouplingPR(0),
31fCouplingPL(0),
32fCouplingNR(0),
33fCouplingNL(0),
34fNstrips(0),
35fNInvalid(0),
36fISigma(0),
37fInvalidP(0),
38fInvalidN(0){
46e97372 39 // Default Constructor
b0f5e3fc 40
46e97372 41}
42//______________________________________________________________________
7537d03c 43AliITSdcsSSD::AliITSdcsSSD(AliITSsegmentation *seg, AliITSCalibration *resp):
44fCouplingPR(0),
45fCouplingPL(0),
46fCouplingNR(0),
47fCouplingNL(0),
48fNstrips(0),
49fNInvalid(0),
50fISigma(0),
51fInvalidP(0),
52fInvalidN(0){
46e97372 53 // Standard constructor
b0f5e3fc 54
aacedc3e 55 fNstrips =(Float_t) (((AliITSsegmentationSSD*)seg)->Npx());
b0f5e3fc 56
57 fInvalidP = new TArrayS();
58 fInvalidN = new TArrayS();
59
fcf95fc7 60 Int_t npar=((AliITSCalibrationSSD*)resp)->NDetParam();
b0f5e3fc 61 if (npar < 6) {
46e97372 62 Warning("AliITSdcsSSD","I need 6 parameters ");
63 npar=6;
64 } // end if
b0f5e3fc 65
aacedc3e 66 Double_t *detpar= new Double_t[npar];
fcf95fc7 67 resp->GetDetParam(detpar);
b0f5e3fc 68
69 fNInvalid = detpar[0];
46e97372 70 fISigma = detpar[1];
b0f5e3fc 71
72 fCouplingPR = detpar[2];
73 fCouplingPL = detpar[3];
74 fCouplingNR = detpar[4];
46e97372 75 fCouplingNL = detpar[5];
b0f5e3fc 76
e8189707 77 char opt[30],dummy[20];
fcf95fc7 78 ((AliITSCalibrationSSD*)resp)->GetParamOptions(opt,dummy);
b0f5e3fc 79 if (strstr(opt,"SetInvalid")) SetInvalidMC(fNInvalid,fISigma);
80
e8189707 81 delete [] detpar;
b0f5e3fc 82}
46e97372 83//______________________________________________________________________
b0f5e3fc 84AliITSdcsSSD::~AliITSdcsSSD() {
46e97372 85 // destructor
86
b0f5e3fc 87 delete fInvalidP;
88 delete fInvalidN;
89}
46e97372 90//______________________________________________________________________
7537d03c 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){
46e97372 101 // Copy Constructor
102
46e97372 103}
b0f5e3fc 104//_________________________________________________________________________
46e97372 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;
b0f5e3fc 121}
b0f5e3fc 122//_____________________________________________________________________
123//
124// Methods for creating invalid strips
125//_____________________________________________________________________
b0f5e3fc 126void AliITSdcsSSD::SetInvalidMC(Float_t mean, Float_t sigma) {
46e97372 127 // set invalid MC
128
b0f5e3fc 129 SetInvalidParam(mean, sigma);
130 SetInvalidMC();
131}
46e97372 132//______________________________________________________________________
b0f5e3fc 133void AliITSdcsSSD::SetInvalidMC() {
46e97372 134 // set invalid MC
b0f5e3fc 135 Int_t pside;
136 Int_t nside;
137 Int_t i;
138 Int_t strip;
139
46e97372 140 pside = (Int_t)gRandom->Gaus(fNInvalid, fISigma);
141 nside = (Int_t)gRandom->Gaus(fNInvalid, fISigma);
b0f5e3fc 142
143 fInvalidP->Set(pside);
144 fInvalidN->Set(nside);
145
146 for(i=0 ;i<pside; i++) {
46e97372 147 strip = (Int_t)(gRandom->Rndm() * fNstrips);
b0f5e3fc 148 fInvalidP->AddAt(strip, i);
46e97372 149 } // end for i
b0f5e3fc 150
151 for(i=0 ;i<nside; i++) {
46e97372 152 strip = (Int_t)(gRandom->Rndm() * fNstrips);
b0f5e3fc 153 fInvalidN->AddAt(strip, i);
46e97372 154 } // end for i
b0f5e3fc 155}
46e97372 156//______________________________________________________________________
b0f5e3fc 157void AliITSdcsSSD::SetInvalidParam(Float_t mean, Float_t sigma) {
46e97372 158 // set invalid param
159
b0f5e3fc 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}
46e97372 169//______________________________________________________________________
7d62fb64 170void AliITSdcsSSD::GetInvalidParam(Float_t &mean, Float_t &sigma) const {
46e97372 171 // get invalid param
172
b0f5e3fc 173 mean = fNInvalid;
174 sigma = fISigma;
b0f5e3fc 175}
b0f5e3fc 176//_____________________________________________________________________
177//
178// Methods for accessing to invalid strips
179//_____________________________________________________________________
b0f5e3fc 180Bool_t AliITSdcsSSD::IsValidP(Int_t strip) {
46e97372 181 // isvalidP
b0f5e3fc 182 Int_t nElem = fInvalidP->GetSize();
46e97372 183
184 for(Int_t i = 0; i<nElem; i++) if(fInvalidP->At(i) == strip) return kFALSE;
b0f5e3fc 185 return kTRUE;
186}
46e97372 187//______________________________________________________________________
b0f5e3fc 188Bool_t AliITSdcsSSD::IsValidN(Int_t strip) {
46e97372 189 // is valid N
b0f5e3fc 190 Int_t nElem = fInvalidN->GetSize();
46e97372 191
192 for(Int_t i = 0; i<nElem; i++) if(fInvalidN->At(i) == strip) return kFALSE;
b0f5e3fc 193 return kTRUE;
194}
46e97372 195//______________________________________________________________________
b0f5e3fc 196TArrayS* AliITSdcsSSD::GetInvalidP() {
46e97372 197 // get invalid P
198
b0f5e3fc 199 return fInvalidP;
200}
46e97372 201//______________________________________________________________________
b0f5e3fc 202TArrayS* AliITSdcsSSD::GetInvalidN() {
46e97372 203 // get invalid N
204
b0f5e3fc 205 return fInvalidN;
206}
46e97372 207//______________________________________________________________________
b0f5e3fc 208Int_t AliITSdcsSSD::GetNInvalidP(){
46e97372 209 // get numeber of invalid P
210
b0f5e3fc 211 return fInvalidP->GetSize();
212}
46e97372 213//______________________________________________________________________
b0f5e3fc 214Int_t AliITSdcsSSD::GetNInvalidN() {
46e97372 215 // get number of invalid N
216
b0f5e3fc 217 return fInvalidN->GetSize();
218}
b0f5e3fc 219//_____________________________________________________________________
220
221
222
223
224