Hi Dario, Move the TString definition out of the loop. This is a CINT problem that we are aware of. I have recoded your example (file dario.C below), such that you can run it with the interpreter or the compiler. You can try root > .x dario.C root > .x dario.C++ Rene Brun #include <vector> #include "TH1.h" void dario() { TH1::AddDirectory(kFALSE); vector <TH1F*> histVect; histVect.push_back( new TH1F("hist0", "title", 10, 0., 10. ) ); histVect.push_back( new TH1F("hist1", "title", 10, 0., 10. ) ); histVect.push_back( new TH1F("hist2", "title", 10, 0., 10. ) ); TString HistId; for (Int_t i = 3; i <= 10; i++) { HistId = "Hist" ; HistId += i ; cout << HistId.Data() << endl ; histVect.push_back( new TH1F(HistId.Data(), "title", 10, 0., 10. ) ); } } Dario Menasce wrote: > > Dear Rene > I got another one for you (by the way thanks for last reply). > The following rather simple script crashes with core dump (maybe I'm > dumb, but just in case...): > > (file is test.cc) > > { > #include <vector> > > vector <TH1F*> histVect; > > histVect.push_back( new TH1F("hist0", "title", 10, 0., 10. ) ); > histVect.push_back( new TH1F("hist1", "title", 10, 0., 10. ) ); > histVect.push_back( new TH1F("hist2", "title", 10, 0., 10. ) ); > > for (Int_t i = 3; i <= 10; i++) > { > TString HistId = "Hist" ; > HistId += i ; > cout << HistId.Data() << endl ; > histVect.push_back( new TH1F(HistId.Data(), "title", 10, 0., 10. ) ); > } > } > > Here's the traceback: > ******************************************* > * * > * W E L C O M E to R O O T * > * * > * Version 3.00/06 12 March 2001 * > * * > * You are welcome to visit our Web site * > * http://root.cern.ch * > * * > ******************************************* > > Compiled with thread support. > > CINT/ROOT C/C++ Interpreter version 5.14.79, Feb 24 2001 > Type ? for help. Commands must be C++ statements. > Enclose multiple statements between { }. > root [0] .x test.cc > Hist3 > Hist4 > > *** Break *** segmentation violation > Root > > > -- > +------------------------------------------------------------------------+ > | Dario Menasce, INFN Milano, via Celoria 16, Italy Tel: +39 02 58357322 > | > | > | > | WEB home page: http://sgimida.mi.infn.it/~menasce/home.html > | > | > | > | In a world without fences and walls, who needs Windows and Gates? > | > +------------------------------------------------------------------------+ > > -------------------------------------------------------------------------------- > > Name: Dario.Menasce.vcf > Dario.Menasce.vcf Type: VCard (text/x-vcard) > Encoding: 7bit > Description: Card for Dario Menasce
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:03 MET