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