1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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.
22 // By default the vertex is smeared between +/- 20 m
23 // Author: andreas.morsch@cern.ch
25 #include "AliGenBeamGas.h"
26 #include "AliGenReader.h"
28 #include <TParticle.h>
31 ClassImp(AliGenBeamGas)
33 AliGenBeamGas::AliGenBeamGas()
44 //____________________________________________________________
46 AliGenBeamGas::~AliGenBeamGas()
52 //___________________________________________________________
53 void AliGenBeamGas::Init()
56 AliGenExtFile::Init();
60 void AliGenBeamGas::Generate()
64 Float_t polar[3] = {0,0,0};
65 Float_t origin[3] = {0,0,0};
71 while(nInt < fInteractions) {
77 origin[2] = 2. * fOsigma[2] * random[0] - fOsigma[2];
81 Float_t ibeam = (random[1] < 0.5) ? -1. : 1.;
84 Float_t time = origin[2]/TMath::Ccgs()*ibeam;
88 Int_t nTracks = fReader->NextEvent();
90 // printf("\n No more events !!! !\n");
91 Warning("AliGenBeamGas::Generate",
92 "\nNo more events in external file!!!\n Last event may be empty or incomplete.\n");
99 for (i = 0; i < nTracks; i++) {
100 TParticle* iparticle = fReader->NextParticle();
101 p[0] = iparticle->Px();
102 p[1] = iparticle->Py();
103 p[2] = iparticle->Pz() * ibeam;
105 Int_t idpart = iparticle->GetPdgCode();
106 Int_t decayed = iparticle->GetFirstDaughter();
107 Int_t doTracking = fTrackIt && (decayed < 0) && (TMath::Abs(idpart) > 10);
108 PushTrack(doTracking,-1,idpart,p,origin,polar,time,kPPrimary,nt);
114 SetHighWaterMark(nt);