#include #include #include #include "RooAbsReal.h" #include "RooAbsCategory.h" #include #include #include #include #include "TObject.h" #include "TCut.h" #include "TH1F.h" #include "TH2F.h" #include "TFile.h" #include "TTree.h" #include "TPostScript.h" #include "TCanvas.h" #include "TNtuple.h" #include "TChain.h" #include "TVector3.h" #include "TLorentzVector.h" #include "TPaveText.h" #include "RooAbsPdf.h" #include "RooFFTConvPdf.h" #include "RooRealVar.h" #include "RooNovosibirsk.h" #include "RooCBShape.h" #include "RooGaussian.h" #include "RooChebychev.h" #include "RooExtendPdf.h" #include "RooDataSet.h" #include "RooArgList.h" #include "RooStats/SPlot.h" #include "RooAddPdf.h" #include "RooPlot.h" #include "RooHist.h" #include "RooNLLVar.h" #include "RooMinimizer.h" using namespace RooFit; void example(const char *input_rootname, const char *out_rootname, const char *output_weight, double Mass_mini, double Mass_maxi){ // read in mass information TChain *chain = new TChain(); std::string chain_name = std::string(input_rootname)+"/DecayTree"; chain->Add(chain_name.c_str()); double Jpsi_M; chain -> SetBranchAddress("Jpsi_DTF_PV_MASS", &Jpsi_M); std::string mass_low_str = to_string(Mass_mini); std::string mass_hig_str = to_string(Mass_maxi); string mass_cut = "Jpsi_DTF_PV_MASS>"+mass_low_str+"&&Jpsi_DTF_PV_MASS<"+mass_hig_str; TTree* ch_new = chain->CopyTree(mass_cut.c_str()); cout << "copytree is ok !" <CloneTree(0); double sig_sw; std::string out_weight_form = std::string(output_weight) + "/D"; DecayTree->Branch(output_weight,&sig_sw,out_weight_form.c_str()); int Number_chain = ch_new->GetEntries(); for(int i=0;iFill(); } cout<<"-----"<cd(); DecayTree->Write(); rootfile->Close(); }