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