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