]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVGEN/AliGenKrypton.cxx
LHAPDF veraion 5.9.1
[u/mrichter/AliRoot.git] / EVGEN / AliGenKrypton.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  2007/10/23 09:27:16  hristov
19 Adding dependence on the dip angle (Marek)
20
21 Revision 1.1  2007/06/24 20:53:11  hristov
22 New generator for the krypton runs of TPC (Marek)
23
24 */ 
25
26 //
27 // generates single Kr decay, in order to generate the calibration data
28 // one should use it together with the AliGenCocktail class
29 //
30 #include "AliGenKrypton.h"
31 #include "TPDGCode.h"
32 //
33 ClassImp(AliGenKrypton)
34
35 //________________________________________________________________________
36 AliGenKrypton::AliGenKrypton(){
37   //
38   // Default constructor
39   //
40 }
41 //________________________________________________________________________
42 void AliGenKrypton::Generate(){
43   Double_t eelectron[6];
44   Double_t egamma[2];
45   Float_t polar[3]={0.,0.,0.};
46   Int_t nelectron, ngamma;
47   Int_t nt;
48   //
49   // generate decay vertex within the gas TPC volume
50   //
51   Float_t rmin,rmax,zmax;
52   zmax=249.7;
53   rmin=78.8;
54   rmax=258.;
55   Float_t me=511.e-6;
56   Double_t rnd;
57   //
58   rnd=gRandom->Rndm();
59   Float_t r = (rmax-rmin)*rnd+rmin;
60   rnd=gRandom->Rndm();
61   Float_t phi=TMath::TwoPi()*rnd;
62   //
63   Float_t origin[3];
64   //
65   rnd=gRandom->Rndm();
66   origin[2]=zmax*(2.*rnd-1.);
67   origin[0]=r*TMath::Cos(phi);
68   origin[1]=r*TMath::Sin(phi);
69   //
70   Float_t ptot,p[3];
71   //
72   // generate decay
73   //
74   KrDecay(nelectron,ngamma,eelectron,egamma);
75   //
76   // electrons
77   //
78   for(Int_t i=0;i<nelectron;i++){
79     rnd=gRandom->Rndm();
80     phi=TMath::TwoPi()*rnd; 
81     rnd=gRandom->Rndm();
82     Double_t theta = TMath::Pi()*rnd;   
83     ptot=TMath::Sqrt(eelectron[i]*(eelectron[i]+2.*me));
84     p[0]=ptot*TMath::Cos(phi)*TMath::Sin(theta);
85     p[1]=ptot*TMath::Sin(phi)*TMath::Sin(theta);    
86     p[2]=ptot*TMath::Cos(theta);
87     //
88     // her push particle
89     //
90     PushTrack(fTrackIt,-1,kElectron,p,origin,polar,0,kPPrimary,nt);
91   }
92   //
93   // gammas
94   //
95   for(Int_t i=0;i<ngamma;i++){
96     rnd=gRandom->Rndm();
97     Double_t theta = TMath::Pi()*rnd;
98     rnd=gRandom->Rndm();
99     phi=TMath::TwoPi()*rnd;    
100     ptot=egamma[i];
101     p[0]=ptot*TMath::Cos(phi)*TMath::Sin(theta);
102     p[1]=ptot*TMath::Sin(phi)*TMath::Sin(theta);
103     p[2]=ptot*TMath::Cos(theta);
104     //
105     // her push particle
106     //
107     PushTrack(fTrackIt,-1,kGamma,p,origin,polar,0,kPPrimary,nt);
108   }  
109 }
110 //________________________________________________________________________
111 void AliGenKrypton::KrDecay(Int_t &nelectron, Int_t &ngamma, Double_t *eelectron, Double_t *egamma)
112 {
113   Double_t prob1[2]={0.76,0.88}; // 0.76, 0.12, 0.12
114   Double_t prob2=0.95;           // 0.95, 0.05
115   nelectron=0;
116   ngamma=0;
117   
118   Double_t rnd;
119   rnd = gRandom->Rndm();
120   //
121   //
122   // first decay - 32 keV
123   //
124    if(rnd < prob1[0]) {
125     // 2 electrons
126     nelectron = 2;
127     eelectron[0]=30.e-6;
128     eelectron[1]=1.8e-6;
129   }
130   else if (rnd > prob1[1]){
131     // 4 electrons
132     nelectron=4;
133     eelectron[0]=18.e-6;
134     eelectron[1]=10.e-6;
135     eelectron[2]=1.8e-6;
136     eelectron[3]=1.8e-6;
137   }
138   else {
139     // 2 electrons + 1 gamma
140     nelectron = 2;
141     ngamma = 1;
142     eelectron[0]=18.e-6;
143     eelectron[1]=1.8e-6;
144     egamma[0]=12.e-6;
145   }
146   //
147   //  second decay - 9 keV
148   // 
149   rnd=gRandom->Rndm();
150   //
151   if(rnd < prob2){
152     // 2 electrons
153     nelectron+=2;
154     eelectron[nelectron-2]=7.6e-6;
155     eelectron[nelectron-1]=1.8e-6;
156   }
157   else {
158     ngamma++;
159     egamma[ngamma-1]=9.e-6;
160   }
161   
162
163 }
164 //________________________________________________________________________