Genreflex migration of Hep3Vector

I am converting a legacy class which contains CLHEP::Hep3Vector members to use ROOT::Math::DisplacementVector3D instead. I’d like to write a schema evolution rule for that in genreflex so I can read legacy data, but before I do I have some basic questions. I’ve looked at
https://root.cern/root/htmldoc/guides/users-guide/InputOutput.html

  • did anyone already create a reflex stanza for this conversion?
  • should I use ioread or ioreadraw for this migration?
  • Is the target class my parent class, or CLHEP::Hep3Vector
    An example showing the class definition before and after migration would be a great addition to this documentation BTW.
    thanks, Dave

Please read tips for efficient and successful posting and posting code

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


Hi @Dave_Brown ,
sorry for the high latency, this must have fallen through the cracks!

I think we need @moneta or @pcanal to comment here.

Cheers,
Enrico

Hi Dave,

Apologies for the late reply. .
Since the underlined data members of CLHEP::Hep3Vector and ROOT::Math::DisplacementVector3D are the same (there double values), it should be possible to write a conversion rule as a pragma statement in a Linked file. This is for ROOT/IO. For genreflex, I think a similar conversion can be defined too. @pcanal, our I/O expert should know and be able to give you a correct answer.

Cheers

Lorenzo

You would need to add 3 clauses to the selection.xml file, one for each data member.

  <ioread sourceClass = "CLHEP::Hep3Vector" version="[1-]"
          targetClass="ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<double>, ROOT::Math::GlobalCoordinateSystemTag >" 
          source = "double clhep_datamber_name" 
          target="root_math_datamember_name">
    <![CDATA[root_math_datamember_name = onfile.clhep_datamber_name;]]>
  </ioread>
1 Like

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