Message: Re: Histogram starting from -0.5 x-axis Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Histogram starting from -0.5 x-axis 

Forum: Analysis
Re: Question Histogram starting from -0.5 x-axis
Re: None Re: Histogram starting from -0.5 x-axis (Ivana Hrivnacova)
Re: None Re: Histogram starting from -0.5 x-axis
Date: 25 Aug, 2016
From: Ivana Hrivnacova <Ivana Hrivnacova>

The histogram range is defined via min, max value which you pass when you create (or set) the histogram. The values in underflow and overflow bin do not contribute to the histogram mena() etc.

So you need to use the command

 /analysis/h1/set 1 100 0 100 MeV"

When you fill this histogram with 0. value, it will be accounted in the bin [1], which center is at 0.5 MeV, but its range is [0.,1.] MeV. You can for example try to add such a fill in the B4a example (in B4aEventAction class)

  analysisManager->FillH1(1, fEnergyAbs);
  analysisManager->FillH1(1, 0.);                 // added

and then, when you print the resulting histogram, you will get (I ran 1000 events):

 root [3] h1->Print("all") 
 TH1.Print Name  = 1, Entries= 2000, Total sum= 2000
  fSumw[0]=0, x=-4, error=0
  fSumw[1]=1000, x=4, error=31.6228   <==  the bin which was filled
   (note that the histogram range in this example is 100 bins within 0. and 800. MeV)
  fSumw[2]=0, x=12, error=0

Best regards,

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: Histogram starting from -0.5 x-axis   (jeonyboy@gmail.com - 28 Aug, 2016)
(_ None: Re: Histogram starting from -0.5 x-axis   (Michael H. Kelsey - 29 Aug, 2016)
(_ None: Re: Histogram starting from -0.5 x-axis   (jeonyboy@gmail.com - 30 Aug, 2016)
 Add Message Add Message
to: "Re: Histogram starting from -0.5 x-axis"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]