Random rays in eta phi for lego plot.
[u/mrichter/AliRoot.git] / STEER / AliLegoGeneratorEtaR.cxx
CommitLineData
37e5988f 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/* $Id $ */
17
18//------------------------------------------------------------------------
19// Lego generator in Eta bins
20// Uses geantino rays to check the material distributions and detector's
21// geometry
22// Author: A.Morsch
23//------------------------------------------------------------------------
24
25#include "TRandom.h"
26
27#include "AliLegoGeneratorEtaR.h"
28#include "AliRun.h"
29#include "AliMC.h"
30#include "AliLog.h"
31
32ClassImp(AliLegoGeneratorEtaR)
33
34
35//___________________________________________
36void AliLegoGeneratorEtaR::Generate()
37{
38// Create a geantino with kinematics corresponding to the current bins
39// Here: Coor1 = phi
40// Coor2 = eta.
41
42 //
43 // Rootinos are 0
44 const Int_t kMpart = 0;
45 Float_t orig[3], pmom[3];
46 Float_t t, cost, sint, cosp, sinp;
47 fCurCoor1 = fCoor1Min + (fCoor1Max - fCoor1Min) * gRandom->Rndm();
48 fCurCoor2 = fCoor2Min + (fCoor2Max - fCoor2Min) * gRandom->Rndm();
49
50 Float_t phi = fCurCoor1 * TMath::Pi() / 180.;
51 Float_t theta = 2. * TMath::ATan(TMath::Exp(-fCurCoor2));
52
53
54 cost = TMath::Cos(theta);
55 sint = TMath::Sin(theta);
56 cosp = TMath::Cos(phi);
57 sinp = TMath::Sin(phi);
58
59 pmom[0] = cosp * sint;
60 pmom[1] = sinp * sint;
61 pmom[2] = cost;
62
63 // --- Where to start
64 orig[0] = orig[1] = orig[2] = 0;
65 Float_t dalicz = 3000;
66 if (fRadMin > 0) {
67 t = PropagateCylinder(orig, pmom, fRadMin, dalicz);
68 orig[0] = pmom[0]*t;
69 orig[1] = pmom[1]*t;
70 orig[2] = pmom[2]*t;
71 if (TMath::Abs(orig[2]) > fZMax) return;
72 }
73
74 Float_t polar[3]={0.,0.,0.};
75 Int_t ntr;
76 gAlice->GetMCApp()->PushTrack(1, -1, kMpart, pmom, orig, polar, 0, kPPrimary, ntr);
77
78}