TPrincipal::MakeHistograms()

Hi,

I found that tutorial principal.C (win + v5.14) create only one hist. “pca_e”, while the method MakeHistograms(), called in this script, must produce a bunch of histograms by default?

To get all other histograms, add option “D” when calling TPrincipal constructor in the tutorial principal.C, ie, change

TPrincipal* principal = new TPrincipal(n,"N"); to

TPrincipal* principal = new TPrincipal(n,"ND");
I have changed the version CVS head to specify this option.

Rene

Thanks the tutorial is OK now.

I wrote simple script using TTree::Principal for creating TPrincipal. In this case, again only one hist pca_e were produced?

Int_t mkpca(const char *name=“ptrn.root”)
{
gROOT->Reset();
TDirectory sys_dir=gDirectory;
const char
inf=name;
TFile fin(inf,“READ”);
sys_dir->cd();
TTree *t=fin.Get(“t”);
TPrincipal *pca;

pca=t->Principal(“vo:v1:v2”);
pca->Print(“MSEV”);
pca->MakeHistograms();
TBrowser* b = new TBrowser(“principalBrowser”, pca);

return -1;
}

The default set of histograms created after replacing the line

pca=t->Principal(“vo:v1:v2”);

with

pca=t->Principal(“vo:v1:v2”,"","");

in this case the default options “np” of method Principal() are ignored?

Igor,

It is not that the options are ignored, you SET them to “” and not the default.
You should call:

pca=t->Principal("vo:v1:v2","","np");
Rene

Hi Rene,

Thanks for your help. There are still some behaviors that seems strange for me.

  1. When the “n” option switched on in tree::Principal, there is only one histogramm generated, and also the UserData vector is not filled?
  2. Once I ran the method MakePrincipal() several times, the obtained results for a feature vector and histograms changes depends on the number rans? i.e.

pca=t->Principal(“a:b:c”,"","");
pca->MakePrincipals();
pca->MakePrincipals();
pca->MakePrincipals();
pca->MakePrincipals();
pca->Print(“MSEV”);
pca->MakeHistograms();

Igor

[quote]1) When the “n” option switched on in tree::Principal, there is only one histogramm generated, and also the UserData vector is not filled?
[/quote]

As I said in my previous post, you have to specify the option “D” to get all histograms.

I cannot reproduce this problem. Could you post a small tar.gz file as attachment containing a small data file and a small script showing the problem?

Rene

Sorry, the problem is appeare only when the TPrincipal created via tree interface by i.e. tree::Principal(“a:b:c”,"",“ND”), while in the tutorial, where TPrincipal created directly, “D” option is working.

Just put in the tutorial the sequence of principal->MakePrincipals() calls and compare produced eigenvalues and histograms in the case of one call and two calls. Then you will find the differences

  
  // Do the actual analysis
  principal->MakePrincipals();
  principal->MakePrincipals();

igor

I changed the tutorial principal.C so it create TPrincipal via tree interface
principal.C (3.16 KB)