Hi, I have 1D histos stored in a .root files and I would like to plot them in different pads within a canvas. I manage to do so (see how in the following lines). I am running into trouble when I want to modify the pads properties. I would like to set xlogscale and ylogscale for each pad and modify the xaxislabelsize but cannot manage to obtain the pads pointers. I have been trying using the GetSelected() method but it revealed unsuccessfull leading to the following error message in cint: "Error: illegal pointer to class object tmpcan 0x0 331 FILE:multiview.C LINE:40 *** Interpreter error recovered ***" I saw GetSelcted() returns a TVirtualPad , I did not understand the goal of this class, is there a way to convert such an object into a standard TPad ? If you have any idea how I could sort out this I would be thankfull. _______________________________________________ { /* multiview.C*/ int entires; NB_MAX_HIST0 = 25; int index = 0; int i; TH1F * h1_array[25]; /*executable statements*/ TIter nextkey( f->GetListOfKeys() ); TKey * key; printf("Max number of histo : %d\n",25); while ( (key = (TKey*)nextkey()) && (index < 25)) {/*store histos in an array*/ h1_array[index] = (TH1F*)key->ReadObj(); index ++; } /*set the number of pads*/ nb_x = (int)sqrt(index); nb_y = (int)sqrt(index); printf("nb_x * nb_y = %d \n",nb_x*nb_y); if ((nb_x * nb_y) < index) {nb_y+=1;}; printf("nb_x * nb_y = %d \n",nb_x*nb_y); if ((nb_x * nb_y) < index) {nb_x+=1;}; printf("Creating a %d * %d pad\n",nb_x,nb_y); TCanvas * can = new TCanvas("can","canvas"); can->Divide(nb_x,nb_y); /*draw stuff in different pads*/ for (i=1;i<=index;i++) { TPad * tmpcan = new TPad(); can->cd(i); //tmpcan=(TPad*)can->GetSelected(); //tmpcan->SetLogx(); h1_array[i-1]->Draw(); delete tmpcan; } printf("Read %d histos\n",index); printf("Exiting \n"); /*end of program*/ } _____________________________________________ -- , , / \ ((__-^^-,-^^-__)) `-_---' `---_-' `--|o` 'o|--' \ ` / ): :( :o_o: "-" http://www.gnu.org
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:53 MET