Vector< > in TTree

Hello,

After some difficulties, I am able to use root on Mavericks.
However, the reading of my TFile failed at each time giving the following error :

[code]Error in TTree::SetBranchAddress: Unable to determine the type given for the address for “PileUp”. This is probably due to a missing dictionary, the original data class for this branch is vector.
Error in TTree::SetBranchAddress: Unable to determine the type given for the address for “HomogenX”. This is probably due to a missing dictionary, the original data class for this branch is vector.
Error in TTree::SetBranchAddress: Unable to determine the type given for the address for “HomogenY”. This is probably due to a missing dictionary, the original data class for this branch is vector.
Error in TTree::SetBranchAddress: Unable to determine the type given for the address for “EventFileName”. This is probably due to a missing dictionary, the original data class for this branch is string.
Error in TTree::SetBranchAddress: Unable to determine the type given for the address for “PositionPeaks”. This is probably due to a missing dictionary, the original data class for this branch is vector.

*** Break *** segmentation violation
Generating stack trace…

Warning: /usr/bin/atos is moving and will be removed from a future OS X release.
It is now available in the Xcode developer tools to be invoked via: xcrun atos
To silence this warning, pass the ‘-d’ command-line flag to this tool.

0x000000010bd4fca0 in main (in ReadData.bin) + 14064

Warning: /usr/bin/atos is moving and will be removed from a future OS X release.
It is now available in the Xcode developer tools to be invoked via: xcrun atos
To silence this warning, pass the ‘-d’ command-line flag to this tool.

0x00007fff841ab5fd in start (in libdyld.dylib) + 1
0x0000000000000002 in
[/code]

Otherwise, everything else works.

Thanks.

Quentin

I still having this problem.
Any body have a solution ?

Cheer

Quentin

[quote=“Riffard”]
Any body have a solution ?

Cheer

Quentin[/quote]

Minimal code/data to reproduce your problem? Otherwise the solution is (probably) to read a message about a missing dictionary.

I just create a root file as the result of my analysis (too huge to join the file).

The code used for the reading of branch containing vector is :

vector<int>     *HomogenX=0;
vector<int>     *HomogenY=0;
vector<double>  *PositionPeaks=0;

tree->SetBranchAddress("HomogenX",&HomogenX);
tree->SetBranchAddress("HomogenY",&HomogenY);
tree->SetBranchAddress("PositionPeaks",&PositionPeaks);

And after I made a loop on each entries of my tree.

[quote=“Riffard”]I just create a root file as the result of my analysis (too huge to join the file).

The code used for the reading of branch containing vector is :

vector<int>     *HomogenX=0;
vector<int>     *HomogenY=0;
vector<double>  *PositionPeaks=0;

tree->SetBranchAddress("HomogenX",&HomogenX);
tree->SetBranchAddress("HomogenY",&HomogenY);
tree->SetBranchAddress("PositionPeaks",&PositionPeaks);

And after I made a loop on each entries of my tree.[/quote]

This is not helpful. hvector.C (from the $ROOTSYS/tutorials/tree) works perfect on Mac OS 10.9 and does actually the same - creates a tree with branches/vectors, fills this tree and later reads this tree setting the branch addresses.

I do this and it worked:

vector<int>     *HomogenX=0;
TBranch         *b_HomogenX;
tree->SetBranchAddress("HomogenX",&HomogenX,&b_HomogenX);

Then to access data in vector:

for (Long64_t jentry=0; jentry<nentries;jentry++) {
      Long64_t ientry = LoadTree(jentry);
      if (ientry < 0) break;
      nb = fChain->GetEntry(jentry);   nbytes += nb;

  int   size =HomogenX->size();
  for(int   i=0;i<size;i++)
      printf("Entry %i=>%i\n", i, HomogenX->at(i));

Where LoadTree function is defined as:

Long64_t TreeRealProcV5::LoadTree(Long64_t entry)
{
// Set the environment to read one entry
   Long64_t centry = fChain->LoadTree(entry);
   if (centry < 0) return centry;
   if (fChain->GetTreeNumber() != fCurrent) {
      fCurrent = fChain->GetTreeNumber();
      Notify();
   }
   return centry;
}

I hope this helps.
CMos