Release version of ITS code
[u/mrichter/AliRoot.git] / ITS / AliITSgeomSPD300.cxx
CommitLineData
50037af7 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/*
17$Log$
3bd79107 18Revision 1.4 2000/06/10 20:34:37 nilsen
19Fixed compilation warning with HP unix.
20
b3acdf28 21Revision 1.3 2000/06/10 10:43:04 nilsen
22Fixed bug in copy and operator =.
23
50037af7 24
25*/
26
27#include "AliITSgeomSPD300.h"
28
29ClassImp(AliITSgeomSPD300)
30
31AliITSgeomSPD300::AliITSgeomSPD300(){
32////////////////////////////////////////////////////////////////////////
33// default constructor, for ITS TDR geometry.
34////////////////////////////////////////////////////////////////////////
35const Float_t kdx=0.6400,kdy=0.0075,kdz=4.1890; // cm; Standard pixel detector
36 // size is 2dx wide, 2dz long,
37 // and 2dy thick. Geant 3.12
38 // units.
39const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
40const Int_t knbinx = 256; // number of pixels along x direction.
41const Float_t kbinz0 = 0.0300; // cm; Standard pixel size in z direction.
42const Int_t knbinz = 279; // number of pixels along z direction.
b3acdf28 43 Int_t i;
50037af7 44
45 fdx = kdx; // default value.
46 fdy = kdy; // default value.
47 fdz = kdz; // default value.
48 fNbinx = knbinx; // default number of bins in x.
49 fNbinz = knbinz; // default number of bins in z.
50
51 fBinSizeX = new Float_t[fNbinx]; // array of bin sizes along x.
b3acdf28 52 for(i=0;i<fNbinx;i++) fBinSizeX[i] = kbinx0; // default x bin size.
50037af7 53 fBinSizeZ = new Float_t[fNbinz]; // array of bin sizes along z.
b3acdf28 54 for(i=0;i<fNbinz;i++) fBinSizeZ[i] = kbinz0; // default z bin size.
50037af7 55
56 // correct detector size for bin size.
57 fdx = 0.0;
3bd79107 58 for(i=0;i<fNbinx;i++) fdx +=fBinSizeX[i];
50037af7 59 fdx *= 0.5;
60 fdz = 0.0;
3bd79107 61 for(i=0;i<fNbinz;i++) fdz +=fBinSizeZ[i];
50037af7 62 fdz *= 0.5;
63
64 fShapeSPD = new TBRIK("ActiveSPD","Active volume of SPD","SPD SI DET",
65 fdx,fdy,fdz);
66}
67//______________________________________________________________________
68AliITSgeomSPD300::AliITSgeomSPD300(Float_t dy,Int_t nx,Float_t *bx,
69 Int_t nz,Float_t *bz){
70////////////////////////////////////////////////////////////////////////
71// default constructor, for a User modified TDR based geometry.
72////////////////////////////////////////////////////////////////////////
b3acdf28 73 Int_t i;
50037af7 74 fdx = 0.0;
75 fdy = dy;
76 fdz = 0.0;
77 fNbinx = nx; // new number of bins in x.
78 fNbinz = nz; // new number of bins in z.
79
80 fBinSizeX = new Float_t[fNbinx]; // array of bin sizes along x.
b3acdf28 81 for(i=0;i<fNbinx;i++) fBinSizeX[i] = bx[i]; // new x bin size.
50037af7 82 fBinSizeZ = new Float_t[fNbinz]; // array of bin sizes along z.
b3acdf28 83 for(i=0;i<fNbinz;i++) fBinSizeZ[i] = bz[i]; // new z bin size.
50037af7 84
85 // correct detector size for bin size.
b3acdf28 86 for(i=0;i<fNbinx;i++) fdx +=fBinSizeX[i];
50037af7 87 fdx *= 0.5;
b3acdf28 88 for(i=0;i<fNbinz;i++) fdz +=fBinSizeZ[i];
50037af7 89 fdz *= 0.5;
90
91 fShapeSPD = new TBRIK("ActiveSPD","Active volume of SPD","SPD SI DET",
92 fdx,fdy,fdz);
93}
94//______________________________________________________________________
95AliITSgeomSPD300::AliITSgeomSPD300(AliITSgeomSPD300 &source){
96 // copy constructor
b3acdf28 97 Int_t i;
50037af7 98 if(&source == this) return;
93a31784 99 this->fShapeSPD = new TBRIK(*(source.fShapeSPD));
50037af7 100 this->fdx = source.fdx;
101 this->fdy = source.fdy;
102 this->fdz = source.fdz;
103 if(this->fBinSizeX) delete[] this->fBinSizeX;
104 if(this->fBinSizeX) delete[] this->fBinSizeZ;
105 this->fNbinx = source.fNbinx;
106 this->fBinSizeX = new Float_t[this->fNbinx];
107 this->fNbinz = source.fNbinz;
108 this->fBinSizeZ = new Float_t[this->fNbinz];
b3acdf28 109 for(i=0;i<fNbinx;i++) this->fBinSizeX[i] = source.fBinSizeX[i];
110 for(i=0;i<fNbinz;i++) this->fBinSizeZ[i] = source.fBinSizeZ[i];
50037af7 111}
112//______________________________________________________________________
113AliITSgeomSPD300& AliITSgeomSPD300::operator=(AliITSgeomSPD300 &source){
114 // = operator
b3acdf28 115 Int_t i;
50037af7 116 if(&source == this) return *this;
93a31784 117 this->fShapeSPD = new TBRIK(*(source.fShapeSPD));
50037af7 118 this->fdx = source.fdx;
119 this->fdy = source.fdy;
120 this->fdz = source.fdz;
121 if(this->fBinSizeX) delete[] this->fBinSizeX;
122 if(this->fBinSizeX) delete[] this->fBinSizeZ;
123 this->fNbinx = source.fNbinx;
124 this->fBinSizeX = new Float_t[this->fNbinx];
125 this->fNbinz = source.fNbinz;
126 this->fBinSizeZ = new Float_t[this->fNbinz];
b3acdf28 127 for(i=0;i<fNbinx;i++) this->fBinSizeX[i] = source.fBinSizeX[i];
128 for(i=0;i<fNbinz;i++) this->fBinSizeZ[i] = source.fBinSizeZ[i];
50037af7 129 return *this;
130}
131//______________________________________________________________________
132AliITSgeomSPD300::~AliITSgeomSPD300(){
133 // destructor
134 delete[] fBinSizeX;
135 delete[] fBinSizeZ;
136 delete fShapeSPD;
137}
138//______________________________________________________________________
139void AliITSgeomSPD300::ReSetBins(Float_t dy,Int_t nx,Float_t *bx,
140 Int_t nz,Float_t *bz){
141////////////////////////////////////////////////////////////////////////
142// default constructor, for a User modified TDR based geometry.
143////////////////////////////////////////////////////////////////////////
b3acdf28 144 Int_t i;
50037af7 145 fdx = 0.0;
146 fdy = dy;
147 fdz = 0.0;
148 fNbinx = nx; // new number of bins in x.
149 fNbinz = nz; // new number of bins in z.
150
151 if(fBinSizeX!=0) delete[] fBinSizeX;
152 fBinSizeX = new Float_t[fNbinx]; // array of bin sizes along x.
b3acdf28 153 for(i=0;i<fNbinx;i++) fBinSizeX[i] = bx[i]; // new x bin size.
50037af7 154 if(fBinSizeZ!=0) delete[] fBinSizeZ;
155 fBinSizeZ = new Float_t[fNbinz]; // array of bin sizes along z.
b3acdf28 156 for(i=0;i<fNbinz;i++) fBinSizeZ[i] = bz[i]; // new z bin size.
50037af7 157
158 // correct detector size for bin size.
b3acdf28 159 for(i=0;i<fNbinx;i++) fdx +=fBinSizeX[i];
50037af7 160 fdx *= 0.5;
b3acdf28 161 for(i=0;i<fNbinz;i++) fdz +=fBinSizeZ[i];
50037af7 162 fdz *= 0.5;
163
164 fShapeSPD = new TBRIK("ActiveSPD","Active volume of SPD","SPD SI DET",
165 fdx,fdy,fdz);
166}
167//----------------------------------------------------------------------
168void AliITSgeomSPD300::Streamer(TBuffer &R__b){
169 // Streamer function for the class AliItSgeomSPD300.
170 Int_t i;
171 UInt_t R__s, R__c;
172
173 if(R__b.IsReading()){
174 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
175 if(R__v==1){
176 TObject::Streamer(R__b);
177 fShapeSPD->Streamer(R__b);
178 R__b >> fdx;
179 R__b >> fdy;
180 R__b >> fdz;
181 }else if (R__v==2){
182 AliITSgeomSPD::Streamer(R__b);
183 fShapeSPD->Streamer(R__b);
184 R__b >> fdx;
185 R__b >> fdy;
186 R__b >> fdz;
187 R__b >> fNbinx;
188 if(fBinSizeX!=0) delete[] fBinSizeX;
189 fBinSizeX = new Float_t[fNbinx];
190 for(i=0;i<fNbinx;i++) R__b >> fBinSizeX[i];
191 R__b >> fNbinz;
192 if(fBinSizeZ!=0) delete[] fBinSizeZ;
193 fBinSizeZ = new Float_t[fNbinz];
194 for(i=0;i<fNbinz;i++) R__b >> fBinSizeZ[i];
195 R__b.CheckByteCount(R__s, R__c, AliITSgeomSPD300::IsA());
196 } // end if R__v==1
197 } else { // IsWriting.
198 R__c = R__b.WriteVersion(AliITSgeomSPD300::IsA(), kTRUE);
199 AliITSgeomSPD::Streamer(R__b);
200 fShapeSPD->Streamer(R__b);
201 R__b << fdx;
202 R__b << fdy;
203 R__b << fdz;
204 R__b << fNbinx;
205 for(i=0;i<fNbinx;i++) R__b << fBinSizeX[i];
206 R__b << fNbinz;
207 for(i=0;i<fNbinz;i++) R__b << fBinSizeZ[i];
208 R__b.SetByteCount(R__c, kTRUE);
209 } // end if R__b.IsReading()
210}
211//----------------------------------------------------------------------