Problem with creating branches in TTree

Hi, I am being puzzled by a strange problem when I tried to create a TTree file with two branches. My intention was to use each branch to save a vector and the vector’s three components. The related codes are as follows:

double position[3];
double px, py, pz;

double direction[3];
double direcx, direcy, direcz;

TTree *tree=new TTree(“EventTree”, “EventTree”);
tree->Branch(“position”, position, "position[3]/D:px/D:py/D:pz/D);
tree->Branch(“direction”, direction, “direction[3]/D:direcx/D:direcy/D:direcz/D”);

void Filltree(double pos[3], double direc[3])
for (int j=0;j<3;j++)
position[j] = pos[j];
direction[j] = direc[j];





When I opened the generated root file in TBrowser, I was surprised to find that the values of position[0], position[1], position[2] were saved in direcx, direcy and direcz respectively, but components of direction were saved in px, py and pz respectively! They are just exactly reverse!

It seemed to be impossible! What 's wrong with my program? I have checked it for times but failed to get the answer. Thans for your help.