Unable to call RooRealVar

Dear Experts,
I am trying to do an unbinned fit of the distribution shown here. Screenshot from 2020-07-06 20-04-20
Here’s the macro and the root file.ksks_fit_trial.C (2.6 KB). forfit_proc11_bucket9to12_bcs.root (12.5 KB)

However, I am receiving the following message when I run the code:

root [0]
Processing ksks_fit_trial.C…

RooFit v3.60 – Developed by Wouter Verkerke and David Kirkby
Copyright © 2000-2013 NIKHEF, University of California & Stanford University
All rights reserved, please read http://roofit.sourceforge.net/license.txt

Warning in TClass::TClass: no dictionary for class ROOT::TIOFeatures is available
Entries = 288
Error: Can’t call RooRealVar::RooRealVar(‘mean’,‘mean_of_the_dist’,0.1454,0.14,0.159,‘GeV/c^{2}’) in current scope ksks_fit_trial.C:61:
Possible candidates are…
(in RooRealVar)
/home/lenovo/Downloads/ROOT_software/root/lib/libRooFitCore.so -1:-1 0 public: RooRealVar RooRealVar::RooRealVar(void);
/home/lenovo/Downloads/ROOT_software/root/lib/libRooFitCore.so -1:-1 0 public: RooRealVar RooRealVar::RooRealVar(const char* name,const char* title,Double_t value,const char* unit="");
/home/lenovo/Downloads/ROOT_software/root/lib/libRooFitCore.so -1:-1 0 public: RooRealVar RooRealVar::RooRealVar(const char* name,const char* title,Double_t minValue,Double_t maxValue,const char* unit="");
/home/lenovo/Downloads/ROOT_software/root/lib/libRooFitCore.so -1:-1 0 public: RooRealVar RooRealVar::RooRealVar(const char* name,const char* title,Double_t value,Double_t minValue,Double_t maxValue,const char* unit="");
/home/lenovo/Downloads/ROOT_software/root/lib/libRooFitCore.so -1:-1 0 public: RooRealVar RooRealVar::RooRealVar(const RooRealVar& other,const char* name=0);
(in RooAbsRealLValue)
(in RooAbsReal)
(in RooAbsArg)
(in RooPrintable)
(in RooAbsLValue)
*** Interpreter error recovered ***

Can you please help me?

Thanks,
Sanjeeda

Please try to replace the single quotes ' by double quotes " for strings, and then remain those undeclared identifier errors:

root [0] .x ksks_fit_trial.C

e[1mRooFit v3.60 -- Developed by Wouter Verkerke and David Kirkbye[0m
                Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University
                All rights reserved, please read http://roofit.sourceforge.net/license.txt

In file included from input_line_8:1:
C:\Users\bellenot\rootdev\Forum\ksks_fit_trial.C:65:53: error: use of undeclared identifier 'r'
  RooFormulaVar diff("diff","deltaM_after_bcs-mpi", r.RooArgList(deltaM,mpi));
                                                    ^
C:\Users\bellenot\rootdev\Forum\ksks_fit_trial.C:65:73: error: use of undeclared identifier 'mpi'
  RooFormulaVar diff("diff","deltaM_after_bcs-mpi", r.RooArgList(deltaM,mpi));
                                                                        ^
C:\Users\bellenot\rootdev\Forum\ksks_fit_trial.C:66:59: error: use of undeclared identifier 'r'
  RooFormulaVar first_part("first_part", "pow(diff,1/2)", r.RooArgList(diff));
                                                          ^
C:\Users\bellenot\rootdev\Forum\ksks_fit_trial.C:67:67: error: use of undeclared identifier 'r'
  RooFormulaVar second_part("second_part", "alpha*pow(diff,3/2)", r.RooArgList(alpha, diff));
                                                                  ^
C:\Users\bellenot\rootdev\Forum\ksks_fit_trial.C:68:54: error: use of undeclared identifier 'r'
  RooGenericPdf bkg("bkg","first_part + second_part",r.RooArgList(first_part, second_part));
                                                     ^
root [1] 

Hi, Thanks a lot. There were alo a fer other errors in the macro.
Here’s the final working one.ksks_fit_trial.C (2.8 KB) .

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