]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSBaseGeometry.cxx
Radiator to Pad goes static.
[u/mrichter/AliRoot.git] / ITS / AliITSBaseGeometry.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   $Id:
17  */
18
19 #include <TObject.h>
20 #include <TObjArray.h>
21
22 //#include <TGeoArb8.h>
23 //#include <TGeoEltu.h>
24 //#include <TGeoOverlap.h>
25 //#include <TGeoTrack.h>
26 //#include <TGeoAtt.h>
27 //#include <TGeoManager.h>
28 //#include <TGeoPainter.h>
29 //#include <TGeoTrd1.h>
30 //#include <TGeoBBox.h>
31 #include <TGeoMaterial.h>
32 //#include <TGeoPara.h>
33 //#include <TGeoTrd2.h>
34 //#include <TGeoBoolNode.h>
35 #include <TGeoMatrix.h>
36 //#include <TGeoPatternFinder.h>
37 //#include <TGeoTube.h>
38 //#include <TGeoCache.h>
39 //#include <TGeoMCGeometry.h>
40 //#include <TGeoPcon.h>
41 //#include <TGeoVolume.h>
42 //#include <TGeoChecker.h>
43 #include <TGeoMedium.h>
44 #include <TGeoPgon.h>
45 //#include <TGeoVoxelFinder.h>
46 //#include <TGeoCompositeShape.h>
47 //#include <TGeometry.h>
48 //#include <TGeoShape.h>
49 //#include <TGeoCone.h>
50 //#include <TGeoNode.h>
51 //#include <TGeoSphere.h>
52 #include "AliITSBaseGeometry.h"
53
54
55 ClassImp(AliITSMixture)
56
57 AliITSMixture::AliITSMixture(const char *name,Int_t N,Double_t *w,TObjArray *m,
58                              Double_t rho,Double_t radlen,Double_t intleng)
59     :TGeoMixture(name,1,rho){
60     // Defines a new mixture from a number of Mixtures, and put the
61     // resulting mixture into this object. This will compute avarage
62     // isotopic value between different elements.
63     // Inputs:
64     //   Int_t    N   The number of mixtures in te TObjArray
65     //   Double_t *w  The array of weights of each mixture
66     //   TObjArray *m The array of AliITSMixture (TGeoMixture)s 
67     //                to be mixed.
68     // Output:
69     //   none.
70     // Return:
71     //   none.
72     Int_t i,z=0,j,Nel;
73     Double_t tw,*nw,wel[110],Ael[110],el[110];
74     TGeoMixture *mix;
75
76     if(N>m->GetEntries()){ // Error not enough mixtures defined
77         Error("Mixing","There are more weight defined than mixtures");
78         return;
79     } // end if
80     // First normilize the weights just in case.
81     tw = 0.0;
82     for(i=0;i<N;i++) if(w[i]>0.0) tw += w[i];
83     nw = new Double_t[N];
84     for(i=0;i<N;i++) {if(w[i]>0.0) nw[i] = w[i]/tw;else nw[i] = 0.0;}
85     //
86     Nel=0;
87     for(i=0;i<110;i++) {el[i] = wel[i] = Ael[i] = 0.0;}
88     for(i=0;i<N;i++)if(w[i]>0.0) {
89         mix = (TGeoMixture*) (m->At(i));
90         for(j=0;j<mix->GetNelements();j++) {
91             z = (Int_t) ((mix->GetZmixt())[j]);
92             wel[z] += nw[i]*((mix->GetWmixt())[j]);
93             el[z]  += wel[z]*((mix->GetZmixt())[j]);
94             Ael[z] += wel[z]*((mix->GetAmixt())[j]);
95         } // end for j
96     } // end for i
97     tw = 0.0;
98     for(i=1;i<110;i++) if(wel[i]>0.0){
99         Nel++;
100         tw += wel[i];
101     } // end for
102     if(tw<=0.0) {  // Error no elements defined.
103         Error("Mixing","Total weight of this mixture is zero");
104         delete[] nw;
105         return;
106     } // end if
107     // setup TGeoMixture data members.
108     fNelements = Nel;
109     if(fZmixture!=0) delete[] fZmixture;
110     if(fAmixture!=0) delete[] fAmixture;
111     if(fWeights!=0)  delete[] fWeights;
112     fZmixture = new Double_t[Nel];
113     fAmixture = new Double_t[Nel];
114     fWeights  = new Double_t[Nel];
115     if(rho>0.) fDensity = rho;
116     else { // try to compute density form mixture.
117         rho = 0.0;
118         for(i=0;i<N;i++) if(nw[i]>0.0) {
119             mix = (TGeoMixture*) (m->At(i));
120             rho += nw[i]*(mix->GetDensity());
121         } // end for i
122         fDensity = rho;
123     } // end if
124     if(radlen>0.) fRadLen = radlen;
125     else { // try to compute radiation form mixture.
126         // From "Review of Particle Physics" Particle Data Group Section
127         // 26.4.1 equation 26.21 (2002).
128         radlen = 0.0;
129         for(i=0;i<N;i++) if(nw[i]>0.0) {
130             mix = (TGeoMixture*) (m->At(i));
131             if(mix->GetRadLen()>0.0) rho += 1.0/(nw[i]*(mix->GetRadLen()));
132         } // end for i
133         fRadLen = 1.0/radlen;
134     } // end if
135     if(intleng>0.) fIntLen = intleng;
136     else { // try to compute interaction form mixture.
137         intleng = 0.0;
138         for(i=0;i<N;i++) if(nw[i]>0.0) {
139             mix = (TGeoMixture*) (m->At(i));
140             if(mix->GetIntLen()>0.0) intleng += 1.0/(nw[i]*(mix->GetIntLen()));
141         } // end for i
142         fIntLen = 1.0/intleng;
143     } // end if
144     j = 0;
145     for(z=1;z<110;z++){
146         wel[z] /= tw;
147         el[z]  /= tw;
148         Ael[z] /= tw;
149         if(wel[z]>0.0) this->DefineElement(j++,Ael[z],el[z],wel[z]);
150     } // end for i
151     delete[] nw;
152 }
153
154 //ClassImp(AliITSArb8)
155
156 //ClassImp(AliITSBBox)
157
158 //ClassImp(AliITSCone)
159
160 //ClassImp(AliITSConeSeg)
161
162 //ClassImp(AliITSCtub)
163
164 //ClassImp(AliITSEltu)
165
166 //ClassImp(AliITSGtra)
167
168 //ClassImp(AliITSpCon)
169
170 //ClassImp(AliITSTube)