update a TNtuple

From: S.J.M. Peeters (Simon.Peeters@cern.ch)
Date: Mon Dec 14 1998 - 22:20:49 MET


Dear ROOT'ers,

I'm trying to read in a pile of ascii files (a mess, but unavoidable) and
put an abstract of information of all these file in an Ntuple so that I
can produce the nice plots I'm looking for. Unfortunately my code seems to
work fine, untill I read in my ntuple to produce the plots:
root [0] a = new TBrowser()
(class TBrowser*)0x0
root [1] mmuzip: error during decompression
mmuzip: error in header

 *** Break *** segmentation violation

I see two ntuple cycles in my file and the above happens when I'm trying
to look into it one of them.

The essential bit of code is (which gets called for each ascii file to be 
read):

      static bool new_file = true;
      TFile *output = new TFile(m_outputfile.String(),"NEW","outputfile");
      TNtuple *threshold;

      if (output->IsOpen())
      {
	 new_file = false;
	 threshold = new TNtuple("threshold","abcdaq data","FE_bias:FE_shaper:" 
                              "channel:threshold:nr_of_hits:nr_of_events");
      }
      else
      {
	 TFile *output = new TFile(m_outputfile.String(),
				   "UPDATE","outputfile");	 
	 threshold = (TNtuple*)output->Get("threshold");
      }

      // loop over data
      TMapIter next_key(m_y_values);
      sjmp::TObjInt *key;
      while (key = (sjmp::TObjInt*)next_key())
      {
	 TObjArray *y_values = (TObjArray*)m_y_values->GetValue(key);
	 TIter next_x_value(m_x_values);
	 TIter next_y_value(y_values);
	 TIter next_n_value(m_number_of_events);
	 sjmp::TObjFloat *x_obj;
	 sjmp::TObjInt   *y_obj;
	 sjmp::TObjInt   *n_obj;
	 while ( ( x_obj = (sjmp::TObjFloat*)next_x_value() ) &&
		 ( y_obj = (sjmp::TObjInt*)  next_y_value() ) &&
		 ( n_obj = (sjmp::TObjInt*)  next_n_value() )  )
	 {
	    threshold->Fill(m_FE_Bias,m_FE_Shaper,key->GetInt(),
                       x_obj->GetFloat(),y_obj->GetInt(),n_obj->GetInt());
	 }
      }
      threshold->Write();
      output->Close(); 

I hope someone can tell me want went wrong!

Simon Peeters
--
    NIKHEF, National Institute for Nuclear and High Energy Physics
    Kruislaan 409, office H-044 Tel:(+31-20-592) 5140
    P.O. Box 41882, 1009 DB Amsterdam (NL) Fax:(+31-20-592) 5155
    CERN, building 40, office 2-D06 Tel:(+41-22-76) 71157



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:41 MET