Reading binary string from TTree

Dear All,

I have a text file of two columns, one is has a double and one has a string of 512 bits (0/1).
I would like to make a TTree of this and then read the string bit by bit. So what I do is the following:

TTree aa;
aa.ReadFile("file.txt");
Double_t nHits;
Char_t dataString;

aa.SetBranchAddress("nHits",&nHits);
aa.SetBranchAddress("dataString",&dataString);

aa.GetEntry(0);
TString s(dataString);

s[4];

So with the last line I ask for the 4th bit in the string, but it returns an error statement that says that the string has a length of only 1.

What should I do in order to get all 512 bits?

Thanks in advance,

Nikkie

Hi,

Shouldn’t dataString be of type Char_t* ?

Cheers, Axel.

Dear Axel,

Thanks for the reply. I’ve tried but nothing seems to work. So I’ve made a different code that reads the file and then fills a tree.

Now I have a different problem, I get only zeros in the tree and I don’t know why. My code looks like this:

// The tree and its branches
TTree *tree;
Int_t Event, thresh, nHits;
Int_t dataBits[nChannels];

void initializeTree() {

  tree = new TTree("eventTree","Tree with data of a step in the signal scan for a metal");
  tree->Branch("Event",&Event,"Event/I");
  tree->Branch("thresh",&thresh,"thresh/I");
  tree->Branch("nHits",&nHits,"nHits/I");
  tree->Branch("dataBits",&dataBits[0],Form("dataBits[%d]/I", nChannels));

}//end void initializeTree

void treeFiller (string metal, int Vcth, unsigned int nEvents) {

  string dataFileName = "/home/xtaldaq/Ph2_ACF/SignalScan/Data_" + metal + "_" + int2str(Vcth) + ".txt";
  ifstream dataFile (dataFileName.c_str());

  unsigned int iEvent = 0;
	string entry = "";

  while ( dataFile >> entry ) {

		// First entry is the event number
		Event = str2int(entry);
		// Second entry is the threshold
		dataFile >> entry;
		thresh = str2int(entry);
		//Third entry is the amount of hits for this threshold
		dataFile >> entry;
		nHits = str2int(entry);
		//Fourth entry is the data bit string which will be pushed back into a vector
		dataFile >> entry;
		for (unsigned int strip=0; strip<entry.length(); strip++) {
			if((entry[strip]=='1')) dataBits[strip] = 1;
			else dataBits[strip] = 0;
		}//end for strip

    // Now we want to fill the TTree with these values
    tree->Fill();

    // Process nEvents at most
    if (++iEvent>=nEvents) break;
    if (iEvent%10000==0) cout << "." << flush;
    
  }//end while entry
  dataFile.close();

}//end void treeFiller

int macro (unsigned int maxEvents=100) {
  
	string treeFileName = Form("TreeScan_%d.root", maxEvents);
  TFile* treeFile = new TFile(treeFileName.c_str(),"recreate");
  initializeTree();
  tree->Write();
  treeFile->Close();

  treeFile = new TFile(treeFileName.c_str(), "update");
  tree = (TTree*)treeFile->Get("eventTree");
  
	for (int iThresh=0; iThresh<nThresholds; ++iThresh) {

    cout << "Theshold " << Vcths[iThresh] << " " << flush;
    treeFiller("Sn", Vcths[iThresh], maxEvents); // to be looped on all thresholds instead
    cout << " done!" << endl;

  }//end for iThresh

  tree->Write("", TObject::kOverwrite); // save only the new version of the tree
  treeFile->Close();

  return 0;

}// end macro

What am I doing wrong?

Thanks in advance,

Nikkie

Hi Nikkie,

You seem to be missing the necessary call to SetBranchAddress after loading the TTree from the file open for update.

Cheers,
Philippe.

Hi Philippe,

Thanks for the quick reply.

I’ve added the SetBranchAddress according to you suggestion but it did not fix the problem. The tree is still filled with zeros only… The code looks like this now:

int macro (unsigned int maxEvents=100) {
  
  string treeFileName = Form("TreeScan_%d.root", maxEvents);
  TFile* treeFile = new TFile(treeFileName.c_str(),"recreate");
  initializeTree();
  tree->Write();
  treeFile->Close();

  treeFile = new TFile(treeFileName.c_str(), "update");
  tree = (TTree*)treeFile->Get("eventTree");
	tree->SetBranchAddress("Event",&Event);
	tree->SetBranchAddress("thresh",&thresh);
	tree->SetBranchAddress("nHits",&nHits);
	tree->SetBranchAddress("dataBits",dataBits);
  
	for (int iThresh=0; iThresh<nThresholds; ++iThresh) {

    cout << "Theshold " << Vcths[iThresh] << " " << flush;
    treeFiller("Sn", Vcths[iThresh], maxEvents); // to be looped on all thresholds instead
    cout << " done!" << endl;

  }//end for iThresh

  tree->Write("", TObject::kOverwrite); // save only the new version of the tree
  treeFile->Close();

  return 0;

}// end macro

Humm… odd… what does tree->Scan("") says on the end result file?

Philippe.

Scan() results in the following:

***********************************************************************
*    Row   * Instance *     Event *    thresh *     nHits *  dataBits *
***********************************************************************
*        0 *        0 *         0 *         0 *         0 *         0 *
*        0 *        1 *         0 *         0 *         0 *         0 *
*        0 *        2 *         0 *         0 *         0 *         0 *
*        0 *        3 *         0 *         0 *         0 *         0 *
*        0 *        4 *         0 *         0 *         0 *         0 *
*        0 *        5 *         0 *         0 *         0 *         0 *
*        0 *        6 *         0 *         0 *         0 *         0 *
*        0 *        7 *         0 *         0 *         0 *         0 *
*        0 *        8 *         0 *         0 *         0 *         0 *
*        0 *        9 *         0 *         0 *         0 *         0 *
*        0 *       10 *         0 *         0 *         0 *         0 *
*        0 *       11 *         0 *         0 *         0 *         0 *
*        0 *       12 *         0 *         0 *         0 *         0 *
*        0 *       13 *         0 *         0 *         0 *         0 *
*        0 *       14 *         0 *         0 *         0 *         0 *
*        0 *       15 *         0 *         0 *         0 *         0 *
*        0 *       16 *         0 *         0 *         0 *         0 *
*        0 *       17 *         0 *         0 *         0 *         0 *
*        0 *       18 *         0 *         0 *         0 *         0 *
*        0 *       19 *         0 *         0 *         0 *         0 *
*        0 *       20 *         0 *         0 *         0 *         0 *
*        0 *       21 *         0 *         0 *         0 *         0 *
*        0 *       22 *         0 *         0 *         0 *         0 *
*        0 *       23 *         0 *         0 *         0 *         0 *

So for each dataBit there is an instance but the values for each branch are always zero.

Thanks a lot!

Nikkie

Can you send me also one of the input file so that I can reproduce the issue?

Thanks,
Philippe.

Of course, thanks so much!

It looks like this, and I would call this file Data_Sn_116.txt. Only my files are 2.6G…

Cheers,

Nikkie

1 116 22 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000011000000001000000000000010000100000000000010000000000000001000010000000000000000000000000001000000001000000000001000000000000000000010000000010000000000000000111000000010100000000000000000000000100000000010000000000000000000000000000000000000000000000010
2 116 25 0000000010000010000000000000001000000000001000000000000000100000000011000000000001001000100000000000000000000000000000000000100000000000001000001000000000000000000010000000000000000000000000000000000000000000000000000000000000010000000000000000000010000011000000000000000000000000000000000000001000000000000000000000000000000010000000000000000000000000000000000000000000000000100000100000000000000000000000100000000000000000000000000000000000000000000000000000000110000000000000000000000000000000000000000000
3 116 38 0000000010001000000000010100101011001000000010000010000000000010000000000000001000000000100000001000100000000000000000000000000000000000000000000000000100000010000000000010000000100100000000000000000000000000000000100000000000000000001000000001000000000011100000000000000000000000000000000000000000100010001000000000000000000000001000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000001000100010000000000000000000100000000000000000000000000000000100000010000000
4 116 19 0000000000000000000100000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000010000000000000100000000000000000000000000000000000001000000010000000000000010000000000000000000000010000000010010000000000000000000000000000000000000000000000000000000000100000000000000000000000100000000001000000000000000000001010000000000000000000000000000000000000000000000000000000000000000000000000000000000100000010000010000000000
5 116 43 0100000000000101000000000000000001000000000000000000000000000000000101100000010001001100000000000100000000000100010100010000001000000010000100000001010000011000000100000001001001000000000000000000000001010000010100000100000000010010000000000001010000011100000000000000000000000000000000000001000000000000000000000000000000000000000000000000000100000000000000000000000000000000010000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000
6 116 44 0001000110000010000001000011010010000000001111001000000000100010000100000000000000000000000010100000000010100010000000000000001001000000000000101000010000001000010010000001000000000000000000000000100000000010110000000000000100000010000000000010000010000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000001000001000000000000000000000000000000000000000000000000000000000000000
7 116 23 0000000000001000000000000000000000000010000001001001000000100000000000010000001000000000000010000000000000000000000000000000000000001100000000000000000000000000000001000000000000000000000000000000001000000010000000000000000000000000000000000000000000000001000000000000000000000000010000000000000000000000000000000000001000000000000100000010000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000001000000100000000000000000000000000000000000000000000010000000000000000000000
8 116 53 0000001000000000000000110100000000000010100100001100001010000010010100000100000001000010000000001011000000100110010001100000100010001010000000110000001000000000100011001000000000000000001000000000000000000000101000000100000000100000000000001000000000000010000000000000001000000000000000000000000000000000000000000000000000000010000000000000000001000000000000000100000000000000000000001000000000000000100010000000000000000000000000000000000000000000000000000000100000000000000000000010000000000000000000000000
9 116 88 0000010000000001000000000000000100000100000000110010000000100000000000010000000100001000000000000000000000000000000000000000000000000000000100000000000000001100000000000100000000000000000000000000000000000000001000000000000000000000000000000000000000000011100010010000110000000000000010100110000000000000000001000100011001000100011000000000000001000001000000001110000100000010000100001001100000000001100110001011000001000010110111000001010101110000100100100100000001100000001100101001000011110001001001100111
10 116 114 1010011100000010001000100001000000100000011100100110000110100111110010111100000000110010100100100101110000111100110010011001001001000100110001010000000111100010001101100011110110000110000011011000010111001000011001011010000010110111111000000001110000111000010000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000011000000000000000000000000000000000000000000000000010000000000000000000000000000000000011000010000000000000010000000000000000000000000100000000010000
11 116 33 1001000000000000000000000100000000000000000000010010100000000010000000000000001000000000000000000000000000100000000000000001000010000100000010001000000000000010100001000000100001000100000010000000100000010000000101000100010000000011000000000000000010010100000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
12 116 29 1000000000000000000000010000010000000000000000000000000010000100010000000000010000000000100100000000000000000011000000000000000000000000000000000010010000010100010000011000011000000000000001000000000000000001000000010010000000000000000000000000000000000100000000000000010000000000000000000100000000000000000000000000001000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
13 116 41 0000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011110010001000000000000000000000000010001000000000100010000000100000000010100000000110100010001000000000000000001010000000001000000001001000100010001010000000001000000010000000000000000000100000000010000000101000000000000000000000000000100010100000100111
14 116 27 0000000010000000000000000000000000000010000000000000000000010000000000000010000000000000000000100000100000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000001000000000000010001000100000000000001000000000000000001000000100100000000000000000000010000010001000000000000001000000000010000000000001000000000010000010000000000000000010000000000000001000
15 116 211 1111111111111011111111011111011111111111111110111111111111101111110111111111111111111111111111111111110110111111111111111111111001111111111011111111111111111011111111111111010111101000000000000000000000000000000000111111111111110111111111111111111111111111000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000001000000100000000000000000000000000000000000000000000000000000000000000000000000000000
16 116 73 1110110100011001000000010000000000000000000100000000000100000000100100011000010000010000000010010001000001001100010100010110000001100100100000110000010001000000001001000001000100000101011000000101000011010000000100010110000000011001000000001001000011100100000100000000000000010000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000010000000000000000000000000000000000000000000100000000000000001000000000000000000000000000000000000000000000000010001000000000100000000001000
17 116 23 0000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011100010000000000010000010000000000000000010000000001000000000000000000010000000000010000000000010000000000000000000010000001000000010000000000000000000000000000000101000000000000000000000100000000010000000100000000010000000000010000000000000000010000000

This is the whole code:

[code]#include
#include
#include
#include
#include “TFile.h”
#include “TTree.h”
#include “TH1.h”
#include “TH1F.h”

using namespace std;

// Constant parameters
double pitch = 90.0; // um
double length = 5.0; // cm
double cRate = 40.0; // MHz
const unsigned int nStrips = 254; // Number of strips for a sensor
const unsigned int nChannels = nStrips*2;
const int nThresholds = 32; // number of points for a scan
int Vcths[nThresholds] = {89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120};

// The tree and its branches
TTree *tree;
Int_t Event, thresh, nHits;
Int_t dataBits[nChannels];

// could use to_string in C++11
string int2str (int number) {

stringstream ss;
ss << number;
return ss.str();

}//end int str2int

int str2int (string str) {

string myString = str;
istringstream buffer(myString);
int value;
buffer >> value;
return value;

}//end double str2doub

// could use atof() instead (#include )
double str2doub (string str) {

string myString = str;
istringstream buffer(myString);
double value;
buffer >> value;
return value;

}//end double str2doub

void initializeTree() {

tree = new TTree(“eventTree”,“Tree with data of a step in the signal scan for a metal”);
tree->Branch(“Event”,&Event,“Event/I”);
tree->Branch(“thresh”,&thresh,“thresh/I”);
tree->Branch(“nHits”,&nHits,“nHits/I”);
tree->Branch(“dataBits”,dataBits,Form(“dataBits[%d]/I”, nChannels));

}//end void initializeTree

void treeFiller (string metal, int Vcth, unsigned int nEvents) {

string dataFileName = “/home/xtaldaq/Ph2_ACF/SignalScan/Data_” + metal + “_” + int2str(Vcth) + “.txt”;
ifstream dataFile (dataFileName.c_str());

unsigned int iEvent = 0;
string entry = “”;

while ( dataFile >> entry ) {

	// First entry is the event number
	Event = str2int(entry);
	// Second entry is the threshold
	dataFile >> entry;
	thresh = str2int(entry);
	//Third entry is the amount of hits for this threshold
	dataFile >> entry;
	nHits = str2int(entry);
	//Fourth entry is the data bit string which will be pushed back into a vector
	dataFile >> entry;
	for (unsigned int strip=0; strip<entry.length(); strip++) {
		if((entry[strip]=='1')) dataBits[strip] = 1;
		else dataBits[strip] = 0;
	}//end for strip

// Now we want to fill the TTree with these values
tree->Fill();

// Process nEvents at most
if (++iEvent>=nEvents) break;
if (iEvent%10000==0) cout << "." << flush;

}//end while entry
dataFile.close();

}//end void treeFiller

int macro (unsigned int maxEvents=100) {

string treeFileName = Form("TreeScan_%d.root", maxEvents);

TFile* treeFile = new TFile(treeFileName.c_str(),“recreate”);
initializeTree();
tree->Write();
treeFile->Close();

treeFile = new TFile(treeFileName.c_str(), “update”);
tree = (TTree*)treeFile->Get(“eventTree”);
tree->SetBranchAddress(“Event”,&Event);
tree->SetBranchAddress(“thresh”,&thresh);
tree->SetBranchAddress(“nHits”,&nHits);
tree->SetBranchAddress(“dataBits”,dataBits);

for (int iThresh=0; iThresh<nThresholds; ++iThresh) {

cout << "Theshold " << Vcths[iThresh] << " " << flush;
treeFiller("Sn", Vcths[iThresh], maxEvents); // to be looped on all thresholds instead
cout << " done!" << endl;

}//end for iThresh

tree->Write("", TObject::kOverwrite); // save only the new version of the tree
treeFile->Close();

return 0;

}// end macro[/code]

Hi,

I do not detect any problem. I tweak the macro:

[code]$ diff macro.orig macro.cxx
68c68,69
< string dataFileName = “/home/xtaldaq/Ph2_ACF/SignalScan/Data_” + metal + “_” + int2str(Vcth) + “.txt”;

//string dataFileName = “/home/xtaldaq/Ph2_ACF/SignalScan/Data_” + metal + “" + int2str(Vcth) + “.txt”;
string dataFileName = "./Data
” + metal + “_” + int2str(Vcth) + “.txt”;
126a128
tree->Scan("","","",1,10);
[/code]
and got

[code]…
Theshold 113 done!
Theshold 114 done!
Theshold 115 done!
Theshold 116 done!
Theshold 117 done!
Theshold 118 done!
Theshold 119 done!
Theshold 120 done!


  • Row * Instance * Event * thresh * nHits * dataBits *

  •   10 *        0 *        11 *       116 *        33 *         1 *
    
  •   10 *        1 *        11 *       116 *        33 *         0 *
    
  •   10 *        2 *        11 *       116 *        33 *         0 *
    
  •   10 *        3 *        11 *       116 *        33 *         1 *
    
  •   10 *        4 *        11 *       116 *        33 *         0 *
    
  •   10 *        5 *        11 *       116 *        33 *         0 *
    
  •   10 *        6 *        11 *       116 *        33 *         0 *
    
  •   10 *        7 *        11 *       116 *        33 *         0 *
    
  •   10 *        8 *        11 *       116 *        33 *         0 *
    
  •   10 *        9 *        11 *       116 *        33 *         0 *
    
  •   10 *       10 *        11 *       116 *        33 *         0 *
    
  •   10 *       11 *        11 *       116 *        33 *         0 *
    
  •   10 *       12 *        11 *       116 *        33 *         0 *
    
  •   10 *       13 *        11 *       116 *        33 *         0 *
    
  •   10 *       14 *        11 *       116 *        33 *         0 *
    
  •   10 *       15 *        11 *       116 *        33 *         0 *
    
  •   10 *       16 *        11 *       116 *        33 *         0 *
    
  •   10 *       17 *        11 *       116 *        33 *         0 *
    
  •   10 *       18 *        11 *       116 *        33 *         0 *
    
  •   10 *       19 *        11 *       116 *        33 *         0 *
    
  •   10 *       20 *        11 *       116 *        33 *         0 *
    
  •   10 *       21 *        11 *       116 *        33 *         0 *
    
  •   10 *       22 *        11 *       116 *        33 *         0 *
    
  •   10 *       23 *        11 *       116 *        33 *         0 *
    
  •   10 *       24 *        11 *       116 *        33 *         0 *
    

Type to continue or q to quit ==> q


[/code]

Which version of ROOT are you using?

Cheers,
Philippe.

Hi Philippe,

Thanks a lot!
I have root version 5.34/36.

Hi Nikkie,

It works equally well for me with v5. Does your simplified example fail for you? What is the output when you add the Scan I added? Did you check that the value are properly read from the text file (by adding print statement of the value before the TTree::Fill)?

Cheers,
Philippe.

Dear Philippe,

I transfered the data to another computer and there it works fine, just like with you. So I’m not sure what is wrong with the other computer but at least I have a tree now.

The funny thing is, that when I checked on the other computer, print statements would result the right values for the entries so I’m still not sure what is wrong there…

Thanks a lot for the help anyway!

Cheers,

Nikkie

Hi All,

I just wanted to post an update, this issue is solved.

Some of the lines in some of the files were not ok, so I build in some extra checks.
The code now looks like this and it works:

#include <sys/stat.h>
#include <iostream>
#include <string>
#include <sstream>
#include <fstream>
#include "TFile.h"
#include "TTree.h"

using namespace std;

double pitch = 90.0;    // um
double length = 5.0;    // cm
double cRate = 40.0;    // MHz
const unsigned int nStrips = 254;     // Number of strips for a sensor
const unsigned int nChannels = nStrips*2;
const int nThresholds = 32;  // number of points for a scan
int Vcths[nThresholds]   = {89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120};

// The tree and its branches
TTree *tree;
Int_t Event, thresh, nHits;
Int_t dataBits[nChannels];

bool fileExists (const char *fileName) {
  struct stat buffer;   
  return (stat (fileName, &buffer) == 0); 
}//end bool fileExists

void initializeTree() {
  tree = new TTree("eventTree","Tree with data of a step in the signal scan for a metal");
  tree->Branch("Event",&Event,"Event/I");
  tree->Branch("thresh",&thresh,"thresh/I");
  tree->Branch("nHits",&nHits,"nHits/I");
  tree->Branch("dataBits",dataBits,Form("dataBits[%d]/I", nChannels));
}//end void initializeTree()

void treeFiller (const char *metal, int Vcth, int nEvents) {
  //string entry;
  const char *dataFileName = Form("/home/calibration/moXData/Data_%s_%d.txt", metal, Vcth); 

  if (fileExists(dataFileName)) {

    int iEvent=0; //For counting the events on the screen
    ifstream dataFile (dataFileName);
    string wholeLine;
    char boolString[nChannels];

    while ( ! dataFile.eof() ) {
      getline(dataFile, wholeLine);
      if (sscanf(wholeLine.c_str(), "%d %d %d %s", &Event, &thresh, &nHits, boolString)!=4) {
        cerr << "Error: did not find 4 entries" << endl;
		  continue;
      }//end if line is not 4 long
      if (strlen(boolString)!=nChannels) {
        cerr << "Error: boolString is " << strlen(boolString) << " instead of " << nChannels << endl;
        continue;
      }//end fi nChannels is not boolString
      // Check on the threshold consistency
      if (thresh!=Vcth) cerr << "ERROR: threshold does not match file's Vcth" << endl;
      // Parse the boolString
      for (unsigned int strip=0; strip<nChannels; strip++) {
        if(boolString[strip]=='1') dataBits[strip] = 1;
        else dataBits[strip] = 0;
      }//end for strip

      // Now we want to fill the TTree with these values
      tree->Fill();

      // Process nEvents at most
      if (++iEvent>=nEvents) break;
      if (iEvent%10000==0) cout << "." << flush;
    
    }//end while entry
    dataFile.close();

  } else {
    cout << "Data file of " << metal << ", threshold " << Vcth << " does not exist!" << endl;
  }//end if fileExists

}//end void treeMaker

int macro (unsigned int maxEvents=10) {
  const char *treeFileName = Form("TreeScan_MoX_%d.root", maxEvents);
  TFile* treeFile = new TFile(treeFileName,"RECREATE");
  initializeTree();

  for (int iThresh=0; iThresh<nThresholds; ++iThresh) {
    cout << "Theshold " << Vcths[iThresh] << " " << flush;
    treeFiller("MoX", Vcths[iThresh], maxEvents); 
    cout << " done!" << endl;
  }//end for iThresh

  tree->Write("", TObject::kOverwrite);
  treeFile->Close();
  return 0;
}// end macro

Thanks for the help!

Cheers,

Nikkie