Reading xAOD file interactively, returns wrong value


I read interactively a MxAOD (small file derived from xAOD) perfectly fine with Tree->Scan(“var”). I am trying to read it through a short C macro presented below:

void getVal(){

    TChain ch("CollectionTree");

    int eventNumber;
    ch.SetBranchAddress("EventInfoAux.eventNumber", &eventNumber);
    for(int i=0; i<ch.GetEntries(); i++){
        std::cout << "EventNumber: " << eventNumber << std::endl;

The value returned is wrong and always the same for every event, e.g. 19326752. The value changes at each attempt but the number of digits stay the same and (of course) changes when I pass the variable to long instead of int.

ROOT version is 6.04.16, the same with which the file has been created. All the setups related to xAOD are properly done and the only warning I get when running is:
Warning in TClass::Init: no dictionary for class CxxUtils_Internal::prime_rehash_policy is available

For additional information, the variable is defined as follow from the file:

   xAOD::EventInfo_v1 *EventInfo;
 //xAOD::EventAuxInfo_v1 *EventInfoAux_;
   xAOD::EventAuxInfo_v1 *EventInfoAux_xAOD__AuxInfoBase;
   ULong64_t       EventInfoAux_eventNumber;
   TBranch        *b_EventInfoAux_eventNumber;   //!
   fChain->SetBranchAddress("EventInfoAux.eventNumber", &EventInfoAux_eventNumber, &b_EventInfoAux_eventNumber);

I understand that a simple C macro is unsafe and most probably unstable on files with such a structure but as I get no error but just the wrong value, I’m really curious about what the problem is here. If you have an answer, I’ll be happy to know about it.

Thanks for your help !