Making Branches with class objects

Dear experts,
I am trying to make a tree with 4 branches, Module0, Module1, Module2, Module3. I have created a simple class called Data with 7 uint32_t data members as follows:
class Data {
public:
uint32_t module;
uint32_t triggernumber;
uint32_t triggerid;
uint32_t bcid;
uint32_t row;
uint32_t col;
uint32_t tot;
};

then I make 4 pointers of the class Data and use them to make the Branches:
Data* Chip0 = new Data();
Data* Chip1 = new Data();
Data* Chip2 = new Data();
Data* Chip3 = new Data();

TTree* outputtree = new TTree("outputtree", "outputtree");

	outputtree->Branch("Module0", "Data", &Chip0,32000,1);
	outputtree->Branch("Module1", "Data", &Chip1,32000,1);
	outputtree->Branch("Module2", "Data", &Chip2,32000,1);
	outputtree->Branch("Module3", "Data", &Chip3,32000,1);

I have some histograms in my code as well. After compiling (with no errors) and running the code, everything seems to be working well. histograms are filled the way I expected. But the outputtree is made with no Branches and consequently contains no data. absolutely nothing.
I used outputtree->Fill() and also I tried to fill each branch separately like Module0->Fill() but non of them worked.
Could you please help me with this problem?
Thanks in advance


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


I think @pcanal can help you.

I can not reproduce the problem. Immediately after the call to Branch, you should see the branch listed in the screen result of outputtree->Print().

Did you call Write on the output file?

How did you assert that there is no branch in the output tree?