"ProtoData" question

Hi experts,
I’m generating a set of toy MC about the time t distribution with a RooSimultaneous PDF that also contains 6 conditional variables. Here’s the code I used.

 weight = new RooRealVar(Weight, "", -10, 10);
       varlist = new RooArgList(*t, *Resolutionsigma, *qf, *CPfinalstate,*EtaSS, *EtaOS,  *TagdecOS, *TagdecSS, *weight);
       RooArgList *varlist_plot = new RooArgList( *qf, *CPfinalstate,*EtaSS, *EtaOS,  *TagdecOS, *TagdecSS, *Resolutionsigma);
       wdata_LL = new RooDataSet("wdata_LL", "weighted data",  *varlist, Import(*seltree_LL), WeightVar(*weight));
       wdata_DD = new RooDataSet("wdata_DD","weighted data", *varlist, Import(*seltree_DD),  WeightVar(*weight));
       RooDataSet *data_plot_LL = new RooDataSet("data_plot","",*varlist_plot, Import(*seltree_LL));
       RooDataSet *data_plot_DD = new RooDataSet("data_plot","",*varlist_plot, Import(*seltree_DD));
       cout << "=====================================================" << endl;
       cout << "data_LL: " << endl;
       wdata_LL->Print();
       cout << "=====================================================" << endl;
       cout << "data_DD: " << endl;
       wdata_DD->Print();
.....
 RooCategory sample("sample", "sample");
 sample.defineType("LL");
 sample.defineType("DD");
 RooDataSet *combData = new RooDataSet("combData", "combined data",*varlist,  Index(sample),WeightVar(*weight),
 Import("LL",*wdata_LL),Import("DD",*wdata_DD));

 cout << "=====================================================" << endl;
 cout << "combData: " << endl;
 combData->Print("v");

RooCategory sample_plot("sample_plot", "sample_plot");
sample_plot.defineType("LL");
sample_plot.defineType("DD");
RooDataSet *combData_plot = new RooDataSet("combData_plot", "combined data",*varlist_plot,  Index(sample_plot),
                        Import("LL",*data_plot_LL),Import("DD",*data_plot_DD));
cout << "=====================================================" << endl;
cout << "combData_plot: " << endl;
combData_plot->Print("v");

RooSimultaneous *simPdf = new RooSimultaneous("simPdf","simultaneous pdf", sample) ;
simPdf->addPdf(*FitPdf_LL,"LL");
simPdf->addPdf(*FitPdf_DD,"DD");
cout << "=====================================================" << endl;
cout << "PDF: " << endl;
simPdf->Print("v");  
....
t->setRange("true_time", 0.2, 15.);
RooDataSet* wdata_sel = (RooDataSet*)combData->reduce(
    RooFit::CutRange("true_time")
);

Double_t sumW = wdata_sel->sumEntries();      
cout << " the number of wdata_sel: " << sumW <<endl;
Int_t    nToy = Int_t(sumW + 0.5);                  
cout << " the number of Toy: " << nToy <<endl;

RooArgSet* obs = simPdf->getObservables(*combData_plot);
cout<< "=========================================================" <<endl;
cout<< "simPdf->getObservables(*combData_plot): " << endl;
obs->Print("v"); 

RooDataSet* toy = simPdf->generate(
        *t,                          
        RooFit::ProtoData(*combData_plot)       
                 );              
cout << "=====================================================" << endl;
cout << "toy: " << endl;
toy->Print("v");

RooDataSet* toy2 = simPdf->generate(
    RooArgSet(*t),
    NumEvents(nToy)
);
cout << "=====================================================" << endl;
cout << "toy2: " << endl;
toy2->Print("v");

What puzzles me is that in the output, it tells me that this is a 4D pdf. I wanted my 6 conditional variables to take values from my raw data and reduce my PDF to 1D, but the ProtoData command doesn’t seem to do what I wanted.

=====================================================
data_LL: 
RooDataSet::wdata_LL[time,sigmat,Comb_TAGDEC,CP_finalState,B0_SSKaonLatest_TAGETA,OS_Combination_ETA,OS_Combination_DEC,B0_SSKaonLatest_TAGDEC,weight:sig_sw] = 72533 entries (754.081 weighted)
=====================================================
data_DD: 
RooDataSet::wdata_DD[time,sigmat,Comb_TAGDEC,CP_finalState,B0_SSKaonLatest_TAGETA,OS_Combination_ETA,OS_Combination_DEC,B0_SSKaonLatest_TAGDEC,weight:sig_sw] = 109496 entries (983.305 weighted)
[#0] ERROR:InputArguments -- RooFormulaVar::readFromStream(sinh_D): can't read
=====================================================
parameter: 
RooArgSet:: = (Resolutionmean,tagOSp0_LL,tagSSp0_LL,tagOSp1_LL,tagSSp1_LL,tagDelta_OSp0_LL,tagDelta_SSp0_LL,tagDelta_OSp1_LL,tagDelta_SSp1_LL,tagOSp0_DD,tagSSp0_DD,tagOSp1_DD,tagSSp1_DD,tagDelta_OSp0_DD,tagDelta_SSp0_DD,tagDelta_OSp1_DD,tagDelta_SSp1_DD,cos_C,sin_S,sinh_D,cosh_C,accf1_LL,accf2_LL,accf3_LL,accf4_LL,accf5_LL,accf6_LL,accf7_LL,accf8_LL,accf1_DD,accf2_DD,accf3_DD,accf4_DD,accf5_DD,accf6_DD,accf7_DD,accf8_DD,Tageff_OS_LL,Tageff_SS_LL,Tageff_OS_DD,Tageff_SS_DD,Tageff_asym_OS,Tageff_asym_SS,Production_asym,Detection_asym,Gammas,Delta_Gammas,Dms)
=====================================================
combData: 
DataStore combData (weighted data)
  Contains 182029 entries
  Observables: 
    1)                  sample = LL(idx = 0)
  "sample"
    2)                    time = 1.43788  L(0.2 - 15) // [ps] "decay time"
    3)                  sigmat = 0.0526797  L(1e-05 - 0.2)  "Resolutionsigma"
    4)             Comb_TAGDEC = B0(idx = 1)
  "qfBachelorID"
    5)           CP_finalState = [cc]KS(idx = 1)
  "CP_finalstate"
    6)  B0_SSKaonLatest_TAGETA = 0.411612  L(0 - 0.5)  "Tagging performance (SS)"
    7)      OS_Combination_ETA = 0.5  L(0 - 0.5)  "Tagging performance (OS)"
    8)      OS_Combination_DEC = UnTaggedOS(idx = 0)
  "TagDecOS"
    9)  B0_SSKaonLatest_TAGDEC = B0(idx = 1)
  "TagDecSS"
  Dataset variable "sig_sw" is interpreted as the event weight
=====================================================
combData_plot: 
DataStore combData_plot ()
  Contains 182029 entries
  Observables: 
    1)             sample_plot = LL(idx = 0)
  "sample_plot"
    2)             Comb_TAGDEC = B0(idx = 1)
  "qfBachelorID"
    3)           CP_finalState = [cc]KS(idx = 1)
  "CP_finalstate"
    4)  B0_SSKaonLatest_TAGETA = 0.411612  L(0 - 0.5)  "Tagging performance (SS)"
    5)      OS_Combination_ETA = 0.5  L(0 - 0.5)  "Tagging performance (OS)"
    6)      OS_Combination_DEC = UnTaggedOS(idx = 0)
  "TagDecOS"
    7)  B0_SSKaonLatest_TAGDEC = B0(idx = 1)
  "TagDecSS"
    8)                  sigmat = 0.0526797  L(1e-05 - 0.2)  "Resolutionsigma"
=====================================================
PDF: 
--- RooAbsArg ---
  Value State: DIRTY
  Shape State: DIRTY
  Attributes: 
  Address: 0x52da270
  Clients: 
  Servers: 
    (0x7ffd46617570,V-) RooCategory::sample "sample"
    (0x42aa5d0,V-) RooBDecay::FitPdf_LL ""
    (0x4313ab0,V-) RooBDecay::FitPdf_DD ""
  Proxies: 
    !plotCoefNormSet -> 
    indexCat -> sample
    LL -> FitPdf_LL
    DD -> FitPdf_DD
--- RooAbsReal ---

  Plot label is "simPdf"
--- RooAbsPdf ---
Cached value = 0
================Successful Two================================
[#1] INFO:Eval -- RooRealVar::setRange(time) new range named 'true_time' created with bounds [0.2,15]
 the number of wdata_sel: 1737.39
 the number of Toy: 1737
=========================================================
simPdf->getObservables(*combData_plot): 
  1) 0x3de41d0 RooCategory::          CP_finalState = [cc]KS(idx = 1)
  "CP_finalstate"
  2) 0x4138ef0 RooCategory::     OS_Combination_DEC = B0 bar(idx = -1)
  "TagDecOS"
  3) 0x413a0e0 RooRealVar::     OS_Combination_ETA = 0.25  L(0 - 0.5)  "Tagging performance (OS)"
  4) 0x41397d0 RooCategory:: B0_SSKaonLatest_TAGDEC = B0 bar(idx = -1)
  "TagDecSS"
  5) 0x413a8a0 RooRealVar:: B0_SSKaonLatest_TAGETA = 0.25  L(0 - 0.5)  "Tagging performance (SS)"
  6) 0x413c870 RooRealVar::                 sigmat = 0.100005  L(1e-05 - 0.2)  "Resolutionsigma"
[#0] WARNING:Generation -- FitPdf_LL_Int[]_Norm[time]::RooAcceptReject: WARNING: generating 4 variables with accept-reject may not be accurate
[#0] WARNING:Generation -- RooAcceptReject::ctor(FitPdf_LL_Int[]_Norm[time]) WARNING: performing accept/reject sampling on a p.d.f in 4 dimensions without prior knowledge on maximum value of p.d.f. Determining maximum value by taking 90000000 trial samples. If p.d.f contains sharp peaks smaller than average distance between trial sampling points these may be missed and p.d.f. may be sampled incorrectly.
[#0] WARNING:Generation -- RooAcceptReject::ctor(FitPdf_LL_Int[]_Norm[time]): WARNING: 90000000 trial samples requested by p.d.f for 4-dimensional accept/reject sampling, this may take some time
=====================================================
toy: 
DataStore FitPdf_LLData (Generated From )
  Contains 182029 entries
  Observables: 
    1)                    time = 1.74055  L(0.2 - 15) // [ps] "decay time"
    2)             sample_plot = LL(idx = 0)
  "sample_plot"
    3)             Comb_TAGDEC = B0(idx = 1)
  "qfBachelorID"
    4)           CP_finalState = [cc]KS(idx = 1)
  "CP_finalstate"
    5)  B0_SSKaonLatest_TAGETA = 0.411612  L(0 - 0.5)  "Tagging performance (SS)"
    6)      OS_Combination_ETA = 0.5  L(0 - 0.5)  "Tagging performance (OS)"
    7)      OS_Combination_DEC = UnTaggedOS(idx = 0)
  "TagDecOS"
    8)  B0_SSKaonLatest_TAGDEC = B0(idx = 1)
  "TagDecSS"
    9)                  sigmat = 0.0526797  L(1e-05 - 0.2)  "Resolutionsigma"
=====================================================
toy2: 
DataStore FitPdf_LLData (Generated From )
  Contains 1737 entries
  Observables: 
    1)  time = 1.33498  L(0.2 - 15) // [ps] "decay time"
[#0] WARNING:Generation -- FitPdf_LL_Int[]_Norm[time]::RooAcceptReject: WARNING: generating 4 variables with accept-reject may not be accurate
[#0] WARNING:Generation -- RooAcceptReject::ctor(FitPdf_LL_Int[]_Norm[time]) WARNING: performing accept/reject sampling on a p.d.f in 4 dimensions without prior knowledge on maximum value of p.d.f. Determining maximum value by taking 90000000 trial samples. If p.d.f contains sharp peaks smaller than average distance between trial sampling points these may be missed and p.d.f. may be sampled incorrectly.
[#0] WARNING:Generation -- RooAcceptReject::ctor(FitPdf_LL_Int[]_Norm[time]): WARNING: 90000000 trial samples requested by p.d.f for 4-dimensional accept/reject sampling, this may take some time
=====================================================

Hi @liuwe,

thank you for the question, maybe @jonas could help here.

Cheers,
Marta

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