Improved common vertex handling.
[u/mrichter/AliRoot.git] / STEER / AliLegoGeneratorPhiZ.cxx
CommitLineData
6872c613 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$ */
6872c613 17
116cbefd 18//-------------------------------------------------------------------------
116cbefd 19// Lego generator in Phi - Z bins
5d8718b8 20// Uses geantino rays to check the material distributions and detector's
21// geometry
22// Author: A.Morsch
116cbefd 23//-------------------------------------------------------------------------
24
6872c613 25#include "AliLegoGeneratorPhiZ.h"
26#include "AliRun.h"
27
28ClassImp(AliLegoGeneratorPhiZ)
29
30
31//___________________________________________
32void AliLegoGeneratorPhiZ::Generate()
33{
34// Create a geantino with kinematics corresponding to the current bins
35// Here: Coor1 = Z
36// Coor2 = phi.
37
38 //
39 // Rootinos are 0
40 const Int_t kMpart = 0;
41 Float_t orig[3], pmom[3];
42 Float_t t, cosp, sinp;
43 if (fCoor1Bin==-1) fCoor1Bin=fNCoor1;
44 // Prepare for next step
45 if(fCoor1Bin>=fNCoor1-1)
46 if(fCoor2Bin>=fNCoor2-1) {
47 Warning("Generate","End of Lego Generation");
48 return;
49 } else {
50 fCoor2Bin++;
39974533 51 printf("Generating rays in Phi-bin:%d\n",fCoor2Bin);
6872c613 52 fCoor1Bin=0;
53 } else fCoor1Bin++;
6872c613 54 fCurCoor1 = (fCoor1Min+(fCoor1Bin+0.5)*(fCoor1Max-fCoor1Min)/fNCoor1);
55 fCurCoor2 = (fCoor2Min+(fCoor2Bin+0.5)*(fCoor2Max-fCoor2Min)/fNCoor2);
56
d55c1573 57 Float_t phi = fCurCoor2*TMath::Pi()/180.;
6872c613 58
59 cosp = TMath::Cos(phi);
60 sinp = TMath::Sin(phi);
61
62 pmom[0] = cosp;
63 pmom[1] = sinp;
64 pmom[2] = 0.;
65
66 // --- Where to start
67 orig[0] = orig[1] = orig[2] = 0;
d55c1573 68 orig[2] = fCurCoor1;
6872c613 69
70 Float_t dalicz = 3000;
71 if (fRadMin > 0) {
72 t = PropagateCylinder(orig,pmom,fRadMin,dalicz);
899c7749 73 orig[0] += pmom[0]*t;
74 orig[1] += pmom[1]*t;
75 orig[2] += pmom[2]*t;
6872c613 76 if (TMath::Abs(orig[2]) > fZMax) return;
77 }
78
79 Float_t polar[3]={0.,0.,0.};
80 Int_t ntr;
9e1a0ddb 81 gAlice->SetTrack(1, -1, kMpart, pmom, orig, polar, 0, kPPrimary, ntr);
6872c613 82
83}