Dear Rooters, I'm having problems with filling of TH1F. I'm working on an application in which a bunch of histograms are declared as 'pointer to array'. Before, I used v. 2.23/12 and it worked without any problems; now, however I have upgraded to version 3.00/06 and then when I run the program it crashes (seg. violation). It turns out that the crash occurs when a Fill() call is done and it is an over- or under flow that is to be filled. The following test program illustrates the problem: //////////////////////////////// int main() { TROOT litta("try","try "); TH1F simp; TH1F * pMult_=NULL; char hname[100], htitle[100]; pMult_ = new TH1F[2]; for( Int_t i = 0; i < 2; i++) { sprintf( hname, "pMult_%d", i); sprintf( htitle, "pointer to Mult %d", i); TH1F * pDum = new TH1F(hname, htitle, 11, -0.5, 10.5); pMult_[i] = *pDum; delete pDum; } simp = TH1F("simp","simp", 11, -0.5, 10.5); for(Int_t i = 0; i < 13; i++) { pMult_[0].Fill(i); pMult_[1].Fill(i); } delete [] pMult_; return 0; } ///////////////////////////// If I compile this (with the --new option sent to root-config (as I'm using a TMapFile in my application)) and then run it, the Fill() call with under- or overflow will crash (seg violation) the program. I can get the small test program to work if I do one of the following: *compile WITHOUT (sic) -- new flag *just run as a macro *use v. 2.23/12 *remove the non-pointer-TH1F simp *change the number of bins to say <11 or > 12 !!! So, I'm a bit confused about this behavior... of course I could re-declare all my histograms but that's not fun and I do like to know what I'm doing wrong. So if anyone has a clue I would very much appreciate being enlightened. Best Regards, Martin P.S. I use RH 6.1 on a SMP i686 (two processors) and with egcs-1.1.2 -- Martin Karlsson Department of Nuclear Physics, University of Lund Box 118, SE-221 00 Lund, Sweden Phone: +46 (0)46 222 96 77 or +46 (0)736 87 84 15 Fax: +46 (0)46 222 76 29
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:44 MET