Merging root files containing vector<myclass>

Hi ,
I have root files in whic I have put objects of classes and vectors of classes that I have defined using rootcint and LinkDef.h
I have a problem with merging them.
I try this code for merging them:

{
TChain chain("t");
chain.Add("ttwh1.root");
chain.Add("ttwh2.root");
chain.Merge("out.root");
}

but it gives a lot of warning from TSreamerInfo and although finally
it produces the out.root it is not readable and this message appears
when tryig to read the content of out.root:

Warning in TStreamerInfo::BuildCheck:
The StreamerInfo of class myevent read from file majid.root
has the same version (=1) as the active class but a different checksum.
You should update the version to ClassDef(myevent,2).
Do not try to write objects with the current class definition,
the files will not be readable.
Is there any way to merge such root files whic do not have histo in them?
Thanks for any comment,
Majid

Hi,

The best is to load your shared library (including the dictionary you generated via rootcint) before doing the merge.

Now it is also possible that the message is really correct and that you somehow generated the file ttwh1 and ttwh2 with TWO different versions of your class AND you forgot to increase the ClassDef version number when you changed your class. If this is the case, you first would need to increase this version number and recompile then take the newer of the two files and clone the content (so that the resulting file is stored using the new class version) and finally do the merge using this new file.

Cheers,
Philippe.

Hi Philippe,
Yes, Thanks , when I load the library it works,
You are a real expert.
Cheers,
Majid

Hi ,
Now for merging it is ok but when reading a problem appears when
reading a vector in my root file.
my classes are as the following:

#ifndef __MYEVENT_HH__
#define __MYEVENT_HH__
#include "TObject.h"
using namespace std;
#include <vector>
#include "mytrack.h"
#include "myobject.h"

class myevent : public TObject {
  
  public :
    myevent(){;}
  ~myevent(){;}

  vector<myobject> Jets;
  vector<myobject> HLTElectrons;
  vector<myobject> HLTMuons;
  vector<myobject> L1mu;
  vector<myobject> L1ele;
  vector<myobject> L1Tau;
  vector<myobject> L2Tau;
  vector<myobject> RecMet;
  vector<myobject> GenMet;
  vector<myobject> MCTau;
  vector<myobject> MCbjet;
  vector<myobject> MCmuon;
  vector<myobject> MCelectron;
 
  private :
    //    vector<mytrack> mytt;
  ClassDef (myevent,1)
};
#endif
#ifndef __MYOBJECT_HH__
#define __MYOBJECT_HH__
#include "TROOT.h"
#include "TObject.h"
using namespace std;
#include <vector>
#include "mytrack.h"
class myobject : public TObject {
public :
  myobject(){;}
  ~myobject(){;}

  float pt,eta,phi,charge,E,px,py,pz;
  //  double cone1,cone2;
  bool tagged;
  vector<mytrack> tracks;
  vector<double> ConesInfo;
  int nprong;
/*    double cone1; */
/*    double cone2; */
/*    double cone3; */
/*    double cone4; */

  ClassDef (myobject,1)
};
#endif
#ifndef __MYTRACK_HH__
#define __MYTRACK_HH__
#include "TROOT.h"
#include "TObject.h"
#include <vector>
class mytrack : public TObject {
public :
  mytrack(){;}
  ~mytrack(){;}
  float px,py,pz,pt,eta,phi,charge,E;
 
  ClassDef (mytrack,1)
};
#endif

as you see in myobject I have ConesInfo which is vector but when reading it in the merged file it complains :

Warning in TStreamerInfo::BuildOld: Cannot convert myobject::ConesInfo from type:vector<double,allocator > to type:vector, skip element

but it was ok in root files berfore merging.
Thanks for reply,
Cheers,
Majid

Hi,

You never specified which version of ROOT you were using.
I think this problem has been solved a while back.
Try with ROOT 4.03/02 and let me know.
Cheers,
Philippe.

Hi Philippe,
ok it works perfect with root432 gcc3.2.3. I was using root3.10.02 gcc3.2.3.
Cheers,
Majid