16 gStyle->SetPalette(1);
17 gROOT->SetStyle(
"Plain");
18 gStyle->SetOptStat(00000);
38 TCanvas*
c1 =
new TCanvas (
"c1",
"",60,60,800,800);
41 TFile*
f =
new TFile(
"yz.root");
45 ntuple = (TNtuple*)f->Get(
"yz");
47 TBranch* eventBranch = ntuple->FindBranch(
"row_wise_branch");
48 if ( ! eventBranch ) rowWise =
false;
51 Double_t
radius,eventID,nofHits,nbEdep,
y,
z,Einc;
53 ntuple->SetBranchAddress(
"radius",&radius);
54 ntuple->SetBranchAddress(
"eventID",&eventID);
55 ntuple->SetBranchAddress(
"nbHits",&nofHits);
56 ntuple->SetBranchAddress(
"nbScoredHits",&nbEdep);
57 ntuple->SetBranchAddress(
"y",&y);
58 ntuple->SetBranchAddress(
"z",&z);
59 ntuple->SetBranchAddress(
"Einc",&Einc);
75 TH1F *hfyw =
new TH1F (
"hfyw",
"hfyw",linB,0,ymax);
77 Int_t
nentries = (Int_t)ntuple->GetEntries();
78 Double_t population=0;
79 Double_t yLocalMin=1e100;
89 hfyw->Fill(y,nofHits/nbEdep);
90 if (yLocalMin>y) yLocalMin=
y;
91 if (yLocalMax<y) yLocalMax=
y;
92 population=population+nofHits/nbEdep;
93 yF_anal = yF_anal + (nofHits/nbEdep)*y;
94 yD_anal = yD_anal + (nofHits/nbEdep)*y*y;
97 cout <<
"**** Results ****" << endl;
99 cout <<
"---> yF =" << yF_anal/population <<
" keV/um" << endl;
100 cout <<
"---> yD =" << (yD_anal/population)/(yF_anal/population) <<
" keV/um" << endl;
102 cout <<
"---> Limits: " << endl;
103 cout <<
" * min value of y = " << yLocalMin <<
" keV/um" << endl;
104 cout <<
" * max value of y = " << yLocalMax <<
" keV/um" << endl;
106 if ( (yLocalMax>ymax) || (yLocalMin<ymin) )
108 cout <<
"WARNING: please check your histogram limits ! " << endl;
112 hfyw->Scale (1./(population*hfyw->GetBinWidth(1)));
113 hfyw->SetTitle(
"f(y) (um/keV)");
114 hfyw->GetXaxis()->SetTitle(
"y (keV/um)");
115 hfyw->SetFillColor(2);
116 hfyw->SetLineColor(2);
TFile f("microbeam.root")
void SetLeafAddress(TNtuple *ntuple, const char *name, void *address)