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