I describe below some steps in producing Monte Carlo samples, mainly for B physics studies, using   Pythia and QQ   which have been incorporated in the Dzero Run II software (mcpp/d0_mcpp).
(1) There is already a  MCpythia.x  in every release located in
$BFDIST/releases/$BFCURRENT/bin/$BFARCH
(all these variables are defined after one does "setup D0RunII xx.xx.xx").
One can run as MCpythia.x -rcp runMCpythia.rcp in which runMCpythia.rcp * may have
string Packages = "p1 MCpythia p3 p4"
RCP p1 = < d0_mcpp MCNewEvent >
RCP MCpythia = < d0_mcpp MCpythia >
RCP p3 = < d0_mcpp MCDumpEvent >
RCP p4 = < d0_mcpp MCWriteEvent >
assuming that you put the rcp files in the directory d0_mcpp/rcp.
* You have to create runMCpythia.rcp yourself and you may modify from d0_mcpp/rcp/runMCisagen.rcp .
(2) The above rcp files can be found in the release area of d0_mcpp/rcp. The other rcp files which may be changed are mcvertex.rcp and seed.rcp and they can also be found in the same directory.
(3) The other files necessary for Pythia are pythia.cards and pythia.cmd. Both files can be found in the release area of mcpp/doc. pythia.cmd is customarily written so that mcpp can call pythia codes. pythia.cards is the standard file to set all the optional parameters for Pythia.
(4) One has to stop the B's generated in Pythia from decaying and let QQ decay the B's. This is set in pythia.cards. For example, if you want QQ to decay Bd , you should set
MDCY(C511,1) = 0 in pythia.cards
(5) Another important file is "user.dec", which control how the B's would decay. The default decays are set in "$QQ_DECAY_FILE", which is also defined after you setup D0RunII --- that in turn "setup qq" for you. "user.dec" would overwrite the information in "$QQ_DECAY_FILE".
In order to activate "user.dec", one needs to define the variable "QQ_USER_FILE" such as
setenv QQ_USER_FILE ./user.dec (in csh).
One example of "user.dec" can be found in the release area of mcpp/doc. For example, to force B0 to decay to pi + pi - , one can have the following in the file "user.dec":
DECAY B0
CHANNEL 0 1.000 PI+ PI-
ENDDECAY
You probably want to look at the file "$QQ_DECAY_FILE" in order to write your own "user.dec" ("$QQ_USER_FILE").
In certain complicated (and probably rare) cases, if you really want to create your own particle in QQ, read these email correspondences.
(6) Succeeding all these steps, you would have a data file in which each event should have one MCKineChunk (from the generator Pythia/QQ).
In the WriteEvent RCP file, one may do :
// Event tagging string WriteEventTags = "save" string VetoEventTags = "delete"to provide tagging switches for your source code to tag only the events that have the B flavor of your interest.
In the source code (in C++), one has to look at the MCKineChunk and loops over all particles in that generator chunk to see whether this is the B particle that you want.
Note: If you just do what it is said up to now, you will have only one MCKineChunk. But, if you run it through d0gstar (see section C), you may have more than one MCKineChunk. In this case, you have to look for the first MCKineChunk which is the chunk for information from the generator, NOT from d0gstar nor minimum biased event information.**In long term, it is not always safe to look at the first MCKineChunk but this is about the only way at the moment.
For example, to see whether there is Bd_bar (particle code = -250) in an "edm::Event event", one can do the following :
list< THandle<MCKineChunk> > mcchunks=_mcKey.findAll(event);
list< THandle<MCKineChunk> >::iterator kinechunk ;
int iichunk=0;
myBflavor = -250 ;
for ( kinechunk=mcchunks.begin(); kinechunk != mcchunks.end() ; ++kinechunk ) {
iichunk++;
if ( iichunk == 1 ) { // To look at the first MCKineChunk from generator, not d0gstar
MCevt* ptevt=(*kinechunk)->ptrMCevt(); // get pointer to MC event
list listp;
ptevt->getParticles(listp); // get complete list of particles
list::iterator jj;
int num_B = 0 ;
for ( jj=listp.begin(); jj != listp.end() ; ++jj ) {
if ( (*jj)->isaId() == myBflavor ) {
num_B++ ;
// do something ...
}
}
// "save" and "delete" are used in consistent with what it is put in the RCP file above
if ( num_B > 0 ) {
event.tag("save") ;
// do something ...
}
else {
event.tag("delete") ;
// do something ...
}
}
}
If you have any questions, corrections or comments, feel free to contact me.