MCEventHeader misses directory?

Dear Experts,

I have a code that used to work. Now I got the following error message:

Error in TTree::SetBranchAddress: Unable to determine the type given for the address for “MCEventHeader.”. This is probably due to a missing dictionary, the original data class for this branch is o2::dataformats::MCEventHeader.

I checked the simulation output Kine file and it does contain MCEventHeader. branch. I alos checked O2 codes and I think the dataformat I try to use is correct. I try to access in the following way:

  TTree *kineTree = (TTree *)fKine->Get("o2sim");
  o2::dataformats::MCEventHeader *mcHeader = nullptr;
  kineTree->SetBranchAddress("MCEventHeader.", &mcHeader);

Other branches like the MCTracks have no such problem.
I use an up-to-date O2.

Thank you in advance

Quickly checked this on my Mac (in a ROOT prompt). I don’t see any problems in my case. Can you share platform, O2 commit, etc?

Thanks for the answer. I’m still testing, may be some header is out dated. I’m working on WSL2 and my O2 is from 6th of September (commit e10235b536862f2fe690a9cbf5f3efd5abfd817d).
The macro I try to run worked in the beginning of the year, if I recall correctly.

Okay, got it. Interesting problem, though. My headers weren’t in the correct order.
Wrong:

#include "SimulationDataFormat/MCEventHeader.h"
#include "SimulationDataFormat/MCTruthContainer.h"

Correct:

#include "SimulationDataFormat/MCTruthContainer.h"
#include "SimulationDataFormat/MCEventHeader.h"

Thanks!

1 Like