ROOT logo
/**************************************************************************
 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 *                                                                        *
 * Author: The ALICE Off-line Project.                                    *
 * Contributors are mentioned in the code where appropriate.              *
 *                                                                        *
 * Permission to use, copy, modify and distribute this software and its   *
 * documentation strictly for non-commercial purposes is hereby granted   *
 * without fee, provided that the above copyright notice appears in all   *
 * copies and that both the copyright notice and this permission notice   *
 * appear in the supporting documentation. The authors make no claims     *
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/

/*
$Log$
Revision 1.2  2007/10/23 09:27:16  hristov
Adding dependence on the dip angle (Marek)

Revision 1.1  2007/06/24 20:53:11  hristov
New generator for the krypton runs of TPC (Marek)

*/ 

//
// generates single Kr decay, in order to generate the calibration data
// one should use it together with the AliGenCocktail class
//
#include "AliGenKrypton.h"
#include "TPDGCode.h"
//
ClassImp(AliGenKrypton)

//________________________________________________________________________
AliGenKrypton::AliGenKrypton(){
  //
  // Default constructor
  //
}
//________________________________________________________________________
void AliGenKrypton::Generate(){
  Double_t eelectron[6];
  Double_t egamma[2];
  Float_t polar[3]={0.,0.,0.};
  Int_t nelectron, ngamma;
  Int_t nt;
  //
  // generate decay vertex within the gas TPC volume
  //
  Float_t rmin,rmax,zmax;
  zmax=249.7;
  rmin=78.8;
  rmax=258.;
  Float_t me=511.e-6;
  Double_t rnd;
  //
  rnd=gRandom->Rndm();
  Float_t r = (rmax-rmin)*rnd+rmin;
  rnd=gRandom->Rndm();
  Float_t phi=TMath::TwoPi()*rnd;
  //
  Float_t origin[3];
  //
  rnd=gRandom->Rndm();
  origin[2]=zmax*(2.*rnd-1.);
  origin[0]=r*TMath::Cos(phi);
  origin[1]=r*TMath::Sin(phi);
  //
  Float_t ptot,p[3];
  //
  // generate decay
  //
  KrDecay(nelectron,ngamma,eelectron,egamma);
  //
  // electrons
  //
  for(Int_t i=0;i<nelectron;i++){
    rnd=gRandom->Rndm();
    phi=TMath::TwoPi()*rnd; 
    rnd=gRandom->Rndm();
    Double_t theta = TMath::Pi()*rnd;   
    ptot=TMath::Sqrt(eelectron[i]*(eelectron[i]+2.*me));
    p[0]=ptot*TMath::Cos(phi)*TMath::Sin(theta);
    p[1]=ptot*TMath::Sin(phi)*TMath::Sin(theta);    
    p[2]=ptot*TMath::Cos(theta);
    //
    // her push particle
    //
    PushTrack(fTrackIt,-1,kElectron,p,origin,polar,0,kPPrimary,nt);
  }
  //
  // gammas
  //
  for(Int_t i=0;i<ngamma;i++){
    rnd=gRandom->Rndm();
    Double_t theta = TMath::Pi()*rnd;
    rnd=gRandom->Rndm();
    phi=TMath::TwoPi()*rnd;    
    ptot=egamma[i];
    p[0]=ptot*TMath::Cos(phi)*TMath::Sin(theta);
    p[1]=ptot*TMath::Sin(phi)*TMath::Sin(theta);
    p[2]=ptot*TMath::Cos(theta);
    //
    // her push particle
    //
    PushTrack(fTrackIt,-1,kGamma,p,origin,polar,0,kPPrimary,nt);
  }  
}
//________________________________________________________________________
void AliGenKrypton::KrDecay(Int_t &nelectron, Int_t &ngamma, Double_t *eelectron, Double_t *egamma)
{
  Double_t prob1[2]={0.76,0.88}; // 0.76, 0.12, 0.12
  Double_t prob2=0.95;           // 0.95, 0.05
  nelectron=0;
  ngamma=0;
  
  Double_t rnd;
  rnd = gRandom->Rndm();
  //
  //
  // first decay - 32 keV
  //
   if(rnd < prob1[0]) {
    // 2 electrons
    nelectron = 2;
    eelectron[0]=30.e-6;
    eelectron[1]=1.8e-6;
  }
  else if (rnd > prob1[1]){
    // 4 electrons
    nelectron=4;
    eelectron[0]=18.e-6;
    eelectron[1]=10.e-6;
    eelectron[2]=1.8e-6;
    eelectron[3]=1.8e-6;
  }
  else {
    // 2 electrons + 1 gamma
    nelectron = 2;
    ngamma = 1;
    eelectron[0]=18.e-6;
    eelectron[1]=1.8e-6;
    egamma[0]=12.e-6;
  }
  //
  //  second decay - 9 keV
  // 
  rnd=gRandom->Rndm();
  //
  if(rnd < prob2){
    // 2 electrons
    nelectron+=2;
    eelectron[nelectron-2]=7.6e-6;
    eelectron[nelectron-1]=1.8e-6;
  }
  else {
    ngamma++;
    egamma[ngamma-1]=9.e-6;
  }
  

}
//________________________________________________________________________
 AliGenKrypton.cxx:1
 AliGenKrypton.cxx:2
 AliGenKrypton.cxx:3
 AliGenKrypton.cxx:4
 AliGenKrypton.cxx:5
 AliGenKrypton.cxx:6
 AliGenKrypton.cxx:7
 AliGenKrypton.cxx:8
 AliGenKrypton.cxx:9
 AliGenKrypton.cxx:10
 AliGenKrypton.cxx:11
 AliGenKrypton.cxx:12
 AliGenKrypton.cxx:13
 AliGenKrypton.cxx:14
 AliGenKrypton.cxx:15
 AliGenKrypton.cxx:16
 AliGenKrypton.cxx:17
 AliGenKrypton.cxx:18
 AliGenKrypton.cxx:19
 AliGenKrypton.cxx:20
 AliGenKrypton.cxx:21
 AliGenKrypton.cxx:22
 AliGenKrypton.cxx:23
 AliGenKrypton.cxx:24
 AliGenKrypton.cxx:25
 AliGenKrypton.cxx:26
 AliGenKrypton.cxx:27
 AliGenKrypton.cxx:28
 AliGenKrypton.cxx:29
 AliGenKrypton.cxx:30
 AliGenKrypton.cxx:31
 AliGenKrypton.cxx:32
 AliGenKrypton.cxx:33
 AliGenKrypton.cxx:34
 AliGenKrypton.cxx:35
 AliGenKrypton.cxx:36
 AliGenKrypton.cxx:37
 AliGenKrypton.cxx:38
 AliGenKrypton.cxx:39
 AliGenKrypton.cxx:40
 AliGenKrypton.cxx:41
 AliGenKrypton.cxx:42
 AliGenKrypton.cxx:43
 AliGenKrypton.cxx:44
 AliGenKrypton.cxx:45
 AliGenKrypton.cxx:46
 AliGenKrypton.cxx:47
 AliGenKrypton.cxx:48
 AliGenKrypton.cxx:49
 AliGenKrypton.cxx:50
 AliGenKrypton.cxx:51
 AliGenKrypton.cxx:52
 AliGenKrypton.cxx:53
 AliGenKrypton.cxx:54
 AliGenKrypton.cxx:55
 AliGenKrypton.cxx:56
 AliGenKrypton.cxx:57
 AliGenKrypton.cxx:58
 AliGenKrypton.cxx:59
 AliGenKrypton.cxx:60
 AliGenKrypton.cxx:61
 AliGenKrypton.cxx:62
 AliGenKrypton.cxx:63
 AliGenKrypton.cxx:64
 AliGenKrypton.cxx:65
 AliGenKrypton.cxx:66
 AliGenKrypton.cxx:67
 AliGenKrypton.cxx:68
 AliGenKrypton.cxx:69
 AliGenKrypton.cxx:70
 AliGenKrypton.cxx:71
 AliGenKrypton.cxx:72
 AliGenKrypton.cxx:73
 AliGenKrypton.cxx:74
 AliGenKrypton.cxx:75
 AliGenKrypton.cxx:76
 AliGenKrypton.cxx:77
 AliGenKrypton.cxx:78
 AliGenKrypton.cxx:79
 AliGenKrypton.cxx:80
 AliGenKrypton.cxx:81
 AliGenKrypton.cxx:82
 AliGenKrypton.cxx:83
 AliGenKrypton.cxx:84
 AliGenKrypton.cxx:85
 AliGenKrypton.cxx:86
 AliGenKrypton.cxx:87
 AliGenKrypton.cxx:88
 AliGenKrypton.cxx:89
 AliGenKrypton.cxx:90
 AliGenKrypton.cxx:91
 AliGenKrypton.cxx:92
 AliGenKrypton.cxx:93
 AliGenKrypton.cxx:94
 AliGenKrypton.cxx:95
 AliGenKrypton.cxx:96
 AliGenKrypton.cxx:97
 AliGenKrypton.cxx:98
 AliGenKrypton.cxx:99
 AliGenKrypton.cxx:100
 AliGenKrypton.cxx:101
 AliGenKrypton.cxx:102
 AliGenKrypton.cxx:103
 AliGenKrypton.cxx:104
 AliGenKrypton.cxx:105
 AliGenKrypton.cxx:106
 AliGenKrypton.cxx:107
 AliGenKrypton.cxx:108
 AliGenKrypton.cxx:109
 AliGenKrypton.cxx:110
 AliGenKrypton.cxx:111
 AliGenKrypton.cxx:112
 AliGenKrypton.cxx:113
 AliGenKrypton.cxx:114
 AliGenKrypton.cxx:115
 AliGenKrypton.cxx:116
 AliGenKrypton.cxx:117
 AliGenKrypton.cxx:118
 AliGenKrypton.cxx:119
 AliGenKrypton.cxx:120
 AliGenKrypton.cxx:121
 AliGenKrypton.cxx:122
 AliGenKrypton.cxx:123
 AliGenKrypton.cxx:124
 AliGenKrypton.cxx:125
 AliGenKrypton.cxx:126
 AliGenKrypton.cxx:127
 AliGenKrypton.cxx:128
 AliGenKrypton.cxx:129
 AliGenKrypton.cxx:130
 AliGenKrypton.cxx:131
 AliGenKrypton.cxx:132
 AliGenKrypton.cxx:133
 AliGenKrypton.cxx:134
 AliGenKrypton.cxx:135
 AliGenKrypton.cxx:136
 AliGenKrypton.cxx:137
 AliGenKrypton.cxx:138
 AliGenKrypton.cxx:139
 AliGenKrypton.cxx:140
 AliGenKrypton.cxx:141
 AliGenKrypton.cxx:142
 AliGenKrypton.cxx:143
 AliGenKrypton.cxx:144
 AliGenKrypton.cxx:145
 AliGenKrypton.cxx:146
 AliGenKrypton.cxx:147
 AliGenKrypton.cxx:148
 AliGenKrypton.cxx:149
 AliGenKrypton.cxx:150
 AliGenKrypton.cxx:151
 AliGenKrypton.cxx:152
 AliGenKrypton.cxx:153
 AliGenKrypton.cxx:154
 AliGenKrypton.cxx:155
 AliGenKrypton.cxx:156
 AliGenKrypton.cxx:157
 AliGenKrypton.cxx:158
 AliGenKrypton.cxx:159
 AliGenKrypton.cxx:160
 AliGenKrypton.cxx:161
 AliGenKrypton.cxx:162
 AliGenKrypton.cxx:163
 AliGenKrypton.cxx:164