Logo ROOT  
Reference Guide
candlescaled.C File Reference

Detailed Description

View in nbviewer Open in SWAN Candle Scaled, illustrates what scaleing does on candle and violin charts. Please try to modify the static functions SetScaledCandle and SetScaledViolin

void candlescaled()
{
TCanvas *c1 = new TCanvas("c1","TCandle Scaled",800,600);
c1->Divide(2,2);
TRandom *rng = new TRandom();
TH2I *h1 = new TH2I("h1","GausXY",20,-5,5,100,-5,5);
TH2I *h3 = new TH2I("h3","GausXY",100,-5,5,20,-5,5);
float myRand1;
float myRand2;
for (int j = 0; j < 100000; j++) {
myRand1 = rng->Gaus(0,1);
myRand2 = rng->Gaus(0,1);
h1->Fill(myRand1, myRand2);
h3->Fill(myRand1, myRand2);
}
c1->cd(1);
TCandle::SetScaledCandle(true); /* This is a global option for all existing candles, default is false */
h1->SetTitle("CandleX scaled");
h1->DrawCopy("candleX2");
c1->cd(2);
h3->SetTitle("CandleY scaled");
h3->DrawCopy("candleY2");
TCandle::SetScaledViolin(true); /* This is a global option for all existing violin, default is true */
TH2I *h2 = (TH2I*)h1->Clone();
h2->SetFillStyle(0);
h2->SetFillColor(kGray+2);
h2->SetLineColor(kBlue);
TH2I *h4 = (TH2I*)h3->Clone();
h4->SetFillStyle(0);
h4->SetFillColor(kGray+2);
h4->SetLineColor(kBlue);
c1->cd(3);
h2->SetTitle("ViolinX unscaled");
h2->DrawCopy("ViolinX");
c1->cd(4);
h4->SetTitle("ViolinY unscaled");
h4->DrawCopy("ViolinY");
}
Author
Georg Troska

Definition in file candlescaled.C.

TRandom::Gaus
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...
Definition: TRandom.cxx:263
TH1::DrawCopy
virtual TH1 * DrawCopy(Option_t *option="", const char *name_postfix="_copy") const
Copy this histogram and Draw in the current pad.
Definition: TH1.cxx:3044
TCandle::SetScaledViolin
static void SetScaledViolin(const Bool_t vScale=true)
Static function to set scaling between violin-withs.
Definition: TCandle.cxx:237
h1
TH1F * h1
Definition: legend1.C:5
TCandle::SetScaledCandle
static void SetScaledCandle(const Bool_t cScale=true)
Static function to set scaling between candles-withs.
Definition: TCandle.cxx:228
TH1::SetTitle
virtual void SetTitle(const char *title)
See GetStatOverflows for more information.
Definition: TH1.cxx:6344
TH1::Clone
TObject * Clone(const char *newname=0) const
Make a complete copy of the underlying object.
Definition: TH1.cxx:2664
TRandom
Definition: TRandom.h:27
TH2I
2-D histogram with an int per channel (see TH1 documentation)}
Definition: TH2.h:212
TH1::Fill
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
Definition: TH1.cxx:3274
TH2::Fill
Int_t Fill(Double_t)
Invalid Fill method.
Definition: TH2.cxx:294
TCanvas
Definition: TCanvas.h:23
kBlue
@ kBlue
Definition: Rtypes.h:66
kGray
@ kGray
Definition: Rtypes.h:65
c1
return c1
Definition: legend1.C:41