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