[904] | 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> |
---|
| 15 | Event Generator Interface |
---|
| 16 | </title> |
---|
| 17 | |
---|
| 18 | <!-- ******************* Section (Level#2) ****************** --> |
---|
| 19 | <sect2 id="sect.EventGen.StructPriEvt"> |
---|
| 20 | <title> |
---|
| 21 | Structure of a primary event |
---|
| 22 | </title> |
---|
| 23 | |
---|
| 24 | <!-- ******************* Section (Level#3) ****************** --> |
---|
| 25 | <sect3 id="sect.EventGen.StructPriEvt.VtxPart"> |
---|
| 26 | <title> |
---|
| 27 | Primary vertex and primary particle |
---|
| 28 | </title> |
---|
| 29 | |
---|
| 30 | <para> |
---|
| 31 | The <emphasis>G4Event</emphasis> class object should have a set of primary |
---|
| 32 | particles 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 |
---|
| 35 | particles to the <emphasis>G4Event</emphasis> object. |
---|
| 36 | </para> |
---|
| 37 | |
---|
| 38 | <para> |
---|
| 39 | The <emphasis>G4PrimaryParticle</emphasis> class represents a primary particle |
---|
| 40 | with which Geant4 starts simulating an event. This class object has |
---|
| 41 | information on particle type and its three momenta. The positional |
---|
| 42 | and time information of primary particle(s) are stored in the |
---|
| 43 | <emphasis>G4PrimaryVertex</emphasis> class object and, thus, this class object |
---|
| 44 | can have one or more <emphasis>G4PrimaryParticle</emphasis> class objects which |
---|
[1211] | 45 | share the same vertex. Primary vertexes and primary particles are associated |
---|
| 46 | with the <emphasis>G4Event</emphasis> object by a form of linked list. |
---|
[904] | 47 | </para> |
---|
| 48 | |
---|
| 49 | <para> |
---|
| 50 | A concrete class of <emphasis>G4VPrimaryGenerator</emphasis>, the |
---|
| 51 | <emphasis>G4PrimaryParticle</emphasis> object is constructed with either a |
---|
| 52 | pointer to <emphasis>G4ParticleDefinition</emphasis> or an integer number which |
---|
| 53 | represents P.D.G. particle code. For the case of some artificial |
---|
| 54 | particles, e.g., geantino, optical photon, etc., or exotic nuclear |
---|
| 55 | fragments, 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 |
---|
| 58 | particles with very short life time, e.g., weak bosons, or |
---|
| 59 | quarks/gluons, can be instantiated as <emphasis>G4PrimaryParticle</emphasis> |
---|
| 60 | objects using the P.D.G. particle code. It should be noted that, |
---|
| 61 | even though primary particles with such a very short life time are |
---|
| 62 | defined, Geant4 will simulate only the particles which are defined |
---|
| 63 | as <emphasis>G4ParticleDefinition</emphasis> class objects. Other primary |
---|
| 64 | particles will be simply ignored by <emphasis>G4EventManager</emphasis>. But it |
---|
| 65 | may still be useful to construct such "intermediate" particles for |
---|
| 66 | recording 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> |
---|
| 74 | Forced decay channel |
---|
| 75 | </title> |
---|
| 76 | |
---|
| 77 | <para> |
---|
| 78 | The <emphasis>G4PrimaryParticle</emphasis> class object can have a list of its |
---|
| 79 | daughter particles. If the parent particle is an "intermediate" |
---|
| 80 | particle, which Geant4 does not have a corresponding |
---|
| 81 | <emphasis>G4ParticleDefinition</emphasis>, this parent particle is ignored and |
---|
| 82 | daughters are assumed to start from the vertex with which their |
---|
| 83 | parent is associated. For example, a Z boson is associated with a |
---|
| 84 | vertex and it has positive and negative muons as its daughters, |
---|
| 85 | these muons will start from that vertex. |
---|
| 86 | </para> |
---|
| 87 | |
---|
| 88 | <para> |
---|
| 89 | There are some kinds of particles which should fly some |
---|
| 90 | reasonable distances and, thus, should be simulated by Geant4, but |
---|
| 91 | you still want to follow the decay channel generated by an event |
---|
| 92 | generator. A typical case of these particles is B meson. Even for |
---|
| 93 | the case of a primary particle which has a corresponding |
---|
| 94 | <emphasis>G4ParticleDefinition</emphasis>, it can have daughter primary |
---|
| 95 | particles. Geant4 will trace the parent particle until it comes to |
---|
| 96 | decay, obeying multiple scattering, ionization loss, rotation with |
---|
| 97 | the magnetic field, etc. according to its particle type. When the |
---|
| 98 | parent comes to decay, instead of randomly choosing its decay |
---|
| 99 | channel, it follows the "pre-assigned" decay channel. To conserve |
---|
| 100 | the energy and the momentum of the parent, daughters will be |
---|
| 101 | Lorentz 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> |
---|
| 110 | Interface to a primary generator |
---|
| 111 | </title> |
---|
| 112 | |
---|
| 113 | <!-- ******************* Section (Level#3) ****************** --> |
---|
| 114 | <sect3 id="sect.EventGen.InterPriGen.HEPEvt"> |
---|
| 115 | <title> |
---|
| 116 | G4HEPEvtInterface |
---|
| 117 | </title> |
---|
| 118 | |
---|
| 119 | <para> |
---|
| 120 | Unfortunately, almost all event generators presently in use, |
---|
| 121 | commonly are written in FORTRAN. For Geant4, it was decided to not |
---|
| 122 | link with any FORTRAN program or library, even though the C++ |
---|
| 123 | language syntax itself allows such a link. Linking to a FORTRAN |
---|
| 124 | package might be convenient in some cases, but we will lose many |
---|
| 125 | advantages of object-oriented features of C++, such as robustness. |
---|
| 126 | Instead, Geant4 provides an ASCII file interface for such event |
---|
| 127 | generators. |
---|
| 128 | </para> |
---|
| 129 | |
---|
| 130 | <para> |
---|
| 131 | <emphasis>G4HEPEvtInterface</emphasis> is one of <emphasis>G4VPrimaryGenerator</emphasis> |
---|
| 132 | concrete 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 |
---|
| 135 | generator and reproduces <emphasis>G4PrimaryParticle</emphasis> objects |
---|
| 136 | associated with a <emphasis>G4PrimaryVertex</emphasis> object. It reproduces a |
---|
| 137 | full production chain of the event generator, starting with primary |
---|
| 138 | quarks, etc. In other words, <emphasis>G4HEPEvtInterface</emphasis> converts |
---|
| 139 | information stored in the <literal>/HEPEVT/</literal> common block to an |
---|
| 140 | object-oriented data structure. Because the <literal>/HEPEVT/</literal> |
---|
| 141 | common block is commonly used by almost all event generators |
---|
| 142 | written in FORTRAN, <emphasis>G4HEPEvtInterface</emphasis> can interface to |
---|
| 143 | almost all event generators currently used in the HEP community. |
---|
| 144 | The 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 |
---|
| 147 | assumed to give a place of the primary particles, the interaction |
---|
| 148 | point must be set before invoking <emphasis>GeneratePrimaryVertex()</emphasis> |
---|
| 149 | method. |
---|
| 150 | </para> |
---|
| 151 | |
---|
| 152 | <example id="programlist_EventGen_1"> |
---|
| 153 | <title> |
---|
| 154 | An 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 | |
---|
| 163 | class G4VPrimaryGenerator; |
---|
| 164 | class G4Event; |
---|
| 165 | |
---|
| 166 | class 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 | |
---|
| 187 | ExN04PrimaryGeneratorAction::ExN04PrimaryGeneratorAction() |
---|
| 188 | { |
---|
| 189 | HEPEvt = new G4HEPEvtInterface("pythia_event.data"); |
---|
| 190 | } |
---|
| 191 | |
---|
| 192 | ExN04PrimaryGeneratorAction::~ExN04PrimaryGeneratorAction() |
---|
| 193 | { |
---|
| 194 | delete HEPEvt; |
---|
| 195 | } |
---|
| 196 | |
---|
| 197 | void ExN04PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) |
---|
| 198 | { |
---|
| 199 | HEPEvt->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,0.*cm)); |
---|
| 200 | HEPEvt->GeneratePrimaryVertex(anEvent); |
---|
| 201 | } |
---|
| 202 | </programlisting> |
---|
| 203 | </example> |
---|
| 204 | |
---|
| 205 | </sect3> |
---|
| 206 | |
---|
| 207 | <!-- ******************* Section (Level#3) ****************** --> |
---|
| 208 | <sect3 id="sect.EventGen.InterPriGen.FormASCII"> |
---|
| 209 | <title> |
---|
| 210 | Format of the ASCII file |
---|
| 211 | </title> |
---|
| 212 | |
---|
| 213 | <para> |
---|
| 214 | An ASCII file, which will be fed by <emphasis>G4HEPEvtInterface</emphasis> |
---|
| 215 | should 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 |
---|
| 235 | generate an ASCII file. |
---|
| 236 | </para> |
---|
| 237 | |
---|
| 238 | <example id="programlist_EventGen_2"> |
---|
| 239 | <title> |
---|
| 240 | A 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 | >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 | > ISTHEP(IHEP),IDHEP(IHEP),JDAHEP(1,IHEP),JDAHEP(2,IHEP), |
---|
| 259 | > PHEP(1,IHEP),PHEP(2,IHEP),PHEP(3,IHEP),PHEP(5,IHEP) |
---|
| 260 | 10 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> |
---|
| 273 | Future interface to the new generation generators |
---|
| 274 | </title> |
---|
| 275 | |
---|
| 276 | <para> |
---|
| 277 | Several activities have already been started for developing |
---|
| 278 | object-oriented event generators. Such new generators can be easily |
---|
| 279 | linked and used with a Geant4 based simulation. Furthermore, we |
---|
| 280 | need not distinguish a primary generator from the physics processes |
---|
| 281 | used in Geant4. Future generators can be a kind of physics process |
---|
| 282 | plugged-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> |
---|
| 292 | Event overlap using multiple generators |
---|
| 293 | </title> |
---|
| 294 | |
---|
| 295 | <para> |
---|
| 296 | Your <emphasis>G4VUserPrimaryGeneratorAction</emphasis> concrete class can have |
---|
| 297 | more than one <emphasis>G4VPrimaryGenerator</emphasis> concrete class. Each |
---|
| 298 | <emphasis>G4VPrimaryGenerator</emphasis> concrete class can be accessed more than |
---|
| 299 | once per event. Using these class objects, one event can have more |
---|
| 300 | than one primary event. |
---|
| 301 | </para> |
---|
| 302 | |
---|
| 303 | <para> |
---|
| 304 | One possible use is the following. Within an event, a |
---|
| 305 | <emphasis>G4HEPEvtInterface</emphasis> class object instantiated with a minimum |
---|
| 306 | bias event file is accessed 20 times and another |
---|
| 307 | <emphasis>G4HEPEvtInterface</emphasis> class object instantiated with a signal |
---|
| 308 | event file is accessed once. Thus, this event represents a typical |
---|
| 309 | signal event of LHC overlapping 20 minimum bias events. It should |
---|
| 310 | be noted that a simulation of event overlapping can be done by |
---|
| 311 | merging hits and/or digits associated with several events, and |
---|
| 312 | these events can be simulated independently. Digitization over |
---|
| 313 | multiple events will be mentioned in |
---|
| 314 | <xref linkend="sect.Digi" />. |
---|
| 315 | </para> |
---|
| 316 | |
---|
| 317 | |
---|
| 318 | </sect2> |
---|
[1211] | 319 | </sect1> |
---|