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
Re: None Re: Histogram starting from -0.5 x-axis (Ivana Hrivnacova)
Re: None Re: Histogram starting from -0.5 x-axis
Date: 29 Aug, 2016
From: Michael H. Kelsey <Michael H. Kelsey>

On Sun, 28 Aug 2016 23:57:52 GMT, jeonyboy wrote:
> On Thu, 25 Aug 2016 15:17:13 GMT, Ivana Hrivnacova wrote:
> 
> > 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
> 
> Thanks for your help! However, I am not clear on your solution to my
> problem. What I want is number of particles that deposit exactly 0
> energy.

You can't do that with a histogram. A histogram (any histogram!) counts the number of entries which satisfy some range of values. You can _approximate_ it by giving your histogram very narrow bins (so, for example, count anything energy deposit between 0 and 0.0001 MeV), but can't get an exact result.

To do an exact match on a specific value, you need to store an N-tuple, with one entry (row) per particle.

    -- Michael Kelsey

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 - 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 ]