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