]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVGEN/AliGenHalo.cxx
New class used for primary vertex finding (AliITSVertexerTracks)
[u/mrichter/AliRoot.git] / EVGEN / AliGenHalo.cxx
CommitLineData
4c039060 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$
116cbefd 18Revision 1.11 2001/07/27 17:09:36 morsch
19Use local SetTrack, KeepTrack and SetHighWaterMark methods
20to delegate either to local stack or to stack owned by AliRun.
21(Piotr Skowronski, A.M.)
22
a99cf51f 23Revision 1.10 2000/12/21 16:24:06 morsch
24Coding convention clean-up
25
675e9664 26Revision 1.9 2000/11/30 07:12:50 alibrary
27Introducing new Rndm and QA classes
28
65fb704d 29Revision 1.8 2000/10/02 15:20:40 morsch
30Direct reference to default input file removed.
31
3459d6b6 32Revision 1.7 2000/06/30 12:19:07 morsch
33Type of fFileName changed to TString, fp has been !-ed.
34
bd1cece1 35Revision 1.6 2000/06/09 20:36:01 morsch
36All coding rule violations except RS3 corrected
37
f87cfe57 38Revision 1.5 1999/11/03 17:43:20 fca
39New version from G.Martinez & A.Morsch
40
886b6f73 41Revision 1.4 1999/09/29 09:24:14 fca
42Introduction of the Copyright and cvs Log
43
4c039060 44*/
45
675e9664 46// Read background particles from a boundary source
47// Very specialized generator to simulate background from beam halo.
48// The input file is a text file specially prepared
49// for this purpose.
50// Author: andreas.morsch@cern.ch
51
116cbefd 52#include <stdlib.h>
c5970876 53
1578254f 54#include <TDatabasePDG.h>
116cbefd 55#include <TPDGCode.h>
56
57#include "AliGenHalo.h"
58#include "AliRun.h"
f87cfe57 59
fe4da5cc 60 ClassImp(AliGenHalo)
61 AliGenHalo::AliGenHalo()
62 :AliGenerator(-1)
63{
f87cfe57 64// Constructor
fe4da5cc 65 fName="Halo";
66 fTitle="Halo from LHC Tunnel";
fe4da5cc 67//
68// Read all particles
69 fNpart=-1;
70 fp=0;
71}
72
73AliGenHalo::AliGenHalo(Int_t npart)
74 :AliGenerator(npart)
75{
f87cfe57 76// Constructor
fe4da5cc 77 fName="Halo";
78 fTitle="Halo from LHC Tunnel";
fe4da5cc 79//
80// Read all particles
81 fNpart=-1;
82 fp=0;
83}
84
f87cfe57 85AliGenHalo::AliGenHalo(const AliGenHalo & Halo)
86{
87// copy constructor
88}
89
90
fe4da5cc 91//____________________________________________________________
92AliGenHalo::~AliGenHalo()
93{
f87cfe57 94// Destructor
fe4da5cc 95}
96
97//____________________________________________________________
98void AliGenHalo::Init()
f87cfe57 99{
100// Initialisation
101}
fe4da5cc 102
103//____________________________________________________________
104void AliGenHalo::Generate()
105{
f87cfe57 106// Generate from input file
fe4da5cc 107 FILE *fp = fopen(fFileName,"r");
108 if (fp) {
bd1cece1 109 printf("\n File %s opened for reading ! \n ", (char*) &fFileName);
fe4da5cc 110 } else {
bd1cece1 111 printf("\n Opening of file %s failed ! \n ", (char*) &fFileName);
fe4da5cc 112 }
113//
114// MARS particle codes
f87cfe57 115 const Int_t kmars[12]={0,kProton,kNeutron,kPiPlus,kPiMinus,kKPlus,kKMinus,
1578254f 116 kMuonPlus,kMuonMinus,kGamma,kElectron,kPositron};
fe4da5cc 117
118 Float_t polar[3]= {0,0,0};
119 Float_t origin[3];
120 Float_t p[3], p0;
121 Float_t ekin, wgt, tx, ty, tz, txy;
1578254f 122 Float_t amass;
fe4da5cc 123 //
1578254f 124 Int_t ipart, ncols, nt;
fe4da5cc 125
126 Int_t nread=0;
127 origin[2]=2650;
128
129 while(1) {
130 ncols = fscanf(fp,"%i %f %f %f %f %f %f",
131 &ipart, &ekin, &wgt,
132 &origin[0], &origin[1],
133 &tx, &ty);
134 if (ncols < 0) break;
135 nread++;
136 if (fNpart !=-1 && nread > fNpart) break;
f87cfe57 137 ipart = kmars[ipart];
1578254f 138 amass = TDatabasePDG::Instance()->GetParticle(ipart)->Mass();
fe4da5cc 139 p0=sqrt(ekin*ekin + 2.*amass);
140
141 txy=TMath::Sqrt(tx*tx+ty*ty);
142 if (txy == 1.) {
143 tz=0;
144 } else {
145 tz=-TMath::Sqrt(1.-txy);
146 }
147 p[0]=p0*tx;
148 p[1]=p0*ty;
149 p[2]=p0*tz;
150 fParentWeight=wgt;
a99cf51f 151 SetTrack(fTrackIt,-1,ipart,p,origin,polar,0,kPNoProcess,nt,fParentWeight);
152// SetTrack(fTrackIt,-1,ipart,p,origin,polar,0,"Halo+",nt,fParentWeight);
fe4da5cc 153 origin[2]=-origin[2];
154 p[2]=-p[2];
a99cf51f 155 SetTrack(fTrackIt,-1,ipart,p,origin,polar,0,kPNoProcess,nt,fParentWeight);
156// SetTrack(fTrackIt,-1,ipart,p,origin,polar,0,"Halo-",nt,fParentWeight);
fe4da5cc 157 origin[2]=-origin[2];
158 p[2]=-p[2];
159 }
160}
161
162
f87cfe57 163AliGenHalo& AliGenHalo::operator=(const AliGenHalo& rhs)
164{
165// Assignment operator
166 return *this;
167}
168
fe4da5cc 169
170
171
172
173
174
175