Genreflex std::vector<MyClass<Double32_t> >

test.C (1.2 KB)Dear Experts,

I am writing std::vector<ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D > > objects into a TTree. I would like to take advantage of the Double32_t behavior, in which ROOT writes only 32 bits to disk for each of the 4 data members, but loads them into memory as 64 bits each. As you can see from the attached test, I am able to do this in a macro if I create dictionaries with gInterpreter->GenerateDictionary(). However, my TTree is from TFileService in CMSSW, which uses genreflex for its dictionaries. That TTree doesn’t recognize the Double32_t version, which is probably because it lacks the dictionary. You can see the error it produces by commenting out the second call to GenerateDictionary() in test().

I tried to define the appropriate dictionary, as

along with the dummy instantiation header. Unfortunately, genreflex unhelpfully changes the name, issuing the message:

—>> genreflex: INFO: Replacing selection name “std::vector<ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<Double32_t> > >” with “std::vector<ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D > >”

and I get the same error.

I tried using

That successfully avoids replacing the selection name, but fails to generate the dictionary.

—>> genreflex: WARNING: Class std::vector<ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<Double32_t> > > in selection file /afs/ not generated.

I also tried to call gInterpreter->GenerateDictionary in my CMSSW class, but they don’t know about gInterpreter (or gSystem, or gROOT).

Can you help me get the incantations right to have access to the dictionary I want in CMSSW? Either genreflex configuration or GenerateDictionary hack?

Thank you,

It turns out I do have access to gInterpreter in CMSSW, and using it** allows me to write Double32_t members to the TTree. Perhaps I forgot to include TInterpreter.h the first time around.

I think its still an unsolved problem how to do this with Reflex, but at least for me it’s no longer urgent.


gInterpreter->GenerateDictionary(“vector<ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<Double32_t> > >”,“vector;Math/LorentzVector.h”)