]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVGEN/AliGenBeamGas.cxx
Some getters
[u/mrichter/AliRoot.git] / EVGEN / AliGenBeamGas.cxx
CommitLineData
4bda3bc1 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
88cb7938 16/* $Id$ */
4bda3bc1 17
508eeb68 18//
19// Generator to simulate beam gas interactions.
20// At present single interactions are read from an external file.
21// Several interactions are combined in one event.
0af12c00 22// By default the vertex is smeared between +/- 20 m
23// Author: andreas.morsch@cern.ch
4bda3bc1 24
25#include "AliGenBeamGas.h"
4a33c50d 26#include "AliGenReader.h"
4bda3bc1 27
28#include <TParticle.h>
4bda3bc1 29
30
198bb1c7 31ClassImp(AliGenBeamGas)
4bda3bc1 32
33AliGenBeamGas::AliGenBeamGas()
1c56e311 34 :AliGenExtFile(),
35 fInteractions(1)
4bda3bc1 36{
37// Constructor
38//
508eeb68 39 fOsigma[0] = 0.;
40 fOsigma[1] = 0.;
41 fOsigma[2] = 2000.;
4bda3bc1 42}
43
4bda3bc1 44//____________________________________________________________
45
46AliGenBeamGas::~AliGenBeamGas()
47{
48// Destructor
49 delete fReader;
50}
51
52//___________________________________________________________
53void AliGenBeamGas::Init()
54{
55// Initialize
56 AliGenExtFile::Init();
57}
58
59
60void AliGenBeamGas::Generate()
61{
62// Generate particles
63
64 Float_t polar[3] = {0,0,0};
65 Float_t origin[3] = {0,0,0};
66 Float_t p[3];
67 Float_t random[2];
68 Int_t i, nt;
69 Int_t nInt = 0;
70
71 while(nInt < fInteractions) {
72//
73 Rndm(random,2);
74//
75// Interaction vertex
76//
508eeb68 77 origin[2] = 2. * fOsigma[2] * random[0] - fOsigma[2];
4bda3bc1 78//
79// beam 1 or 2
80//
81 Float_t ibeam = (random[1] < 0.5) ? -1. : 1.;
82
83//
84// Read next event
85//
86 Int_t nTracks = fReader->NextEvent();
87 if (nTracks == 0) {
88 // printf("\n No more events !!! !\n");
89 Warning("AliGenBeamGas::Generate",
90 "\nNo more events in external file!!!\n Last event may be empty or incomplete.\n");
91 return;
92 }
93
94 //
95 // Stack filling loop
96 //
97 for (i = 0; i < nTracks; i++) {
98 TParticle* iparticle = fReader->NextParticle();
99 p[0] = iparticle->Px();
100 p[1] = iparticle->Py();
101 p[2] = iparticle->Pz() * ibeam;
102
103 Int_t idpart = iparticle->GetPdgCode();
104 Int_t decayed = iparticle->GetFirstDaughter();
105 Int_t doTracking = fTrackIt && (decayed < 0) && (TMath::Abs(idpart) > 10);
642f15cf 106 PushTrack(doTracking,-1,idpart,p,origin,polar,0,kPPrimary,nt);
4bda3bc1 107 KeepTrack(nt);
108 } // track loop
109 nInt++;
110 } // event loop
111//
112 SetHighWaterMark(nt);
113//
114 CdEventFile();
115}
116
117
4bda3bc1 118
4bda3bc1 119
120