source: trunk/documents/UserDoc/DocBookUsersGuides/ForApplicationDeveloper/xml/Fundamentals/eventGenerator.xml @ 1358

Last change on this file since 1358 was 1211, checked in by garnier, 15 years ago

CVS update

File size: 11.3 KB
Line 
1<!-- ******************************************************** -->
2<!--                                                          -->
3<!--  [History]                                               -->
4<!--    Converted to DocBook: Katsuya Amako, Aug-2006         -->
5<!--    Changed by: Katsuya Amako, 21-Sep-1998                -->
6<!--    Changed by: Dennis Wright, 25-Jun-2002                -->
7<!--    Proof read by: Joe Chuma,  28-Jun-1999                -->
8<!--                                                          -->
9<!-- ******************************************************** -->
10
11
12<!-- ******************* Section (Level#1) ****************** -->
13<sect1 id="sect.EventGen">
14<title>
15Event Generator Interface
16</title>
17
18<!-- ******************* Section (Level#2) ****************** -->
19<sect2 id="sect.EventGen.StructPriEvt">
20<title>
21Structure of a primary event
22</title>
23
24<!-- ******************* Section (Level#3) ****************** -->
25<sect3 id="sect.EventGen.StructPriEvt.VtxPart">
26<title>
27Primary vertex and primary particle
28</title>
29
30<para>
31The <emphasis>G4Event</emphasis> class object should have a set of primary
32particles when it is sent to <emphasis>G4EventManager</emphasis> via
33<literal>processOneEvent()</literal> method. It is the mandate of your
34<emphasis>G4VUserPrimaryGeneratorAction</emphasis> concrete class to send primary
35particles to the <emphasis>G4Event</emphasis> object.
36</para>
37
38<para>
39The <emphasis>G4PrimaryParticle</emphasis> class represents a primary particle
40with which Geant4 starts simulating an event. This class object has
41information on particle type and its three momenta. The positional
42and time information of primary particle(s) are stored in the
43<emphasis>G4PrimaryVertex</emphasis> class object and, thus, this class object
44can have one or more <emphasis>G4PrimaryParticle</emphasis> class objects which
45share the same vertex. Primary vertexes and primary particles are associated
46with the <emphasis>G4Event</emphasis> object by a form of linked list.
47</para>
48
49<para>
50A concrete class of <emphasis>G4VPrimaryGenerator</emphasis>, the
51<emphasis>G4PrimaryParticle</emphasis> object is constructed with either a
52pointer to <emphasis>G4ParticleDefinition</emphasis> or an integer number which
53represents P.D.G. particle code. For the case of some artificial
54particles, e.g., geantino, optical photon, etc., or exotic nuclear
55fragments, which the P.D.G. particle code does not cover, the
56<emphasis>G4PrimaryParticle</emphasis> should be constructed by
57<emphasis>G4ParticleDefinition</emphasis> pointer. On the other hand, elementary
58particles with very short life time, e.g., weak bosons, or
59quarks/gluons, can be instantiated as <emphasis>G4PrimaryParticle</emphasis>
60objects using the P.D.G. particle code. It should be noted that,
61even though primary particles with such a very short life time are
62defined, Geant4 will simulate only the particles which are defined
63as <emphasis>G4ParticleDefinition</emphasis> class objects. Other primary
64particles will be simply ignored by <emphasis>G4EventManager</emphasis>. But it
65may still be useful to construct such "intermediate" particles for
66recording the origin of the primary event.
67</para>
68
69</sect3>
70
71<!-- ******************* Section (Level#3) ****************** -->
72<sect3 id="sect.EventGen.StructPriEvt.ForcedDecay">
73<title>
74Forced decay channel
75</title>
76
77<para>
78The <emphasis>G4PrimaryParticle</emphasis> class object can have a list of its
79daughter particles. If the parent particle is an "intermediate"
80particle, which Geant4 does not have a corresponding
81<emphasis>G4ParticleDefinition</emphasis>, this parent particle is ignored and
82daughters are assumed to start from the vertex with which their
83parent is associated. For example, a Z boson is associated with a
84vertex and it has positive and negative muons as its daughters,
85these muons will start from that vertex.
86</para>
87
88<para>
89There are some kinds of particles which should fly some
90reasonable distances and, thus, should be simulated by Geant4, but
91you still want to follow the decay channel generated by an event
92generator. A typical case of these particles is B meson. Even for
93the case of a primary particle which has a corresponding
94<emphasis>G4ParticleDefinition</emphasis>, it can have daughter primary
95particles. Geant4 will trace the parent particle until it comes to
96decay, obeying multiple scattering, ionization loss, rotation with
97the magnetic field, etc. according to its particle type. When the
98parent comes to decay, instead of randomly choosing its decay
99channel, it follows the "pre-assigned" decay channel. To conserve
100the energy and the momentum of the parent, daughters will be
101Lorentz transformed according to their parent's frame.
102</para>
103
104</sect3>
105</sect2>
106
107<!-- ******************* Section (Level#2) ****************** -->
108<sect2 id="sect.EventGen.InterPriGen">
109<title>
110Interface to a primary generator
111</title>
112
113<!-- ******************* Section (Level#3) ****************** -->
114<sect3 id="sect.EventGen.InterPriGen.HEPEvt">
115<title>
116G4HEPEvtInterface
117</title>
118
119<para>
120Unfortunately, almost all event generators presently in use,
121commonly are written in FORTRAN. For Geant4, it was decided to not
122link with any FORTRAN program or library, even though the C++
123language syntax itself allows such a link. Linking to a FORTRAN
124package might be convenient in some cases, but we will lose many
125advantages of object-oriented features of C++, such as robustness.
126Instead, Geant4 provides an ASCII file interface for such event
127generators.
128</para>
129
130<para>
131<emphasis>G4HEPEvtInterface</emphasis> is one of <emphasis>G4VPrimaryGenerator</emphasis>
132concrete class and thus it can be used in your
133<emphasis>G4VUserPrimaryGeneratorAction</emphasis> concrete class.
134<emphasis>G4HEPEvtInterface</emphasis> reads an ASCII file produced by an event
135generator and reproduces <emphasis>G4PrimaryParticle</emphasis> objects
136associated with a <emphasis>G4PrimaryVertex</emphasis> object. It reproduces a
137full production chain of the event generator, starting with primary
138quarks, etc. In other words, <emphasis>G4HEPEvtInterface</emphasis> converts
139information stored in the <literal>/HEPEVT/</literal> common block to an
140object-oriented data structure. Because the <literal>/HEPEVT/</literal>
141common block is commonly used by almost all event generators
142written in FORTRAN, <emphasis>G4HEPEvtInterface</emphasis> can interface to
143almost all event generators currently used in the HEP community.
144The constructor of <emphasis>G4HEPEvtInterface</emphasis> takes the file name.
145<xref linkend="programlist_EventGen_1" /> shows an example how to use
146<emphasis>G4HEPEvtInterface</emphasis>. Note that an event generator is not
147assumed to give a place of the primary particles, the interaction
148point must be set before invoking <emphasis>GeneratePrimaryVertex()</emphasis>
149method.
150</para>
151
152<example id="programlist_EventGen_1">
153<title>
154An example code for <emphasis>G4HEPEvtInterface</emphasis>
155</title>
156<programlisting>
157#ifndef ExN04PrimaryGeneratorAction_h
158#define ExN04PrimaryGeneratorAction_h 1
159
160#include "G4VUserPrimaryGeneratorAction.hh"
161#include "globals.hh"
162
163class G4VPrimaryGenerator;
164class G4Event;
165
166class ExN04PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
167{
168  public:
169    ExN04PrimaryGeneratorAction();
170    ~ExN04PrimaryGeneratorAction();
171
172  public:
173    void GeneratePrimaries(G4Event* anEvent);
174
175  private:
176    G4VPrimaryGenerator* HEPEvt;
177};
178
179#endif
180
181
182#include "ExN04PrimaryGeneratorAction.hh"
183
184#include "G4Event.hh"
185#include "G4HEPEvtInterface.hh"
186
187ExN04PrimaryGeneratorAction::ExN04PrimaryGeneratorAction()
188{
189  HEPEvt = new G4HEPEvtInterface("pythia_event.data");
190}
191
192ExN04PrimaryGeneratorAction::~ExN04PrimaryGeneratorAction()
193{
194  delete HEPEvt;
195}
196
197void ExN04PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
198{
199  HEPEvt-&gt;SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,0.*cm));
200  HEPEvt-&gt;GeneratePrimaryVertex(anEvent);
201}
202</programlisting>
203</example>
204
205</sect3>
206
207<!-- ******************* Section (Level#3) ****************** -->
208<sect3 id="sect.EventGen.InterPriGen.FormASCII">
209<title>
210Format of the ASCII file
211</title>
212
213<para>
214An ASCII file, which will be fed by <emphasis>G4HEPEvtInterface</emphasis>
215should have the following format.
216
217<itemizedlist spacing="compact">
218  <listitem><para>
219    The first line of each primary event should be an integer which
220    represents the number of the following lines of primary
221    particles.
222  </para></listitem>
223  <listitem><para>
224    Each line in an event corresponds to a particle in the
225    <literal>/HEPEVT/</literal> common. Each line has <literal>ISTHEP, IDHEP,
226    JDAHEP(1), JDAHEP(2), PHEP(1), PHEP(2), PHEP(3), PHEP(5).</literal>
227    Refer to the <literal>/HEPEVT/</literal> manual for the meanings of these
228    variables.
229  </para></listitem>
230</itemizedlist>
231</para>
232
233<para>
234<xref linkend="programlist_EventGen_2" /> shows an example FORTRAN code to
235generate an ASCII file.
236</para>
237
238<example id="programlist_EventGen_2">
239<title>
240A FORTRAN example using the <literal>/HEPEVT/</literal> common.
241</title>
242<programlisting>
243***********************************************************
244      SUBROUTINE HEP2G4
245*
246* Convert /HEPEVT/ event structure to an ASCII file
247* to be fed by G4HEPEvtInterface
248*
249***********************************************************
250      PARAMETER (NMXHEP=2000)
251      COMMON/HEPEVT/NEVHEP,NHEP,ISTHEP(NMXHEP),IDHEP(NMXHEP),
252     &gt;JMOHEP(2,NMXHEP),JDAHEP(2,NMXHEP),PHEP(5,NMXHEP),VHEP(4,NMXHEP)
253      DOUBLE PRECISION PHEP,VHEP
254*
255      WRITE(6,*) NHEP
256      DO IHEP=1,NHEP
257       WRITE(6,10)
258     &gt;  ISTHEP(IHEP),IDHEP(IHEP),JDAHEP(1,IHEP),JDAHEP(2,IHEP),
259     &gt;  PHEP(1,IHEP),PHEP(2,IHEP),PHEP(3,IHEP),PHEP(5,IHEP)
26010     FORMAT(4I10,4(1X,D15.8))
261      ENDDO
262*
263      RETURN
264      END
265</programlisting>
266</example>
267
268</sect3>
269
270<!-- ******************* Section (Level#3) ****************** -->
271<sect3 id="sect.EventGen.InterPriGen.FutureInt">
272<title>
273Future interface to the new generation generators
274</title>
275
276<para>
277Several activities have already been started for developing
278object-oriented event generators. Such new generators can be easily
279linked and used with a Geant4 based simulation. Furthermore, we
280need not distinguish a primary generator from the physics processes
281used in Geant4. Future generators can be a kind of physics process
282plugged-in by inheriting <emphasis>G4VProcess</emphasis>.
283</para>
284
285</sect3>
286</sect2>
287
288
289<!-- ******************* Section (Level#2) ****************** -->
290<sect2 id="sect.EventGen.EvtOverlap">
291<title>
292Event overlap using multiple generators
293</title>
294
295<para>
296Your <emphasis>G4VUserPrimaryGeneratorAction</emphasis> concrete class can have
297more than one <emphasis>G4VPrimaryGenerator</emphasis> concrete class. Each
298<emphasis>G4VPrimaryGenerator</emphasis> concrete class can be accessed more than
299once per event. Using these class objects, one event can have more
300than one primary event.
301</para>
302
303<para>
304One possible use is the following. Within an event, a
305<emphasis>G4HEPEvtInterface</emphasis> class object instantiated with a minimum
306bias event file is accessed 20 times and another
307<emphasis>G4HEPEvtInterface</emphasis> class object instantiated with a signal
308event file is accessed once. Thus, this event represents a typical
309signal event of LHC overlapping 20 minimum bias events. It should
310be noted that a simulation of event overlapping can be done by
311merging hits and/or digits associated with several events, and
312these events can be simulated independently. Digitization over
313multiple events will be mentioned in
314<xref linkend="sect.Digi" />.
315</para>
316
317
318</sect2>
319</sect1>
Note: See TracBrowser for help on using the repository browser.