Solid eventgenerator

From Hall A Wiki
Revision as of 08:51, 25 April 2018 by Tianye (Talk | contribs) (Compile and run it on the current ifarm environment)

Jump to: navigation, search


inclusive event generator


[1], Yuxiang's talk

see "readme"

SoLID inclusive electron generator

This is a generator to generate inclusive electrons in the (Ep, theta) phase space.

It's wriiten for JLab HallA SoLID, but it can have general use too.

The process includes QE + resonance + DIS for nucleus target with Z protons and A atoms.

The W<3 GeV region uses Peter Bosted fit

the W>3 GeV region uses world PDF sets, the LHAPDF6 interface is used

pure C/C++ code, using CMake compiler


see "readme"


What it can do

It can generate:

  • <math>e^- </math> DIS events
  • <math>\pi^+ , \pi^-, \pi^0, K^+, K^-, K_s, p</math> with cross section given by the WISER fits. The <math>\pi^0</math> then decay in two photons. The two photons output are in the tree as pi0_g1 and pi0_g2.
  • <math>e^- </math> ELASTIC events
  • The output is then written also in LUND and SOLLUND format (the decay products will be part of the same event)
  • The vertex position is decided in an uniform way randomly inside the raster. For the two decayed <math>\gamma</math>s from the <math>\pi^0</math> the vertex is shifted by a displacement determined selecting randomly the decay time. If the radius is set to "0.0" in the input file, the vertex will not be generated

see "readme" for details

The input file

the input file it commands the event generator with information in common to every process. an example can be found at The flags are (they need to be in the same order as in the example)

  • nevt : Number of events to be generated (for example 25000)
  • nprint : Number of events every which to print and output on screen (for example 1000000)
  • lumin  : Luminosity for nuclei (not for nucleon) (for example 1.0e37 Hz/cm^2)
  • runtime  : Runtime (for example 48.0 hours)
  • e-_en  : Beam energy (for example 6.0 GeV)
  • ion_en : Energy of the ions of the target (for example 0.938 GeV)
  • ion_m : Mass of the ions of the target (for example 0.938 GeV)
  • ion_Z : Number of protons in the target (for example 1)
  • ion_N : Number of neutrons in the target (for example 1)
  • dens : Density of the target (g/cm^3): if 0.0, will try to search one in his own database. If you rather than want to use your own (or it is not in the database), specify it here (for example 0.162 g/cm^3)
  • length : Length of the target (cm): if 0.0, will try to search one in his own database. If you rather than want to use your own (or it is not in the database), specify it here (for example 40 cm)
  • lenx : size in X of the raster (cm , it is assumed to be of cylindrical shape): if 0.0 The vertex will not be generated (for example 0.2 cm)
  • leny : size in Y of the raster (cm , it is assumed to be of cylindrical shape): if 0.0 The vertex will not be generated (for example 0.2 cm)
  • model : Model for the cross section used: 1= electron DIS ; 2=pi+ ; 3=pi- ; 4=pi0 ; 5= electron ELASTIC ( for example 1)
  • output : Output format: 1=root ; 2=root+LUND ' 3=root+SOLLUND (for example 3)

Output file

The output file name is specified at the time of execution of eicRate. If not specified the default 'output.root' will be used. It is also possible to have text output in lund format in parallel of the root format

   fTree->Branch("weight", &fData.weight, "weight/D");   (this is number of events for the luminosity and run time)
   fTree->Branch("rate", &fData.rate, "rate/D");  (this is event rate in Hz/s for the luminosity)
   fTree->Branch("theta", &fData.theta, "theta/D");
   fTree->Branch("jetth", &fData.jetth, "jetth/D");
   fTree->Branch("phi", &fData.phi, "phi/D");
   fTree->Branch("x", &fData.x, "x/D");
   fTree->Branch("Ef", &fData.ef, "Ef/D");
   fTree->Branch("crs", &, "crs/D");
   fTree->Branch("F1", &fData.f1, "F1/D");
   fTree->Branch("F2", &fData.f2, "F2/D");
   fTree->Branch("F1gZ", &fData.f1gz, "F1gZ/D");
   fTree->Branch("F3gZ", &fData.f3gz, "F3gZ/D");
   fTree->Branch("F1Wp", &fData.f1wp, "F1Wp/D");
   fTree->Branch("F3Wp", &fData.f3wp, "F3Wp/D");
   fTree->Branch("F1Wm", &fData.f1wm, "F1Wm/D");
   fTree->Branch("F3Wm", &fData.f3wm, "F3Wm/D");
   fTree->Branch("eta_gZ", &fData.eta_gZ, "eta_gZ/D");
   fTree->Branch("Q2", &fData.Q2, "Q2/D");
   fTree->Branch("pdf", fData.pdf, "pdf[6]/D");
   fTree->Branch("Dpdf", fData.Dpdf, "pdf[5]/D");
   fTree->Branch("Abeam", &fData.Abeam, "Abeam/D");
   fTree->Branch("A_L", &fData.A_L, "A_L/D");
   fTree->Branch("A_L_g1", &fData.A_L_g1, "A_L_g1/D");
   fTree->Branch("A_L_g5", &fData.A_L_g5, "A_L_g5/D");
   fTree->Branch("A_T", &fData.A_T, "A_T/D");
   fTree->Branch("Y_L", &fData.Y_L, "Y_L/D");
   fTree->Branch("Y_T", &fData.Y_T, "Y_T/D");
   fTree->Branch("eta_L", &fData.eta_L, "eta_L/D");
   fTree->Branch("eta_T", &fData.eta_T, "eta_T/D");
   fTree->Branch("g1gZ", &fData.g1gz, "g1gZ/D");
   fTree->Branch("g5gZ", &fData.g5gz, "g5gZ/D");
   fTree->Branch("g1Wp", &fData.g1wp, "g1Wp/D");
   fTree->Branch("g5Wp", &fData.g5wp, "g5Wp/D");
   fTree->Branch("g1Wm", &fData.g1wm, "g1Wm/D");
   fTree->Branch("g5Wm", &fData.g5wm, "g5Wm/D");
   fTree->Branch("W", &fData.W, "W/D");
   fTree->Branch("y", &fData.y, "y/D");
   fTree->Branch("Y", &fData.Y, "Y/D");
   fTree->Branch("AWp", &fData.AWp, "AWp/D");
   fTree->Branch("AWp_g1", &fData.AWp_g1, "AWp_g1/D");
   fTree->Branch("AWp_g5", &fData.AWp_g5, "AWp_g5/D");
   fTree->Branch("AWm", &fData.AWm, "AWm/D");
   fTree->Branch("AWm_g1", &fData.AWm_g1, "AWm_g1/D");
   fTree->Branch("AWm_g5", &fData.AWm_g5, "AWm_g5/D");
   fTree->Branch("Wpweight", &fData.Wpweight, "Wpweight/D");
   fTree->Branch("Wprate",   &fData.Wprate, "Wprate/D");
   fTree->Branch("Wmweight", &fData.Wmweight, "Wmweight/D");
   fTree->Branch("Wmrate",   &fData.Wmrate, "Wmrate/D");
   fTree->Branch("jetp", &fData.jetp, "jetp/D");
   fTree->Branch("jetE", &fData.jetE, "jetE/D");
   fTree->Branch("Z_ion", &fData.Z_ion, "Z_ion/I");
   fTree->Branch("N_ion", &fData.N_ion, "N_ion/I");    
   fTree->Branch("particle_id", &fData.particle_id, "particle_id/I");
   fTree->Branch("charge", &fData.charge, "charge/I");
   fTree->Branch("mass", &fData.mass, "mass/D");
   fTree->Branch("pf", &, "pf/D");
   fTree->Branch("vx", &fData.vx, "vx/D");
   fTree->Branch("vy", &fData.vy, "vy/D");
   fTree->Branch("vz", &fData.vz, "vz/D");
   fTree->Branch("g1_theta", &fData.g1_theta, "g1_theta/D");
   fTree->Branch("g1_phi", &fData.g1_phi, "g1_phi/D");
   fTree->Branch("g1_p", &fData.g1_p, "g1_p/D");
   fTree->Branch("g2_theta", &fData.g2_theta, "g2_theta/D");
   fTree->Branch("g2_phi", &fData.g2_phi, "g2_phi/D");
   fTree->Branch("g2_p", &fData.g2_p, "g2_p/D");
  • LUND format
    • used for input into GEMC. flag 'output 2' in the inputfile (a script will create another file, named changing the string "root" in the output name with "lund", so by default 'output.lund'
    • GEMC 2.x take all entries in 1st row as they are into GEMC output bank "header"
    • GEMC 1.x doesn't have header bank so no 1st row entry will pass into GEMC output, the workaround is to use the information from the LUND file or from eicRate root tree output, pay special attention the make sure the event index is right.
    • the lund format is at [2], the entries defined here are
     OUT << "1" << " \t " << Wprate  << " \t " << Wmrate  << " \t " << "0"  << " \t " << "0" << " \t "  << x << " \t " << y  << " \t " << W  << " \t " << Q2  << " \t " << rate << endl;
     OUT << " \t " << "1" << " \t " << charge << " \t " << "1" << " \t " << particle_id << " \t " << "0" << " \t " << "0" << " \t " << px << " \t " << py << " \t " << pz << " \t " << Ef << " \t " << mass << " \t " << p_vertex.X()  << " \t " << p_vertex.Y() << " \t " << p_vertex.Z() << endl;
  • SOLLUND format
    • this is an alternative workaround to overcome the shortcoming of GEMC 1.x
    • flag 'output 3' in the inputfile (a script will create another file, named changing the string "root" in the output name with "sollund", so by default 'output.sollund'
    • based on LUND format, except one more entry "weight" is added between "Number of particles" and "Number of target nucleons"
    • SOLLUND file can be as input for solgemc, the "weight" will be taken into output.

Generated events

2.5M events for 4.4GeV, 5.5GeV, 6.6GeV, 11.0GeV at

Conversion from root to lund format

Following is shown a tool to convert and play with the output of the event generator


     Arguments for constructor are as follows 
                  name             mass          width         charge
                2*spin           parity  C-conjugation
             2*Isospin       2*Isospin3       G-parity
                  type    lepton number  baryon number   PDG encoding
                stable         lifetime    decay table 
                shortlived      subType    anti_encoding
                 name,           0.0*MeV,       0.0*MeV,         0.0, 
                 0,                    0,             0,          
                 0,                    0,             0,             
                 "geantino",           0,             0,           0,
                 true,               0.0,          NULL,
                 false,        "geantino",            0


                name,         0.0*MeV,       0.0*MeV,   +1.*eplus, 
                   0,               0,             0,          
                   0,               0,             0,             
          "geantino",               0,             0,           0,
                true,             0.0,          NULL,
                false,     "geantino",             0


I modified my root to lund conversion so that one can filter the data 
based on the angle of scattering of the electron.
I have also put the option to use a "lund format" file as input for 
filtering based on the angle (you have these files right now).
There is also an option to have in the output a geantino or a charged geantino, rather than the electron.


If you running without flags you get this message (how to use it):

 root2lund : This Program translate the output from eicRate in LUND format and Filter the scattered electron angles
 Usage: root2lund -o outputfile -i inputfile [-th_min theta_min] [-th_max theta_max] [-ph_min phi_min] [-ph_max phi_max] [-l 1-0] [-g 2-1-0]
     -o outputfile     : output file name (example pluto.lund)  
     -i inputfile      : input file name (example pluto.root)  
     -h help, print this message 
     -th_min theta_min : specify theta minimum for scattered electron 
     -th_max theta_max : specify theta maximum for scattered electron 
     -ph_min phi_min   : specify phi minimum for scattered electron 
     -ph_max phi_max   : specify phi maximum for scattered electron 
     -l 1-0            : specify format input file ( lund-> 1 (just angle filtering); root->0 (default) )
     -g 2-1-0          : specify if particle in output is a geantino ( geantino-> 1 ; charged geantino-> 2 ; normal->0 (default) )


Based on bbgen from halld to generate dominant exclusive events of photonproduction on proton, electron production on any nuclear target is added by assuming EPA for virtual photons and bremsstrahlung for real photons. scattered electron is not included in the output.

Rakitha's note

Rakitha's slides in time order [3][4][5]

HallD note

source code

compiled version with instruction /group/solid/apps/evgen/solid_bggen (it only works on ifarm1101 with centos6.5 for now because of dependence on /site/cernlib/i386_rhel6)

some lund file generated /work/halla/solid/evgen/solid_bggen

Some information and instructions from Rakitha:

The last entry in the lund file contains total rate divided by the total events in the file. So this number is small if the file contain large no.of events. I think the two files you were comparing may have been 10k (old file) and 100K (new file). The variable fEvQ2 which is the one before the last entry stores the total absolute rate for the particle. This is per Zhiwen's request. So this number can be compared between lund files with different event sizes.

I wanted to give you the steps I followed to generate these files. Here they are, modify the fort.15 macro file to set no.of events and random number value then run bggen using "./bggen" 1. First run the hall D code and this will generate a PAW file with default file name, "bggen.nt" 2. Convert the PAW file to root format using h2root command for example "h2root bggen.nt /home/rakithab/Simulation_Analysis/Generators/HallD/ElectroProduction/FixRate_10k_rootfiles/bggen_LH40cm_output_300k_1.root" 3. Then I have a script called available in remoll repository, to generate lund files. 4. For example "./HallD_gen_lund /home/rakithab/Simulation_Analysis/Generators/HallD/ElectroProduction/FixRate_10k_rootfiles/bggen_LH40cm_output_300k_8.root 1 2 1 " you can see what these options are in the code.

The final step will create 6 different lund files.

Compile and run solid_bggen on the current ifarm environment

SIDIS event generator (outdated)

see readme


see "readme"


see "readme"