[ROOT] Tree Problem

From: Paolo ADRAGNA (paolo.adragna@pi.infn.it)
Date: Tue Jun 10 2003 - 17:15:15 MEST


Hi everyone,

I found out a very strange problem with my program.

I created this simple class:

/***************************************************************************
                          TC_BeamTDCData.h  -  description
                             -------------------
    begin                : Sat Mar 29 2003
    copyright            : (C) 2003 by Paolo ADRAGNA
    email                : paolo.adragna@pi.infn.it
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef TC_BEAMTDCDATA_H
#define TC_BEAMTDCDATA_H

#include <algorithm>
#include <iostream>
#include <vector>

#include <TObject.h>

#include "TC_Calibration.h"

class TC_BeamTDCData : public TObject
{

 private:

  Float_t Xcha1;
  Float_t Ycha1;
  
  Float_t Xcha2;
  Float_t Ycha2;

  Float_t Ximp;
  Float_t Yimp;

  std::vector<int> tdc1;
  std::vector<int> tdc2;
  
  const TC_Calibration beam;
    
 public:

  TC_BeamTDCData(void);
  virtual ~TC_BeamTDCData(void);
  
  void Reset();
  void Decode(int size, unsigned long *data);
  void Print();
  
  Float_t GetXcha1();
  Float_t GetYcha1();
  Float_t GetXcha2();
  Float_t GetYcha2();

  ClassDef(TC_BeamTDCData,1)

};

#endif

Then I create a TTree and a TBranch with 

tree->Branch("BeamTDC", "TC_BeamTDCData", &fBeamTDCData, 32000, 3);

where we have  TC_BeamTDCData* fBeamTDCData.

When I fill the tree (with a loop, one entry for every event) I am sure that 
fBeamTDCData is not empty: all the data members have the right expected value 
(I checked with a Print() method).
But if I try

tree->Scan("Xcha1:Ycha1:Xcha2:Ycha2:Ximp:Yimp","","", 6, 0)

for example, I find that only Ximp and Yimp have the correct values. As far as 
the other variable, only the first entry is correct; from the second on all 
the values seems to b meaningless, surely different from the printed ones, 
and frequently also equal among them. Here an example:

************************************************************************************
*  Row * Xcha1 *     Ycha1 *     Xcha2 *     Ycha2 *      Ximp *       Yimp *
************************************************************************************
*  0 * -0.938000 * -1.289999 * -0.936900 * -1.289999 * -0.936623 *-1.289999 
*  1 * 6.5722312 * 6.5722312 * 6.5722312 * 6.5722312 * 3.0130693 * 2.3270983 
*  2 * 6.5722312 * 6.5722312 * 6.5722312 * 6.5722312 *  2.486444 * 2.2331476 *
*  3 * 6.5722312 * 6.5722312 * 6.5722312 * 6.5722312 * 1.6526198 * 1.5285182 *
*  4 * 6.5722312 * 6.5722312 * 6.5722312 * 6.5722312 * 1.9159326 * 3.6893818 *
************************************************************************************

Any idea on this strange behaviour? I use the Version  3.05/04  21 April 2003 
on gcc 2.95.2

Ciao,
				Paolo Adragna



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET