]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSdcsSSD.cxx
Minor fixes in the event tag to take into account the new way of storing the trigger...
[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//______________________________________________________________________
29AliITSdcsSSD::AliITSdcsSSD(){
30 // Default Constructor
b0f5e3fc 31
46e97372 32 fInvalidP = 0;
33 fInvalidN = 0;
34}
35//______________________________________________________________________
fcf95fc7 36AliITSdcsSSD::AliITSdcsSSD(AliITSsegmentation *seg, AliITSCalibration *resp){
46e97372 37 // Standard constructor
b0f5e3fc 38
aacedc3e 39 fNstrips =(Float_t) (((AliITSsegmentationSSD*)seg)->Npx());
b0f5e3fc 40
41 fInvalidP = new TArrayS();
42 fInvalidN = new TArrayS();
43
fcf95fc7 44 Int_t npar=((AliITSCalibrationSSD*)resp)->NDetParam();
b0f5e3fc 45 if (npar < 6) {
46e97372 46 Warning("AliITSdcsSSD","I need 6 parameters ");
47 npar=6;
48 } // end if
b0f5e3fc 49
aacedc3e 50 Double_t *detpar= new Double_t[npar];
fcf95fc7 51 resp->GetDetParam(detpar);
b0f5e3fc 52
53 fNInvalid = detpar[0];
46e97372 54 fISigma = detpar[1];
b0f5e3fc 55
56 fCouplingPR = detpar[2];
57 fCouplingPL = detpar[3];
58 fCouplingNR = detpar[4];
46e97372 59 fCouplingNL = detpar[5];
b0f5e3fc 60
e8189707 61 char opt[30],dummy[20];
fcf95fc7 62 ((AliITSCalibrationSSD*)resp)->GetParamOptions(opt,dummy);
b0f5e3fc 63 if (strstr(opt,"SetInvalid")) SetInvalidMC(fNInvalid,fISigma);
64
e8189707 65 delete [] detpar;
b0f5e3fc 66}
46e97372 67//______________________________________________________________________
b0f5e3fc 68AliITSdcsSSD::~AliITSdcsSSD() {
46e97372 69 // destructor
70
b0f5e3fc 71 delete fInvalidP;
72 delete fInvalidN;
73}
46e97372 74//______________________________________________________________________
ac74f489 75AliITSdcsSSD::AliITSdcsSSD(const AliITSdcsSSD &source) : TObject(source){
46e97372 76 // Copy Constructor
77
78 if(&source == this) return;
b0f5e3fc 79
46e97372 80 this->fCouplingPR = source.fCouplingPR;
81 this->fCouplingPL = source.fCouplingPL;
82 this->fCouplingNR = source.fCouplingNR;
83 this->fCouplingNL = source.fCouplingNL;
84 this->fNstrips = source.fNstrips;
85 this->fNInvalid = source.fNInvalid;
86 this->fISigma = source.fISigma;
87 this->fInvalidP = source.fInvalidP;
88 this->fInvalidN = source.fInvalidN;
89
90 return;
91}
b0f5e3fc 92//_________________________________________________________________________
46e97372 93AliITSdcsSSD& AliITSdcsSSD::operator=(const AliITSdcsSSD &source) {
94 // Assignment operator
95
96 if(&source == this) return *this;
97
98 this->fCouplingPR = source.fCouplingPR;
99 this->fCouplingPL = source.fCouplingPL;
100 this->fCouplingNR = source.fCouplingNR;
101 this->fCouplingNL = source.fCouplingNL;
102 this->fNstrips = source.fNstrips;
103 this->fNInvalid = source.fNInvalid;
104 this->fISigma = source.fISigma;
105 this->fInvalidP = source.fInvalidP;
106 this->fInvalidN = source.fInvalidN;
107
108 return *this;
b0f5e3fc 109}
b0f5e3fc 110//_____________________________________________________________________
111//
112// Methods for creating invalid strips
113//_____________________________________________________________________
b0f5e3fc 114void AliITSdcsSSD::SetInvalidMC(Float_t mean, Float_t sigma) {
46e97372 115 // set invalid MC
116
b0f5e3fc 117 SetInvalidParam(mean, sigma);
118 SetInvalidMC();
119}
46e97372 120//______________________________________________________________________
b0f5e3fc 121void AliITSdcsSSD::SetInvalidMC() {
46e97372 122 // set invalid MC
b0f5e3fc 123 Int_t pside;
124 Int_t nside;
125 Int_t i;
126 Int_t strip;
127
46e97372 128 pside = (Int_t)gRandom->Gaus(fNInvalid, fISigma);
129 nside = (Int_t)gRandom->Gaus(fNInvalid, fISigma);
b0f5e3fc 130
131 fInvalidP->Set(pside);
132 fInvalidN->Set(nside);
133
134 for(i=0 ;i<pside; i++) {
46e97372 135 strip = (Int_t)(gRandom->Rndm() * fNstrips);
b0f5e3fc 136 fInvalidP->AddAt(strip, i);
46e97372 137 } // end for i
b0f5e3fc 138
139 for(i=0 ;i<nside; i++) {
46e97372 140 strip = (Int_t)(gRandom->Rndm() * fNstrips);
b0f5e3fc 141 fInvalidN->AddAt(strip, i);
46e97372 142 } // end for i
b0f5e3fc 143}
46e97372 144//______________________________________________________________________
b0f5e3fc 145void AliITSdcsSSD::SetInvalidParam(Float_t mean, Float_t sigma) {
46e97372 146 // set invalid param
147
b0f5e3fc 148 fNInvalid = mean;
149 fISigma = sigma;
150
151 fNInvalid = (fNInvalid<0)? 0 : fNInvalid;
152 fNInvalid = (fNInvalid>fNstrips)? fNstrips: fNInvalid;
153
154 fISigma = (fISigma < 0)? 0 : fISigma;
155 fISigma = (fISigma > fNstrips/10) ? fNstrips/10 : fISigma;
156}
46e97372 157//______________________________________________________________________
7d62fb64 158void AliITSdcsSSD::GetInvalidParam(Float_t &mean, Float_t &sigma) const {
46e97372 159 // get invalid param
160
b0f5e3fc 161 mean = fNInvalid;
162 sigma = fISigma;
b0f5e3fc 163}
b0f5e3fc 164//_____________________________________________________________________
165//
166// Methods for accessing to invalid strips
167//_____________________________________________________________________
b0f5e3fc 168Bool_t AliITSdcsSSD::IsValidP(Int_t strip) {
46e97372 169 // isvalidP
b0f5e3fc 170 Int_t nElem = fInvalidP->GetSize();
46e97372 171
172 for(Int_t i = 0; i<nElem; i++) if(fInvalidP->At(i) == strip) return kFALSE;
b0f5e3fc 173 return kTRUE;
174}
46e97372 175//______________________________________________________________________
b0f5e3fc 176Bool_t AliITSdcsSSD::IsValidN(Int_t strip) {
46e97372 177 // is valid N
b0f5e3fc 178 Int_t nElem = fInvalidN->GetSize();
46e97372 179
180 for(Int_t i = 0; i<nElem; i++) if(fInvalidN->At(i) == strip) return kFALSE;
b0f5e3fc 181 return kTRUE;
182}
46e97372 183//______________________________________________________________________
b0f5e3fc 184TArrayS* AliITSdcsSSD::GetInvalidP() {
46e97372 185 // get invalid P
186
b0f5e3fc 187 return fInvalidP;
188}
46e97372 189//______________________________________________________________________
b0f5e3fc 190TArrayS* AliITSdcsSSD::GetInvalidN() {
46e97372 191 // get invalid N
192
b0f5e3fc 193 return fInvalidN;
194}
46e97372 195//______________________________________________________________________
b0f5e3fc 196Int_t AliITSdcsSSD::GetNInvalidP(){
46e97372 197 // get numeber of invalid P
198
b0f5e3fc 199 return fInvalidP->GetSize();
200}
46e97372 201//______________________________________________________________________
b0f5e3fc 202Int_t AliITSdcsSSD::GetNInvalidN() {
46e97372 203 // get number of invalid N
204
b0f5e3fc 205 return fInvalidN->GetSize();
206}
b0f5e3fc 207//_____________________________________________________________________
208
209
210
211
212