Event class alteration not working

Hi all,
I am configuring the event class to my needs. But when I alter some of the methods defined, EventDict.cxx complains. In particular, I have removed the reference to “date” in the SetHeader call. But then I get

working_directory/EventDict.cxx: In member function ‘virtual void EventHeader::ShowMembers(TMemberInspector&)’:
working_directory/EventDict.cxx:335: error: ‘fDate’ was not declared in this scope

The code snippet from Event.cxx is:

void Event::SetHeader(Int_t i, Int_t run)
{
   fNtrack = 0;
   fEvtHdr.Set(i, run);
}

The relevant declarations in Event.h are:

class EventHeader {

private:
   Int_t   fEvtNum;
   Int_t   fRun;

public:
   EventHeader() : fEvtNum(0), fRun(0) { }
   virtual ~EventHeader() { }
   void   Set(Int_t i, Int_t r ) { fEvtNum = i; fRun = r; }
   Int_t  GetEvtNum() const { return fEvtNum; }
   Int_t  GetRun() const { return fRun; }

   ClassDef(EventHeader,1)  //Event Header
};

class Event : public TObject {

private:
   char           fType[20];          //event type
   char          *fEventName;         //run+event number in character format
   Int_t          fNtrack;            //Number of tracks
  //etc. etc. etc.
   EventHeader    fEvtHdr;
  //etc. etc. etc.

public:
   Event();
   virtual ~Event();
   void          Build(Int_t ev, Int_t arg5=600, Float_t ptmin=1);
   void          Clear(Option_t *option ="");
   Bool_t        IsValid() const { return fIsValid; }
   static void   Reset(Option_t *option ="");
  //etc.  etc. etc.
   void          SetHeader(Int_t i, Int_t run);
  //etc.  etc. etc.
   EventHeader  *GetHeader() { return &fEvtHdr; }
   ClassDef(Event,1)  //Event structure
};

I do not understand. EventDict.cxx is supposed to read in the call options from Event.h and Event.cxx and configure itself to have the right mapping. Here is my Makefile for completeness

#-----------configure ROOT-----------#
ifdef ROOTSYS
include $(ROOTSYS)/etc/Makefile.arch

ROOTINC     :=$(shell $(ROOTSYS)/bin/root-config --incdir)
ROOTLIBDIR  :=$(shell $(ROOTSYS)/bin/root-config --libdir)
ROOTLDFLAGS :=$(shell $(ROOTSYS)/bin/root-config --ldflags)
ROOTCFLAGS  :=$(shell $(ROOTSYS)/bin/root-config --cflags)
ROOTCFLAGS  += -DUSE_ROOT
ROOTCFLAGS  += -DHAVE_ZLIB
ROOTCFLAGS  += -DUSE_TREE
ROOTCFLAGS  += -DUSE_HISTO
ROOTLIBS    := $(shell  $(ROOTSYS)/bin/root-config --libs)
ROOTLIBS    += -lThread -lSpectrum -lMinuit -lMinuit2
ROOTLIBS    += -lMathCore -lFumili -Wl,--no-as-needed
ROOTLIBS    += -lTMVA -lMLP -lTreePlayer
ROOTCINT   := $(ROOTSYS)/bin/rootcint
ROOTLINK = $(ROOTLIBS) $(ROOTCFLAGS) $(ROOTLDFLAGS) -I$(ROOTINC)
else 
@echo "NO ROOTSYS!"
endif

LIBDIR=$(shell pwd)/lib
SRCDIR=$(shell pwd)/src
OBJDIR=$(shell pwd)/obj
BINDIR=$(shell pwd)/bin
INCDIR=$(shell pwd)/include


#--------configure compiler----------#
CXX      = g++
CFLAGS   = $(ROOTLINK) -I$(INCDIR) 
CFLAGS  += -O2 -Wall -Wno-write-strings
LDFLAGS  = $(ROOTLDFLAGS)
LIBS     = -lm -lz -lutil -lnsl -lpthread
 
#----------configure the Event class-----------#
EVENTO   = $(OBJDIR)/Event.$(ObjSuf) $(OBJDIR)/EventDict.$(ObjSuf)
EVENTS   = $(SRCDIR)/Event.$(SrcSuf) $(SRCDIR)/EventDict.$(SrcSuf)
EVENTSO  = $(LIBDIR)/libEvent.$(DllSuf)
EVENT    = $(BINDIR)/Event$(ExeSuf)
EVENTLIB = $(shell pwd)/$(EVENTSO)

OBJECTS = $(EVENTO)

default: all

all: myApp $(OBJECTS) $(EVENTSO)

$(EVENTSO):     $(EVENTO)
		@echo "compiling $@"
		$(LD) $(SOFLAGS) $(LDFLAGS) $^ $(OutPutOpt) $@ $(EXPLLINKLIBS)
		@echo "$@ done"
		@echo "----------------------------------"

$(EVENT):       $(EVENTSO)
		@echo "compiling $@"
		$(LD) $(ROOTLINK) $(LDFLAGS) $(EVENTO) $(LIBS) $(OutPutOpt)$@
		@echo "$@ done"
		@echo "----------------------------------"

$(EVENTO): $(INCDIR)/Event.h

$EventDict.$(SrcSuf): $(INCDIR)/Event.h $(INCDIR)/EventLinkDef.h
	@echo "Generating dictionary $@..."
	@rootcint -f $@ -c $^
	@echo "$@ done"
	@echo "-------------------------------"
 
$(OBJDIR)/%.$(ObjSuf): $(SRCDIR)/%.$(SrcSuf)
	@echo "Compiling $@"
	$(CXX) $(CFLAGS) -c $< -o $@
	@echo "-----------------------------------------------------"

$(BINDIR)/%$(ExeSuf): $(SRCDIR)/%.$(SrcSuf)
	@echo "Compiling $@"
	$(CXX) $(CFLAGS) -o $@ $< 
	@echo "-----------------------------------------------------"

myApp: $(SRCDIR)/myApp.cxx $(EVENTO) $(EVENTSO)
	@echo "Compiling $@"
	$(CXX) $(CFLAGS) -o $(BINDIR)/myApp $(SRCDIR)/myApp.cxx $(EVENTO) $(EVENTSO)
	@echo "-----------------------------------------------------"

clean::
	rm -f $(OBJECTS)
	rm -f $(EVENTSO)
	rm -f $(BINDIR)/myApp

Hi,

was the dictionary correctly re-generated?

Cheers,
Danilo

It was not. If I delete EventDict.cxx, then it is not remade upon making.

But I don’t know why this should be so.

Many thanks!

Hi,

the reason is that the header changed and the dictionary did not. It was fatal since a data member used within the dictionary disappeared from the class definition.
I am marking the item solved.

Cheers,
Danilo

Thanks for the attention!

I understand about the dictionary not changing to reflect the new header. But I put explicitly in my makefile that the dictionary is dependent on the header file. Also, this is almost exact copy of the code recommended to compile the event class. So I don’t see what else I can do to ensure that the dictionary is updated to reflect my changes to Event.h