]>
Commit | Line | Data |
---|---|---|
c5ca52b2 | 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 | ||
acd84897 | 16 | /* $Id$ */ |
c5ca52b2 | 17 | |
116cbefd | 18 | //------------------------------------------------------------------------- |
116cbefd | 19 | // Lego generator in x - y - z bins |
5d8718b8 | 20 | // Uses geantino rays to check the material distributions and detector's |
21 | // geometry | |
22 | // Author: A.Morsch | |
116cbefd | 23 | //------------------------------------------------------------------------- |
24 | ||
c5ca52b2 | 25 | #include "AliLegoGeneratorXYZ.h" |
26 | #include "AliRun.h" | |
5d12ce38 | 27 | #include "AliMC.h" |
c5ca52b2 | 28 | |
29 | ClassImp(AliLegoGeneratorXYZ) | |
30 | ||
31 | ||
32 | //___________________________________________ | |
33 | ||
34 | ||
35 | AliLegoGeneratorXYZ::AliLegoGeneratorXYZ() | |
36 | { | |
37 | // Default Constructor | |
38 | fDir1[0]=1.; fDir1[1]=0.; fDir1[2]=0.; | |
39 | fDir2[0]=0.; fDir2[1]=1.; fDir2[2]=0.; | |
40 | fDir3[0]=0.; fDir3[1]=0.; fDir3[2]=1.; | |
41 | } | |
42 | ||
43 | AliLegoGeneratorXYZ::AliLegoGeneratorXYZ(char* axis) | |
44 | { | |
45 | // Constructor | |
46 | if (!strcmp(axis,"x") || !strcmp(axis,"X")) | |
47 | { | |
48 | fDir1[0]=0.; fDir1[1]=1.; fDir1[2]=0.; | |
49 | fDir2[0]=0.; fDir2[1]=0.; fDir2[2]=1.; | |
50 | fDir3[0]=1.; fDir3[1]=0.; fDir3[2]=0.; | |
51 | } | |
52 | else if (!strcmp(axis,"y") || !strcmp(axis,"Y")) | |
53 | { | |
54 | fDir1[0]=1.; fDir1[1]=0.; fDir1[2]=0.; | |
55 | fDir2[0]=0.; fDir2[1]=0.; fDir2[2]=1; | |
56 | fDir3[0]=0.; fDir3[1]=1.; fDir3[2]=0.; | |
57 | } | |
58 | else if (!strcmp(axis,"z") || !strcmp(axis,"Z")) | |
59 | { | |
60 | fDir1[0]=1.; fDir1[1]=0.; fDir1[2]=0.; | |
61 | fDir2[0]=0.; fDir2[1]=1.; fDir2[2]=0.; | |
62 | fDir3[0]=0.; fDir3[1]=0.; fDir3[2]=1.; | |
63 | } | |
64 | else | |
65 | { | |
66 | fDir1[0]=1.; fDir1[1]=0.; fDir1[2]=0.; | |
67 | fDir2[0]=0.; fDir2[1]=1.; fDir2[2]=0.; | |
68 | fDir3[0]=0.; fDir3[1]=0.; fDir3[2]=1.; | |
69 | } | |
70 | } | |
71 | ||
72 | ||
73 | AliLegoGeneratorXYZ::AliLegoGeneratorXYZ(Int_t nc1, Float_t c1min, | |
74 | Float_t c1max, Int_t nc2, | |
75 | Float_t c2min, Float_t c2max, | |
76 | Float_t rmin, Float_t rmax, Float_t zmax) : | |
77 | AliLegoGenerator(nc1, c1min, c1max, nc2, c2min, c2max, | |
78 | rmin, rmax, zmax) | |
79 | { | |
80 | // Constructor | |
81 | fDir1[0]=1.; fDir1[1]=0.; fDir1[2]=0.; | |
82 | fDir2[0]=0.; fDir2[1]=1.; fDir2[2]=0.; | |
83 | fDir3[0]=0.; fDir3[1]=0.; fDir3[2]=1.; | |
84 | } | |
85 | ||
86 | ||
87 | //___________________________________________ | |
88 | void AliLegoGeneratorXYZ::Generate() | |
89 | { | |
90 | // Create a geantino with kinematics corresponding to the current bins | |
91 | // Here: Coor1 = x | |
92 | // Coor2 = z | |
93 | ||
94 | // | |
95 | // Rootinos are 0 | |
96 | const Int_t kMpart = 0; | |
97 | Float_t orig[3], pmom[3]; | |
98 | ||
99 | // Prepare for next step | |
100 | if(fCoor1Bin>=fNCoor1-1) | |
101 | if(fCoor2Bin>=fNCoor2-1) { | |
102 | Warning("Generate","End of Lego Generation"); | |
103 | return; | |
104 | } else { | |
105 | fCoor2Bin++; | |
106 | printf("Generating rays in Coordinate 2 bin:%d\n",fCoor2Bin); | |
107 | fCoor1Bin=0; | |
108 | } else fCoor1Bin++; | |
109 | ||
110 | ||
111 | fCurCoor1 = (fCoor1Min+(fCoor1Bin+0.5)*(fCoor1Max-fCoor1Min)/fNCoor1); | |
112 | fCurCoor2 = (fCoor2Min+(fCoor2Bin+0.5)*(fCoor2Max-fCoor2Min)/fNCoor2); | |
113 | ||
114 | // Origin and direction | |
115 | Int_t i; | |
116 | for (i=0; i<3; i++) { | |
117 | pmom[i]=fDir3[i]; | |
118 | orig[i]=fCurCoor1*fDir1[i]+fCurCoor2*fDir2[i]; | |
119 | } | |
120 | ||
121 | Float_t dalicz = 3000; | |
122 | if (fRadMin > 0) { | |
123 | Float_t t = PropagateCylinder(orig,pmom,fRadMin,dalicz); | |
124 | orig[0] = pmom[0]*t; | |
125 | orig[1] = pmom[1]*t; | |
126 | orig[2] = pmom[2]*t; | |
127 | if (TMath::Abs(orig[2]) > fZMax) return; | |
128 | } | |
129 | ||
130 | Float_t polar[3]={0.,0.,0.}; | |
131 | Int_t ntr; | |
5d12ce38 | 132 | gAlice->GetMCApp()->PushTrack(1, -1, kMpart, pmom, orig, polar, 0, kPPrimary, ntr); |
c5ca52b2 | 133 | |
134 | } | |
135 | ||
136 | ||
137 | ||
138 |