]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVGEN/AliGenHalo.cxx
All coding rule violations except RS3 corrected
[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$
f87cfe57 18Revision 1.5 1999/11/03 17:43:20 fca
19New version from G.Martinez & A.Morsch
20
886b6f73 21Revision 1.4 1999/09/29 09:24:14 fca
22Introduction of the Copyright and cvs Log
23
4c039060 24*/
25
fe4da5cc 26#include "AliGenHalo.h"
fe4da5cc 27#include "AliRun.h"
c5970876 28#include "AliPDG.h"
29
1578254f 30#include <TDatabasePDG.h>
fe4da5cc 31#include <stdlib.h>
f87cfe57 32
fe4da5cc 33 ClassImp(AliGenHalo)
34 AliGenHalo::AliGenHalo()
35 :AliGenerator(-1)
36{
f87cfe57 37// Constructor
fe4da5cc 38 fName="Halo";
39 fTitle="Halo from LHC Tunnel";
40 // Set the default file
41 fFileName="~/marsip/marsip5.mu";
42//
43// Read all particles
44 fNpart=-1;
45 fp=0;
46}
47
48AliGenHalo::AliGenHalo(Int_t npart)
49 :AliGenerator(npart)
50{
f87cfe57 51// Constructor
fe4da5cc 52 fName="Halo";
53 fTitle="Halo from LHC Tunnel";
54 // Set the default file
55 fFileName="~/marsip/marsip5.mu";
56//
57// Read all particles
58 fNpart=-1;
59 fp=0;
60}
61
f87cfe57 62AliGenHalo::AliGenHalo(const AliGenHalo & Halo)
63{
64// copy constructor
65}
66
67
fe4da5cc 68//____________________________________________________________
69AliGenHalo::~AliGenHalo()
70{
f87cfe57 71// Destructor
fe4da5cc 72}
73
74//____________________________________________________________
75void AliGenHalo::Init()
f87cfe57 76{
77// Initialisation
78}
fe4da5cc 79
80//____________________________________________________________
81void AliGenHalo::Generate()
82{
f87cfe57 83// Generate from input file
fe4da5cc 84 FILE *fp = fopen(fFileName,"r");
85 if (fp) {
86 printf("\n File %s opened for reading ! \n ", fFileName);
87 } else {
88 printf("\n Opening of file %s failed ! \n ", fFileName);
89 }
90//
91// MARS particle codes
f87cfe57 92 const Int_t kmars[12]={0,kProton,kNeutron,kPiPlus,kPiMinus,kKPlus,kKMinus,
1578254f 93 kMuonPlus,kMuonMinus,kGamma,kElectron,kPositron};
fe4da5cc 94
95 Float_t polar[3]= {0,0,0};
96 Float_t origin[3];
97 Float_t p[3], p0;
98 Float_t ekin, wgt, tx, ty, tz, txy;
1578254f 99 Float_t amass;
fe4da5cc 100 //
1578254f 101 Int_t ipart, ncols, nt;
fe4da5cc 102
103 Int_t nread=0;
104 origin[2]=2650;
105
106 while(1) {
107 ncols = fscanf(fp,"%i %f %f %f %f %f %f",
108 &ipart, &ekin, &wgt,
109 &origin[0], &origin[1],
110 &tx, &ty);
111 if (ncols < 0) break;
112 nread++;
113 if (fNpart !=-1 && nread > fNpart) break;
f87cfe57 114 ipart = kmars[ipart];
1578254f 115 amass = TDatabasePDG::Instance()->GetParticle(ipart)->Mass();
fe4da5cc 116 p0=sqrt(ekin*ekin + 2.*amass);
117
118 txy=TMath::Sqrt(tx*tx+ty*ty);
119 if (txy == 1.) {
120 tz=0;
121 } else {
122 tz=-TMath::Sqrt(1.-txy);
123 }
124 p[0]=p0*tx;
125 p[1]=p0*ty;
126 p[2]=p0*tz;
127 fParentWeight=wgt;
886b6f73 128 gAlice->SetTrack(fTrackIt,-1,ipart,p,origin,polar,0,"Halo+",nt,fParentWeight);
fe4da5cc 129 origin[2]=-origin[2];
130 p[2]=-p[2];
886b6f73 131 gAlice->SetTrack(fTrackIt,-1,ipart,p,origin,polar,0,"Halo-",nt,fParentWeight);
fe4da5cc 132 origin[2]=-origin[2];
133 p[2]=-p[2];
134 }
135}
136
137
f87cfe57 138AliGenHalo& AliGenHalo::operator=(const AliGenHalo& rhs)
139{
140// Assignment operator
141 return *this;
142}
143
fe4da5cc 144
145
146
147
148
149
150