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