Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
spectrumpainter.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_spectrum
3/// Examples showing how to use TSpectrum2Painter (the SPEC option)
4///
5/// \macro_image
6/// \macro_code
7///
8/// \author: Olivier Couet, Miroslav Morhac
9
10void spectrumpainter()
11{
12 TH2F("h2", "h2", 40, -8, 8, 40, -9, 9);
13 Float_t px, py;
14 for (Int_t i = 0; i < 50000; i++) {
15 gRandom->Rannor(px, py);
16 h2->Fill(px, py);
17 h2->Fill(px + 4, py - 4, 0.5);
18 h2->Fill(px + 4, py + 4, 0.25);
19 h2->Fill(px - 3, py + 4, 0.125);
20 }
21
22 TCanvas *c1 = new TCanvas("c1", "Illustration of 2D graphics", 10, 10, 800, 700);
23 c1->Divide(2, 2);
24
25 c1->cd(1);
26 h2->Draw("SPEC dm(2,10) zs(1)");
27 c1->cd(2);
28 h2->Draw("SPEC dm(1,10) pa(2,1,1) ci(1,4,8) a(15,45,0)");
29 c1->cd(3);
30 h2->Draw("SPEC dm(2,10) pa(1,1,1) ci(1,1,1) a(15,45,0) s(1,1)");
31 c1->cd(4);
32 h2->Draw("SPEC dm(1,10) pa(2,1,1) ci(1,4,8) a(15,45,0) cm(1,15,4,4,1) cg(1,2)");
33}
int Int_t
Definition RtypesCore.h:45
float Float_t
Definition RtypesCore.h:57
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
R__EXTERN TRandom * gRandom
Definition TRandom.h:62
The Canvas class.
Definition TCanvas.h:23
2-D histogram with a float per channel (see TH1 documentation)
Definition TH2.h:307
Service class for 2-D histogram classes.
Definition TH2.h:30
virtual void Rannor(Float_t &a, Float_t &b)
Return 2 numbers distributed following a gaussian with mean=0 and sigma=1.
Definition TRandom.cxx:507
return c1
Definition legend1.C:41