Difference between revisions of "ForestErrAnal Lab 8.C"
Jump to navigation
Jump to search
(Created page with 'void DataRead() { TH1F *LengthHist=new TH1F("LengthHist","LengthHist",30,18.45,21.45); ifstream in; in.open("length.dat"); Float_t Length,LengthErr; Int_t Counts; Int...') |
|||
| (2 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
| + | <pre> | ||
| + | #include "Riostream.h" | ||
void DataRead() { | void DataRead() { | ||
TH1F *LengthHist=new TH1F("LengthHist","LengthHist",30,18.45,21.45); | TH1F *LengthHist=new TH1F("LengthHist","LengthHist",30,18.45,21.45); | ||
| Line 20: | Line 22: | ||
LengthHist->Draw(); | LengthHist->Draw(); | ||
} | } | ||
| + | </pre> | ||
| + | |||
| + | |||
| + | Go Back [[TF_ErrAna_InClassLab#Lab_8]] | ||
Latest revision as of 21:27, 3 March 2017
#include "Riostream.h"
void DataRead() {
TH1F *LengthHist=new TH1F("LengthHist","LengthHist",30,18.45,21.45);
ifstream in;
in.open("length.dat");
Float_t Length,LengthErr;
Int_t Counts;
Int_t nlines=0;
while(in.good()){
in >> Length >> Counts;
if(Counts>0)
LengthErr=0.5/sqrt(Counts);
printf( " %d \t %f +/- %f \t %d\n", nlines, Length, LengthErr, Counts);
/*
*/
nlines++;
LengthHist->Fill(Length,Counts);
}
LengthHist->Draw();
}
Go Back TF_ErrAna_InClassLab#Lab_8