Hi Krzysztof, Unfortunately, I cannot test your code with root 3.10.1 . The MLP implementation has evolved a lot since root 3.10.1. Running ROOT 4.00/02 gives the expected output : root [0] .x testNN.C I expect `aaa' and `BBB' to be identical now: aaa->GetEntries()=10 BBB->GetEntries()=10 aaa x[0]=0 type[0]=0 BBB x[0]=0 type[0]=0 aaa x[1]=1 type[1]=1 BBB x[1]=1 type[1]=1 aaa x[2]=2 type[2]=0 BBB x[2]=2 type[2]=0 aaa x[3]=3 type[3]=1 BBB x[3]=3 type[3]=1 aaa x[4]=4 type[4]=0 BBB x[4]=4 type[4]=0 aaa x[5]=5 type[5]=1 BBB x[5]=5 type[5]=1 aaa x[6]=6 type[6]=0 BBB x[6]=6 type[6]=0 aaa x[7]=7 type[7]=1 BBB x[7]=7 type[7]=1 aaa x[8]=8 type[8]=0 BBB x[8]=8 type[8]=0 aaa x[9]=9 type[9]=1 BBB x[9]=9 type[9]=1 root [1] I would encourage you to move to a new ROOT release. Cheers, Christophe. On Friday 02 April 2004 15:37, Krzysztof Syryczynski wrote: > Red Hat 7 root 3.10.1 CINT/ROOT C/C++ 5.15.105 > > Hello > > It seems that creation of TMultiLayerPerceptron does something to the tree > or I don't know how to use it. > > TMultiLayerPerceptron "mlp1" works fine with tree "aaa". > After using "mlp1", I'd like to remove data from tree "aaa" > and fill it gain. > How to do it properly? > > Please test the following script "test.C" > Result depends on creation of mlp1 and/or mlp2. > Existance of another tree "BBB" is not the reason. > All lines with "BBB" can be removed. > > Cheers > Krzysztof Syryczynski > > > void test() > { > gROOT->Reset(); > gDirectory->GetList()->Delete(); > if (!gROOT->GetClass("TMultiLayerPerceptron")) gSystem->Load("libMLP"); > > Int_t type; > Float_t x; > TTree *aaa = new TTree("aaa", "aaa Events"); > aaa->Branch("x", &x, "x/F"); > aaa->Branch("type", &type, "type/I"); > > TTree *BBB = new TTree("BBB", "BBB Events"); > BBB->Branch("x", &x, "x/F"); > BBB->Branch("type", &type, "type/I"); > > Long_t i; > for (i = 0; i < 1000; i++) { > x=sin(i); > if (x>0.5) type = 1; > else type = 0; > aaa->Fill(); > } > > //creation of multiperceptron does something to the tree > TMultiLayerPerceptron *mlp1 = new > TMultiLayerPerceptron("x/F:30:type/I",aaa); > > //TMultiLayerPerceptron *mlp2 = new > //TMultiLayerPerceptron("x/F:30:type/I",BBB); > > aaa->Reset(); > BBB->Reset(); > for (i = 0; i < 10; i++) { > x=i; > type=i % 2; > aaa->Fill(); > BBB->Fill(); > } > cout<<"I expect `aaa' and `BBB' to be identical now:"<<endl; > cout<<" aaa->GetEntries()="<< aaa->GetEntries(); > cout<<" BBB->GetEntries()="<< BBB->GetEntries() > cout<<endl; > for (i = 0; i < 10; i++) { > aaa->GetEntry(i); > cout<<" aaa"<<" x["<<i<<"]="<<x<<" type["<<i<<"]="<<type; > BBB->GetEntry(i); > cout<<" BBB"<<" x["<<i<<"]="<<x<<" type["<<i<<"]="<<type; > cout<<endl; > } > } -- +-----------------------------------------------------------\|/---+ | Christophe DELAERE office: e253 !o o! | | UCL - FYNU phone : 32-(0)10-473234 ! i ! | | chemin du cyclotron, 2 fax : 32-(0)10-452183 `-' | | 1348 Louvain-la-Neuve BELGIUM e-mail: delaere@fynu.ucl.ac.be | +-----------------------------------------------------------------+
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET