Example of TGraphTime showing how the class could be used to visualize a set of particles with their time stamp in a MonteCarlo program.
See the TGraphTime documentation
#include <vector>
void gr018_time2(
Int_t nsteps = 200,
Int_t np = 5000)
{
if (np > 5000) np = 5000;
std::vector<Int_t> color(np);
std::vector<Double_t> cosphi(np), sinphi(np), speed(np);
g->SetTitle(
"TGraphTime demo 2;X;Y");
for (
Int_t i = 0; i < np; i++) {
speed[i] =
r.Uniform(0.5, 1);
if (rc > 0.3) color[i] =
kBlue;
}
for (
Int_t s = 0; s < nsteps; s++) {
for (
Int_t i = 0; i < np; i++) {
m->SetMarkerColor(color[i]);
m->SetMarkerSize(1.5 -s/(speed[i]*nsteps));
}
}
}
int Int_t
Signed integer 4 bytes (int).
double Double_t
Double 8 bytes.
TGraphTime is used to draw a set of objects evolving with nsteps in time between tmin and tmax.
A Pave (see TPave) with a text centered in the Pave.
Random number generator class based on M.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
- Author
- Rene Brun
Definition in file gr018_time2.C.