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