Dear experts,
I am writing as I got a naive question on how to access array-like branches with the type “float”.
So what I am trying to do is reading a file (in CMS nanoAOD format) and getting the pt distributions of the leading and subleading jet in each event. Jet pt values are stored in a branch, and I believe the structure of the data stored in it should be similar to the std::vector or a normal C++ dynamic array (so that you can store all the jet pts for each event). However, when I tried to use TTree::SetBranchAddress to link the branch and a local std::vector, the script returned an error:
“The pointer type given “vector” does not correspond to the type needed “Float_t” (5) by the branch: Jet_pt”
I also printed the tree and found that the type of the data stored in that branch is indeed Float_t
…
*Br 214 :Jet_pt : Float_t
*Entries : 4579 : Total Size= 20527 bytes File Size = 1866 *
*Baskets : 2 : Basket Size= 34816 bytes Compression= 10.66 *
…
I am quite confused as it is very clear that this branch is not a scalar-like branch, but an array-like branch. And I have not idea why the type expected by this branch would be “Float_t”, rather than “Float_t *” or similar…
I checked the file using root object browser and verified that this branch is indeed array-like (more values stored than the number of events, so multiple values per event)
Do you know what is happening? And do you have suggestions on how to properly access this branch?
Thanks a lot for your kind help!
Best regards,
Sebastian