Problem with std::bitset in lariatsoft
We have made changes in lardataobj related to the anab::ParticleID object. Part of this involves a std::bitset to encode the plane(s) used. Because of this, std::bitset<8> and _Base_bitset<1> were added to lardataobj/AnalysisBase/classes_def.xml. This has caused no problems in most experimental code, but does cause an issue in lariatsoft:
When compiling with c2 qualifier, we see a compiler error:
'Warning: Unused class rule: _Base_bitset<1>'
When removing the _Base_bitset<1> line from the classes_def.xml file, the code compiles in both e17 and c2, but we get this error at run time:
No dictionary found for the following classes: _Base_bitset<1> Most likely they were never generated, but it may be that they were generated in the wrong package. Please add (or move) the specification <class name="MyClassName"/> to the appropriate classes_def.xml file.List of branches in use:
- larana: feature/alister1_chi2_pidclassupgrade
- lardataobj: feature/alister1_pid_ioread
- lariatsoft: feature/kduffy_updatedPIDdataprod
Additional information from emails:
From: Kyle Knoepfel
Sent: Thursday, February 7, 2019 2:03 PM
To: Philippe G Canal
Cc: Kyle Knoepfel; Lynn A Garren; Christopher H Green; Hunter C. Sullivan; larsoft-team; Johnny Ho; Erica Snider; Adam Lister; Giuseppe B. Cerati
Subject: Re: Dictionary for std::bitset
Okay, thanks Philippe. In that case, a new version of art will be required that makes the appropriate adjustments.
In this case, the guidance is straightforward, the checker needs to recognize that the class is std::bitset and ignore its base class. The dictionary for the base should never be requested.
On 2/7/19 1:21 PM, Kyle Knoepfel wrote:
Hi Lynn, Chris,
I have talked with Philippe (cc’d), who has told me that ROOT does not transparently support std::bitset—i.e. it is necessary for the user to generate the dictionary for a given std::bitset instantiation. The problem here is that Clang and GCC implement the std::bitset template differently: std::bitset<1>’s base class in GCC is _Base_bitset<1>, whereas in Clang it is __bitset<1,1>.
Philippe and Chris, our dictionary checker in canvas_root_io recursively checks the presence of dictionaries (going through all base classes) until it either reaches a type/template that is transparently handled by ROOT, or until there are no more base classes. What is the guidance for handling this particular case? Are there alternative XML tags that users should specify depending on what STL implementation is being used?