RooAbsPdf::createHistogram (const char *varNameList, Int_t xbins=0, Int_t ybins=0, Int_t zbins=0) const

With the following code:

  TFile * fw = TFile::Open("workspaces/modelTwoHypo.root");
  RooWorkspace *w = (RooWorkspace *) fw -> Get("w");
  RooRealVar * CMS_th1x = w -> var("CMS_th1x");
  RooPlot * frame = CMS_th1x -> frame();
  RooAbsPdf *ttbar = w -> pdf("shapeSig_b1_ttbar_morph");                                             
  ttbar	-> plotOn(frame);                                                                                                        
  TCanvas * c = new TCanvas("c", "c");
  frame -> Draw();

I get a frame drawn on a canvas matching the expectations.

To get a similar histogram I try:

TH1 * h = ttbar -> createHistogram("??", CMS_th1x -> getValV());

I am particularly uncertain about what to supply for varNameList. How can I check what variable was used to make the frame?

The output from ttbar -> Print() is

FastVerticalInterpHistPdf2::shapeSig_b1_ttbar_morph[ coefList=(MC13TeV_TTJets_jec_CorrelationGroupMPFInSitu,MC13TeV_TTJets_jec_RelativeFSR,MC13TeV_TTJets_jec_CorrelationGroupUncorrelated,MC13TeV_TTJets_jec_FlavorPureGluon,MC13TeV_TTJets_jec_FlavorPureQuark,MC13TeV_TTJets_jec_FlavorPureCharm,MC13TeV_TTJets_jec_FlavorPureBottom,MC13TeV_TTJets_jer,MC13TeV_TTJets_btag_heavy,MC13TeV_TTJets_btag_light,MC13TeV_TTJets_csv_heavy,MC13TeV_TTJets_csv_light,MC13TeV_TTJets_tracking,MC13TeV_TTJets_isr,MC13TeV_TTJets_fsr,MC13TeV_TTJets_hdamp,MC13TeV_TTJets_ue) x=CMS_th1x ] = 0.0407928

perhaps @moneta or @vcroft can help here?

Thank you,

Hi @Viesturs

there’s a nice example showing how to get histograms of various dimensionality from a RooAbsPdf here:

I think that in your case the varNameList is just the name that you want to give the histogram. However you can also get multiple dimensions out with the format in the link above (hence the list bit in the name).

Let me know if that helps… since maybe I misunderstood the question.

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