|
string | __author__ = 'Juerg Beringer' |
|
string | __version__ = '$Id: fitman.py 721742 2016-02-03 23:34:44Z beringer $' |
|
string | __usage__ |
|
list | qargv = [ ] |
|
string | qcmd = ' '.join(qargv) |
|
| parser = OptionParser(usage=__usage__, version=__version__) |
|
| dest |
|
| default |
|
| None |
|
| help |
|
| type |
|
| action |
|
| False |
|
| options |
|
| args |
|
| cmdList = args |
|
| srcFile = ROOT.TFile(options.srcNtName) |
|
| srcNt = srcFile.Get(options.srcTreeName) |
|
| nEntries = srcNt.GetEntries() |
|
| dstFile = ROOT.TFile(options.ntName,'recreate') |
|
| dstNt = ROOT.TTree(options.ntTree,'Vertices') |
|
| bx = array('d',[0]); dstNt.Branch('x',bx,'x/D') |
|
| by = array('d',[0]); dstNt.Branch('y',by,'y/D') |
|
| bz = array('d',[0]); dstNt.Branch('z',bz,'z/D') |
|
| bvxx = array('d',[0]); dstNt.Branch('vxx',bvxx,'vxx/D') |
|
| bvyy = array('d',[0]); dstNt.Branch('vyy',bvyy,'vyy/D') |
|
| bvxy = array('d',[0]); dstNt.Branch('vxy',bvxy,'vxy/D') |
|
| bvxz = array('d',[0]); dstNt.Branch('vxz',bvxz,'vxz/D') |
|
| bvyz = array('d',[0]); dstNt.Branch('vyz',bvyz,'vyz/D') |
|
| bvzz = array('d',[0]); dstNt.Branch('vzz',bvzz,'vzz/D') |
|
int | nSelected = 0 |
|
int | nWritten = 0 |
|
| maxVtxErr2 = options.maxvtxerr*options.maxvtxerr |
|
| minVtxErr2 = options.minvtxerr*options.minvtxerr |
|
| x = RooRealVar("x","x [mm]",-3,3) |
|
| y = RooRealVar("y","y [mm]",-3,3) |
|
| z = RooRealVar("z","z [mm]",-300,300) |
|
| vxx = RooRealVar("vxx","vxx",-3,3) |
|
| vyy = RooRealVar("vyy","vyy",-3,3) |
|
| vxy = RooRealVar("vxy","vxy",-3,3) |
|
| vxz = RooRealVar("vxz","vxz",-3,3) |
|
| vyz = RooRealVar("vyz","vyz",-3,3) |
|
| vzz = RooRealVar("vzz","vzz",-3,3) |
|
| vtxDataFile = ROOT.TFile(options.ntName) |
|
| vtxData = vtxDataFile.Get(options.ntTree) |
|
def | hx = tmpHist('x',-3.,3.) |
|
def | hy = tmpHist('y',-3.,3.) |
|
def | hz = tmpHist('z',-300.,300.) |
|
| data = RooDataSet("data","data", vtxData, RooArgSet(x,y,z,vxx,vyy,vxy,vzz)) |
|
| mx = RooRealVar("mx","Mean x", hx.GetMean(), -2, 2) |
|
| sx = RooRealVar("sx","Sigma x", hx.GetRMS(), 0, 1) |
|
| ax = RooRealVar("ax","Tilt x", 0, -1e-3, 1e-3) |
|
| my = RooRealVar("my","Mean y", hy.GetMean(), -2, 2) |
|
| sy = RooRealVar("sy","Sigma y", hy.GetRMS(), 0, 1) |
|
| ay = RooRealVar("ay","Tilt y", 0, -1e-3, 1e-3) |
|
| mz = RooRealVar("mz","Mean z", hz.GetMean(), -300, 300) |
|
| sz = RooRealVar("sz","Sigma z", hz.GetRMS(), 0, 100) |
|
| k = RooRealVar("k","Error scale factor", 1, 0.0, 3) |
|
| rho = RooRealVar("rho","Correlation coefficient", 0, -1, 1) |
|
| f = RooRealVar("f", "Fraction of 1st Gauss", 0.9, 0., 1) |
|
| mx2 = RooRealVar("mx2","Mean x", -0.05, -2, 2) |
|
| sx2 = RooRealVar("sx2","Sigma x", 0.10, 0, 1) |
|
| ax2 = RooRealVar("ax2","Tilt x", 0, -1e-3, 1e-3) |
|
| my2 = RooRealVar("my2","Mean y", 1, -2, 2) |
|
| sy2 = RooRealVar("sy2","Sigma y", 0.10, 0, 1) |
|
| ay2 = RooRealVar("ay2","Tilt y", 0, -1e-3, 1e-3) |
|
| mz2 = RooRealVar("mz2","Mean z", -3, -300, 300) |
|
| sz2 = RooRealVar("sz2","Sigma z", 60, 0, 100) |
|
| rho2 = RooRealVar("rho2","Correlation coefficient", 0, -1, 1) |
|
| mux = RooFormulaVar("mux","@0+@1*(@2-@3)",RooArgList(mx,ax,z,mz)) |
|
| muy = RooFormulaVar("muy","@0+@1*(@2-@3)",RooArgList(my,ay,z,mz)) |
|
| cxx = RooFormulaVar("cxx","@0*@0+@1*@1*@2",RooArgList(sx,k,vxx)) |
|
| cxy = RooFormulaVar("cxy","@0*@1*@2+@3*@3*@4",RooArgList(rho,sx,sy,k,vxy)) |
|
| cyy = RooFormulaVar("cyy","@0*@0+@1*@1*@2",RooArgList(sy,k,vyy)) |
|
| czz = RooFormulaVar("czz","@0*@0",RooArgList(sz)) |
|
| czzv = RooFormulaVar("czz","@0*@0+@1",RooArgList(sz,vzz)) |
|
| mux2 = RooFormulaVar("mux2","@0+@1*(@2-@3)",RooArgList(mx2,ax,z,mz)) |
|
| muy2 = RooFormulaVar("muy2","@0+@1*(@2-@3)",RooArgList(my2,ay,z,mz)) |
|
| cxx2 = RooFormulaVar("cxx2","@0*@0+@1*@1*@2",RooArgList(sx2,k,vxx)) |
|
| cxy2 = RooFormulaVar("cxy2","@0*@1*@2+@3*@3*@4",RooArgList(rho,sx2,sy2,k,vxy)) |
|
| cyy2 = RooFormulaVar("cyy2","@0*@0+@1*@1*@2",RooArgList(sy2,k,vyy)) |
|
| czz2 = RooFormulaVar("czz","@0*@0",RooArgList(sz)) |
|
| dummyMatrix = ROOT.TMatrixDSym(3) |
|
bool | cmdOk = False |
|
| fitmodel |
|
| fitresult |
|
| g1 |
|
| g2 |
|
| plots = Plots(whatList = ['x','y','z']) |
|
| saveAsList |
|
| gPadSaveAsList |
|
| allCanvasDivs |
|
| allCanvasSize |
|