Package with classDef conflict

Dear Rooters,

I’m trying to use the package KinFitter available at this link : https://github.com/goepfert/KinFitter.
The compilation works and I built a very basic macro to test the compilation.

#include "./KinFitter/TFitConstraintM.h"
#include "./KinFitter/TKinFitter.h"

#include "TLorentzVector.h"
#include <iostream>

void macro() {
std::cout << "Performing kinematic fit..." << std::endl;
std::cout << "Done." << std::endl;
}

When I run the macro with ROOT (version 6.08/06) I have this kind of error message :

In file included from KinFitter_Cint dictionary payload:9:
KinFitter/TFitConstraintEp.h:12:32: error: base class has incomplete type
class TFitConstraintEp: public TAbsFitConstraint {
                      ~~~~~~~^~~~~~~~~~~~~~~~~
KinFitter_Cint dictionary forward declarations' payload:6:248: note: forward declaration of 'TAbsFitConstraint'
...base class for fit constraints)ATTRDUMP"))) __attribute__((annotate("$clingAutoload$TAbsFitConstraint.h")))  TAbsFitC...
                                                                                                                ^
Error in <TInterpreter::AutoParse>: Error parsing payload code for class TAbsFitParticle with content:

#line 1 "KinFitter_Cint dictionary payload"

#ifndef G__VECTOR_HAS_CLASS_ITERATOR
#define G__VECTOR_HAS_CLASS_ITERATOR 1
#endif

#define _BACKWARD_BACKWARD_WARNING_H
#include "TAbsFitConstraint.h"
#include "TAbsFitParticle.h"
#include "TFitConstraintEp.h"
#include "TFitConstraintM.h"
#include "TKinFitter.h"

#undef  _BACKWARD_BACKWARD_WARNING_H

In file included from input_line_14:1:
In file included from /afs/.../private/KinFitter/macro.C:1:
In file included from /afs/.../private/KinFitter/./KinFitter/TFitConstraintM.h:10:
In file included from KinFitter/TAbsFitConstraint.h:5:
KinFitter/TAbsFitParticle.h:65:29: error: expected parameter declarator
ClassDef(TAbsFitParticle, 1);  // Abstract base class for fit particles
                          ^
KinFitter/TAbsFitParticle.h:65:29: error: expected ')'
KinFitter/TAbsFitParticle.h:65:11: note: to match this '('
ClassDef(TAbsFitParticle, 1);  // Abstract base class for fit particles
        ^
KinFitter/TAbsFitParticle.h:65:3: error: C++ requires a type specifier for all declarations
ClassDef(TAbsFitParticle, 1);  // Abstract base class for fit particles
^
In file included from KinFitter_Cint dictionary payload:9:
KinFitter/TFitConstraintEp.h:12:32: error: base class has incomplete type
class TFitConstraintEp: public TAbsFitConstraint {
                      ~~~~~~~^~~~~~~~~~~~~~~~~
KinFitter/TAbsFitConstraint.h:10:7: note: definition of 'TAbsFitConstraint' is not complete until the closing '}'
class TAbsFitConstraint : public TNamed {
    ^
Error in <TInterpreter::AutoParse>: Error parsing payload code for class TAbsFitConstraint with content:

#line 1 "KinFitter_Cint dictionary payload"

#ifndef G__VECTOR_HAS_CLASS_ITERATOR
#define G__VECTOR_HAS_CLASS_ITERATOR 1
#endif

#define _BACKWARD_BACKWARD_WARNING_H
#include "TAbsFitConstraint.h"
#include "TAbsFitParticle.h"
#include "TFitConstraintEp.h"
#include "TFitConstraintM.h"
#include "TKinFitter.h"

#undef  _BACKWARD_BACKWARD_WARNING_H

KinFitter/TAbsFitConstraint.h:52:31: error: expected parameter declarator
ClassDef(TAbsFitConstraint, 1);  // Abstract base class for fit constraints
                            ^
KinFitter/TAbsFitConstraint.h:52:31: error: expected ')'
KinFitter/TAbsFitConstraint.h:52:11: note: to match this '('
ClassDef(TAbsFitConstraint, 1);  // Abstract base class for fit constraints
        ^
KinFitter/TAbsFitConstraint.h:52:3: error: C++ requires a type specifier for all declarations
ClassDef(TAbsFitConstraint, 1);  // Abstract base class for fit constraints
^
In file included from input_line_14:1:
In file included from /afs/.../private/KinFitter/macro.C:1:
KinFitter/TFitConstraintM.h:20:19: error: unknown type name 'vector'
TFitConstraintM(vector<TAbsFitParticle*>* ParList1, vector<TAbsFitParticle*>* ParList2, Double_t Mass = 0);
                ^
KinFitter/TFitConstraintM.h:20:25: error: expected ')'
TFitConstraintM(vector<TAbsFitParticle*>* ParList1, vector<TAbsFitParticle*>* ParList2, Double_t Mass = 0);
                      ^
KinFitter/TFitConstraintM.h:20:18: note: to match this '('
TFitConstraintM(vector<TAbsFitParticle*>* ParList1, vector<TAbsFitParticle*>* ParList2, Double_t Mass = 0);
               ^
KinFitter/TFitConstraintM.h:21:62: error: unknown type name 'vector'
TFitConstraintM(const TString &name, const TString &title, vector<TAbsFitParticle*>* ParList1, vector<TAbsFitPartic...
                                                           ^
KinFitter/TFitConstraintM.h:21:68: error: expected ')'
TFitConstraintM(const TString &name, const TString &title, vector<TAbsFitParticle*>* ParList1, vector<TAbsFitPartic...
                                                                 ^
KinFitter/TFitConstraintM.h:21:18: note: to match this '('
TFitConstraintM(const TString &name, const TString &title, vector<TAbsFitParticle*>* ParList1, vector<TAbsFitPartic...
               ^
KinFitter/TFitConstraintM.h:37:17: error: unknown type name 'vector'
Bool_t OnList(vector<TAbsFitParticle*>* List, TAbsFitParticle* particle);
              ^
KinFitter/TFitConstraintM.h:37:23: error: expected ')'
Bool_t OnList(vector<TAbsFitParticle*>* List, TAbsFitParticle* particle);
                    ^
KinFitter/TFitConstraintM.h:37:16: note: to match this '('
Bool_t OnList(vector<TAbsFitParticle*>* List, TAbsFitParticle* particle);
             ^
KinFitter/TFitConstraintM.h:38:21: error: unknown type name 'vector'
Double_t CalcMass(vector<TAbsFitParticle*>* List, Bool_t IniVal);
                  ^
KinFitter/TFitConstraintM.h:38:27: error: expected ')'
Double_t CalcMass(vector<TAbsFitParticle*>* List, Bool_t IniVal);
                        ^
KinFitter/TFitConstraintM.h:38:20: note: to match this '('
Double_t CalcMass(vector<TAbsFitParticle*>* List, Bool_t IniVal);
                 ^
KinFitter/TFitConstraintM.h:44:3: error: unknown type name 'vector'
vector<TAbsFitParticle*> _ParList1;
^
KinFitter/TFitConstraintM.h:44:9: error: expected member name or ';' after declaration specifiers
vector<TAbsFitParticle*> _ParList1;
            ^
KinFitter/TFitConstraintM.h:45:3: error: unknown type name 'vector'
vector<TAbsFitParticle*> _ParList2;
^
KinFitter/TFitConstraintM.h:45:9: error: expected member name or ';' after declaration specifiers
vector<TAbsFitParticle*> _ParList2;
~~~~~~^
KinFitter/TFitConstraintM.h:48:29: error: expected parameter declarator
ClassDef(TFitConstraintM, 1);
                          ^
KinFitter/TFitConstraintM.h:48:29: error: expected ')'
KinFitter/TFitConstraintM.h:48:11: note: to match this '('
ClassDef(TFitConstraintM, 1);
        ^
KinFitter/TFitConstraintM.h:48:3: error: C++ requires a type specifier for all declarations
ClassDef(TFitConstraintM, 1);
^
Error in <TInterpreter::AutoParse>: Error parsing payload code for class TKinFitter with content:

#line 1 "KinFitter_Cint dictionary payload"

#ifndef G__VECTOR_HAS_CLASS_ITERATOR
#define G__VECTOR_HAS_CLASS_ITERATOR 1
#endif

#define _BACKWARD_BACKWARD_WARNING_H
#include "TAbsFitConstraint.h"
#include "TAbsFitParticle.h"
#include "TFitConstraintEp.h"
#include "TFitConstraintM.h"
#include "TKinFitter.h"

#undef  _BACKWARD_BACKWARD_WARNING_H

Error in <TInterpreter::AutoParse>: Error parsing payload code for class vector with content:

#line 1 "libCore dictionary payload"

#ifndef G__VECTOR_HAS_CLASS_ITERATOR
#define G__VECTOR_HAS_CLASS_ITERATOR 1
#endif
#ifndef SYSTEM_TYPE_unix
#define SYSTEM_TYPE_unix 1
#endif

#define _BACKWARD_BACKWARD_WARNING_H
#include "TApplication.h"
#include "TApplicationImp.h"
#include "TAtt3D.h"
#include "TAttAxis.h"
#include "TAttBBox.h"
#include "TAttBBox2D.h"
#include "TAttFill.h"
#include "TAttLine.h"
#include "TAttMarker.h"
#include "TAttPad.h"
#include "TAttText.h"
#include "TBase64.h"
#include "TBenchmark.h"
#include "TBrowser.h"
#include "TBrowserImp.h"
#include "TBuffer.h"
#include "TBuffer3D.h"
#include "TBuffer3DTypes.h"
#include "TCanvasImp.h"
#include "TColor.h"
#include "TColorGradient.h"
#include "TContextMenu.h"
#include "TContextMenuImp.h"
#include "TControlBarImp.h"
#include "TDatime.h"
#include "TDirectory.h"
#include "TEnv.h"
#include "TError.h"
#include "TException.h"
#include "TExec.h"
#include "TFileCollection.h"
#include "TFileInfo.h"
#include "TFolder.h"
#include "TGuiFactory.h"
#include "TInetAddress.h"
#include "TInspectorImp.h"
#include "TMD5.h"
#include "TMacro.h"
#include "TMathBase.h"
#include "TMemberInspector.h"
#include "TMessageHandler.h"
#include "TNamed.h"
#include "TObjString.h"
#include "TObject.h"
#include "TObjectSpy.h"
#include "TPRegexp.h"
#include "TParameter.h"
#include "TPluginManager.h"
#include "TPoint.h"
#include "TProcessID.h"
#include "TProcessUUID.h"
#include "TQClass.h"
#include "TQCommand.h"
#include "TQConnection.h"
#include "TQObject.h"
#include "TQObjectEmitVA.h"
#include "TROOT.h"
#include "TRedirectOutputGuard.h"
#include "TRef.h"
#include "TRefCnt.h"
#include "TRegexp.h"
#include "TRemoteObject.h"
#include "TRootIOCtor.h"
#include "TStopwatch.h"
#include "TStorage.h"
#include "TString.h"
#include "TStringLong.h"
#include "TStyle.h"
#include "TSysEvtHandler.h"
#include "TSystem.h"
#include "TSystemDirectory.h"
#include "TSystemFile.h"
#include "TTask.h"
#include "TThreadSlots.h"
#include "TTime.h"
#include "TTimeStamp.h"
#include "TTimer.h"
#include "TUUID.h"
#include "TUri.h"
#include "TUrl.h"
#include "TVersionCheck.h"
#include "TVirtualAuth.h"
#include "TVirtualFFT.h"
#include "TVirtualGL.h"
#include "TVirtualMonitoring.h"
#include "TVirtualMutex.h"
#include "TVirtualPS.h"
#include "TVirtualPad.h"
#include "TVirtualPadEditor.h"
#include "TVirtualPadPainter.h"
#include "TVirtualPerfStats.h"
#include "TVirtualTableInterface.h"
#include "TVirtualViewer3D.h"
#include "TVirtualX.h"
#include "GuiTypes.h"
#include "KeySymbols.h"
#include "Buttons.h"
#include "ROOT/TDirectory.hxx"
#include "ROOT/TDirectoryEntry.hxx"
#include "ROOT/TDrawable.hxx"
#include "ROOT/TIndexIter.hxx"
#include "ROOT/TLogger.hxx"
#include "strlcpy.h"
#include "snprintf.h"
#include "TArray.h"
#include "TArrayC.h"
#include "TArrayD.h"
#include "TArrayF.h"
#include "TArrayI.h"
#include "TArrayL.h"
#include "TArrayL64.h"
#include "TArrayS.h"
#include "TBits.h"
#include "TBtree.h"
#include "TClassTable.h"
#include "TClonesArray.h"
#include "TCollection.h"
#include "TCollectionProxyInfo.h"
#include "TExMap.h"
#include "THashList.h"
#include "THashTable.h"
#include "TIterator.h"
#include "TList.h"
#include "TMap.h"
#include "TObjArray.h"
#include "TObjectTable.h"
#include "TOrdCollection.h"
#include "TRefArray.h"
#include "TRefTable.h"
#include "TSeqCollection.h"
#include "TSortedList.h"
#include "TVirtualCollectionProxy.h"
#include "TUnixSystem.h"
#include "ESTLType.h"
#include "RConversionRuleParser.h"
#include "RStringView.h"
#include "TClassEdit.h"
#include "TClingRuntime.h"
#include "TSchemaRuleProcessor.h"
#include "TSchemaType.h"
#include "root_std_complex.h"
#include "TBaseClass.h"
#include "TClass.h"
#include "TClassGenerator.h"
#include "TClassMenuItem.h"
#include "TClassRef.h"
#include "TClassStreamer.h"
#include "TDataMember.h"
#include "TDataType.h"
#include "TDictAttributeMap.h"
#include "TDictionary.h"
#include "TEnum.h"
#include "TEnumConstant.h"
#include "TFileMergeInfo.h"
#include "TFunction.h"
#include "TFunctionTemplate.h"
#include "TGenericClassInfo.h"
#include "TGlobal.h"
#include "TInterpreter.h"
#include "TInterpreterValue.h"
#include "TIsAProxy.h"
#include "TListOfDataMembers.h"
#include "TListOfEnums.h"
#include "TListOfEnumsWithLock.h"
#include "TListOfFunctionTemplates.h"
#include "TListOfFunctions.h"
#include "TMemberStreamer.h"
#include "TMethod.h"
#include "TMethodArg.h"
#include "TMethodCall.h"
#include "TProtoClass.h"
#include "TRealData.h"
#include "TSchemaHelper.h"
#include "TSchemaRule.h"
#include "TSchemaRuleSet.h"
#include "TStreamer.h"
#include "TStreamerElement.h"
#include "TToggle.h"
#include "TToggleGroup.h"
#include "TVirtualIsAProxy.h"
#include "TVirtualRefProxy.h"
#include "TVirtualStreamerInfo.h"
#include "Getline.h"

#undef  _BACKWARD_BACKWARD_WARNING_H

In file included from input_line_14:1:
In file included from /afs/.../private/KinFitter/macro.C:4:
KinFitter/TKinFitter.h:150:9: error: unknown type name 'vector'
Int_t _nParB;     // Number of measured parameters
      ^
KinFitter/TKinFitter.h:150:15: error: expected member name or ';' after declaration specifiers
Int_t _nParB;     // Number of measured parameters
      ~~~~~~^
KinFitter/TKinFitter.h:152:28: error: unknown type name 'vector'
vector<TAbsFitConstraint*> _constraints;    // vector with constraints
                         ^
KinFitter/TKinFitter.h:152:34: error: expected member name or ';' after declaration specifiers
vector<TAbsFitConstraint*> _constraints;    // vector with constraints
                         ~     ^
KinFitter/TKinFitter.h:153:26: error: unknown type name 'vector'
vector<TAbsFitParticle*>   _particles;      // vector with particles
                       ^
KinFitter/TKinFitter.h:153:32: error: expected member name or ';' after declaration specifiers
vector<TAbsFitParticle*>   _particles;      // vector with particles
                       ~     ^
KinFitter/TKinFitter.h:157:40: error: expected parameter declarator
Int_t _nbIter;   // number of iteration performed in the fit
                                     ^
KinFitter/TKinFitter.h:157:40: error: expected ')'
KinFitter/TKinFitter.h:157:27: note: to match this '('
Int_t _nbIter;   // number of iteration performed in the fit
                        ^
KinFitter/TKinFitter.h:157:19: error: C++ requires a type specifier for all declarations
Int_t _nbIter;   // number of iteration performed in the fit
                ^
KinFitter/TKinFitter.h:29:64: error: cannot initialize a parameter of type 'TAbsFitParticle *' with an rvalue of type 'int'
void addMeasParticles( TAbsFitParticle* p1, TAbsFitParticle* p2 = 0, TAbsFitParticle* p3 = 0, 
                                                             ^    ~
KinFitter/TKinFitter.h:29:64: note: passing argument to parameter 'p2' here
KinFitter/TKinFitter.h:29:89: error: cannot initialize a parameter of type 'TAbsFitParticle *' with an rvalue of type 'int'
void addMeasParticles( TAbsFitParticle* p1, TAbsFitParticle* p2 = 0, TAbsFitParticle* p3 = 0, 
                                                                                      ^    ~
KinFitter/TKinFitter.h:29:89: note: passing argument to parameter 'p3' here
KinFitter/TKinFitter.h:30:22: error: cannot initialize a parameter of type 'TAbsFitParticle *' with an rvalue of type 'int'
                       TAbsFitParticle* p4 = 0, TAbsFitParticle* p5 = 0, TAbsFitParticle* p6 = 0,
                                        ^    ~
KinFitter/TKinFitter.h:30:22: note: passing argument to parameter 'p4' here
KinFitter/TKinFitter.h:30:47: error: cannot initialize a parameter of type 'TAbsFitParticle *' with an rvalue of type 'int'
                       TAbsFitParticle* p4 = 0, TAbsFitParticle* p5 = 0, TAbsFitParticle* p6 = 0,
                                                                 ^    ~
KinFitter/TKinFitter.h:30:47: note: passing argument to parameter 'p5' here
KinFitter/TKinFitter.h:30:72: error: cannot initialize a parameter of type 'TAbsFitParticle *' with an rvalue of type 'int'
                       TAbsFitParticle* p4 = 0, TAbsFitParticle* p5 = 0, TAbsFitParticle* p6 = 0,
                                                                                          ^    ~
KinFitter/TKinFitter.h:30:72: note: passing argument to parameter 'p6' here
KinFitter/TKinFitter.h:31:22: error: cannot initialize a parameter of type 'TAbsFitParticle *' with an rvalue of type 'int'
                       TAbsFitParticle* p7 = 0, TAbsFitParticle* p8 = 0, TAbsFitParticle* p9 = 0);
                                        ^    ~
KinFitter/TKinFitter.h:31:22: note: passing argument to parameter 'p7' here
KinFitter/TKinFitter.h:31:47: error: cannot initialize a parameter of type 'TAbsFitParticle *' with an rvalue of type 'int'
                       TAbsFitParticle* p7 = 0, TAbsFitParticle* p8 = 0, TAbsFitParticle* p9 = 0);
                                                                 ^    ~
KinFitter/TKinFitter.h:31:47: note: passing argument to parameter 'p8' here
KinFitter/TKinFitter.h:31:72: error: cannot initialize a parameter of type 'TAbsFitParticle *' with an rvalue of type 'int'
                       TAbsFitParticle* p7 = 0, TAbsFitParticle* p8 = 0, TAbsFitParticle* p9 = 0);
                                                                                          ^    ~
KinFitter/TKinFitter.h:31:72: note: passing argument to parameter 'p9' here
KinFitter/TKinFitter.h:33:66: error: cannot initialize a parameter of type 'TAbsFitParticle *' with an rvalue of type 'int'
void addUnmeasParticles( TAbsFitParticle* p1, TAbsFitParticle* p2 = 0, TAbsFitParticle* p3 = 0, 
                                                               ^    ~
KinFitter/TKinFitter.h:33:66: note: passing argument to parameter 'p2' here
KinFitter/TKinFitter.h:33:91: error: cannot initialize a parameter of type 'TAbsFitParticle *' with an rvalue of type 'int'
void addUnmeasParticles( TAbsFitParticle* p1, TAbsFitParticle* p2 = 0, TAbsFitParticle* p3 = 0, 
                                                                                        ^    ~
KinFitter/TKinFitter.h:33:91: note: passing argument to parameter 'p3' here
fatal error: too many errors emitted, stopping now [-ferror-limit=]

As you can see in this message, only some of the files provided in the package were compiled together (as I had a bigger error with all files I reduced their number in order to fix the bug).

Below please find what I unsdertood/saw :

  • The files TFitConstraintEp.h, TFitConstraintM.h and TKinFitter.h depend on TAbsFitParticles.h and TAbsFitParticle.h.
  • If I compile only TKinFitter.h with TAbsFitParticles.h and TAbsFitParticle.h : the macro run without complaining.
  • If I add TFitConstraintM.h to the previous run : the macro run without complaining.
    The problem comes when I add an other TFiConstraint file.

According the error message it seems that the error come from a conflict between the following lines but I am not sure :

class TFitConstraintM: public TAbsFitConstraint {…}
class TFitConstraintEp: public TAbsFitConstraint {…}

I don’t know how to fix this…
Thanks in advance :slight_smile:

Best,
M.

Have you contacted the developers of KinFitter?

Hi ksmith,

Thanks for your answer.
Yes, I contacted them.

Best,
Marina

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