Line data Source code
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 6 : ClassImp(AliGenKrypton)
34 :
35 : //________________________________________________________________________
36 0 : AliGenKrypton::AliGenKrypton(){
37 : //
38 : // Default constructor
39 : //
40 0 : }
41 : //________________________________________________________________________
42 : void AliGenKrypton::Generate(){
43 0 : Double_t eelectron[6];
44 0 : Double_t egamma[2];
45 0 : Float_t polar[3]={0.,0.,0.};
46 0 : Int_t nelectron, ngamma;
47 0 : 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 0 : rnd=gRandom->Rndm();
59 0 : Float_t r = (rmax-rmin)*rnd+rmin;
60 0 : rnd=gRandom->Rndm();
61 0 : Float_t phi=TMath::TwoPi()*rnd;
62 : //
63 0 : Float_t origin[3];
64 : //
65 0 : rnd=gRandom->Rndm();
66 0 : origin[2]=zmax*(2.*rnd-1.);
67 0 : origin[0]=r*TMath::Cos(phi);
68 0 : origin[1]=r*TMath::Sin(phi);
69 : //
70 0 : Float_t ptot,p[3];
71 : //
72 : // generate decay
73 : //
74 0 : KrDecay(nelectron,ngamma,eelectron,egamma);
75 : //
76 : // electrons
77 : //
78 0 : for(Int_t i=0;i<nelectron;i++){
79 0 : rnd=gRandom->Rndm();
80 0 : phi=TMath::TwoPi()*rnd;
81 0 : rnd=gRandom->Rndm();
82 0 : Double_t theta = TMath::Pi()*rnd;
83 0 : ptot=TMath::Sqrt(eelectron[i]*(eelectron[i]+2.*me));
84 0 : p[0]=ptot*TMath::Cos(phi)*TMath::Sin(theta);
85 0 : p[1]=ptot*TMath::Sin(phi)*TMath::Sin(theta);
86 0 : p[2]=ptot*TMath::Cos(theta);
87 : //
88 : // her push particle
89 : //
90 0 : PushTrack(fTrackIt,-1,kElectron,p,origin,polar,0,kPPrimary,nt);
91 : }
92 : //
93 : // gammas
94 : //
95 0 : for(Int_t i=0;i<ngamma;i++){
96 0 : rnd=gRandom->Rndm();
97 0 : Double_t theta = TMath::Pi()*rnd;
98 0 : rnd=gRandom->Rndm();
99 0 : phi=TMath::TwoPi()*rnd;
100 0 : ptot=egamma[i];
101 0 : p[0]=ptot*TMath::Cos(phi)*TMath::Sin(theta);
102 0 : p[1]=ptot*TMath::Sin(phi)*TMath::Sin(theta);
103 0 : p[2]=ptot*TMath::Cos(theta);
104 : //
105 : // her push particle
106 : //
107 0 : PushTrack(fTrackIt,-1,kGamma,p,origin,polar,0,kPPrimary,nt);
108 : }
109 0 : }
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 0 : nelectron=0;
116 0 : ngamma=0;
117 :
118 : Double_t rnd;
119 0 : rnd = gRandom->Rndm();
120 : //
121 : //
122 : // first decay - 32 keV
123 : //
124 0 : if(rnd < prob1[0]) {
125 : // 2 electrons
126 0 : nelectron = 2;
127 0 : eelectron[0]=30.e-6;
128 0 : eelectron[1]=1.8e-6;
129 0 : }
130 0 : else if (rnd > prob1[1]){
131 : // 4 electrons
132 0 : nelectron=4;
133 0 : eelectron[0]=18.e-6;
134 0 : eelectron[1]=10.e-6;
135 0 : eelectron[2]=1.8e-6;
136 0 : eelectron[3]=1.8e-6;
137 0 : }
138 : else {
139 : // 2 electrons + 1 gamma
140 0 : nelectron = 2;
141 0 : ngamma = 1;
142 0 : eelectron[0]=18.e-6;
143 0 : eelectron[1]=1.8e-6;
144 0 : egamma[0]=12.e-6;
145 : }
146 : //
147 : // second decay - 9 keV
148 : //
149 0 : rnd=gRandom->Rndm();
150 : //
151 0 : if(rnd < prob2){
152 : // 2 electrons
153 0 : nelectron+=2;
154 0 : eelectron[nelectron-2]=7.6e-6;
155 0 : eelectron[nelectron-1]=1.8e-6;
156 0 : }
157 : else {
158 0 : ngamma++;
159 0 : egamma[ngamma-1]=9.e-6;
160 : }
161 :
162 :
163 0 : }
164 : //________________________________________________________________________
|