-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic script and histogram creation examples
- Loading branch information
Showing
4 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
int add42(int value) { | ||
return value+42; | ||
} | ||
int add53(int value) { | ||
return value+53; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include "TH2F.h" | ||
#include "TRandom.h" | ||
|
||
TH2* h2D; | ||
|
||
void make_2D() | ||
{ | ||
h2D = new TH2F("h2D","2D Gaussian peak",160,-4.,4.,160,-4.,4.); | ||
for( int i=0; i<100000; ++i ) { | ||
double x = gRandom->Gaus(0,1); | ||
double y = gRandom->Gaus(1,2); | ||
h2D->Fill(x,y); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include "TH1I.h" | ||
#include "TRandom.h" | ||
|
||
TH1 *h1, *h2; | ||
|
||
void make_histos() { | ||
h1 = new TH1I("h1","Gaussian distribution",160,-4.,4.); | ||
h2 = new TH1I("h2","Shifted narrower Gaussian",160,-4.,4.); | ||
for ( int i=0; i<10000; ++i ) { | ||
double x; | ||
x = gRandom->Gaus(0,1); | ||
h1->Fill(x); | ||
x = gRandom->Gaus(0.2,0.8); | ||
h2->Fill(x); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include "TProfile.h" | ||
#include "TRandom.h" | ||
|
||
TProfile* hp; | ||
|
||
void make_prof() | ||
{ | ||
hp = new TProfile("hp","Profile of shifted Gaussian",160,-4.,4.); | ||
for( int i=0; i<100000; ++i ) { | ||
double x = gRandom->Gaus(0,1); | ||
double y = gRandom->Gaus(1,2); | ||
hp->Fill(x,y); | ||
} | ||
} |