void candleplotstack()
{
auto dateBegin =
new TDatime(2010,1,1,0,0,0);
auto dateEnd =
new TDatime(2011,1,1,0,0,0);
int bins = 1000;
auto h1 =
new TH2I(
"h1",
"Machine A",6,dateBegin->Convert(),dateEnd->Convert(),bins,0,1000);
auto h2 =
new TH2I(
"h2",
"Machine B",6,dateBegin->Convert(),dateEnd->Convert(),bins,0,1000);
auto hsum =
new TH2I(
"h4",
"Sum",6,dateBegin->Convert(),dateEnd->Convert(),bins,0,1000);
float Rand;
for (int i = dateBegin->Convert(); i < dateEnd->Convert(); i+=86400*30) {
for (int j = 0; j < 1000; j++) {
Rand = rng->Gaus(500+sin(i/10000000.)*100,50);
h1->
Fill(i,Rand);
hsum->Fill(i,Rand);
Rand = rng->Gaus(500+sin(i/12000000.)*100,50); h2->Fill(i,Rand);
hsum->Fill(i,Rand);
}
}
auto hs =
new THStack(
"hs",
"Machine A+B");
hs->Add(h2,"candle2");
hs->Add(
hsum,
"violin1");
hs->Draw("candle3");
hs->GetXaxis()->SetNdivisions(410);
hs->GetXaxis()->SetTimeDisplay(1);
hs->GetXaxis()->SetTimeFormat("%d/%m/%y");
hs->GetXaxis()->SetNdivisions(-6);
hs->GetXaxis()->SetTitle("Date [day/month/year]");
gPad->BuildLegend(0.75,0.75,0.95,0.95,
"");
}
R__EXTERN TStyle * gStyle
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
2-D histogram with an int per channel (see TH1 documentation)
The Histogram stack class.
This is the base class for the ROOT Random number generators.
void SetTimeOffset(Double_t toffset)
Change the time offset for time plotting.