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