A morphing function as a function of one coefficient is setup and can be used to obtain the distribution for any value of the coefficient.
 
import ROOT
 
 
observablename = "pTV"
 
 
 
par = "cHq3"
samplelist = ["SM_NPsq0", "cHq3_NPsq1", "cHq3_NPsq2"]
 
 
 
 
 
 
morph_datahist_0p01 = 
ROOT.RooDataHist(
"morph_dh_cHq3=0.01", 
"", [obsvar], morph_hist_0p01)
 
morph_datahist_0p25 = 
ROOT.RooDataHist(
"morph_dh_cHq3=0.25", 
"", [obsvar], morph_hist_0p25)
 
morph_datahist_0p5 = 
ROOT.RooDataHist(
"morph_dh_cHq3=0.5", 
"", [obsvar], morph_hist_0p5)
 
 
 
input_hists = {sample: 
ROOT.TFile.Open(infilename).Get(sample).FindObject(observablename) 
for sample 
in samplelist}
 
input_datahists = {
    sample: 
ROOT.RooDataHist(
"dh_" + sample, 
"dh_" + sample, [obsvar], input_hists[sample]) 
for sample 
in samplelist
 
}
 
 
frame0 = 
obsvar.frame(Title=
"Input templates for p_{T}^{V}")
 
for sample, color 
in zip(samplelist, 
"krb"):
 
    input_datahists[sample].plotOn(frame0, Name=sample, LineColor=color, MarkerColor=color, MarkerSize=1)
 
 
frame1 = 
obsvar.frame(Title=
"Morphed templates for selected values")
 
plot_args = dict(
    DrawOption="C",
    DataError=None,
    XErrorSize=0,
)
 
 
 
 
 
 
leg1.AddEntry(
"cHq3_NPsq1", 
"c_{Hq^{(3)}}=1.0 at #Lambda^{-2}", 
"LP")
 
leg1.AddEntry(
"cHq3_NPsq2", 
"c_{Hq^{(3)}}=1.0 at #Lambda^{-4}", 
"LP")
 
 
 
 
 
 
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
 
  [#0] PROGRESS:InputArguments -- initializing physics inputs from file /github/home/ROOT-CI/build/tutorials/roofit/input_histos_rf_lagrangianmorph.root with object name(s) 'pTV'
[#0] PROGRESS:Caching -- creating cache from getCache function for 0x56260b8be910
[#0] PROGRESS:Caching -- current storage has size 3
[#0] PROGRESS:ObjectHandling -- observable: pTV
[#0] PROGRESS:ObjectHandling -- binWidth: binWidth_pTV
[#1] INFO:DataHandling -- RooDataHist::adjustBinning(morph_dh_cHq3=0.01): fit range of variable pTV expanded to nearest bin boundaries: [10,600] --> [0,600]
[#1] INFO:InputArguments -- RooAbsData::plotOn(dh_SM_NPsq0) INFO: dataset has non-integer weights, auto-selecting SumW2 errors instead of Poisson errors
[#1] INFO:InputArguments -- RooAbsData::plotOn(dh_cHq3_NPsq1) INFO: dataset has non-integer weights, auto-selecting SumW2 errors instead of Poisson errors
[#1] INFO:Plotting -- RooPlot::updateFitRangeNorm: New event count of 24931.9 will supersede previous event count of 10852.3 for normalization of PDF projections
[#1] INFO:InputArguments -- RooAbsData::plotOn(dh_cHq3_NPsq2) INFO: dataset has non-integer weights, auto-selecting SumW2 errors instead of Poisson errors
[#1] INFO:Plotting -- RooPlot::updateFitRangeNorm: New event count of 29789.2 will supersede previous event count of 24931.9 for normalization of PDF projections
[#1] INFO:Plotting -- RooPlot::updateFitRangeNorm: New event count of 18947.1 will supersede previous event count of 11104.6 for normalization of PDF projections
[#1] INFO:Plotting -- RooPlot::updateFitRangeNorm: New event count of 30765.5 will supersede previous event count of 18947.1 for normalization of PDF projections
[#0] PROGRESS:Caching -- creating cache from getCache function for 0x56260cba1ac0
[#0] PROGRESS:Caching -- current storage has size 3
[#0] PROGRESS:ObjectHandling -- observable: pTV
[#0] PROGRESS:ObjectHandling -- binWidth: binWidth_pTV
 
[#1] INFO:NumericIntegration -- RooRealIntegral::init(w_SM_NPsq0_morphfunc_Int[cHq3]) using numeric integrator RooIntegrator1D to calculate Int(cHq3)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(w_cHq3_NPsq1_morphfunc_Int[cHq3]) using numeric integrator RooIntegrator1D to calculate Int(cHq3)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(w_cHq3_NPsq2_morphfunc_Int[cHq3]) using numeric integrator RooIntegrator1D to calculate Int(cHq3)
[#0] PROGRESS:Caching -- creating cache from getCache function for 0x56260cc08240
[#0] PROGRESS:Caching -- current storage has size 3
[#0] PROGRESS:ObjectHandling -- observable: pTV
[#0] PROGRESS:ObjectHandling -- binWidth: binWidth_pTV
 
[#1] INFO:NumericIntegration -- RooRealIntegral::init(w_SM_NPsq0_morphfunc_Int[cHq3]) using numeric integrator RooIntegrator1D to calculate Int(cHq3)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(w_cHq3_NPsq1_morphfunc_Int[cHq3]) using numeric integrator RooIntegrator1D to calculate Int(cHq3)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(w_cHq3_NPsq2_morphfunc_Int[cHq3]) using numeric integrator RooIntegrator1D to calculate Int(cHq3)