1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
20 #include <TObjArray.h>
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>
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"
55 ClassImp(AliITSMixture)
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.
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
73 Double_t tw,*nw,wel[110],Ael[110],el[110];
76 if(N>m->GetEntries()){ // Error not enough mixtures defined
77 Error("Mixing","There are more weight defined than mixtures");
80 // First normilize the weights just in case.
82 for(i=0;i<N;i++) if(w[i]>0.0) tw += w[i];
84 for(i=0;i<N;i++) {if(w[i]>0.0) nw[i] = w[i]/tw;else nw[i] = 0.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]);
98 for(i=1;i<110;i++) if(wel[i]>0.0){
102 if(tw<=0.0) { // Error no elements defined.
103 Error("Mixing","Total weight of this mixture is zero");
107 // setup TGeoMixture data members.
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.
118 for(i=0;i<N;i++) if(nw[i]>0.0) {
119 mix = (TGeoMixture*) (m->At(i));
120 rho += nw[i]*(mix->GetDensity());
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).
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()));
133 fRadLen = 1.0/radlen;
135 if(intleng>0.) fIntLen = intleng;
136 else { // try to compute interaction form mixture.
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()));
142 fIntLen = 1.0/intleng;
149 if(wel[z]>0.0) this->DefineElement(j++,Ael[z],el[z],wel[z]);
154 //ClassImp(AliITSArb8)
156 //ClassImp(AliITSBBox)
158 //ClassImp(AliITSCone)
160 //ClassImp(AliITSConeSeg)
162 //ClassImp(AliITSCtub)
164 //ClassImp(AliITSEltu)
166 //ClassImp(AliITSGtra)
168 //ClassImp(AliITSpCon)
170 //ClassImp(AliITSTube)