Pull distribution creation help

Hello,

I’m quite new to this so I’m gonna ask a few things,
I have a tree that contains 6 branches and i want to import this tree to another script and create a pull distribution

I manage to import the branches but how should i proceed?
how can i declare a RooHist with the specific function i want to use?
I need a pull distribution for sigma and one for mean (i.e. sigmaFit-sigmaInj)/sigmaFitError

thanks in advance :slight_smile:
Code (i’ve only gone that far) is below:

#ifndef __CINT__
#include "RooGlobalFunc.h"
#endif
#include "RooRealVar.h"
#include "RooDataSet.h"
#include "RooGaussian.h"
#include "RooDataHist.h"
#include "TCanvas.h"
#include "RooPlot.h"
#include "TAxis.h"
#include "TFile.h"
#include "RooWorkspace.h"

using namespace RooFit ;


void roofit_test_loops_readtree(){

  RooMsgService::instance().setSilentMode(kTRUE);
  RooMsgService::instance().setStreamStatus(0,kFALSE);
  RooMsgService::instance().setStreamStatus(1,kFALSE); 
  
    gROOT->Reset();
    gROOT->SetStyle("Plain"); 
    gStyle->SetOptStat(0);
    gStyle->SetOptFit(0);
    gStyle->SetPadColor(0);
    gStyle->SetPalette(1);

    TFile *f = TFile::Open("pdfloop.root", "READ");
    TTree *tree = (TTree*)f->Get("tree");
    TFile *outf = TFile::Open("pdfloopdraw.root", "RECREATE");

  
  float sigmaInj, meanInj, sigmaFit, meanFit, sigmaFitError,meanFitError;
  
  tree->SetBranchAddress("sigmaInj",&sigmaInj);
  tree->SetBranchAddress("meanInj",&meanInj);
  tree->SetBranchAddress("sigmaFit",&sigmaFit);
  tree->SetBranchAddress("meanFit",&meanFit);
  tree->SetBranchAddress("sigmaFitError",&sigmaFitError);
  tree->SetBranchAddress("meanFitError",&meanFitError);

Hi,

Your code is not complete, please attach to the message instead of copying inside as text.

Also it is not clear to me what exactly you want to do. To make a pull distribution you need to perform repeated fit to dataset’s originated with the same physical model.

Lorenzo

As a side note:

Never used gROOT->Reset(); inside a function or from python.

Cheers,
Philippe

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.