Filling a tree with a tobject containing vectors

Hi,
I have a class, dinamically allocating n integers to be used as words for a trigger bit map (I use a std::vector). I want one istance of this class to be added as a tree branch, in order to store per-event trigger information.

If the output file is output.root, when I try and do

root -l .L TriggerInfo.C+ // the class TFile *f = new TFile("output.root")
I get the following complaint:

[code]Warning in TClass::TClass: no dictionary for class TEvent is available
Warning in TStreamerInfo::BuildCheck:
The StreamerInfo of class TriggerInfo read from file output.root
has the same version (=2) as the active class but a different checksum.
You should update the version to ClassDef(TriggerInfo,3).
Do not try to write objects with the current class definition,
the files will not be readable.

Warning in TClass::TClass: no dictionary for class TMET is available
Warning in TClass::TClass: no dictionary for class Muon is available
Warning in TClass::TClass: no dictionary for class Vertex is available
Warning in TClass::TClass: no dictionary for class TJet is available
Warning in TClass::TClass: no dictionary for class MuL1 is available
Warning in TClass::TClass: no dictionary for class TruthParticle is available
Warning in TClass::TClass: no dictionary for class TElectron is available
[/code]
(as you would note, I have a bunch of TObjects in the tree - TEvent, TMET - and TClonesArray of TObjects for the other non-compiled classes).

Is this a serious issue or just an ACLiC problem which should be harmless when (as I usually did before introducing this new class) I run my analysis from g++ compiled code?
What does that error actually mean?

[quote]What does that error actually mean?[/quote]They means that you are missing the dictionary (and probably the definition) for many of your classes and that for the one class for which you do have the definition and the dictionary (I am guessing it is in the file TriggerInfo.C), you have changed the schema but have not changed the class version (re-read the User’s Guide chapter on I/O for more details).

Cheers,
Philippe.

the problem is that I actually didn’t do that (I use the same class version for both generating my tree and reading it)
it happens with all and only the TObjects containing std::vector’s…

Hi,

Did you load all the dictionary for all your classes in both the writing and the reading?

Philippe.

Yes I did: when I generate the TTree, I use a compiled C++ code (of course including the object classes and the proper roodict dictionary), while to read it in interactive mode I do

[code]root [0] .L TElectron.C+
root [1] .L TJet.C+
root [2] .L Vertex.C+
root [3] .L TriggerInfo.C+
root [4] .L TriggerMap.C+
root [5] .L TruthParticle.C+
root [6] .L Muon.C+
root [7] .L TEvent.C+
root [8] .L MuL1.C+
root [9] .L TMET.C+
root [10] f=new TFile(“output.root”)

Warning in TStreamerInfo::BuildCheck:
The StreamerInfo of class TruthParticle read from file output.root
has the same version (=6) as the active class but a different checksum.
You should update the version to ClassDef(TruthParticle,7).
Do not try to write objects with the current class definition,
the files will not be readable.
[/code]

(here the only TObject still including std::vectors is TruthParticle)

The problem is that, if I run on the TTree using a C++ compiled code (properly including object classes and dictionary), I do not get any warning like this. Should I assume everything is okay, and it’s ACLiC’s fault, or is there some dangerous background I am not aware of when running using g++ compiled code?

Cheers,
Philippe.

Actually when I run from ROOT 5.28.00a (afs) I do not get that warning anymore. The output of the command you suggested is

[quote]root [11] TClass::GetClass(“TruthParticle”)->GetStreamerInfos()->ls();
OBJ: TObjArray TObjArray An array of objects : 0

StreamerInfo for class: TruthParticle, version=6, checksum=0xc566e920
TObject BASE offset= 0 type=66 Basic ROOT object
Float_t m_pt offset= 0 type= 5
Float_t m_m offset= 0 type= 5
Float_t m_eta offset= 0 type= 5
Float_t m_phi offset= 0 type= 5
Int_t m_status offset= 0 type= 3
Int_t m_barcode offset= 0 type= 3
vector<Int_t> m_parents offset= 0 type=300 ,stl=1, ctype=3,
vector<Int_t> m_children offset= 0 type=300 ,stl=1, ctype=3,
Int_t m_pdgId offset= 0 type= 3
Float_t m_charge offset= 0 type= 5
Float_t m_vx_x offset= 0 type= 5
Float_t m_vx_y offset= 0 type= 5
Float_t m_vx_z offset= 0 type= 5
vector<Int_t> m_child_index offset= 0 type=300 ,stl=1, ctype=3,
vector<Int_t> m_parent_index offset= 0 type=300 ,stl=1, ctype=3,
[/quote]

In ROOT 5.26/00e, the version used to create the TTree, this output is truncated after the first line (the OBJ one).

Is there any reason for which I can’t open the tree with the same ROOT version I used to create it?

Philippe

I call it before compiling classes via ACLiC but it still does not work…

Hi,

Can you send me the output of:root [0] .L TElectron.C+ root [1] .L TJet.C+ root [2] .L Vertex.C+ root [3] .L TriggerInfo.C+ root [4] .L TriggerMap.C+ root [5] .L TruthParticle.C+ root [6] .L Muon.C+ root [7] .L TEvent.C+ root [8] .L MuL1.C+ root [9] .L TMET.C+ root [10] TClass::GetClass("TruthParticle")->GetStreamerInfo()->ls();and of root [1] f=new TFile("output.root") root [2] TClass::GetClass("TruthParticle")->GetStreamerInfo()->ls();

Cheers,
Philippe.


I get

[code]root [0] .L TElectron.C+
root [1] .L TJet.C+
root [2] .L Vertex.C+
root [3] .L TriggerInfo.C+
root [4] .L TriggerMap.C+
root [5] .L TruthParticle.C+
root [6] .L Muon.C+
root [7] .L TEvent.C+
root [8] .L MuL1.C+
root [9] .L TMET.C+
root [10]  TClass::GetClass("TruthParticle")->GetStreamerInfo()->ls();

StreamerInfo for class: TruthParticle, version=6, checksum=0x2004d9d0
  TObject        BASE            offset=  0 type=66 Basic ROOT object   
  Float_t        m_pt            offset= 12 type= 5                     
  Float_t        m_m             offset= 16 type= 5                     
  Float_t        m_eta           offset= 20 type= 5                     
  Float_t        m_phi           offset= 24 type= 5                     
  Int_t          m_status        offset= 28 type= 3                     
  Int_t          m_barcode       offset= 32 type= 3                     
  vector<int>    m_parents       offset= 36 type=300 ,stl=1, ctype=3,                     
  vector<int>    m_children      offset= 48 type=300 ,stl=1, ctype=3,                     
  Int_t          m_pdgId         offset= 60 type= 3                     
  Float_t        m_charge        offset= 64 type= 5                     
  Float_t        m_vx_x          offset= 68 type= 5                     
  Float_t        m_vx_y          offset= 72 type= 5                     
  Float_t        m_vx_z          offset= 76 type= 5                     
  vector<int>    m_child_index   offset= 80 type=300 ,stl=1, ctype=3,                     
  vector<int>    m_parent_index  offset= 92 type=300 ,stl=1, ctype=3,                     
   i= 0, TObject         type= 66, offset=  0, len=1, method=0
   i= 1, m_pt            type= 25, offset= 12, len=4, method=0
   i= 2, m_status        type= 23, offset= 28, len=2, method=0
   i= 3, m_parents       type=300, offset= 36, len=1, method=0
   i= 4, m_children      type=300, offset= 48, len=1, method=0
   i= 5, m_pdgId         type=  3, offset= 60, len=1, method=0
   i= 6, m_charge        type= 25, offset= 64, len=4, method=0
   i= 7, m_child_index   type=300, offset= 80, len=1, method=0
   i= 8, m_parent_index  type=300, offset= 92, len=1, method=0
[/code]

and


[code]root [0] f=new TFile("output.root")
Warning in <TClass::TClass>: no dictionary for class TEvent is available
Warning in <TClass::TClass>: no dictionary for class TriggerInfo is available
Warning in <TClass::TClass>: no dictionary for class TMET is available
Warning in <TClass::TClass>: no dictionary for class Muon is available
Warning in <TClass::TClass>: no dictionary for class Vertex is available
Warning in <TClass::TClass>: no dictionary for class TJet is available
Warning in <TClass::TClass>: no dictionary for class MuL1 is available
Warning in <TClass::TClass>: no dictionary for class TruthParticle is available
Warning in <TClass::TClass>: no dictionary for class TElectron is available
Warning in <TClass::TClass>: no dictionary for class TriggerMap is available
(class TFile*)0x9973d38
root [1] TClass::GetClass("TruthParticle")->GetStreamerInfo()->ls();

StreamerInfo for class: TruthParticle, version=6, checksum=0xc566e920
  TObject        BASE            offset=  0 type=66 Basic ROOT object   
  Float_t        m_pt            offset= 12 type= 5                     
  Float_t        m_m             offset= 16 type= 5                     
  Float_t        m_eta           offset= 20 type= 5                     
  Float_t        m_phi           offset= 24 type= 5                     
  Int_t          m_status        offset= 28 type= 3                     
  Int_t          m_barcode       offset= 32 type= 3                     
  vector<Int_t>  m_parents       offset= 36 type=300 ,stl=1, ctype=3,                     
  vector<Int_t>  m_children      offset= 48 type=300 ,stl=1, ctype=3,                     
  Int_t          m_pdgId         offset= 60 type= 3                     
  Float_t        m_charge        offset= 64 type= 5                     
  Float_t        m_vx_x          offset= 68 type= 5                     
  Float_t        m_vx_y          offset= 72 type= 5                     
  Float_t        m_vx_z          offset= 76 type= 5                     
  vector<Int_t>  m_child_index   offset= 80 type=300 ,stl=1, ctype=3,                     
  vector<Int_t>  m_parent_index  offset= 92 type=300 ,stl=1, ctype=3,                     
   i= 0, TObject         type= 66, offset=  0, len=1, method=0
   i= 1, m_pt            type=  5, offset= 12, len=1, method=0
   i= 2, m_m             type=  5, offset= 16, len=1, method=0
   i= 3, m_eta           type=  5, offset= 20, len=1, method=0
   i= 4, m_phi           type=  5, offset= 24, len=1, method=0
   i= 5, m_status        type=  3, offset= 28, len=1, method=0
   i= 6, m_barcode       type=  3, offset= 32, len=1, method=0
   i= 7, m_parents       type=300, offset= 36, len=1, method=0
   i= 8, m_children      type=300, offset= 48, len=1, method=0
   i= 9, m_pdgId         type=  3, offset= 60, len=1, method=0
   i=10, m_charge        type=  5, offset= 64, len=1, method=0
   i=11, m_vx_x          type=  5, offset= 68, len=1, method=0
   i=12, m_vx_y          type=  5, offset= 72, len=1, method=0
   i=13, m_vx_z          type=  5, offset= 76, len=1, method=0
   i=14, m_child_index   type=300, offset= 80, len=1, method=0
   i=15, m_parent_index  type=300, offset= 92, len=1, method=0
[/code]

I get

[code]root [0] .L TElectron.C+
root [1] .L TJet.C+
root [2] .L Vertex.C+
root [3] .L TriggerInfo.C+
root [4] .L TriggerMap.C+
root [5] .L TruthParticle.C+
root [6] .L Muon.C+
root [7] .L TEvent.C+
root [8] .L MuL1.C+
root [9] .L TMET.C+
root [10] TClass::GetClass(“TruthParticle”)->GetStreamerInfo()->ls();

StreamerInfo for class: TruthParticle, version=6, checksum=0x2004d9d0
TObject BASE offset= 0 type=66 Basic ROOT object
Float_t m_pt offset= 12 type= 5
Float_t m_m offset= 16 type= 5
Float_t m_eta offset= 20 type= 5
Float_t m_phi offset= 24 type= 5
Int_t m_status offset= 28 type= 3
Int_t m_barcode offset= 32 type= 3
vector m_parents offset= 36 type=300 ,stl=1, ctype=3,
vector m_children offset= 48 type=300 ,stl=1, ctype=3,
Int_t m_pdgId offset= 60 type= 3
Float_t m_charge offset= 64 type= 5
Float_t m_vx_x offset= 68 type= 5
Float_t m_vx_y offset= 72 type= 5
Float_t m_vx_z offset= 76 type= 5
vector m_child_index offset= 80 type=300 ,stl=1, ctype=3,
vector m_parent_index offset= 92 type=300 ,stl=1, ctype=3,
i= 0, TObject type= 66, offset= 0, len=1, method=0
i= 1, m_pt type= 25, offset= 12, len=4, method=0
i= 2, m_status type= 23, offset= 28, len=2, method=0
i= 3, m_parents type=300, offset= 36, len=1, method=0
i= 4, m_children type=300, offset= 48, len=1, method=0
i= 5, m_pdgId type= 3, offset= 60, len=1, method=0
i= 6, m_charge type= 25, offset= 64, len=4, method=0
i= 7, m_child_index type=300, offset= 80, len=1, method=0
i= 8, m_parent_index type=300, offset= 92, len=1, method=0
[/code]

and

[code]root [0] f=new TFile(“output.root”)
Warning in TClass::TClass: no dictionary for class TEvent is available
Warning in TClass::TClass: no dictionary for class TriggerInfo is available
Warning in TClass::TClass: no dictionary for class TMET is available
Warning in TClass::TClass: no dictionary for class Muon is available
Warning in TClass::TClass: no dictionary for class Vertex is available
Warning in TClass::TClass: no dictionary for class TJet is available
Warning in TClass::TClass: no dictionary for class MuL1 is available
Warning in TClass::TClass: no dictionary for class TruthParticle is available
Warning in TClass::TClass: no dictionary for class TElectron is available
Warning in TClass::TClass: no dictionary for class TriggerMap is available
(class TFile*)0x9973d38
root [1] TClass::GetClass(“TruthParticle”)->GetStreamerInfo()->ls();

StreamerInfo for class: TruthParticle, version=6, checksum=0xc566e920
TObject BASE offset= 0 type=66 Basic ROOT object
Float_t m_pt offset= 12 type= 5
Float_t m_m offset= 16 type= 5
Float_t m_eta offset= 20 type= 5
Float_t m_phi offset= 24 type= 5
Int_t m_status offset= 28 type= 3
Int_t m_barcode offset= 32 type= 3
vector<Int_t> m_parents offset= 36 type=300 ,stl=1, ctype=3,
vector<Int_t> m_children offset= 48 type=300 ,stl=1, ctype=3,
Int_t m_pdgId offset= 60 type= 3
Float_t m_charge offset= 64 type= 5
Float_t m_vx_x offset= 68 type= 5
Float_t m_vx_y offset= 72 type= 5
Float_t m_vx_z offset= 76 type= 5
vector<Int_t> m_child_index offset= 80 type=300 ,stl=1, ctype=3,
vector<Int_t> m_parent_index offset= 92 type=300 ,stl=1, ctype=3,
i= 0, TObject type= 66, offset= 0, len=1, method=0
i= 1, m_pt type= 5, offset= 12, len=1, method=0
i= 2, m_m type= 5, offset= 16, len=1, method=0
i= 3, m_eta type= 5, offset= 20, len=1, method=0
i= 4, m_phi type= 5, offset= 24, len=1, method=0
i= 5, m_status type= 3, offset= 28, len=1, method=0
i= 6, m_barcode type= 3, offset= 32, len=1, method=0
i= 7, m_parents type=300, offset= 36, len=1, method=0
i= 8, m_children type=300, offset= 48, len=1, method=0
i= 9, m_pdgId type= 3, offset= 60, len=1, method=0
i=10, m_charge type= 5, offset= 64, len=1, method=0
i=11, m_vx_x type= 5, offset= 68, len=1, method=0
i=12, m_vx_y type= 5, offset= 72, len=1, method=0
i=13, m_vx_z type= 5, offset= 76, len=1, method=0
i=14, m_child_index type=300, offset= 80, len=1, method=0
i=15, m_parent_index type=300, offset= 92, len=1, method=0
[/code]

Hi,

So the problem (apparently fixed in v5.28) is the difference between ‘vector’ and ‘vector<Int_t>’ leads to a spurious warning message.
So in this very case the warning message is errorneous and can be safely ignored (it can not be safely ignored in the general case).

Philippe.

thank you for your help!