Candle Decay, illustrate a time development of a certain value.
void hist047_Graphics_candle_decay()
{
auto *hist =
new TH2I(
"hist",
"Decay; probability density; time", 1000, 0, 1000, 20, 0, 20);
for (int iBin = 0; iBin < 19; iBin++) {
for (int j = 0; j < 1000000; j++) {
float myRand = rand.
Gaus(350 + iBin * 8, 20 + 2 * iBin);
hist->Fill(myRand, iBin);
}
}
hist->SetBarWidth(3);
hist->SetFillStyle(0);
hist->SetFillColor(
kGray);
hist->SetLineColor(
kBlue);
auto *can =
new TCanvas(
"can",
"Candle Decay", 800, 600);
can->Divide(2, 1);
can->cd(1);
hist->Draw("violiny(112000000)");
can->cd(2);
auto *hist2 =
static_cast<TH2I *
>(hist->Clone(
"hist2"));
hist2->DrawCopy("candley2");
}
virtual void SetBarWidth(Float_t width=0.5)
Set the width of bars as fraction of the bin width for drawing mode "B".
2-D histogram with an int per channel (see TH1 documentation)
This is the base class for the ROOT Random number generators.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
- Author
- Georg Troska
Definition in file hist047_Graphics_candle_decay.C.