Hi,
I’m trying to calculate a measure (Mututal Information) where I need f(x,y)/(f(x)*f(y)). I’d like to use KeysPDFs for this but have run into a problem if nothing else in my understanding of the normalisation of RooNDKeysPDF.
Here’s a sample code (TTree: tree is loaded earlier as pointer):
RooRealVar pointx("pointx","pointx",-10.,10.);
RooRealVar pointy("pointy","pointy",-10.,10.) ;
RooDataSet* data = new RooDataSet("data","dataset",RooArgSet(pointx,pointy),Import(*tree) );
RooKeysPdf keys1("keys1","keys1",pointx,*data,RooKeysPdf::MirrorBoth) ;
RooKeysPdf keys2("keys2","keys2",pointy,*data,RooKeysPdf::MirrorBoth) ;
RooNDKeysPdf keys12("keys12","keys12",RooArgSet(pointx,pointy),*data,"am") ;
RooArgSet* pdfObs = keys12.getObservables(data) ; double sum12=0; double sum1=0;
for (int i=0 ; i<data->numEntries() ; i++) {
*pdfObs = *data->get(i);
sum12+=keys12.getVal();
sum1+=keys1.getVal()
cout << "keys12.getVal() " <<keys12.getVal()<< endl;
cout << "keys12.getNorm() " <<keys12.getNorm()<< endl;
cout<< "keys1.getVal() " << keys1.getVal() << endl;
cout << "keys1.getNorm() " <<keys1.getNorm()<< endl;
cout << "keys12.getVal(pdfObs) " <<keys12.getVal(pdfObs)<< endl;
cout << "keys12.getNorm(pdfObs) " <<keys12.getNorm(pdfObs)<< endl;
cout << "keys1.getVal(pdfObs) " << keys1.getVal(pdfObs) << endl;
}
with the output for each event:
keys12.getVal() 40.4498
keys12.getNorm() 1
keys1.getVal() 0.189049
keys1.getNorm() 1
keys12.getVal(pdfObs) 0.404498
keys12.getNorm(pdfObs) 100
keys1.getVal(pdfObs) 0.567152
keys1.getNorm(pdfObs) 0.333331
… etc …
keys12.getVal() larger than 1 I believe is because it is the normalised to number of entries in the dataset which is 100. I however still don’t understand the value and the sum total for alle entries is ~1000 for the keys12.getVal(). and ~10 for the two others. To how this makes sense I’m at a complete loss. What I really just want are the values at x for the pdfs normalised to unity.
Any help would be most appreciated,
Ask