Hello Rooters, I would like to write small Event Display, but cannot solve some problems. I spent a lot of time, but results are small. Firstly, I don't know how create 3-dim scaterplot: x,y - position and dE - height (lego). In my below programme I find only how histogramm x and y from ntuples, but I need lego of dE on z-axis and not lego event number. I don't know also how link this scatterplot with predefined axis. Should h1 and h2 histos be 2 or 3 - dimensional? 3-dim histo still have failed me. Next problem is how clear ntuples for next event display. I have event loop by j and I want to display event by event untill 5. Could you explain my problems? Thank you very,very much Tadeusz Pytlos { ////////////////////////////////////////////////////////// // This file has been automatically generated // (Mon Nov 24 12:46:19 1997 by ROOT version 1.03/07) // from TTree kas/DATA // found on file: dst00459.root ////////////////////////////////////////////////////////// //Reset ROOT and connect tree file gROOT->Reset(); kret=new TCanvas("kret","Test",0,0,500,700); kret->SetFillColor(10); pad1 = new TPad("pad1","The Array1",0.05,0.50,0.95,0.95,10); pad2 = new TPad("pad2","The Array2",0.05,0.05,0.95,0.50,10); pad1->Draw(); pad2->Draw(); TChain kas("h10"); kas.Add("data.root"); //Declaration of leaves types .................. //Set branch addresses .................. // This is the loop skeleton // To read only selected branches, Insert statements like: kas->SetBranchStatus("*",1); // able all branches FILE *fp1 = fopen("posall.det","r"); FILE *fp2 = fopen("posarr.det","r"); TH2F *h1 = new TH2F("h1","ARRAY",16,-100,100,16,-100,100); TH2F *h2 = new TH2F("h2","TRIGGERPLANE",19,-9.1,9.1,24,-2.23,12.89); nt1 = new TNtuple("nt1","ARRAY","x:y:dE"); nt2 = new TNtuple("nt2","TRIGGERPLANE","x:y:dE"); Int_t nentries = kas->GetEntries(); Double_t pi=3.14159; Int_t n=0,nr,nbytes = 0,ans; Int_t quarter1[]={3,6,9,12}; Int_t quarter2[]={7,11,13,14}; Int_t quarter3[]={15}; Float_t x,y,dE,d,xd[648],yd[648],xd1[252],yd1[252]; Double_t xy,xi,yi; Int_t ncols1,ncols2,it1,it2,qua; gBenchmark->Start("dep"); ..................calculation...................... for (Int_t j=0; j<5;j++) { nbytes += kas->GetEvent(j); .................................................... for (Int_t i=0; i<nm;i++) { ................................................... x=xd[ik1]; y=yd[ik1]; dE=vhm[i]*cos(ze[2]); nt1->Fill(x,y,dE); } for (Int_t i=0; i<nt;i++) { ................................................... x=xd[it2]; y=yd[it2]; dE=vht[i]*cos(ze[2]); nt2->Fill(x,y,dE); } pad1->cd(); pad1->SetGrid(); pad1->GetFrame()->SetFillColor(42); pad1->GetFrame()->SetBorderMode(-1); pad1->GetFrame()->SetBorderSize(5); h1.SetLineWidth(2); h1.SetXTitle("E"); h1.SetYTitle("N"); nt1.Draw("x:y>>h1"); h1.Draw("LEGO"); pad2->cd(); pad2->SetGrid(); pad2->GetFrame()->SetFillColor(42); pad2->GetFrame()->SetBorderMode(-1); pad2->GetFrame()->SetBorderSize(5); h2.SetLineWidth(2); h2.SetXTitle("E"); h2.SetYTitle("N"); nt2.Draw("x:y>>h2); h2.Draw("LEGO"); ans=getchar(); } gBenchmark->Show("dep"); fclose(fp1); fclose(fp2); kret->cd(); } -- Tadeusz Pytlos mailto:pytlos@fizwe5.fic.uni.lodz.pl Lodz, Poland
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:30 MET