ALICE:tmp

= cast =
 * http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=12265&p=53018&hilit=_cast+static_cast+dynamic_cast#p53018
 * http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=5075&p=20365&hilit=_cast+static_cast+dynamic_cast#p20365

= after =


 * http://www.pp.rhul.ac.uk/~cowan/stat_course.html (aposn prve tri lekcie)
 * http://www.physi.uni-heidelberg.de/~nberger/teaching/ws11/statistics.php
 * http://www.physi.uni-heidelberg.de/~nberger/teaching/ws12/statistics/statistics.php   !!!!!! OKOKOK  !!!!!!
 * http://www.physi.uni-heidelberg.de/~nberger/teaching/ws13/statistics/statistics.php  (je tu viac stranok preverit)

use sumw2 before filling the histogram !!!

Rene Brun If a histogram has associated error bars (TH1::Sumw2 has been called), the resulting error bars are also computed assuming independent histograms. In case of divisions, binomial errors are also supported.

The Add, Divide and Multiply functions also exist to add, divide or multiply an histogram by a function. If an histogram has associated errors bars (TH1::Sumw2), the resulting error bar are also computing assuming independent histograms In case of divisions, Binomial errors are also supported

– h1.SetError(const double *error), set the bin errors equal to array error (if you know the errors aren't gaussian) – h1.Sumw2, create a structure to keep the sum of weights (if you scale the histogram the errors are correctly modified)


 * http://www-ekp.physik.uni-karlsruhe.de/~quast/Skripte/diving_into_ROOT.pdf

line 27(h->Sumw2): This is a crucial step for the sum and ratio of histograms to handle errors properly. The method TH1::Sumw2 causes the squares of weights to be stored inside the histogram (equivalent to the number of entries per bin if weights of 1 are used). This information is needed to correctly calculate the errors of each bin entry when the methods TH1::Add and TH1::Divide are applied.

http://root.cern.ch/drupal/content/binned-data

A (1-dimensional) histogram is defined as the collection of the N pairs (1, n1), (2, n2), ..., (N, nN) and it is usually implemented as an array in which the first value of the pair (i, ni) is the index of the element containing the value ni.

Algorithm to compute the errors per bin If has been called for the histogram, the error computed is the square root of the sum of the square of weights for this bin. If not, the error computed is the square root of the bin content.

Associate error bars with this histogram (see )

Hi,

If the histogram represent counts, thus when each entry that is filled has a weight=1, the statistical error in each bin is computed as SQRT(N), where N is the number of entries in each bin, which by definition is in this case equal to the bin content.

If you are filling the histogram with a weight different than one, then the bin content is equal to the sum of the weight in each bin (different than the number of entries in each bin). The statistical error in this case con be approximately computed from SQRT( sum of weight^2) in each bin. However, in order to have the histogram doing this, you ned to set the option TH1::Sumw2. By doing this the histogram will store the bin sum of weight square, that can be used to compute the errors.

So you should use this option when your histogram is filled with weights different than one.

Best Regards

Lorenzo

Your data points are counts (or weighted counts) ? If this is the case you should also set the errors as the square root of the sum of the weight square for each bin.

Lorenzo

If you have an histogram filled with counts and scaled with some weights you can use the weighted likelihood method. But you need to call Sumw2 and also not just SetBinContent but also SetBinError on your histogram, since the errors are not anymore the square root of the content. Note that if you call, as in your code, only Sumw2 and SetBinContent the errors are set to zero.

Best Regards

Lorenzo

I have a TH1F. How to get its median value? Is there some function which does this?

You can use the function TH1::GetQuantiles and you use 0.5 as the probability value Lorenzo

Another advanced note: If you know what you're doing, you can use the same trick that ROOT uses when it creates the histogram you create with commands like tree1->Draw("zv"). The trick is: TH1* hist = new TH1D(...); // define your histogram hist->SetBit(TH1::kCanRebin); // allow the histogram to re-bin itself hist->Sumw2; // so the error bars are correct after re-binning “Re-binning” means that if a value is supplied to the histogram that's outside its limits, it will adjust those limits automatically. It does this by summing existing bins then doubling the bin width; the bin limits change, while the number of histogram bins remains constant.

A tangent I can indulge in, now that you know about filling histograms: Suppose you're told to fill two histograms, then add them together. If you do this, you'll want to call the "Sumw2" method of both histograms before you fill them; e.g., TH1* hist1 = new TH1D(...); TH1* hist2 = new TH1D(...); hist1->Sumw2; hist2->Sumw2; // Fill your histograms hist1->Fill(...); hist2->Fill(...); // Add hist2 to the contents of hist1: hist1->Add(hist2); If you forget Sumw2, then your error bars after the math operation won't be correct. General rule: If you're going to perform histogram arithmetic, use Sumw2 (which means "sum the squares of the weights"). Some physicists use Sumw2 all the time, just in case.

– Use  any time (zeby sumw2) you're weighting/scaling  or  doing  an  operation such as adding or dividing histograms – If in doubt, use Sumw2 it doesn’t hurt. The weights are 1 by default.
 * http://hep05.baylor.edu/elog/ms2/091210_134804/MiniSymposium09.pdf

TH1::Sumw2 •  Create  structure  to  store  sum  of  squares  of weights •  if  histogram  is  already  ﬁlled,  the  sum  of  squares  of  weights  is  ﬁlled  with  the  existing  bin  contents •  The  error  per  bin  will  be  computed  as  sqrt(sum of squares of weight)  for  each bin. •  This  function is  automatically  called when  the  histogram  is  created   if  the static function TH1::SetDefaultSumw2 has been called before In summary:
 * 1) Scaling => use sumw2
 * 2) Adding/Subtracting => use sumw2 if a histogram is weighted
 * 3) Multiplying/Dividing => use sumw2 if a histogram is weighted

Poisson je priblizenie binomial, ked average of successes is much smaller than possible number. v Principe OK, ale kukat do MiniSymposium09.ppt


 * http://iktp.tu-dresden.de/IKTP/Seminare/IS2010/Christian_Gumpert.pdf
 * TH1::Divide uses normal approximation which fails for ε → 1 or 0 → confidence intervals have bad coverage
 * only one (bayesian) method for a proper error calculation is supported
 * no reasonable results for weighted histograms
 * external fitting routine (TBinomialEfficiencyFitter)

Sometimes events might have different weights
 * http://hep.ph.liv.ac.uk/~mccauley/linux_root/Linux-root13.pdf
 * Prescales.
 * Changing a parent spectrum.
 * Correcting for efficiencies.
 * The weight is an extra parameter in the Fill method.

The error on a histogram bin is just √N - Poisson statistics But what if you’re using weights.
 * Call Sumw2 before filling.
 * The error is actually √(Σwi2) (Think about this, try w=1)
 * The errors are usually calculated on the fly. (The errors are usually calculated on the fly.,  You need to call Sumw2 to save the errors if doing any operations on/with the histogram.)


 * http://indico3.twgrid.org/indico/getFile.py/access?contribId=151&resId=0&materialId=slides&confId=3

HTML5 SVG demo  HTML5 SVG Demo (embed with img src);;;; http://edutechwiki.unige.ch/en/Using_SVG_with_HTML5_tutorial A nice green circle that was embeded using the img element: 

xrdgsiproxy destroy xrdgsiproxy init xrdgsiproxy info xrdcp tree800.root root://skaf.saske.sk:1098//musinsky/

root [0] TProof::Open("") +++ Starting PROOF-Lite with 4 workers +++ Opening connections to workers: OK (4 workers) Setting up worker servers: OK (4 workers)

gEnv->SetValue("XSec.GSI.DelegProxy", "2")   // dovolim aby sa proxy rozdistrubuovalo aj na workers

TProof::Open("alice-caf.cern.ch") TProof::Open("skaf.saske.sk")

gProof->Exec(".!hostname") gProof->Exec("gROOT->GetVersion") gProof->Exec("gSystem->Load(\"libGeom.so\")")

TProof::Open("alice-caf.cern.ch", "workers=2") TProof::Open("alice-caf.cern.ch", "masteronly")

gProof->ShowPackages drwxr-xr-x 3 alicaf z2 4096 Oct 29 23:19 VO_ALICE@AliRoot::v5-02-07-AN gProof->EnablePackage("VO_ALICE@AliRoot::v5-02-07a-AN")

gProof->ShowDataSets /default/sahn/LHC10e_000130354_pass2     |      95 | /esdTree     | 1.838e+05|    20 GB |   93 %

gProof->ShowDataSets("/default/sahn/LHC10e_00013*")

gProof->ShowDataSets("/alice/*")  // for all data gProof->ShowDataSets("/alice/sim/*")  // for sim data gProof->ShowDataSets("/alice/data/*")  // for real data

http://www.w3.org/TR/SVG11/linking.html

  /home/musinsky/c1.svg Creator: ROOT Version 5.34/09 CreationDate: Fri Aug 2 10:17:46 2013      <path d="M57,346v -1h 18v 1h 4v -1h 9v -1h 14v 1h 5v -2h 4v -1h 5v 1h 4v -2h 5v -3h 9v -2h 4v -3h 5v -4h 4v -3h 9v -3h 5v -11h 5v -6h 4v -5h 5v -6h 4v -1h 5v -10h 4v -11h 5v -12h 4v -7h 5v -17h 4v -23h 5v -2h 4v -12h 5v -27h 9v -18h 5v -23h 4v -8h 5v -1h 9v -26h 4v -14h 5v -6h 4v -3h 5v -20h 4v 16h 5v -17h 4v 5h 5v -1h 5v 8h 4v -12h 5v 30h 4v -2h 5v 1h 4v 28h 5v 8h 4v 18h 5v 2h 4v 27h 5v 7h 4v 7h 5v 17h 4v 23h 5v 12h 5v 9h 4v 13h 5v 4h 4v 4h 5v 13h 4v 12h 5v 18h 4v -2h 5v 10h 4v 5h 5v 4h 4v 5h 5v 4h 5v 3h 9v 3h 4v 1h 5v 3h 4v 2h 5v -1h 4v 2h 5v 1h 13v -1h 5v 1h 4v 1h 5v 1h 5v -1h 4v -1h 5v 1h 4v 1h 9z" fill="#a5777a"/> <path d="M57,345h 18v 1h 4v -1h 9v -1h 14v 1h 5v -2h 4v -1h 5v 1h 4v -2h 5v -3h 9v -2h 4v -3h 5v -4h 4v -3h 9v -3h 5v -11h 5v -6h 4v -5h 5v -6h 4v -1h 5v -10h 4v -11h 5v -12h 4v -7h 5v -17h 4v -23h 5v -2h 4v -12h 5v -27h 9v -18h 5v -23h 4v -8h 5v -1h 9v -26h 4v -14h 5v -6h 4v -3h 5v -20h 4v 16h 5v -17h 4v 5h 5v -1h 5v 8h 4v -12h 5v 30h 4v -2h 5v 1h 4v 28h 5v 8h 4v 18h 5v 2h 4v 27h 5v 7h 4v 7h 5v 17h 4v 23h 5v 12h 5v 9h 4v 13h 5v 4h 4v 4h 5v 13h 4v 12h 5v 18h 4v -2h 5v 10h 4v 5h 5v 4h 4v 5h 5v 4h 5v 3h 9v 3h 4v 1h 5v 3h 4v 2h 5v -1h 4v 2h 5v 1h 13v -1h 5v 1h 4v 1h 5v 1h 5v -1h 4v -1h 5v 1h 4v 1h 9" fill="none" stroke="#000099"/>       hpx  <text x="447" y="52" fill="black" font-size="12" font-family="Helvetica"> Entries <text x="512" y="52" fill="black" font-size="12" font-family="Helvetica"> 25000 <text x="447" y="67" fill="black" font-size="12" font-family="Helvetica"> Mean <text x="494" y="67" fill="black" font-size="12" font-family="Helvetica"> -0.004011 <text x="447" y="83" fill="black" font-size="12" font-family="Helvetica"> RMS <text x="509" y="83" fill="black" font-size="12" font-family="Helvetica"> 0.9978 <path d="M57,346h 453" fill="none" stroke="black"/> <path d="M57,336v 10" fill="none" stroke="black"/> <path d="M68,341v 5" fill="none" stroke="black"/> <path d="M79,341v 5" fill="none" stroke="black"/> <path d="M91,341v 5" fill="none" stroke="black"/> <path d="M102,341v 5" fill="none" stroke="black"/> <path d="M113,336v 10" fill="none" stroke="black"/> <path d="M125,341v 5" fill="none" stroke="black"/> <path d="M136,341v 5" fill="none" stroke="black"/> <path d="M147,341v 5" fill="none" stroke="black"/> <path d="M159,341v 5" fill="none" stroke="black"/> <path d="M170,336v 10" fill="none" stroke="black"/> <path d="M181,341v 5" fill="none" stroke="black"/> <path d="M193,341v 5" fill="none" stroke="black"/> <path d="M204,341v 5" fill="none" stroke="black"/> <path d="M215,341v 5" fill="none" stroke="black"/> <path d="M227,336v 10" fill="none" stroke="black"/> <path d="M238,341v 5" fill="none" stroke="black"/> <path d="M249,341v 5" fill="none" stroke="black"/> <path d="M261,341v 5" fill="none" stroke="black"/> <path d="M272,341v 5" fill="none" stroke="black"/> <path d="M283,336v 10" fill="none" stroke="black"/> <path d="M295,341v 5" fill="none" stroke="black"/> <path d="M306,341v 5" fill="none" stroke="black"/> <path d="M317,341v 5" fill="none" stroke="black"/> <path d="M329,341v 5" fill="none" stroke="black"/> <path d="M340,336v 10" fill="none" stroke="black"/> <path d="M351,341v 5" fill="none" stroke="black"/> <path d="M363,341v 5" fill="none" stroke="black"/> <path d="M374,341v 5" fill="none" stroke="black"/> <path d="M386,341v 5" fill="none" stroke="black"/> <path d="M397,336v 10" fill="none" stroke="black"/> <path d="M408,341v 5" fill="none" stroke="black"/> <path d="M420,341v 5" fill="none" stroke="black"/> <path d="M431,341v 5" fill="none" stroke="black"/> <path d="M442,341v 5" fill="none" stroke="black"/> <path d="M454,336v 10" fill="none" stroke="black"/> <path d="M465,341v 5" fill="none" stroke="black"/> <path d="M476,341v 5" fill="none" stroke="black"/> <path d="M488,341v 5" fill="none" stroke="black"/> <path d="M499,341v 5" fill="none" stroke="black"/> <path d="M510,336v 10" fill="none" stroke="black"/> <text x="51" y="358" fill="black" font-size="12" font-family="Helvetica"> -4 <text x="108" y="358" fill="black" font-size="12" font-family="Helvetica"> -3 <text x="164" y="358" fill="black" font-size="12" font-family="Helvetica"> -2 <text x="222" y="358" fill="black" font-size="12" font-family="Helvetica"> -1 <text x="280" y="358" fill="black" font-size="12" font-family="Helvetica"> 0 <text x="337" y="358" fill="black" font-size="12" font-family="Helvetica"> 1 <text x="393" y="358" fill="black" font-size="12" font-family="Helvetica"> 2 <text x="450" y="358" fill="black" font-size="12" font-family="Helvetica"> 3 <text x="507" y="358" fill="black" font-size="12" font-family="Helvetica"> 4 <path d="M57,346v -308" fill="none" stroke="black"/> <path d="M70,346h -13" fill="none" stroke="black"/> <path d="M63,338h -6" fill="none" stroke="black"/> <path d="M63,331h -6" fill="none" stroke="black"/> <path d="M63,324h -6" fill="none" stroke="black"/> <path d="M63,317h -6" fill="none" stroke="black"/> <path d="M70,309h -13" fill="none" stroke="black"/> <path d="M63,302h -6" fill="none" stroke="black"/> <path d="M63,295h -6" fill="none" stroke="black"/> <path d="M63,288h -6" fill="none" stroke="black"/> <path d="M63,281h -6" fill="none" stroke="black"/> <path d="M70,273h -13" fill="none" stroke="black"/> <path d="M63,266h -6" fill="none" stroke="black"/> <path d="M63,259h -6" fill="none" stroke="black"/> <path d="M63,252h -6" fill="none" stroke="black"/> <path d="M63,244h -6" fill="none" stroke="black"/> <path d="M70,237h -13" fill="none" stroke="black"/> <path d="M63,230h -6" fill="none" stroke="black"/> <path d="M63,223h -6" fill="none" stroke="black"/> <path d="M63,216h -6" fill="none" stroke="black"/> <path d="M63,208h -6" fill="none" stroke="black"/> <path d="M70,201h -13" fill="none" stroke="black"/> <path d="M63,194h -6" fill="none" stroke="black"/> <path d="M63,187h -6" fill="none" stroke="black"/> <path d="M63,179h -6" fill="none" stroke="black"/> <path d="M63,172h -6" fill="none" stroke="black"/> <path d="M70,165h -13" fill="none" stroke="black"/> <path d="M63,158h -6" fill="none" stroke="black"/> <path d="M63,151h -6" fill="none" stroke="black"/> <path d="M63,143h -6" fill="none" stroke="black"/> <path d="M63,136h -6" fill="none" stroke="black"/> <path d="M70,129h -13" fill="none" stroke="black"/> <path d="M63,122h -6" fill="none" stroke="black"/> <path d="M63,114h -6" fill="none" stroke="black"/> <path d="M63,107h -6" fill="none" stroke="black"/> <path d="M63,100h -6" fill="none" stroke="black"/> <path d="M70,93h -13" fill="none" stroke="black"/> <path d="M63,85h -6" fill="none" stroke="black"/> <path d="M63,78h -6" fill="none" stroke="black"/> <path d="M63,71h -6" fill="none" stroke="black"/> <path d="M63,64h -6" fill="none" stroke="black"/> <path d="M70,57h -13" fill="none" stroke="black"/> <path d="M70,57h -13" fill="none" stroke="black"/> <path d="M63,49h -6" fill="none" stroke="black"/> <path d="M63,42h -6" fill="none" stroke="black"/> <text x="47" y="350" fill="black" font-size="12" font-family="Helvetica"> 0 <text x="33" y="314" fill="black" font-size="12" font-family="Helvetica"> 100 <text x="33" y="278" fill="black" font-size="12" font-family="Helvetica"> 200 <text x="33" y="241" fill="black" font-size="12" font-family="Helvetica"> 300 <text x="33" y="206" fill="black" font-size="12" font-family="Helvetica"> 400 <text x="33" y="170" fill="black" font-size="12" font-family="Helvetica"> 500 <text x="33" y="133" fill="black" font-size="12" font-family="Helvetica"> 600 <text x="33" y="97" fill="black" font-size="12" font-family="Helvetica"> 700 <text x="33" y="61" fill="black" font-size="12" font-family="Helvetica"> 800 <rect x="442" y="25" width="114" height="61" fill="white"/> <path d="M442,86h 114" fill="none" stroke="black"/> <path d="M556,86v -61" fill="none" stroke="black"/> <path d="M556,25h -114" fill="none" stroke="black"/> <path d="M442,25v 61" fill="none" stroke="black"/> <text x="488" y="36" fill="black" font-size="13" font-family="Helvetica"> hpx <path d="M442,40h 114" fill="none" stroke="black"/> <text x="447" y="52" fill="black" font-size="12" font-family="Helvetica"> Entries <text x="512" y="52" fill="black" font-size="12" font-family="Helvetica"> 25000 <text x="447" y="67" fill="black" font-size="12" font-family="Helvetica"> Mean <text x="494" y="67" fill="black" font-size="12" font-family="Helvetica"> -0.004011 <text x="447" y="83" fill="black" font-size="12" font-family="Helvetica"> RMS <text x="509" y="83" fill="black" font-size="12" font-family="Helvetica"> 0.9978 <text x="181" y="17" fill="black" font-size="18" font-family="Helvetica"> This is the px distribution

<a href="https://www.writelatex.com" title="writeLaTeX.com"><img src="https://www.writelatex.com/assets/set/WL1s_bw.png" alt="writeLaTeX.com"></a>