]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSgeomSPD300.cxx
update info about cvs installation using cvs account
[u/mrichter/AliRoot.git] / ITS / AliITSgeomSPD300.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.4  2000/06/10 20:34:37  nilsen
19 Fixed compilation warning with HP unix.
20
21 Revision 1.3  2000/06/10 10:43:04  nilsen
22 Fixed bug in copy and operator =.
23
24
25 */
26
27 #include "AliITSgeomSPD300.h"
28
29 ClassImp(AliITSgeomSPD300)
30
31 AliITSgeomSPD300::AliITSgeomSPD300(){
32 ////////////////////////////////////////////////////////////////////////
33 //    default constructor, for ITS TDR geometry.
34 ////////////////////////////////////////////////////////////////////////
35 const 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.
39 const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
40 const Int_t   knbinx = 256;    // number of pixels along x direction.
41 const Float_t kbinz0 = 0.0300; // cm; Standard pixel size in z direction.
42 const Int_t   knbinz = 279;    // number of pixels along z direction.
43     Int_t i;
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.
52     for(i=0;i<fNbinx;i++) fBinSizeX[i] = kbinx0; // default x bin size.
53     fBinSizeZ = new Float_t[fNbinz]; // array of bin sizes along z.
54     for(i=0;i<fNbinz;i++) fBinSizeZ[i] = kbinz0; // default z bin size.
55
56     // correct detector size for bin size.
57     fdx = 0.0;
58     for(i=0;i<fNbinx;i++) fdx +=fBinSizeX[i];
59     fdx *= 0.5;
60     fdz = 0.0;
61     for(i=0;i<fNbinz;i++) fdz +=fBinSizeZ[i];
62     fdz *= 0.5;
63
64     fShapeSPD = new TBRIK("ActiveSPD","Active volume of SPD","SPD SI DET",
65                           fdx,fdy,fdz);
66 }
67 //______________________________________________________________________
68 AliITSgeomSPD300::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 ////////////////////////////////////////////////////////////////////////
73     Int_t i;
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.
81     for(i=0;i<fNbinx;i++) fBinSizeX[i] = bx[i]; // new x bin size.
82     fBinSizeZ = new Float_t[fNbinz]; // array of bin sizes along z.
83     for(i=0;i<fNbinz;i++) fBinSizeZ[i] = bz[i]; // new z bin size.
84
85     // correct detector size for bin size.
86     for(i=0;i<fNbinx;i++) fdx +=fBinSizeX[i];
87     fdx *= 0.5;
88     for(i=0;i<fNbinz;i++) fdz +=fBinSizeZ[i];
89     fdz *= 0.5;
90
91     fShapeSPD = new TBRIK("ActiveSPD","Active volume of SPD","SPD SI DET",
92                           fdx,fdy,fdz);
93 }
94 //______________________________________________________________________
95 AliITSgeomSPD300::AliITSgeomSPD300(AliITSgeomSPD300 &source){
96   // copy constructor
97     Int_t i;
98     if(&source == this) return;
99     this->fShapeSPD = new TBRIK(*(source.fShapeSPD));
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];
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];
111 }
112 //______________________________________________________________________
113 AliITSgeomSPD300& AliITSgeomSPD300::operator=(AliITSgeomSPD300 &source){
114   // = operator
115     Int_t i;
116     if(&source == this) return *this;
117     this->fShapeSPD = new TBRIK(*(source.fShapeSPD));
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];
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];
129     return *this;
130 }
131 //______________________________________________________________________
132 AliITSgeomSPD300::~AliITSgeomSPD300(){
133   // destructor
134     delete[] fBinSizeX;
135     delete[] fBinSizeZ;
136     delete   fShapeSPD;
137 }
138 //______________________________________________________________________
139 void 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 ////////////////////////////////////////////////////////////////////////
144     Int_t i;
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.
153     for(i=0;i<fNbinx;i++) fBinSizeX[i] = bx[i]; // new x bin size.
154     if(fBinSizeZ!=0) delete[] fBinSizeZ;
155     fBinSizeZ = new Float_t[fNbinz]; // array of bin sizes along z.
156     for(i=0;i<fNbinz;i++) fBinSizeZ[i] = bz[i]; // new z bin size.
157
158     // correct detector size for bin size.
159     for(i=0;i<fNbinx;i++) fdx +=fBinSizeX[i];
160     fdx *= 0.5;
161     for(i=0;i<fNbinz;i++) fdz +=fBinSizeZ[i];
162     fdz *= 0.5;
163
164     fShapeSPD = new TBRIK("ActiveSPD","Active volume of SPD","SPD SI DET",
165                           fdx,fdy,fdz);
166 }
167 //----------------------------------------------------------------------
168 void 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 //----------------------------------------------------------------------