Help to fill the branches correctly

Hi rooters,
I am have a problem to fill some branches of my tree.

In some parts of my code i need to fill the branches only one time per event (like number of tracks) and other parts I need to fill more than one time (like the energy of a colorimeter tower).

I tryed (just a piece of code):

      for(CaloTowerCollection::const_iterator itCalTo = calto->begin(); itCalTo != calto->end(); ++itCalTo) {	
        CaloTowersTotalEnergy += itCalTo->energy();
        CaloTowersTotalEt += itCalTo->et();

        CaloTower_Phi  = itCalTo->phi();
        CaloTower_E    = itCalTo->energy();
        CaloTower_Et   = itCalTo->et();
        CaloTower_Eta  = itCalTo->eta();
        
      }   

      Zmumu->Fill(); // Zmumu is the name of my TTree

This code filled right the variables that depends of a previously computation, like total CaloTowersTotalEnergy, but filled wrong for the others.

How to fill correctly my tree in this situation?

Cheers,
Marco

Each branch of a tree can be a collection of variable length objects.

Rene