]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSgeomSPD425.cxx
New ITS code replacing the old structure and simulations code.
[u/mrichter/AliRoot.git] / ITS / AliITSgeomSPD425.cxx
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$
18 Revision 1.1.2.6  2000/06/12 18:10:18  barbera
19 fixed posible compilation errors on HP unix
20
21 Revision 1.1.2.5  2000/06/11 20:30:56  barbera
22 Minore changes.
23
24 Revision 1.4  2000/06/10 20:34:22  nilsen
25 Fixed compilation warning with HP unix.
26
27 Revision 1.3  2000/06/10 10:42:49  nilsen
28 Fixed bug in copy and operator =.
29
30
31 */
32
33 #include <TShape.h>
34
35 #include "AliITSgeomSPD425.h"
36
37 ClassImp(AliITSgeomSPD425)
38
39 AliITSgeomSPD425::AliITSgeomSPD425(){
40 ////////////////////////////////////////////////////////////////////////
41 //    default constructor, for ITS post TDR geometry.
42 ////////////////////////////////////////////////////////////////////////
43
44 const Float_t kdx=0.6400,kdy=0.0075,kdz=4.23625;// cm; Standard pixel detector
45                                                 // size is 2dx wide, 2dz long,
46                                                 // and 2dy thick. Geant 3.12
47                                                 // units.
48 const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
49 const Int_t   knbinx = 256;    // number of pixels along x direction.
50 const Float_t kbinz0 = 0.0425; // cm; Standard pixel size in z direction.
51 const Float_t kbinz1 = 0.0625; // cm; Special pixel size in z direction.
52 const Int_t   knbinz = 197;    // number of pixels along z direction.
53     Int_t i;
54
55     fdx = kdx;  // default value.
56     fdy = kdy;  // default value.
57     fdz = kdz;  // default value.
58     fNbinx = knbinx; // default number of bins in x.
59     fNbinz = knbinz; // default number of bins in z.
60
61     fBinSizeX = new Float_t[fNbinx]; // array of bin sizes along x.
62     for(i=0;i<fNbinx;i++) fBinSizeX[i] = kbinx0; // default x bin size.
63     fBinSizeZ = new Float_t[fNbinz]; // array of bin sizes along z.
64     for(i=0;i<fNbinz;i++) fBinSizeZ[i] = kbinz0; // default z bin size.
65     fBinSizeZ[ 31] = kbinz1;
66     fBinSizeZ[ 32] = kbinz1;
67
68     fBinSizeZ[ 64] = kbinz1;
69     fBinSizeZ[ 65] = kbinz1;
70
71     fBinSizeZ[ 97] = kbinz1;
72     fBinSizeZ[ 98] = kbinz1;
73
74     fBinSizeZ[130] = kbinz1;
75     fBinSizeZ[131] = kbinz1;
76
77     fBinSizeZ[163] = kbinz1;
78     fBinSizeZ[164] = kbinz1;
79
80     // correct detector size for bin size.
81     fdx = 0.0;
82     for(i=0;i<fNbinx;i++) fdx +=fBinSizeX[i];
83     fdx *= 0.5;
84     fdz = 0.0;
85     for(i=0;i<fNbinz;i++) fdz +=fBinSizeZ[i];
86     fdz *= 0.5;
87
88     fShapeSPD = new TBRIK("ActiveSPD","Active volume of SPD","SPD SI DET",
89                           fdx,fdy,fdz);
90 }
91 //______________________________________________________________________
92 AliITSgeomSPD425::AliITSgeomSPD425(Float_t dy,Int_t nx,Float_t *bx,
93                                                 Int_t nz,Float_t *bz){
94 ////////////////////////////////////////////////////////////////////////
95 //    default constructor, for a User modified TDR based geometry.
96 ////////////////////////////////////////////////////////////////////////
97     Int_t i;
98     fdx = 0.0;
99     fdy =  dy;
100     fdz = 0.0;
101     fNbinx = nx; // new number of bins in x.
102     fNbinz = nz; // new number of bins in z.
103
104     fBinSizeX = new Float_t[fNbinx]; // array of bin sizes along x.
105     for(i=0;i<fNbinx;i++) fBinSizeX[i] = bx[i]; // new x bin size.
106     fBinSizeZ = new Float_t[fNbinz]; // array of bin sizes along z.
107     for(i=0;i<fNbinz;i++) fBinSizeZ[i] = bz[i]; // new z bin size.
108
109     // correct detector size for bin size.
110     for(i=0;i<fNbinx;i++) fdx +=fBinSizeX[i];
111     fdx *= 0.5;
112     for(i=0;i<fNbinz;i++) fdz +=fBinSizeZ[i];
113     fdz *= 0.5;
114
115     fShapeSPD = new TBRIK("ActiveSPD","Active volume of SPD","SPD SI DET",
116                           fdx,fdy,fdz);
117 }
118 //______________________________________________________________________
119 AliITSgeomSPD425::AliITSgeomSPD425(AliITSgeomSPD425 &source){
120   // copy constructor
121     Int_t i;
122     if(&source == this) return;
123     this->fShapeSPD = new TBRIK(*(source.fShapeSPD));
124     this->fdx = source.fdx;
125     this->fdy = source.fdy;
126     this->fdz = source.fdz;
127     if(this->fBinSizeX) delete[] this->fBinSizeX; 
128     if(this->fBinSizeX) delete[] this->fBinSizeZ;
129     this->fNbinx = source.fNbinx;
130     this->fBinSizeX = new Float_t[this->fNbinx];
131     this->fNbinz = source.fNbinz;
132     this->fBinSizeZ = new Float_t[this->fNbinz];
133     for(i=0;i<fNbinx;i++) this->fBinSizeX[i] = source.fBinSizeX[i];
134     for(i=0;i<fNbinz;i++) this->fBinSizeZ[i] = source.fBinSizeZ[i];
135 }
136 //______________________________________________________________________
137 AliITSgeomSPD425& AliITSgeomSPD425::operator=(AliITSgeomSPD425 &source){
138   // = operator
139     Int_t i;
140     if(&source == this) return *this;
141     this->fShapeSPD = new TBRIK(*(source.fShapeSPD));
142     this->fdx = source.fdx;
143     this->fdy = source.fdy;
144     this->fdz = source.fdz;
145     if(this->fBinSizeX) delete[] this->fBinSizeX; 
146     if(this->fBinSizeX) delete[] this->fBinSizeZ;
147     this->fNbinx = source.fNbinx;
148     this->fBinSizeX = new Float_t[this->fNbinx];
149     this->fNbinz = source.fNbinz;
150     this->fBinSizeZ = new Float_t[this->fNbinz];
151     for(i=0;i<fNbinx;i++) this->fBinSizeX[i] = source.fBinSizeX[i];
152     for(i=0;i<fNbinz;i++) this->fBinSizeZ[i] = source.fBinSizeZ[i];
153     return *this;
154 }
155 //______________________________________________________________________
156 AliITSgeomSPD425::~AliITSgeomSPD425(){
157   // destructor
158     delete[] fBinSizeX;
159     delete[] fBinSizeZ;
160     delete   fShapeSPD;
161 }
162 //______________________________________________________________________
163 void AliITSgeomSPD425::ReSetBins(Float_t dy,Int_t nx,Float_t *bx,
164                                         Int_t nz,Float_t *bz){
165 ////////////////////////////////////////////////////////////////////////
166 //    default constructor, for a User modified TDR based geometry.
167 ////////////////////////////////////////////////////////////////////////
168     Int_t i;
169     fdx = 0.0;
170     fdy =  dy;
171     fdz = 0.0;
172     fNbinx = nx; // new number of bins in x.
173     fNbinz = nz; // new number of bins in z.
174
175     if(fBinSizeX!=0) delete[] fBinSizeX;
176     fBinSizeX = new Float_t[fNbinx]; // array of bin sizes along x.
177     for(i=0;i<fNbinx;i++) fBinSizeX[i] = bx[i]; // new x bin size.
178     if(fBinSizeZ!=0) delete[] fBinSizeZ;
179     fBinSizeZ = new Float_t[fNbinz]; // array of bin sizes along z.
180     for(i=0;i<fNbinz;i++) fBinSizeZ[i] = bz[i]; // new z bin size.
181
182     // correct detector size for bin size.
183     for(i=0;i<fNbinx;i++) fdx +=fBinSizeX[i];
184     fdx *= 0.5;
185     for(i=0;i<fNbinz;i++) fdz +=fBinSizeZ[i];
186     fdz *= 0.5;
187
188     fShapeSPD = new TBRIK("ActiveSPD","Active volume of SPD","SPD SI DET",
189                           fdx,fdy,fdz);
190 }
191 //----------------------------------------------------------------------
192 void AliITSgeomSPD425::Streamer(TBuffer &R__b){
193     // Streamer function for the class AliITSgeomSPD425.
194     Int_t i;
195     UInt_t R__s, R__c;
196
197     if(R__b.IsReading()){
198         Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
199         if(R__v==1){
200             TObject::Streamer(R__b);
201             fShapeSPD->Streamer(R__b);
202             R__b >> fdx;
203             R__b >> fdy;
204             R__b >> fdz;
205         }else if (R__v==2){
206             AliITSgeomSPD::Streamer(R__b);
207             fShapeSPD->Streamer(R__b);
208             R__b >> fdx;
209             R__b >> fdy;
210             R__b >> fdz;
211             R__b >> fNbinx;
212             if(fBinSizeX!=0) delete[] fBinSizeX;
213             fBinSizeX = new Float_t[fNbinx];
214             for(i=0;i<fNbinx;i++) R__b >> fBinSizeX[i];
215             R__b >> fNbinz;
216             if(fBinSizeZ!=0) delete[] fBinSizeZ;
217             fBinSizeZ = new Float_t[fNbinz];
218             for(i=0;i<fNbinz;i++) R__b >> fBinSizeZ[i];
219             R__b.CheckByteCount(R__s, R__c, AliITSgeomSPD425::IsA());
220         } // end if R__v==1
221     } else { // IsWriting.
222         R__c = R__b.WriteVersion(AliITSgeomSPD425::IsA(), kTRUE);
223         AliITSgeomSPD::Streamer(R__b);
224         fShapeSPD->Streamer(R__b);
225         R__b << fdx;
226         R__b << fdy;
227         R__b << fdz;
228         R__b << fNbinx;
229         for(i=0;i<fNbinx;i++) R__b << fBinSizeX[i];
230         R__b << fNbinz;
231         for(i=0;i<fNbinz;i++) R__b << fBinSizeZ[i];
232         R__b.SetByteCount(R__c, kTRUE);
233     } // end if R__b.IsReading()
234 }
235 //----------------------------------------------------------------------