Read from TTree

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


I am trying to read a tree containing Float_t and Char_t branches. Here is a small eaxample:

void analysis_test(){
TFile *file = new TFile(“PhaseSpaceActor1_noshield.root”);
TTree tree = (TTree)file->Get(“PhaseSpace”);

    Float_t Ekine;
    Char_t ParticleName;


    cout << ParticleName << endl;
    cout << E << endl;


When setting the branch adress for both Ekine and ParticleName, the value for Ekine gets overwritten:
ParticleName = g
Ekine = 2.73735e+20
When reading only Ekine, the real value Ekine = 0.866 is stored in Ekine.

What could I do to solve this problem?

Thank you! It does work now😊


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.