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