Skip to content

Fix DATAVECTOR_BASE for TrackMeasurementValidation

Dan Guest requested to merge dguest/athena:fixhit into 24.0

This really needs some attention from someone like @ssnyder, since I'm way over my head here.

What I think the problem is

The TrackMeasurementValidation_v1 class was inappropriately using DATAVECTOR_BASE, by having

DATAVECTOR_BASE( xAOD::TrackMeasurementValidation_v1, SG::AuxElement );

at the end of the header. Here I'm requesting that we remove that line. [I'm suggesting that we add a header to make it work]

Why would I want to do that?

We (@backes and I) were unable to get SG::ReadDecorHandleKey<xAOD::TrackMeasurementValidationContainer> to compile. The full error message is below, but it included

static assertion failed: You should use the CLASS_DEF macro to define CLID and VERSION
...
error: 'classID' is not a member of 'DataVector<SG::AuxElement>'

I have some recollection that we can't use SG::AuxElement as a base class in the IO layer for some reason, so I tried removing the macro [unless you also include xAODCore/BaseContainer.h, so I added that] and the code compiled.

What are other EDM classes doing?

Alternatives seem to be using SG_BASE or using nothing at all.

I looked around at some other objects and found that the following used DATAVECTOR_BASE with SG::AuxElement

Event/xAOD/xAODMuonRDO/xAODMuonRDO/versions/NRPCRDO_v1.h
Event/xAOD/xAODTracking/xAODTracking/versions/TrackMeasurementValidation_v1.h
MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonSimHit/xAODMuonSimHit/versions/MuonSimHit_v1.h

on the other hand, there were 54 headers that used the SG_BASE macro. This might suggest that I should replace the macro with SG_BASE. On the third hand, in xAOD::BTagging_v1 we don't use either of these things, and it seems to work.

Since I tend to be reluctant to do something when nothing will suffice, I'm proposing nothing here. But if using SG_BASE would let us read the object as an SG::AuxElement, that would be awesome (we should implement that for xAOD::BTagging as well).

Ugly details

The full error we were getting is listed below.

In file included from /usr/AthAnalysis/25.2.10/InstallArea/x86_64-el9-gcc13-opt/src/Control/AthenaKernel/AthenaKernel/DataBucketBase.icc:14,
                 from /usr/AthAnalysis/25.2.10/InstallArea/x86_64-el9-gcc13-opt/src/Control/AthenaKernel/AthenaKernel/DataBucketBase.h:102,
                 from /usr/AthAnalysis/25.2.10/InstallArea/x86_64-el9-gcc13-opt/src/Control/AthenaKernel/AthenaKernel/DataBucket.h:10,
                 from /usr/AthAnalysis/25.2.10/InstallArea/x86_64-el9-gcc13-opt/src/Control/AthenaKernel/AthenaKernel/StorableConversions.h:15,
                 from /usr/AthAnalysis/25.2.10/InstallArea/x86_64-el9-gcc13-opt/src/Control/StoreGate/StoreGate/VarHandleBase.h:25,
                 from /usr/AthAnalysis/25.2.10/InstallArea/x86_64-el9-gcc13-opt/src/Control/AthenaBaseComps/AthenaBaseComps/HandleClassifier.h:18,
                 from /usr/AthAnalysis/25.2.10/InstallArea/x86_64-el9-gcc13-opt/src/Control/AthenaBaseComps/AthenaBaseComps/AthCommonDataStore.h:38,
                 from /usr/AthAnalysis/25.2.10/InstallArea/x86_64-el9-gcc13-opt/src/Control/AthenaBaseComps/AthenaBaseComps/AthReentrantAlgorithm.h:19,
                 from /home/atlas/work/dumpster/training-dataset-dumper/athena/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/JetHitAssociationAlg.h:10,
                 from /home/atlas/work/dumpster/training-dataset-dumper/athena/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/src/JetHitAssociationAlg.cxx:6:
/usr/AthAnalysis/25.2.10/InstallArea/x86_64-el9-gcc13-opt/src/Control/AthenaKernel/AthenaKernel/ClassID_traits.h: In instantiation of 'static const CLID& ClassID_traits<T>::ID() [with T = DataVector<SG::AuxElement>; CLID = unsigned int]':
/usr/AthAnalysis/25.2.10/InstallArea/x86_64-el9-gcc13-opt/src/Control/StoreGate/StoreGate/ReadDecorHandleKey.icc:80:40:   required from 'SG::ReadDecorHandleKey<T>::ReadDecorHandleKey(OWNER*, const std::string&, const std::string&, const std::string&) [with OWNER = FlavorTagDiscriminants::JetHitAssociationAlg; <template-parameter-2-2> = void; T = DataVector<xAOD::TrackMeasurementValidation_v1>; std::string = std::__cxx11::basic_string<char>]'
/home/atlas/work/dumpster/training-dataset-dumper/athena/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/JetHitAssociationAlg.h:45:79:   required from here
/usr/AthAnalysis/25.2.10/InstallArea/x86_64-el9-gcc13-opt/src/Control/AthenaKernel/AthenaKernel/ClassID_traits.h:51:22: error: static assertion failed: You should use the CLASS_DEF macro to define CLID and VERSION
   51 |     MY_STATIC_ASSERT(s_isDataObject);
      |                      ^~~~~~~~~~~~~~
/usr/AthAnalysis/25.2.10/InstallArea/x86_64-el9-gcc13-opt/src/Control/AthenaKernel/AthenaKernel/ClassID_traits.h:33:18: note: in definition of macro 'MY_STATIC_ASSERT'
   33 |   static_assert (B, "You should use the CLASS_DEF macro to define CLID and VERSION");
      |                  ^
/usr/AthAnalysis/25.2.10/InstallArea/x86_64-el9-gcc13-opt/src/Control/AthenaKernel/AthenaKernel/ClassID_traits.h:51:22: note: 'ClassID_traits<DataVector<SG::AuxElement> >::s_isDataObject' evaluates to false
   51 |     MY_STATIC_ASSERT(s_isDataObject);
      |                      ^~~~~~~~~~~~~~
/usr/AthAnalysis/25.2.10/InstallArea/x86_64-el9-gcc13-opt/src/Control/AthenaKernel/AthenaKernel/ClassID_traits.h:33:18: note: in definition of macro 'MY_STATIC_ASSERT'
   33 |   static_assert (B, "You should use the CLASS_DEF macro to define CLID and VERSION");
      |                  ^
/usr/AthAnalysis/25.2.10/InstallArea/x86_64-el9-gcc13-opt/src/Control/AthenaKernel/AthenaKernel/ClassID_traits.h:52:22: error: 'classID' is not a member of 'DataVector<SG::AuxElement>'
   52 |     return T::classID();
      |            ~~~~~~~~~~^~
Edited by Dan Guest

Merge request reports

Loading