An upgraded version of the package BCVEGPY2.0: [C.-H. Chang, J.-X. Wang, X.-G. Wu, Comput. Phys. Commun. 174 (2006) 241] is presented, which works under LINUX system and is named as BCVEGPY2.1. With the version and a GNU C compiler additionally, users may simulate the
Bc-events in various experimental environments very conveniently. It has been manipulated in better modularity and code reusability (less cross communication among various modules) than BCVEGPY2.0 has. Furthermore, in the upgraded version a special execution is arranged as that the GNU command
make compiles a requested code with the help of a master
makefile in main code directory, and then builds an executable file with the default name
run. Finally, this paper may also be considered as an erratum, i.e., typo errors in BCVEGPY2.0 and corrections accordingly have been listed.
New version program (BCVEGPY2.1) summary
Title of program: BCVEGPY2.1
Catalogue identifier: ADTJ_v2_1
Program summary URL: http://cpc.cs.qub.ac.uk/summaries/ADTJ_v2_1
Program obtainable from: CPC Program Library, Queen's University of Belfast, N. Ireland
Reference to original program: BCVEGPY2.0
Reference in CPC: Comput. Phys. Commun. 174 (2006) 241
Does the new version supersede the old program: No
Computer: Any LINUX based on PC with FORTRAN 77 or FORTRAN 90 and GNU C compiler as well
Operating systems: LINUX
Programming language used: FORTRAN 77/90
Memory required to execute with typical data: About 2.0 MB
No. of lines in distributed program, including test data, etc.: 31 521
No. of bytes in distributed program, including test data, etc.: 1 310 179
Distribution format: tar.gz
Nature of physical problem: Hadronic production of Bc meson itself and its excited states
Method of solution: The code with option can generate weighted and unweighted events. An interface to PYTHIA is provided to meet the needs of jets hadronization in the production.
Restrictions on the complexity of the problem: The hadronic production of
-quarkonium in S-wave and P-wave states via the mechanism of gluon–gluon fusion are given by the so-called ‘complete calculation’ approach.
Reasons for new version: Responding to the feedback from users, we rearrange the program in a convenient way and then it can be easily adopted by the users to do the simulations according to their own experimental environment (e.g. detector acceptances and experimental cuts). We have paid many efforts to rearrange the program into several modules with less cross communication among the modules, the main program is slimmed down and all the further actions are decoupled from the main program and can be easily called for various purposes.
Typical running time: The typical running time is machine and user-parameters dependent. Typically, for production of the S-wave
-quarkonium, when IDWTUP = 1, it takes about 20 hour on a 1.8 GHz Intel P4-processor machine to generate 1000 events; however, when IDWTUP = 3, to generate 106 events it takes about 40 minutes only. Of the production, the time for the P-wave
-quarkonium will take almost two times longer than that for its S-wave quarkonium.
Summary of the changes (improvements):
(1) The structure and organization of the program have been changed a lot. The new version package BCVEGPY2.1 has been divided into several modules with less cross communication among the modules (some old version source files are divided into several parts for the purpose). The main program is slimmed down and all the further actions are decoupled from the main program so that they can be easily called for various applications. All of the Fortran codes are organized in the main code directory named as bcvegpy2.1, which contains the main program, all of its prerequisite files and subsidiary ‘folders’ (subdirectory to the main code directory). The method for setting the parameter is the same as that of the previous versions [C.-H. Chang, C. Driouich, P. Eerola, X.-G. Wu, Comput. Phys. Commun. 159 (2004) 192, hep-ph/0309120. [1]], [C.-H. Chang, J.-X. Wang, X.-G. Wu, Comput. Phys. Commun. 174 (2006) 241, hep-ph/0504017. [2]], i.e. the parameters are set in a file named parameter.F. Each subsidiary ‘folders’ contains the necessary files to complete specific tasks accordingly. And there are totally seven modules/‘folders’ in the program:
• The module generate: it is the key module, which contains the files for generating the Bc events. There are seven source files in this ‘folder’: evntinit.F, colorflow.F, genevnt.F, py6208.F (a nickname of PYTHIA6.208 [T. Sjostrand, Comput. Phys. Commun. 82 (1994) 74. [3]]), totfun.F, outerpdf.F and initmixgrade.F. The function of the module generate is to set the initialize conditions for event simulation; to establish a connection with PYTHIA [T. Sjostrand, Comput. Phys. Commun. 82 (1994) 74. [3]]; to establish a connection to the parton distribution functions (PDFs) that are not included in PYTHIA according to specific need; to record the color flow information of the generated Bc events and may provide it according to one's need; to calculate the kernel for phase space integration with the help of swave module and pwave module; to do the phase space integration with the help of phase module. A useful trick for generating the mixed type of Bc events is suggested (three types of mixed events are provided in the generator [C.-H. Chang, J.-X. Wang, X.-G. Wu, Comput. Phys. Commun. 174 (2006) 241, hep-ph/0504017. [2]], e.g. by setting the parameter IMIXTYPE = 2, one can generate the mixed events for the two color-singlet
-quarkonium states
and
). The file initmixgrade.F is used to initialize the importance sampling function for Monte Carlo simulation, i.e., either by using the importance sampling function given by the current VEGAS running [G.P. Lepage, J. Comp. Phys. 27 (1978) 192. [4]] or by using the existed importance sampling function recorded in an existed grade file in data subdirectory that has already been generated by earlier VEGAS running. Once the importance sampling function has been obtained by VEGAS, it is recorded in a grade file (with suffix.grid) automatically, and can be conveniently used (by initmixgrade.F) for later usage without running VEGAS again. Some more detail on this point will be shown in the following item (2).
• The module phase: it contains the files for generating the allowed phase-space point and for generating an importance sampling function with VEGAS program [G.P. Lepage, J. Comp. Phys. 27 (1978) 192. [4]]. It contains three source files: phase_gen.F, phase_point.F and vegas.F.
• The module swave: it contains the files for calculating the square of the amplitudes for producing the four color-singlet and color-octet
-quarkonium in S-wave:
,
,
and
, where the subscripts 1 and 8 stand for color-singlet and color-octet accordingly. Note that in fact the configurations
and
play comparatively important role only for the production of the P-wave excited Bc states as shown in Ref. [C.-H. Chang, C.-F. Qiao, J.-X. Wang, X.-G. Wu, Phys. Rev. D 71 (2005) 074012. [5]]. It contains five source files: s_bound.F, s_common.F, s_foursets.F, s_free.F and s_samp.F.
• The module pwave: it contains the files for calculating the square of the amplitudes for producing the four color-singlet
-quarkonium in P-wave:
and
(J=1,2,3). It contains six source files: p_lorentz.F, p1p1amp.F, pj0amp.F, pj1amp.F, pj2amp.F and p_samp.F.
• The module pybook: it contains the files for initializing the subroutine PYBOOK of PYTHIA to record the events. The user may conveniently switch off this module in the main program to use his/her own way to record the data. It contains five source files: pybookinit.F, uphistrange.F, uppydump.F, uppyfact.F and uppyfill.F.
• The module setparameter: it contains the files for inner use of the parameters (mainly generates some short notations for the parameters) that have been set in parameter.F. It has only two source files: simparameter.F and uperror.F, where uperror.F lists some typical error messages for the cases when the input parameters are out of allowed (reasonable) range.
• The module system: it contains files to open or close the record files and to print out certain running messages at the intermediate steps according to need, which may tell the users at what step the program is running. It contains six source files: upopenfile.F, uplogo.F, vegaslogo.F, updatafile.F, upclosegradefile.F and upclosepyfile.F.
Each module is equipped with its own makefile that will be used to make a library of the same name, e.g. the makefile in the ‘folder’ swave/ will be used by the GNU command make to generate a library swave.a. These sub-makefiles are orchestrated by a master makefile in the main code directory. Libraries required for the main program are listed in the LIBS variable of the master makefile and built automatically by invoking the sub-makefiles:LIBS=generate.a swave.a pwave.a phase.a setparameter.a system.a pybook.aIn the way that based on makefile then the make command builds an executable file whose default name is run, the program acquires good modularity and code reusability, and the user can easily make the BCVEGPY generator to suit his/her experimental simulation environment as wish. Namely, to connect this generator with his/her own generator package such as ANTENNA (used by ATLAS group), LHCb (used by LHCB group) and SIMUB (used by CMS group)1only a few pieces of the program need to be changed. By doing this way, the time for compiling the Fortran source files can be saved, because once the source file has been compiled, it does not need to be recompiled again unless some changes have been made. The schematic structure of the program is shown in Fig. 1. Note that in order to let the make command work smoothly, especially, to deal with some preprocessor parameters in the source files, all the suffixes of the source files (with suffix .for) in the original version of BCVEGPY2.0 [C.-H. Chang, J.-X. Wang, X.-G. Wu, Comput. Phys. Commun. 174 (2006) 241, hep-ph/0504017. [2]] are renamed as .F and the suffixes of the original header files (with suffix .f) are renamed as .h.

Fig. 1. The schematic structure for the new version of BCVEGPY.
(2) To simulate the events in mixture of the Bc and its excited states properly and in order to save CPU time, we offer an additional option in the package BCVEGPY2.1: by setting IVEGASOPEN = 0 and IGRADE = 1, one may generate the mixed Bc events just by reading the existent importance sampling function and total cross-section from ‘previous’ VEGAS runs for the production, when they have been saved in date files with initmixgrade.F accordingly. Thus, it means that when using the package under the option, one runs VEGAS once enough. Whereas, in BCVEGPY2.0 [C.-H. Chang, J.-X. Wang, X.-G. Wu, Comput. Phys. Commun. 174 (2006) 241, hep-ph/0504017. [2]], there is only one option by setting IVEGASOPEN = 1: it is to run VEGAS every time, although the importance sampling function obtained by each run is recorded in an existed grade file in the data subdirectory. For the new option offered here, the trick to save CPU time is not to run VEGAS, once the importance sampling function has been recorded in the .grid file already.
(3) In the package BCVEGPY2.1, for testing the importance sampling function obtained by VEGAS and simulating the true situation as well as possible, we have further offered another option: with setting IVEGASOPEN = 0 and IGRADE = 0, VEGAS or the importance sampling function (grade function) generated in previous runs will not be used at all. In this case, being different from the other options, all of the files with suffix .grid must be generated and saved via previous run(s) for the states which one would like to mix according to their weights. Namely one should have them in advance, because the program needs to read the total cross-sections of these states from the .grid files accordingly, so as to determine the relative weight of each state in making the mixing correctly.
(4) As stated in Ref. [C.-H. Chang, J.-X. Wang, X.-G. Wu, Comput. Phys. Commun. 174 (2006) 241, hep-ph/0504017. [2]], the precision of the generated importance sampling function by running VEGAS can be improved by properly adjusting the maximum iteration number, the number of calls to the integrand in each time of the iteration, and the number of bins (the [0,1] region is divided into how many sub-regions) as well. In the present version, we define three overall parameters: NVEGITMX, NVEGCALL and NVEGBIN in the head file invegas.h, with these three parameters one can easily adjust them. Similarly, for convenience, the parameters which are not changed frequently are also defined in the source file run.F, e.g. NUMOFEVENTS (number of events to be generated), ENERGYOFTEVA (TEVATRON energy) and ENERGYOFLHC (LHC energy).
(5) All the files for obtained data are put in the subdirectory data. For clarity, in recording the obtained data, all of the grade files are ended with the suffix .grid, all the intermediate files, that record the used parameter values and the VEGAS running information, are ended with suffix .cs and all the files that record the differential distributions, e.g. the transverse momentum and rapidity distributions of the
-quarkonium, are ended with suffix .dat. In a specific grade file, not only the information for the sampling importance function is recorded, but also the total cross-section and the maximum differential cross-section are recorded.
(6) A simple script, named as do which does all the necessary jobs for generating the events, is put in the main code directory. For convenience, a script, named as pnuglot that may produce a high-quality plot in Encapsulatetd PostScript (EPS) format from a data file, is supplied here (taken from the FormCalc package [T. Hahn, M. Rauch, hep-ph/0601248, 2006. [7]]).
(7) We have found several typos in BCVEGPY2.0 [C.-H. Chang, J.-X. Wang, X.-G. Wu, Comput. Phys. Commun. 174 (2006) 241, hep-ph/0504017. [2]], so we list all of them and their corrections here:
• In the subprogram bcvegpy.for: in lines 493–507, the values for MSTU(112) and PARU(112) should be exchanged; in line 212, IMIXTYPE =1 should be replaced by IMIXTYPE = 3; in line 956, PETA =PYP(I, 19) should be replaced with PSETA = PYP(I, 19).
• In the subprogram genevnt.for: in line 505, ICOLUP(1, 3) = 503 should be replaced by ICOLUP(1, 4) = 503.
• In the subprogram parameter.for: we should add the statement ‘double complex colmat, bundamp’ for assigning the nature of the variables in all of the three subroutines there; in the subroutine setparameter when calling the subroutine setctq6, to match to the default setting of the parameters, the original setctq6(3) should be replaced by setctq6(4), which corresponds to the default setting of PDF as CTEQ6L1 [H.L. Lai, et al., JHEP 0207 (2002) 012, hep-ph/0201195. [6]].