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