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