Dear Rooters, I writed a simple macro below which takes a TH1F *resb in a file toto.root, made a x-axis translation of resb and put it in a TH1F *resa I want to draw all resa in the same canvas When i run this macro, it is like the "SAME" option is unconsidered. So, what do i wrong? Thanks. Lionel NEUKERMANS. { gROOT->Reset(); TFile *toto = new TFile("toto.root","read"); toto->cd(); c1 = new TCanvas("c1","c1",5,5,500,500); c1->Draw(); c1->Update(); char *text; text = (char*) calloc (100,sizeof(char)); Float_t resval; TH1F *resa, *resb; resa = new TH1F("resa","resa",150,0.,150.); resa->Draw(); Int_t ieta; Int_t ibin, itime; for(ieta=32;ieta<44;ieta++) { sprintf(text,"h%d",ieta); resb = (TH1F*) toto->Get(text); printf("lay=%d phi=%d eta=%d ",ilay,iphi,ieta); for(ibin=0;ibin<125;ibin++) { itime = ibin-eta; if(itime<0) resval=0.; else { resval = resb->GetBinContent(ibin); resa->SetBinContent(itime+1,resval); } } resa->Draw("SAME"); c1->Update(); } free(text); }
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:24 MET