Hello, /* I wrote ths message before digging into the rootalk digest. I found a message that might be an answer : http://root.cern.ch/root/roottalk/roottalk98/1293.html (2D/3D array classes Masaharu Goto (MXJ02154@nifty.ne.jp) Sun, 19 Jul 1998 21:37:00 +0900) Another might refer to a related problem : http://root.cern.ch/root/roottalk/roottalk98/1295.html Just tell me if this 2D/3D class is what I need in this case, and if there's anything new to add. */ ( * Version 2.22/10 28 July 1999 * ) ( on a DEC Alpha OSF1 ) I have this macro in a file called tototest.C TH1F *B_sect_r [12][3]; void sub_n_print_hist1(TH1F *sector[][]); tototest() { B_sect_r[5][2] = new TH1F("stuff","stuff",200,-10,130); B_sect_r [5][2] ->Fill(20); B_sect_r[5][2]->Draw(); c1->Modified(); c1->Update(); sub_n_print_hist1(B_sect_r); } void sub_n_print_hist1(TH1F *sector[][]) { sector[5][2]->Draw(); c1->Modified(); c1->Update(); } If I do : root [3] .L prvtest.C root [4] .b tototest root [5] tototest() [...] 19 sub_n_print_hist1(B_sect_r); FILE:prvtest.C LINE:19 cint> Error: No symbol sub_n_print_hist1(B_sect_r) in current scope FILE:/tmp_mnt/home/patois/work/root/rootscripts/./prvtest.C LINE:19 Possible candidates are... filename line:size busy function type and name /tmp_mnt/home/patois/work/root/rootscripts/./prvtest.C 24:7 0 public: void sub_n_print_hist1(TH1F***sector); <<<<<<< I can have it work if I declare sub_n_print_hist1 as taking a TH1F** instead of a TH1F***: [...] void sub_n_print_hist1(TH1F sector[][]) { sector[5][2].Draw(); [...] This would be the first question... Obviously B_sect_r is declared as a 2d array of pointer to TH1F, why then should I refence it as a 2d array of TH1F when calling a subroutine? CINT seems somethimes not to care too much about the way I call a member of a class, often, foo->Function() has the same effect as foo.Function(). Is there any clear rules for that? My second question is that the modification doesnt work : 27 sector[5][2].Draw(); FILE:prvtest.C LINE:27 cint> *** Break *** floating point exception Could someone explain me what I didnt understand about the way CINT work? thanx. Yannick PS: btw how to reset root after this kind of crash ? I often get things like this when loading a new version of a macro after it crashed : root [12] .L prvtest.C Function sub_n_print_hist1() busy. loaded after "/tmp_mnt/home/patois/work/root/rootscripts/./prvtest.C" I only know .q and start again... I'm sure there's something better ? _/ Yannick Patois _________________ Address (home) __________________ | irc(undernet): Garp on #france25+ | La Villa des Sciences | | email : patois@ganil.fr | 12, avenue de Cambridge | | web :http://www.sura.org/~patois/ | 14200 Herouville-Saint-Clair | | Tel(home) :+33 (0)2 31 94 50 32 | FRANCE | |___________________________________|__________________________________|
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:40 MET