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 **************************************************************************/
18 //-------------------------------------------------------------------------
19 // Lego generator in x - y - z bins
20 // Uses geantino rays to check the material distributions and detector's
23 //-------------------------------------------------------------------------
25 #include "AliLegoGeneratorXYZ.h"
30 ClassImp(AliLegoGeneratorXYZ)
33 //___________________________________________
36 AliLegoGeneratorXYZ::AliLegoGeneratorXYZ()
38 // Default Constructor
39 fDir1[0]=1.; fDir1[1]=0.; fDir1[2]=0.;
40 fDir2[0]=0.; fDir2[1]=1.; fDir2[2]=0.;
41 fDir3[0]=0.; fDir3[1]=0.; fDir3[2]=1.;
44 AliLegoGeneratorXYZ::AliLegoGeneratorXYZ(char* axis)
47 if (!strcmp(axis,"x") || !strcmp(axis,"X"))
49 fDir1[0]=0.; fDir1[1]=1.; fDir1[2]=0.;
50 fDir2[0]=0.; fDir2[1]=0.; fDir2[2]=1.;
51 fDir3[0]=1.; fDir3[1]=0.; fDir3[2]=0.;
53 else if (!strcmp(axis,"y") || !strcmp(axis,"Y"))
55 fDir1[0]=1.; fDir1[1]=0.; fDir1[2]=0.;
56 fDir2[0]=0.; fDir2[1]=0.; fDir2[2]=1;
57 fDir3[0]=0.; fDir3[1]=1.; fDir3[2]=0.;
59 else if (!strcmp(axis,"z") || !strcmp(axis,"Z"))
61 fDir1[0]=1.; fDir1[1]=0.; fDir1[2]=0.;
62 fDir2[0]=0.; fDir2[1]=1.; fDir2[2]=0.;
63 fDir3[0]=0.; fDir3[1]=0.; fDir3[2]=1.;
67 fDir1[0]=1.; fDir1[1]=0.; fDir1[2]=0.;
68 fDir2[0]=0.; fDir2[1]=1.; fDir2[2]=0.;
69 fDir3[0]=0.; fDir3[1]=0.; fDir3[2]=1.;
74 AliLegoGeneratorXYZ::AliLegoGeneratorXYZ(Int_t nc1, Float_t c1min,
75 Float_t c1max, Int_t nc2,
76 Float_t c2min, Float_t c2max,
77 Float_t rmin, Float_t rmax, Float_t zmax) :
78 AliLegoGenerator(nc1, c1min, c1max, nc2, c2min, c2max,
82 fDir1[0]=1.; fDir1[1]=0.; fDir1[2]=0.;
83 fDir2[0]=0.; fDir2[1]=1.; fDir2[2]=0.;
84 fDir3[0]=0.; fDir3[1]=0.; fDir3[2]=1.;
88 //___________________________________________
89 void AliLegoGeneratorXYZ::Generate()
91 // Create a geantino with kinematics corresponding to the current bins
97 const Int_t kMpart = 0;
98 Float_t orig[3], pmom[3];
100 // Prepare for next step
101 if(fCoor1Bin>=fNCoor1-1)
102 if(fCoor2Bin>=fNCoor2-1) {
103 AliWarning("End of Lego Generation");
107 AliDebug(1, Form("Generating rays in Coordinate 2 bin:%d",fCoor2Bin));
112 fCurCoor1 = (fCoor1Min+(fCoor1Bin+0.5)*(fCoor1Max-fCoor1Min)/fNCoor1);
113 fCurCoor2 = (fCoor2Min+(fCoor2Bin+0.5)*(fCoor2Max-fCoor2Min)/fNCoor2);
115 // Origin and direction
117 for (i=0; i<3; i++) {
119 orig[i]=fCurCoor1*fDir1[i]+fCurCoor2*fDir2[i];
122 Float_t dalicz = 3000;
124 Float_t t = PropagateCylinder(orig,pmom,fRadMin,dalicz);
128 if (TMath::Abs(orig[2]) > fZMax) return;
131 Float_t polar[3]={0.,0.,0.};
133 gAlice->GetMCApp()->PushTrack(1, -1, kMpart, pmom, orig, polar, 0, kPPrimary, ntr);