- I can help you debug your programs. If you have trouble getting your program to compile or you have a specific question about why it behaves in a way that you don't expect, e-mail me your program and I will have a look at it.
- I will be happy to discuss any intermediate results you have and let you know how to judge whether they are reasonable.
- Powers of double precision numbers are calculated using the
`pow()`function, not the '^' character, which is used to represent bit-wise exclusive-or operation. So, the following are equivalent ways to cube a double precision number`x`#include <math.h> ... double y = x*x*x; double y = pow(x,3); // This function needs the math.h include file

- The first question doesn't require a histogram
- Neither does the second question
- In practice, the rejection method will probably be easier than solving
for the root of a third order polynomial, which would be necessary in
order to apply the inversion method. The resulting distributions will
require two histograms. Here are the suggested definitions:
TH1F *h_xf = new TH1F("xf","Feynman x",100,0.0,1.0); TH1F *h_pzcm = new TH1F("pzcm","Pz(D0) in center of mass frame",100,0.0,50.0);

- After boosting the D0 back into the lab frame, it would be hard to
imagine that it might have a momentum larger than that of the incident
pion... Therefore, a reasonable definition for the histogram of the
longitudinal momentum of the D0 in the lab frame would be
TH1F *h_pzlab = new TH1F("pzlab","Pz(D0) in lab frame",100,0.0,500.0);

- Since we want to count the number of D0's that decay before travelling 1 cm, a reasonable definition for the decay length is TH1F *h_len = new TH1F("len","D0 decay length in lab frame",100,0.0,2.0);
- Question 6 doesn't require any computing.
- Since cos(theta*) ranges from -1 to +1 and theta* ranges from 0 to
pi, reasonable histogram definitions are as follows:
TH1F *h_costhkcm = new TH1F("costhkcm","cos(theta*) of kaon in D0 rest frame",100,-1.0,1.0); TH1F *h_thkcm = new TH1F("thkcm","theta* (deg) in D0 rest frame",180,0,180.0);

where the angle needs to be converted to degrees before being filled in this histogram. - You will find that the angles in the lab frame are really quite small
since the boost is large. Reasonable definitions for these angles in
degrees are as follows:
TH1F *h_thklab = new TH1F("thklab","theta (deg) of kaon in lab frame",100,0.0,5.0); TH1F *h_thpilab = new TH1F("thpilab","theta (deg) of pion in lab frame",100,0,5.0);

- The D0 has a mass of about 1.8 GeV, so a reasonable range would be
TH1F *h_mkpi = new TH1F("mkpi","M(K,pi) in GeV",100,1.6,2.0);

- When the K and pi are accidentally swapped, a very wide distribution
results. In this case a reasonable definition is
TH1F *h_mkpiswap = new TH1F("mkpiswap","M(K,pi) from wrong mass hypothesis in GeV",100,0.0,5.0);

It is also interesting to fill both cases in the same histogram to see how the wrong mass hypotheses result in a fairly broad background that is easily distinguished from the signal obtained with the correct mass hypothesis.