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