I was thinking that root version 4.00.03 supports “std::vector” as tree top level branch.
But I cannot make it working. The syntaxe I have tried is:
vector vEcalHit;
TTree *arbre = new TTree(“AMSRoot”,“mon_arbre”);
arbre->Branch(“fEcalHit”,“vector”,&vEcalHit,16000,1);
…
There is no error or warning while compilation but the following message appears at the executing time, and the branch is not created.
Error in TTree::Bronch: vector with no dictionary defined in branch: fEcalHit
Ok, I have wrapped my std::vector into another class.
Fill the TTree with class’s std vector works fine.
I test it by checking the vector size after asign it.
I finished by writing my new TTree in a root file.
But there are problems when I try to access to this std:vector later in a root session.
When I access my std::vector via the new class in the new generate root file, std::vector size in NULL.
I hope to be clear;
thank you for your answer.
******CODE
class LappAnal : public TObject
{
public:
LappAnal(){};
~LappAnal(){};
vector vEcalHit;
ClassDef(LappAnal,1)
};
…
LappAnal* pla = new LappAnal;
arbre->Branch(“blapp”,“LappAnal”,&pla,16000,1);
…
// loop
pla->vEcalHit = pev->EcalHit(); //<<-- std vector assignement.
arbre->Fill(); // on rempli l’ “arbre”
…