Hi Giacomo, The list of TGraph is only generated with option "cont". See some comments in the relevant part of your code below Rene Brun onetwojet_rateI.Draw("CONT List"); //must be option "cont" not "cont1" c2->Update(); //to force the effective painting TObjArray *contours = (TObjArray*)gROOT->GetListOfSpecials()->FindObject("contours"); Int_t ncontours =contours->GetSize(); printf("%d \n",ncontours); //for (Int_t i=0; i<ncontours;i++) { TList *list = (TList *)(contours->At(8)); //some contours may have 0 TGraph printf("%d \n",list->GetSize()); TGraph *gr111 = (TGraph *)list->First(); printf("%d \n",gr111->GetFillColor()); On Tue, 6 Aug 2002, Giacomo Bruno wrote: > > On Mon, 5 Aug 2002, Rene Brun wrote: > > > Could you send me evidence that the option (cont List) returning > > a list of TGraphs does not work (C++ macro and a Root file)? > > > Hi Rene, > sorry for the late answer, but my delay was due to some changement of > behaviour I have observed as I was preparing the macro and the root file > for you to check. > > You can find the macro and the root file under > > /afs/cern.ch/user/g/gbruno/public/For_Rene/ > > Part of the problems (unpredictable behaviour) have disappeared as soon as > I got rid of a library that I used to load at the beginning of the macro, > but that I was not actually using to make that particular contour plot. > This library had > been compiled separately with the compiler used by the reconstruction > program ORCA of CMS (gcc 2.95.2). I have not understood yet why this > caused problems but I guess it could be linked to some conflict > since in the library I was using the class TObjArray. > > However after removing the load of this library I have still error > messages. > Actually I have now realized (after restarting root from > scratch), that the error occurs at different lines according to the past > of the root session. > > The last error I get is > > Error: illegal pointer to class object contours 0x0 219 FILE:Rene.C > LINE:95 > > Before restarting root, this line was not giving any problem. Instead I > could not get access to contour 9 , the last of the 10 I set. The other > contours seemed to be ok. > The error was > > Error: illegal pointer to class object contours 0x0 219 FILE:Rene.C > LINE:101 > *** Interpreter error recovered *** > > > I hope you will be able to help me > > cheers > Giacomo > > > > > > > > Rene Brun > > > > On Mon, 5 Aug 2002, Giacomo Bruno wrote: > > > > > > > > Hi > > > I would like to draw a 2-d histogram in contour format showing the levels > > > with lines of different colours. I get the lines as expected, but then I > > > would also like to draw a legend. > > > To this aim I need to retrieve in some way the colours id > > > of the lines. On the user's guide 3.02 at page 42 it is explained how to > > > access the TGraph objects that are created when drawing a contour plot, however when I > > > tried it everything happened (sometimes crashes, sometimes wrong results and > > > almost always running the same code gave different results). I was then obliged to > > > guess the colours and set them by hand. Does anyone have an idea on how to > > > solve this problem? > > > Thanks in advance > > > > > > cheers > > > Giacomo > > > > > > > > > > > > ----------------------------------------- > > > | Giacomo BRUNO | > > > | | > > > | CERN | > > > | EP Division | > > > | | > > > | mail: 40-2-B20 | > > > | C.E.R.N. | > > > | CH - 1211 Geneva 23 | > > > | Switzerland | > > > | e-mail: Giacomo.Bruno@cern.ch | > > > | phone: +41 22 76 71624 | > > > ----------------------------------------- > > > > > > > > > > > > > > > ----------------------------------------- > | Giacomo BRUNO | > | | > | CERN | > | EP Division | > | | > | mail: 40-2-B20 | > | C.E.R.N. | > | CH - 1211 Geneva 23 | > | Switzerland | > | e-mail: Giacomo.Bruno@cern.ch | > | phone: +41 22 76 71624 | > ----------------------------------------- > > > >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:03 MET