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