SetBranchStatus of Vectors

Hi!

How can one set the branchStatus of a variable of the type

ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D >

from a root chain? Normally, it should work like this:

ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D >* myvector;
fChain->SetBranchStatus("",0); (1)
myvector=0;
fChain->SetBranchStatus("myvector
", 1); (2)
fChain->SetBranchAddress(“myvector”, &myvector);

(1) here, every branch of the tree is set not to be processed
(2) here, the single branch “myvector” is reset to be processed

This works very fine with e.g. objects of the type

vector*
vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D >* >

but not (!) with
ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D >

-> Then myvector is not filled. If I skip
fChain->SetBranchStatus("*",0);
it also works fine. So the crutial point is to reset the BranchStatus to “1”. Can someone help, please? Thank you!

Cheers, Matthias

NB: the Star * is important for (2) - it includes all branches root can find which begin with “myvector”

p.s.: The full code with a small input file can be found at desy.de/~mstein/mysusy/. Run it with root make.C. You might have to load FW-Lite beforehand. In my case, the variable in question is metP4AK5 - search for it in mysusy.h

Hi,

The issue is that since the branch metP4AK5 was not created with a trailing dot at the end of its name, its sub-branches are not related name-wise. Namely, we have: root [8] tree->GetBranch("metP4AK5")->Print() *Branch :metP4AK5 * *Entries : 20 : BranchElement (see below) * *............................................................................* *Br 0 :fCoordinates : * *Entries : 20 : Total Size= 4217 bytes One basket in memory * *Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 * *............................................................................* *Br 1 :fCoordinates.fX : * *Entries : 20 : Total Size= 1100 bytes File Size = 242 * *Baskets : 1 : Basket Size= 32000 bytes Compression= 1.00 * *............................................................................* *Br 2 :fCoordinates.fY : * *Entries : 20 : Total Size= 1100 bytes File Size = 242 * *Baskets : 1 : Basket Size= 32000 bytes Compression= 1.00 * *............................................................................* *Br 3 :fCoordinates.fZ : * *Entries : 20 : Total Size= 1100 bytes File Size = 103 * *Baskets : 1 : Basket Size= 32000 bytes Compression= 2.35 * *............................................................................* *Br 4 :fCoordinates.fT : * *Entries : 20 : Total Size= 1100 bytes File Size = 222 * *Baskets : 1 : Basket Size= 32000 bytes Compression= 1.09 * *............................................................................*and thus

fChain->SetBranchStatus("metP4AK5*", 1); only enables the top level branches and not the sub-branches.
To also enable the sub-branches you need to also use:fChain->SetBranchStatus("fCoordinates*", 1);

Cheers,
Philippe.