elaird / supy

analyze events stored in TTrees in parallel
8 stars 7 forks source link

Foms #180

Closed elaird closed 11 years ago

elaird commented 11 years ago

Hello,

Here are (a) some backward-compatible additions to the plotter; (b) a few calculables. If you guys would prefer that some of these calculables go into susycaf instead of supy, that's also fine with me.

Ted

betchart commented 11 years ago

Dear Ted,

What is a FOMS?

Burt

elaird commented 11 years ago

Dear Burt,

A figure of merit. One can use this to have columns such as s/b, s/sqrt(b), etc. in each yield table.

Ted

gerbaudo commented 11 years ago

Hi Ted and Burt,

I have tried it with two foms, and it works nicely. One needs to import the relevant modules to define the foms (either within the lambda or within the analysis file).

supy.plotter(...,
             foms = [{'value': lambda x, y: x/y,                                                       
                        'uncRel': lambda x, y, xUnc, yUnc: __import__('math').sqrt((xUnc/x)**2 + (yUnc/y)**2),                                                                                                         
                        'label': lambda x, y:"%s/%s" % (x, y),                                           
                        },                                                                               
                        {'value': lambda x, y: x/__import__('math').sqrt(y),                              
                         'uncRel': lambda x, y, xUnc, yUnc: __import__('math').sqrt(0.25*(xUnc/x)**2 + (yUnc/y)**2),                                                                                                    
                         'label': lambda x, y:"%s/sqrt(%s)" % (x, y),                                     
                        }]

Nice, thanks for implementing this!

Davide

betchart commented 11 years ago

Sounds good to me.