Problem generating dictionary

Dear ROOT experts,

I am trying to generate dictionary for a class using Makefile. Following is the setup:

I have class Analyse in Analyse.C and Analyse.h to analyse a root tree. I try to read the tree using ExRootTreeReader.
It has Event class stored as a branch. I am using Makefile to compile main.C which calls function Loop() of class Analyse and also generate the dictionary of class Event using rootcint.
The code compiles fine. But when I run the code by doing ./main.exe input1 input2,
I get the following warning and problem:

Warning in <TClass::TClass>: no dictionary for class LHEFEvent is available Warning in <TClass::TClass>: no dictionary for class Event is available Warning in <TStreamerInfo::BuildCheck>: The StreamerInfo from B-4p-0-1-v1510_14TEV_50PileUp_101175088.root does not match existing one (Event:1) The existing one has not been used yet and will be discarded. Reading the file B-4p-0-1-v1510_14TEV/B-4p-0-1-v1510_14TEV_50PileUp_101175088.root will work properly, however writing object of type Event will not work properly. Most likely the version number of the class was not properly updated [See ClassDef(Event,1)]. Fatal: (cl==0 || info==0) && (cl!=0 || info!=0) violated at line 2028 of `/build/muz/53x/g462/BUILD/slc5_amd64_gcc462/lcg/root/5.32.00-cms18/root-5.32.00/io/io/src/TStreamerInfo.cxx' aborting

I suspect that my code is aborting because it did not find the dictionary for class Event and LHEFEvent.
Do you have any suggestions? Also, if I am generating the dictionary using Makefile then why does it
still say that the dictionary is not found.

Please find main.C Analyse.C Analyse.h Linkdef.h and Makefile attached. Please note that the file DelphesClasses.h containes the defintion of classes Event and LHEFEvent

Thanks,
Shilpi
Linkdef.h (121 Bytes)
Makefile.txt (618 Bytes)
main.C (306 Bytes)
Analyser.h (982 Bytes)
Analyser.C (1.17 KB)

Try with the attached files.
Linkdef.h (91 Bytes)
main.C (388 Bytes)
Makefile.txt (533 Bytes)

Hi Wile,

Thanks for the suggestion. I tried with the files you sent but it is giving me the
same problem as earlier.

Thanks

I guess one needs access to your “B-4p-0-1-v1510_14TEV/B-4p-0-1-v1510_14TEV_50PileUp_101175088.root” file for inspection. If it’s small, attach it here, if it’s big put it somewhere (e.g. in your “public” area of “afs”, if you have it).

Hi WIle,

Please find the root file here:
/afs/cern.ch/user/s/shilpi/public/B-4p-0-1-v1510_14TEV_50PileUp_101175088.root

Thanks

I donwloaded your file: [...]$ ls -al B-4p-0-1-v1510_14TEV_50PileUp_101175088.root -rw-r--r-- 1 user group 503316480 Sep 17 16:03 B-4p-0-1-v1510_14TEV_50PileUp_101175088.root [...]$ md5sum -b B-4p-0-1-v1510_14TEV_50PileUp_101175088.root 11297f0eabfe68d1646f3e4820e5a638 *B-4p-0-1-v1510_14TEV_50PileUp_101175088.root but I am not able to open it with ROOT (neither v5-34-20 nor v6-00-02): [...]$ root B-4p-0-1-v1510_14TEV_50PileUp_101175088.root root [0] Attaching file B-4p-0-1-v1510_14TEV_50PileUp_101175088.root as _file0... Error in <TFile::Init>: file B-4p-0-1-v1510_14TEV_50PileUp_101175088.root is truncated at 503316480 bytes: should be 536067640, trying to recover Info in <TFile::Recover>: B-4p-0-1-v1510_14TEV_50PileUp_101175088.root, recovered key TProcessID:ProcessID0 at address 322 Warning in <TFile::Init>: successfully recovered 1 keys Error in <TFile::ReadBuffer>: error reading all requested bytes from file B-4p-0-1-v1510_14TEV_50PileUp_101175088.root, got 0 of 7420 Warning in <TFile::GetRecordHeader>: B-4p-0-1-v1510_14TEV_50PileUp_101175088.root: failed to read the StreamerInfo data from disk. root [1] _file0 (class TFile*)0x0 (well, try to exclude this particular file from the list of your input files as it seems to be broken).

Hi Wile,

Sorry about that. It was not properly copied. Now the file can be opened
fine. Please find hte file at the same place.

Thanks

Check the following.

  1. Is it possible that you have two different versions on the “DelphesClasses.h” file? One in the “current subdirectory” where the “Linkdef.h” resides (used by “rootcint”) and another one “classes/DelphesClasses.h” (#included in “Analyser.C”).
  2. Check the relevant “ClassDef” lines in the “DelphesClasses.h” file for both classes that make problems, i.e. “Event” and “LHEFEvent”. Your root file contains version 1 of “Event” and 2 of “LHEFEvent”, so you should have something like “ClassDef(Event, 1)” and “ClassDef(LHEFEvent, 2)”.

Hi Wile,

Thanks for the suggestions.
(1) The DelphesClasses.h in the current directory and in the classes/DelphesClasses.h are
the same. Even if I remove DelphesClasses.h and point to just classes/DelphesClasses.h everywhere
in the code and Makefile, I still get the same error.

(2) I checked in classes/DelphesClasses.h that class “Event” corresponds to ClassDef(Event, 1)
and LHEFEvent to ClassDef(LHEFEvent, 2)

It seems that there is a version mismatch between the rootfile and the code. How can I correct that now?

Thanks,
Shilpi

Hi Wile,

I also wanted to ask a very naive question as to how to check the version of class Event and LHEFEvent
in the rootfile.

Thanks,
Shilpi

You can “inspect” your root file using: root [0] TFile *f = TFile::Open("B-4p-0-1-v1510_14TEV_50PileUp_101175088.root") root [1] f->MakeProject("MyRootFile", "*", "recreate++") root [2] Event::Class_Version() root [3] LHEFEvent::Class_Version() root [4] .class Event root [5] .class LHEFEvent root [6] f->ls() root [7] Delphes->Print() and afterwards you can simply use the created shared library with tiny dictionaries: root [0] .L MyRootFile/MyRootFile.so root [1] Event::Class_Version() root [2] LHEFEvent::Class_Version() root [3] .class Event root [4] .class LHEFEvent root [5] TFile *f = TFile::Open("B-4p-0-1-v1510_14TEV_50PileUp_101175088.root") root [6] f->ls() root [7] Delphes->Print() Note that the TFile::MakeProject will always INCREASE all class versions by 1 in the tiny dictionaries that it generates.

Hi Wile,

Thanks for the help. I just wanted to mention one more thing.
If I do not use the Makefile and use ACLiC to build the dictionaries
and compile the code:

.L Analyser.C++
Analyse t
t.Loop("input1","input2");

Then it does not give the same problem. It runs fine.
I understand that this way also, the same code of DelphesClasses.h is used.
Is that right?

Thanks,
Shilpi

It will #include “classes/DelphesClasses.h” but it is not clear where the “classes/” subdirectory comes from (the same for #include “external/ExRootAnalysis/ExRoot…h”).
Try: root [0] gSystem->GetIncludePath()

Well, if “.L Analyser.C++” works fine for you then this possibly means that you have “./rootlogon.C” and/or “./.rootrc” and/or “${HOME}/.rootrc” which modify your interactive ROOT session on startup (and then you need to introduce appropriate modifications when building the standalone “main.exe”, too).

There is another thing that seems strange to me.
Your root file contains 10 (or 11) classes for which you need a dictionary, so why do you get problems for 2 of them only?

Try the attached files (they should generate dictionaries for all involved classes).
Linkdef.h (398 Bytes)
Makefile.txt (566 Bytes)

Hi Wile,

Many thanks for looking into the problem. With the attached files I still get the same problem.
is it working for you?

Thanks,
Shilpi

I cannot really test it because I do not have “libDelphes” (and related “classes/" and "external/ExRootAnalysis/”).
I’m afraid that you need to find people who use the same root files and ask them for help.

I’ve got another idea …

Check the ROOT version …

  1. that you use now (while analyzing your data)
  2. that was used to compile your “libDelphes.so
  3. that was used to create your root files

I would say that versions from point 1. and 2. should be exactly the same (make also sure that they both use the same compiler versions) but they can be newer than the version from point 3. (though there are known cases in which “backwards compatibility” was a real problem, so when analyzing data you might need to use exactly the same version that was used to create your root files).

Hi Wile,

Thanks for the suggestion. I made sure that the 3 root versions are the same.
I still get the same error.

Below I paste the whole error[1]

Thanks,
Shilp

[1]


Warning in <TClass::TClass>: no dictionary for class LHEFEvent is available
Warning in <TClass::TClass>: no dictionary for class Event is available
Warning in <TStreamerInfo::BuildCheck>: 
   The StreamerInfo from /uscms_data/d2/jshilpi/GuestAndVisitorProgram_2014/UserCode/spadhi/Snowmass/Delphes/Delphes-3.0.9/try.root does not match existing one (Event:1)
   The existing one has not been used yet and will be discarded.
   Reading the file /uscms_data/d2/jshilpi/GuestAndVisitorProgram_2014/UserCode/spadhi/Snowmass/Delphes/Delphes-3.0.9/try.root will work properly, however writing object of
   type Event will not work properly.  Most likely the version number
   of the class was not properly updated [See ClassDef(Event,1)].
Fatal: (cl==0 || info==0) && (cl!=0 || info!=0) violated at line 2028 of `/build/muz/53x/g462/BUILD/slc5_amd64_gcc462/lcg/root/5.32.00-cms18/root-5.32.00/io/io/src/TStreamerInfo.cxx'
aborting

#0  0x0000003043e98c05 in waitpid () from /lib64/libc.so.6
#1  0x0000003043e3c481 in do_system () from /lib64/libc.so.6
#2  0x00002b04fa2daaf0 in TUnixSystem::StackTrace() () from /uscmst1/prod/sw/cms/slc5_amd64_gcc462/cms/cmssw/CMSSW_5_3_6/external/slc5_amd64_gcc462/lib/libCore.so
#3  0x00002b04fa225192 in DefaultErrorHandler(int, bool, char const*, char const*) () from /uscmst1/prod/sw/cms/slc5_amd64_gcc462/cms/cmssw/CMSSW_5_3_6/external/slc5_amd64_gcc462/lib/libCore.so
#4  0x00002b04fa22566e in ErrorHandler () from /uscmst1/prod/sw/cms/slc5_amd64_gcc462/cms/cmssw/CMSSW_5_3_6/external/slc5_amd64_gcc462/lib/libCore.so
#5  0x00002b04fa225b82 in Fatal(char const*, char const*, ...) () from /uscmst1/prod/sw/cms/slc5_amd64_gcc462/cms/cmssw/CMSSW_5_3_6/external/slc5_amd64_gcc462/lib/libCore.so
#6  0x00002b04fb2cebb3 in TStreamerInfo::CompareContent(TClass*, TVirtualStreamerInfo*, bool, bool) () from /uscmst1/prod/sw/cms/slc5_amd64_gcc462/cms/cmssw/CMSSW_5_3_6/external/slc5_amd64_gcc462/lib/libRIO.so
#7  0x00002b04fb2d0f33 in TStreamerInfo::BuildCheck() () from /uscmst1/prod/sw/cms/slc5_amd64_gcc462/cms/cmssw/CMSSW_5_3_6/external/slc5_amd64_gcc462/lib/libRIO.so
#8  0x00002b04fb29f8ad in TFile::ReadStreamerInfo() () from /uscmst1/prod/sw/cms/slc5_amd64_gcc462/cms/cmssw/CMSSW_5_3_6/external/slc5_amd64_gcc462/lib/libRIO.so
#9  0x00002b04fb2a2604 in TFile::Init(bool) () from /uscmst1/prod/sw/cms/slc5_amd64_gcc462/cms/cmssw/CMSSW_5_3_6/external/slc5_amd64_gcc462/lib/libRIO.so
#10 0x00002b04fb2a3383 in TFile::TFile(char const*, char const*, char const*, int) () from /uscmst1/prod/sw/cms/slc5_amd64_gcc462/cms/cmssw/CMSSW_5_3_6/external/slc5_amd64_gcc462/lib/libRIO.so
#11 0x00002b04fb2ad593 in TFile::Open(char const*, char const*, char const*, int, int) () from /uscmst1/prod/sw/cms/slc5_amd64_gcc462/cms/cmssw/CMSSW_5_3_6/external/slc5_amd64_gcc462/lib/libRIO.so
#12 0x00002b04fbf1778f in TChain::LoadTree(long long) () from /uscmst1/prod/sw/cms/slc5_amd64_gcc462/cms/cmssw/CMSSW_5_3_6/external/slc5_amd64_gcc462/lib/libTree.so
#13 0x00002b04fbf15b56 in TChain::GetEntries() const () from /uscmst1/prod/sw/cms/slc5_amd64_gcc462/cms/cmssw/CMSSW_5_3_6/external/slc5_amd64_gcc462/lib/libTree.so
#14 0x0000000000405624 in ExRootTreeReader::GetEntries (this=0x1c370620) at external/ExRootAnalysis/ExRootTreeReader.h:32