]>
Commit | Line | Data |
---|---|---|
8766db25 | 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 | /* $Id$ */ | |
17 | ||
18 | // | |
19 | // Wrapper for ISAJET generator. | |
20 | // It is using ISAJET to comunicate with fortarn code | |
21 | // | |
22 | // | |
23 | // | |
24 | // | |
25 | ||
26 | #include <Riostream.h> | |
27 | ||
28 | //#include "TSystem.h" | |
29 | //#include "TUnixSystem.h" | |
30 | #include <TParticle.h> | |
31 | #include "TIsajet.h" | |
32 | #include "AliMC.h" | |
33 | #include "AliIsajetRndm.h" | |
34 | #include "AliGenIsajet.h" | |
35 | #include "AliRun.h" | |
36 | ||
37 | ||
38 | ||
39 | ClassImp(AliGenIsajet) | |
40 | ||
41 | AliGenIsajet::AliGenIsajet() : | |
42 | AliGenMC(), | |
43 | fKineBias(1), | |
44 | fTrials(0) | |
45 | { | |
46 | ||
47 | } | |
48 | //____________________________________________________________________________ | |
49 | AliGenIsajet::AliGenIsajet(Int_t npart) | |
50 | :AliGenMC(npart), | |
51 | fKineBias(1), | |
52 | fTrials(0) | |
53 | { | |
54 | ||
55 | fIsajet = new TIsajet(); | |
56 | AliIsajetRndm::SetIsajetRandom(GetRandom()); | |
57 | ||
58 | } | |
59 | ||
8766db25 | 60 | //____________________________________________________________________________ |
61 | AliGenIsajet::~AliGenIsajet() | |
62 | { | |
63 | // | |
64 | // Standard destructor | |
65 | // | |
66 | if (fIsajet) delete fIsajet; | |
67 | } | |
68 | ||
69 | //____________________________________________________________________________ | |
70 | void AliGenIsajet::Init() | |
71 | { | |
72 | // | |
73 | // Generator initialisation method | |
74 | // | |
75 | cout<<"isajet4"<<endl; | |
76 | fIsajet->SetECM(2000); | |
77 | cout<<"isajet5"<<endl; | |
78 | fIsajet->SetJobtype("MINBIAS"); | |
79 | cout<<"isajet6"<<endl; | |
80 | fIsajet->SetIDIN(0,1); | |
81 | cout<<"isajet7"<<endl; | |
82 | fIsajet->SetIDIN(1,1); | |
83 | cout<<"isajet8"<<endl; | |
84 | fIsajet->Initialise(); | |
85 | cout<<"isajet9"<<endl; | |
86 | } | |
87 | ||
88 | //____________________________________________________________________________ | |
89 | void AliGenIsajet::Generate() | |
90 | { | |
91 | ||
92 | Float_t polar[3] = {0,0,0}; | |
93 | Float_t origin[3]= {0,0,0}; | |
94 | Float_t origin0[3]= {0,0,0}; | |
95 | Float_t p[4], random[6]; | |
96 | Int_t j, kf, ks, imo; | |
97 | Int_t nt=0; | |
98 | Int_t jev=0; | |
99 | ||
100 | fTrials=0; | |
101 | ||
102 | static TClonesArray *particles; | |
103 | //cout<<"generate"<<endl; | |
104 | if(!particles) particles=new TClonesArray("TParticle",10000); | |
105 | const Float_t kconv=0.001/2.999792458e8; | |
106 | ||
107 | VertexInternal(); | |
108 | ||
109 | origin[0] = fVertex[0]; | |
110 | origin[1] = fVertex[1]; | |
111 | origin[2] = fVertex[2]; | |
112 | //cout<<"generate1"<<endl; | |
113 | ||
114 | while(1) | |
115 | { | |
116 | //cout<<"generate2"<<endl; | |
117 | fIsajet->GenerateEvent(); | |
118 | //cout<<"generate3"<<endl; | |
119 | fTrials++; | |
120 | fIsajet->ImportParticles(particles,"All"); | |
121 | //cout<<"generate4"<<endl; | |
122 | Int_t np = particles->GetEntriesFast()-1; | |
123 | //cout<<"generate51"<<endl; | |
124 | if (np == 0 ) continue; | |
125 | ||
126 | Int_t nc=0; | |
127 | Int_t * newPos = new Int_t[np]; | |
128 | //cout<<"generate52"<<endl; | |
129 | ||
130 | for (Int_t i = 0; i<np; i++) *(newPos+i)=-1; | |
131 | //cout<<"generate5"<<endl; | |
132 | for (Int_t i = 0; i<np; i++) | |
133 | { | |
134 | TParticle * iparticle = (TParticle *) particles->At(i); | |
135 | //cout<<"generate6"<<endl; | |
136 | imo = iparticle->GetFirstMother(); | |
137 | kf = iparticle->GetPdgCode(); | |
138 | ks = iparticle->GetStatusCode(); | |
139 | if (ks != 3 && | |
140 | KinematicSelection(iparticle,0)) | |
141 | { | |
142 | nc++; | |
143 | p[0]=iparticle->Px(); | |
144 | p[1]=iparticle->Py(); | |
145 | p[2]=iparticle->Pz(); | |
146 | p[3]=iparticle->Energy(); | |
147 | Float_t tof = kconv*iparticle->T(); | |
148 | Int_t iparent = (imo > -1) ? newPos[imo] : -1; | |
149 | Int_t trackIt = (ks == 1) && fTrackIt; | |
150 | PushTrack(trackIt, iparent, kf, | |
151 | p[0], p[1], p[2], p[3], | |
152 | origin[0], origin[1], origin[2], | |
153 | tof, | |
154 | polar[0], polar[1], polar[2], | |
155 | kPPrimary, nt,1.,ks); | |
156 | KeepTrack(nt); | |
157 | newPos[i]=nt; | |
158 | } | |
159 | }// end of for: particle loop | |
160 | if (newPos) delete[] newPos; | |
161 | // MakeHeader(); | |
162 | if (nc > 0) { | |
163 | jev+=nc; | |
164 | if (jev >= fNpart || fNpart == -1) { | |
165 | fKineBias=Float_t(fNpart)/Float_t(fTrials); | |
166 | break; | |
167 | }} | |
168 | ||
169 | } | |
170 | SetHighWaterMark(nt); | |
171 | } | |
8766db25 | 172 | |
173 | //____________________________________________________________________________ | |
8766db25 | 174 |