Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-09-27 07:03:08

0001 import sys
0002 
0003 import numpy as np
0004 from pyHepMC3 import HepMC3
0005 
0006 # generates 2 electrons from different vertices relevant for the lumi Pair Spectrometer
0007 outfilename = sys.argv[1]
0008 mass = 0.511e-3
0009 pz = -10 # GeV
0010 E = np.sqrt(mass**2 + pz**2)
0011 
0012 y1 = 110 # y position of gun 1 in mm
0013 y2 = 180 # y position of gun 2 in mm
0014 z = -64000 # z position close to entrance of lumi Pair Spectrometer CALs in mm
0015 
0016 writer = HepMC3.WriterAscii( outfilename )
0017 
0018 for ix in range(100):
0019 
0020     particle_in1 = HepMC3.GenParticle(HepMC3.FourVector(0, 0, pz, E))
0021     particle_in1.set_pdg_id(11)
0022     particle_in1.set_status(3)
0023     particle_out1 = HepMC3.GenParticle(HepMC3.FourVector(0, 0, pz, E))
0024     particle_out1.set_pdg_id(11)
0025     particle_out1.set_status(1)
0026 
0027     particle_in2 = HepMC3.GenParticle(HepMC3.FourVector(0, 0, pz, E))
0028     particle_in2.set_pdg_id(11)
0029     particle_in2.set_status(3)
0030     particle_out2 = HepMC3.GenParticle(HepMC3.FourVector(0, 0, pz, E))
0031     particle_out2.set_pdg_id(11)
0032     particle_out2.set_status(1)
0033 
0034     vertex1 = HepMC3.GenVertex(HepMC3.FourVector(0., y1, z, 0.))
0035     vertex1.add_particle_in( particle_in1 )
0036     vertex1.add_particle_out( particle_out1 )
0037 
0038     vertex2 = HepMC3.GenVertex(HepMC3.FourVector(0., y2, z, 0.))
0039     vertex2.add_particle_in( particle_in2 )
0040     vertex2.add_particle_out( particle_out2 )
0041 
0042     event = HepMC3.GenEvent( HepMC3.Units.GEV, HepMC3.Units.MM )
0043     event.add_vertex( vertex1 )
0044     event.add_vertex( vertex2 )
0045 
0046     writer.write_event( event )