Re: [BLAST_ANAWARE] new asmmetry function in util_j.C

From: Jason Seely (seely@MIT.EDU)
Date: Fri Dec 06 2002 - 18:27:25 EST


hey everyone,

i fixed GetAsymmetry so that it calculates the errors properly.  i encourage you to use it if you're interested in calculating asymmetries for anything.  here's a simple example:

root>.L util_j.C
root>TH1 *h1 = new TH1F("h1","h1",10,1,10);
root>TH1 *h2 = new TH1F("h2","h2",10,1,10);
root>TH1 *a = new TH1F("a","a",10,1,10);
    .. then once you have filled h1 and h2, say from an ntuple or something:
root>GetAsymmetry(a,h1,h2);

and that's it.  then you just have to plot a or whatever.  this works for histograms of any dimension (1,2,3) and type (S,F,D), but note that if you declare a to be an integer histogram you will be doing integer division, so you will likely get all zeros for your asymmetries.  so you should use a TH*F for the asymmetry histogram ('a').  also, it's probably a good idea to make h1 and h2 TH*F too, just to make sure the errors are correct.

have fun,

jason

Jason Seely wrote:

hey everyone,

i just made a new function for util.C that takes histograms as input and calculates the asymmetries for each bin.  actually, at the moment you can find it in util_j.C because for some reason, i wasn't able to write to the real util.C (i didn't want to play around too much), so maybe chris or someone can merge this in or something.  anyway, if you want to use it, just load util_j.C for now where you would normally load util.C (they are identical, except that util_j.C has the new funciton.)

anyway, assuming you have 3 histograms (which are the same dimension, etc.), h1, h2, asym (these can be any type of histogram that inherits from TH1, so it works for 1 or 2d histograms) just say:

GetAsymmetry(asym, h1, h2)

then asym will be asym = (h1-h2)/(h1+h2).

so the bins in asym are filled with the asymmetries between the corresponding bins of h1 and h2.  if there are no events in h1 or h2, then the asymmetry and error are both set to zero.

it also calculates the errors for the asymmetry, but at the moment it's not quite right (ROOT returns sqrt((1-asym*asym)/(h1+h2)) as the error when it should really be  sqrt((1-asym*asym)/(h1+h2))), but it's a slight overestimate.  i'm working on fixing this, but i thought some people might be able to use this now that we're starting to calculate asymmetries.

have fun,

jason

-- 
--------------------------------------------------------------------
jason seely
26.650.b
massachusetts institute of technology
77 massachusetts avenue
cambridge, ma 02139-4307

email:  seely@mit.edu
phone:  617.253.4772/6734
 html:  web.mit.edu/seely/www
--------------------------------------------------------------------
 
-- 
--------------------------------------------------------------------
jason seely
26.650.b
massachusetts institute of technology
77 massachusetts avenue
cambridge, ma 02139-4307

email:  seely@mit.edu
phone:  617.253.4772/6734
 html:  web.mit.edu/seely/www
--------------------------------------------------------------------
 



This archive was generated by hypermail 2.1.2 : Mon Feb 24 2014 - 14:07:29 EST