How to copy a subset of a Chain of Trees to a single Tree

Hi,
I need to copy a subset of the branches of a chain of trees to a single new tree.
In the root tutorials I found a macro ( root.cern.ch/root/html/examples/copytree.C.html ) that copies a subset of a tree to a new tree. Is there a way to do the same for a chain of trees ?
I have tryed using this same macro but the new Tree seems to get corrputed .
Thanks,
Andre

PS: Bellow follows the macro that I addapted and doesn’t work !

make_subtree( TString& files_list){
// Root macro to copy a subset of a Chain of Trees to a new Tree
// The input Trees have been generated by the CMS Famos package
gROOT->Reset();
gSystem->Load(“libExRootAnalysisReader”);

// Create a chain with the list of input files
TChain chain(“Analysis”);
FillChain(chain, files_list);

// Use ExRootAnalysisReader method to access the branch
ExRootTreeReader *treeReader = new ExRootTreeReader(&chain);
TClonesArray *branchMuonGLB = treeReader->UseBranch(“MuonGLB”);

// Enable only the branches one wants to keep
chain.SetBranchAddress(“MuonGLB”, &branchMuonGLB );
chain.SetBranchStatus("*",0);
chain.SetBranchStatus(“MuonGLB”,1);

//Create a new file + a clone of old tree in new file
TFile *newfile = new TFile(“small.root”,“recreate”);
TTree *newtree = chain.CloneTree();

newtree->Print();
newfile->Write();
delete newfile;

Your code looks correct unless your branch muonGLB is not a top level branch.
Could yous end the output of chain.Print() and newtree.Print(0 ?

Rene

Dear Rene,
Bellow follows the newtree and chain Print().

===================================================
Here Follows the new Tree print:


*Tree :Analysis : Analysis tree *
*Entries : 1000 : Total = 8998 bytes File Size = 0 *

  •    :          : Tree compression factor =   1.00                       *
    

*Br 0 :MuonGLB : MuonGLB_ *
*Entries : 1000 : Total Size= 8657 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

===================================================
Here Follows the Chain print:


*Tree :Analysis : Analysis tree *
*Entries : 500 : Total = 322199672 bytes File Size = 87188894 *

  •    :          : Tree compression factor =   3.73                       *
    

*Br 0 :Gen_size : Gen_size/I *
*Entries : 500 : Total Size= 2652 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *

*Br 1 :Gen : Gen_ *
*Entries : 500 : Total Size= 843527 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 2 :Gen.fUniqueID : fUniqueID[Gen_] *
*Entries : 500 : Total Size= 1650638 bytes File Size = 12062 *
*Baskets : 26 : Basket Size= 64000 bytes Compression= 133.18 *

*Br 3 :Gen.fBits : fBits[Gen_] *
*Entries : 500 : Total Size= 1650510 bytes File Size = 12895 *
*Baskets : 26 : Basket Size= 64000 bytes Compression= 124.57 *

*Br 4 :Gen.PID : PID[Gen_] *
*Entries : 500 : Total Size= 1650446 bytes File Size = 375629 *
*Baskets : 26 : Basket Size= 64000 bytes Compression= 4.28 *

*Br 5 :Gen.Status : Status[Gen_] *
*Entries : 500 : Total Size= 1650542 bytes File Size = 123359 *
*Baskets : 26 : Basket Size= 64000 bytes Compression= 13.02 *

*Br 6 :Gen.M1 : M1[Gen_] *
*Entries : 500 : Total Size= 1650414 bytes File Size = 369091 *
*Baskets : 26 : Basket Size= 64000 bytes Compression= 4.35 *

*Br 7 :Gen.M2 : M2[Gen_] *
*Entries : 500 : Total Size= 1650414 bytes File Size = 68556 *
*Baskets : 26 : Basket Size= 64000 bytes Compression= 23.43 *

*Br 8 :Gen.D1 : D1[Gen_] *
*Entries : 500 : Total Size= 1650414 bytes File Size = 406356 *
*Baskets : 26 : Basket Size= 64000 bytes Compression= 3.95 *

*Br 9 :Gen.D2 : D2[Gen_] *
*Entries : 500 : Total Size= 1650414 bytes File Size = 406496 *
*Baskets : 26 : Basket Size= 64000 bytes Compression= 3.95 *

*Br 10 :Gen.E : E[Gen_] *
*Entries : 500 : Total Size= 1650382 bytes File Size = 1482733 *
*Baskets : 26 : Basket Size= 64000 bytes Compression= 1.08 *

*Br 11 :Gen.Px : Px[Gen_] *
*Entries : 500 : Total Size= 1650414 bytes File Size = 1471737 *
*Baskets : 26 : Basket Size= 64000 bytes Compression= 1.09 *

*Br 12 :Gen.Py : Py[Gen_] *
*Entries : 500 : Total Size= 1650414 bytes File Size = 1471635 *
*Baskets : 26 : Basket Size= 64000 bytes Compression= 1.09 *

*Br 13 :Gen.Pz : Pz[Gen_] *
*Entries : 500 : Total Size= 1650414 bytes File Size = 1521842 *
*Baskets : 26 : Basket Size= 64000 bytes Compression= 1.06 *

*Br 14 :Gen.PT : PT[Gen_] *
*Entries : 500 : Total Size= 1650414 bytes File Size = 1423206 *
*Baskets : 26 : Basket Size= 64000 bytes Compression= 1.13 *

*Br 15 :Gen.Eta : Eta[Gen_] *
*Entries : 500 : Total Size= 1650446 bytes File Size = 1461050 *
*Baskets : 26 : Basket Size= 64000 bytes Compression= 1.10 *

*Br 16 :Gen.Phi : Phi[Gen_] *
*Entries : 500 : Total Size= 1650446 bytes File Size = 1461669 *
*Baskets : 26 : Basket Size= 64000 bytes Compression= 1.10 *

*Br 17 :Gen.T : T[Gen_] *
*Entries : 500 : Total Size= 1650382 bytes File Size = 271340 *
*Baskets : 26 : Basket Size= 64000 bytes Compression= 5.92 *

*Br 18 :Gen.X : X[Gen_] *
*Entries : 500 : Total Size= 1650382 bytes File Size = 273294 *
*Baskets : 26 : Basket Size= 64000 bytes Compression= 5.88 *

*Br 19 :Gen.Y : Y[Gen_] *
*Entries : 500 : Total Size= 1650382 bytes File Size = 273278 *
*Baskets : 26 : Basket Size= 64000 bytes Compression= 5.88 *

*Br 20 :Gen.Z : Z[Gen_] *
*Entries : 500 : Total Size= 1650382 bytes File Size = 275742 *
*Baskets : 26 : Basket Size= 64000 bytes Compression= 5.83 *

*Br 21 :Cal_size : Cal_size/I *
*Entries : 500 : Total Size= 2652 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *

*Br 22 :Cal : Cal_ *
*Entries : 500 : Total Size= 152371 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 23 :Cal.fUniqueID : fUniqueID[Cal_] *
*Entries : 500 : Total Size= 18560782 bytes File Size = 122600 *
*Baskets : 346 : Basket Size= 64000 bytes Compression= 151.32 *

*Br 24 :Cal.fBits : fBits[Cal_] *
*Entries : 500 : Total Size= 18559374 bytes File Size = 131400 *
*Baskets : 346 : Basket Size= 64000 bytes Compression= 141.18 *

*Br 25 :Cal.E : E[Cal_] *
*Entries : 500 : Total Size= 18557966 bytes File Size = 17423285 *
*Baskets : 346 : Basket Size= 64000 bytes Compression= 1.06 *

*Br 26 :Cal.Eta : Eta[Cal_] *
*Entries : 500 : Total Size= 18558670 bytes File Size = 9408578 *
*Baskets : 346 : Basket Size= 64000 bytes Compression= 1.97 *

*Br 27 :Cal.Phi : Phi[Cal_] *
*Entries : 500 : Total Size= 18558670 bytes File Size = 13961779 *
*Baskets : 346 : Basket Size= 64000 bytes Compression= 1.33 *

*Br 28 :Cal.X : X[Cal_] *
*Entries : 500 : Total Size= 18557966 bytes File Size = 13325062 *
*Baskets : 346 : Basket Size= 64000 bytes Compression= 1.39 *

*Br 29 :Cal.Y : Y[Cal_] *
*Entries : 500 : Total Size= 18557966 bytes File Size = 11164150 *
*Baskets : 346 : Basket Size= 64000 bytes Compression= 1.66 *

*Br 30 :Cal.Z : Z[Cal_] *
*Entries : 500 : Total Size= 18557966 bytes File Size = 4991082 *
*Baskets : 346 : Basket Size= 64000 bytes Compression= 3.72 *

*Br 31 :Cal.hasRecHit : hasRecHit[Cal_] *
*Entries : 500 : Total Size= 4641031 bytes File Size = 31249 *
*Baskets : 77 : Basket Size= 64000 bytes Compression= 147.14 *

*Br 32 :Cal.Layer : Layer[Cal_] *
*Entries : 500 : Total Size= 9280520 bytes File Size = 65644 *
*Baskets : 169 : Basket Size= 64000 bytes Compression= 141.06 *

*Br 33 :Cal.SimHits : SimHits[Cal_] *
*Entries : 500 : Total Size= 125056525 bytes File Size = 1392324 *
*Baskets : 500 : Basket Size= 64000 bytes Compression= 89.81 *

*Br 34 :VtxPVF_size : VtxPVF_size/I *
*Entries : 500 : Total Size= 2670 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *

*Br 35 :VtxPVF : VtxPVF_ *
*Entries : 500 : Total Size= 158729 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 36 :VtxPVF.fUniqueID : fUniqueID[VtxPVF_] *
*Entries : 500 : Total Size= 8446 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 37 :VtxPVF.fBits : fBits[VtxPVF_] *
*Entries : 500 : Total Size= 8422 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 38 :VtxPVF.X : X[VtxPVF_] *
*Entries : 500 : Total Size= 8398 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 39 :VtxPVF.Y : Y[VtxPVF_] *
*Entries : 500 : Total Size= 8398 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 40 :VtxPVF.Z : Z[VtxPVF_] *
*Entries : 500 : Total Size= 8398 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 41 :VtxPVF.Chi2 : Chi2[VtxPVF_] *
*Entries : 500 : Total Size= 8416 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 42 :VtxPVF.NDOF : NDOF[VtxPVF_] *
*Entries : 500 : Total Size= 8416 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 43 :VtxPVF.Err[3][3] : Err[VtxPVF_] *
*Entries : 500 : Total Size= 53708 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 44 :VtxPVF.OriginalTracks : OriginalTracks[VtxPVF_] *
*Entries : 500 : Total Size= 41021 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 45 :VtxPVFPrim_size : VtxPVFPrim_size/I *
*Entries : 500 : Total Size= 2694 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *

*Br 46 :VtxPVFPrim : VtxPVFPrim_ *
*Entries : 500 : Total Size= 133505 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 47 :VtxPVFPrim.fUniqueID : fUniqueID[VtxPVFPrim_] *
*Entries : 500 : Total Size= 7358 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 48 :VtxPVFPrim.fBits : fBits[VtxPVFPrim_] *
*Entries : 500 : Total Size= 7334 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 49 :VtxPVFPrim.X : X[VtxPVFPrim_] *
*Entries : 500 : Total Size= 7310 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 50 :VtxPVFPrim.Y : Y[VtxPVFPrim_] *
*Entries : 500 : Total Size= 7310 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 51 :VtxPVFPrim.Z : Z[VtxPVFPrim_] *
*Entries : 500 : Total Size= 7310 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 52 :VtxPVFPrim.Chi2 : Chi2[VtxPVFPrim_] *
*Entries : 500 : Total Size= 7328 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 53 :VtxPVFPrim.NDOF : NDOF[VtxPVFPrim_] *
*Entries : 500 : Total Size= 7328 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 54 :VtxPVFPrim.Err[3][3] : Err[VtxPVFPrim_] *
*Entries : 500 : Total Size= 43660 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 55 :VtxPVFPrim.OriginalTracks : OriginalTracks[VtxPVFPrim_] *
*Entries : 500 : Total Size= 33493 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 56 :Elec_size : Elec_size/I *
*Entries : 500 : Total Size= 2658 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *

*Br 57 :Elec : Elec_ *
*Entries : 500 : Total Size= 85826 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 58 :Elec.fUniqueID : fUniqueID[Elec_] *
*Entries : 500 : Total Size= 3726 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 59 :Elec.fBits : fBits[Elec_] *
*Entries : 500 : Total Size= 3702 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 60 :Elec.CalE : CalE[Elec_] *
*Entries : 500 : Total Size= 3696 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 61 :Elec.CalET : CalET[Elec_] *
*Entries : 500 : Total Size= 3702 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 62 :Elec.CalEta : CalEta[Elec_] *
*Entries : 500 : Total Size= 3708 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 63 :Elec.CalPhi : CalPhi[Elec_] *
*Entries : 500 : Total Size= 3708 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 64 :Elec.TrkP : TrkP[Elec_] *
*Entries : 500 : Total Size= 3696 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 65 :Elec.TrkPx : TrkPx[Elec_] *
*Entries : 500 : Total Size= 3702 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 66 :Elec.TrkPy : TrkPy[Elec_] *
*Entries : 500 : Total Size= 3702 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 67 :Elec.TrkPz : TrkPz[Elec_] *
*Entries : 500 : Total Size= 3702 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 68 :Elec.TrkPT : TrkPT[Elec_] *
*Entries : 500 : Total Size= 3702 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 69 :Elec.TrkEta : TrkEta[Elec_] *
*Entries : 500 : Total Size= 3708 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 70 :Elec.TrkPhi : TrkPhi[Elec_] *
*Entries : 500 : Total Size= 3708 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 71 :Elec.EoverP : EoverP[Elec_] *
*Entries : 500 : Total Size= 3708 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 72 :Elec.EHadOverE : EHadOverE[Elec_] *
*Entries : 500 : Total Size= 3726 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 73 :Elec.DEtaTrkCluster : DEtaTrkCluster[Elec_] *
*Entries : 500 : Total Size= 3756 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 74 :Elec.TrkPixLines : TrkPixLines[Elec_] *
*Entries : 500 : Total Size= 3738 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 75 :Elec.TrkIsolation : TrkIsolation[Elec_] *
*Entries : 500 : Total Size= 3266 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 76 :Elec.TrkStatus : TrkStatus[Elec_] *
*Entries : 500 : Total Size= 3248 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 77 :Elec.Trk : Trk[Elec_] *
*Entries : 500 : Total Size= 5602 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 78 :Elec.Cand : Cand[Elec_] *
*Entries : 500 : Total Size= 5608 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 79 :stuck_out_tongue:hoton_size : Photon_size/I *
*Entries : 500 : Total Size= 2670 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *

*Br 80 :stuck_out_tongue:hoton : Photon_ *
*Entries : 500 : Total Size= 86412 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 81 :stuck_out_tongue:hoton.fUniqueID : fUniqueID[Photon_] *
*Entries : 500 : Total Size= 8018 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 82 :stuck_out_tongue:hoton.fBits : fBits[Photon_] *
*Entries : 500 : Total Size= 7994 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 83 :stuck_out_tongue:hoton.CalPT : CalPT[Photon_] *
*Entries : 500 : Total Size= 7994 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 84 :stuck_out_tongue:hoton.CalEta : CalEta[Photon_] *
*Entries : 500 : Total Size= 8000 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 85 :stuck_out_tongue:hoton.CalPhi : CalPhi[Photon_] *
*Entries : 500 : Total Size= 8000 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 86 :stuck_out_tongue:hoton.VtxZ : VtxZ[Photon_] *
*Entries : 500 : Total Size= 7988 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 87 :stuck_out_tongue:hoton.Isolation : Isolation[Photon_] *
*Entries : 500 : Total Size= 5402 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 88 :stuck_out_tongue:hoton.PixLines : PixLines[Photon_] *
*Entries : 500 : Total Size= 5396 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 89 :stuck_out_tongue:hoton.hasSeed : hasSeed[Photon_] *
*Entries : 500 : Total Size= 4082 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 90 :stuck_out_tongue:hoton.Cand : Cand[Photon_] *
*Entries : 500 : Total Size= 18452 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 91 :MuonL3_size : MuonL3_size/I *
*Entries : 500 : Total Size= 2670 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *

*Br 92 :MuonL3 : MuonL3_ *
*Entries : 500 : Total Size= 369595 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 93 :MuonL3.fUniqueID : fUniqueID[MuonL3_] *
*Entries : 500 : Total Size= 10070 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 94 :MuonL3.fBits : fBits[MuonL3_] *
*Entries : 500 : Total Size= 10046 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 95 :MuonL3.P : P[MuonL3_] *
*Entries : 500 : Total Size= 10022 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 96 :MuonL3.Px : Px[MuonL3_] *
*Entries : 500 : Total Size= 10028 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 97 :MuonL3.Py : Py[MuonL3_] *
*Entries : 500 : Total Size= 10028 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 98 :MuonL3.Pz : Pz[MuonL3_] *
*Entries : 500 : Total Size= 10028 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 99 :MuonL3.PT : PT[MuonL3_] *
*Entries : 500 : Total Size= 10028 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 100 :MuonL3.Eta : Eta[MuonL3_] *
*Entries : 500 : Total Size= 10034 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 101 :MuonL3.Phi : Phi[MuonL3_] *
*Entries : 500 : Total Size= 10034 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 102 :MuonL3.dcaX : dcaX[MuonL3_] *
*Entries : 500 : Total Size= 10040 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 103 :MuonL3.dcaY : dcaY[MuonL3_] *
*Entries : 500 : Total Size= 10040 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 104 :MuonL3.dcaZ : dcaZ[MuonL3_] *
*Entries : 500 : Total Size= 10040 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 105 :MuonL3.dcaP : dcaP[MuonL3_] *
*Entries : 500 : Total Size= 10040 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 106 :MuonL3.dcaPx : dcaPx[MuonL3_] *
*Entries : 500 : Total Size= 10046 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 107 :MuonL3.dcaPy : dcaPy[MuonL3_] *
*Entries : 500 : Total Size= 10046 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 108 :MuonL3.dcaPz : dcaPz[MuonL3_] *
*Entries : 500 : Total Size= 10046 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 109 :MuonL3.dcaPT : dcaPT[MuonL3_] *
*Entries : 500 : Total Size= 10046 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 110 :MuonL3.dcaEta : dcaEta[MuonL3_] *
*Entries : 500 : Total Size= 10052 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 111 :MuonL3.dcaPhi : dcaPhi[MuonL3_] *
*Entries : 500 : Total Size= 10052 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 112 :MuonL3.dcaErr[3][3] : dcaErr[MuonL3_] *
*Entries : 500 : Total Size= 68444 bytes File Size = 42021 *
*Baskets : 1 : Basket Size= 64000 bytes Compression= 1.48 *

*Br 113 :MuonL3.outX : outX[MuonL3_] *
*Entries : 500 : Total Size= 10040 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 114 :MuonL3.outY : outY[MuonL3_] *
*Entries : 500 : Total Size= 10040 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 115 :MuonL3.outZ : outZ[MuonL3_] *
*Entries : 500 : Total Size= 10040 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 116 :MuonL3.outP : outP[MuonL3_] *
*Entries : 500 : Total Size= 10040 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 117 :MuonL3.outPx : outPx[MuonL3_] *
*Entries : 500 : Total Size= 10046 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 118 :MuonL3.outPy : outPy[MuonL3_] *
*Entries : 500 : Total Size= 10046 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 119 :MuonL3.outPz : outPz[MuonL3_] *
*Entries : 500 : Total Size= 10046 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 120 :MuonL3.outPT : outPT[MuonL3_] *
*Entries : 500 : Total Size= 10046 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 121 :MuonL3.outEta : outEta[MuonL3_] *
*Entries : 500 : Total Size= 10052 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 122 :MuonL3.outPhi : outPhi[MuonL3_] *
*Entries : 500 : Total Size= 10052 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 123 :MuonL3.outErr[3][3] : outErr[MuonL3_] *
*Entries : 500 : Total Size= 68444 bytes File Size = 44370 *
*Baskets : 1 : Basket Size= 64000 bytes Compression= 1.40 *

*Br 124 :MuonL3.Chi2 : Chi2[MuonL3_] *
*Entries : 500 : Total Size= 10040 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 125 :MuonL3.NormChi2 : NormChi2[MuonL3_] *
*Entries : 500 : Total Size= 10064 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 126 :MuonL3.dcaOK : dcaOK[MuonL3_] *
*Entries : 500 : Total Size= 4583 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 127 :MuonL3.outOK : outOK[MuonL3_] *
*Entries : 500 : Total Size= 4583 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 128 :MuonL3.NDOF : NDOF[MuonL3_] *
*Entries : 500 : Total Size= 6398 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 129 :MuonL3.Charge : Charge[MuonL3_] *
*Entries : 500 : Total Size= 6410 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 130 :MuonL3.Hits : Hits[MuonL3_] *
*Entries : 500 : Total Size= 6398 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 131 :MuonL3.LostHits : LostHits[MuonL3_] *
*Entries : 500 : Total Size= 6422 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 132 :MuonL3.InvalidHits : InvalidHits[MuonL3_] *
*Entries : 500 : Total Size= 6440 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 133 :MuonGLB_size : MuonGLB_size/I *
*Entries : 500 : Total Size= 2676 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *

*Br 134 :MuonGLB : MuonGLB_ *
*Entries : 500 : Total Size= 376981 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 135 :MuonGLB.fUniqueID : fUniqueID[MuonGLB_] *
*Entries : 500 : Total Size= 10214 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 136 :MuonGLB.fBits : fBits[MuonGLB_] *
*Entries : 500 : Total Size= 10190 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 137 :MuonGLB.P : P[MuonGLB_] *
*Entries : 500 : Total Size= 10166 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 138 :MuonGLB.Px : Px[MuonGLB_] *
*Entries : 500 : Total Size= 10172 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 139 :MuonGLB.Py : Py[MuonGLB_] *
*Entries : 500 : Total Size= 10172 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 140 :MuonGLB.Pz : Pz[MuonGLB_] *
*Entries : 500 : Total Size= 10172 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 141 :MuonGLB.PT : PT[MuonGLB_] *
*Entries : 500 : Total Size= 10172 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 142 :MuonGLB.Eta : Eta[MuonGLB_] *
*Entries : 500 : Total Size= 10178 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 143 :MuonGLB.Phi : Phi[MuonGLB_] *
*Entries : 500 : Total Size= 10178 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 144 :MuonGLB.dcaX : dcaX[MuonGLB_] *
*Entries : 500 : Total Size= 10184 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 145 :MuonGLB.dcaY : dcaY[MuonGLB_] *
*Entries : 500 : Total Size= 10184 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 146 :MuonGLB.dcaZ : dcaZ[MuonGLB_] *
*Entries : 500 : Total Size= 10184 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 147 :MuonGLB.dcaP : dcaP[MuonGLB_] *
*Entries : 500 : Total Size= 10184 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 148 :MuonGLB.dcaPx : dcaPx[MuonGLB_] *
*Entries : 500 : Total Size= 10190 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 149 :MuonGLB.dcaPy : dcaPy[MuonGLB_] *
*Entries : 500 : Total Size= 10190 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 150 :MuonGLB.dcaPz : dcaPz[MuonGLB_] *
*Entries : 500 : Total Size= 10190 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 151 :MuonGLB.dcaPT : dcaPT[MuonGLB_] *
*Entries : 500 : Total Size= 10190 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 152 :MuonGLB.dcaEta : dcaEta[MuonGLB_] *
*Entries : 500 : Total Size= 10196 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 153 :MuonGLB.dcaPhi : dcaPhi[MuonGLB_] *
*Entries : 500 : Total Size= 10196 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 154 :MuonGLB.dcaErr[3][3] : dcaErr[MuonGLB_] *
*Entries : 500 : Total Size= 69677 bytes File Size = 42002 *
*Baskets : 1 : Basket Size= 64000 bytes Compression= 1.48 *

*Br 155 :MuonGLB.outX : outX[MuonGLB_] *
*Entries : 500 : Total Size= 10184 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 156 :MuonGLB.outY : outY[MuonGLB_] *
*Entries : 500 : Total Size= 10184 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 157 :MuonGLB.outZ : outZ[MuonGLB_] *
*Entries : 500 : Total Size= 10184 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 158 :MuonGLB.outP : outP[MuonGLB_] *
*Entries : 500 : Total Size= 10184 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 159 :MuonGLB.outPx : outPx[MuonGLB_] *
*Entries : 500 : Total Size= 10190 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 160 :MuonGLB.outPy : outPy[MuonGLB_] *
*Entries : 500 : Total Size= 10190 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 161 :MuonGLB.outPz : outPz[MuonGLB_] *
*Entries : 500 : Total Size= 10190 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 162 :MuonGLB.outPT : outPT[MuonGLB_] *
*Entries : 500 : Total Size= 10190 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 163 :MuonGLB.outEta : outEta[MuonGLB_] *
*Entries : 500 : Total Size= 10196 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 164 :MuonGLB.outPhi : outPhi[MuonGLB_] *
*Entries : 500 : Total Size= 10196 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 165 :MuonGLB.outErr[3][3] : outErr[MuonGLB_] *
*Entries : 500 : Total Size= 69677 bytes File Size = 44413 *
*Baskets : 1 : Basket Size= 64000 bytes Compression= 1.40 *

*Br 166 :MuonGLB.Chi2 : Chi2[MuonGLB_] *
*Entries : 500 : Total Size= 10184 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 167 :MuonGLB.NormChi2 : NormChi2[MuonGLB_] *
*Entries : 500 : Total Size= 10208 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 168 :MuonGLB.dcaOK : dcaOK[MuonGLB_] *
*Entries : 500 : Total Size= 4625 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 169 :MuonGLB.outOK : outOK[MuonGLB_] *
*Entries : 500 : Total Size= 4625 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 170 :MuonGLB.NDOF : NDOF[MuonGLB_] *
*Entries : 500 : Total Size= 6474 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 171 :MuonGLB.Charge : Charge[MuonGLB_] *
*Entries : 500 : Total Size= 6486 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 172 :MuonGLB.Hits : Hits[MuonGLB_] *
*Entries : 500 : Total Size= 6474 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 173 :MuonGLB.LostHits : LostHits[MuonGLB_] *
*Entries : 500 : Total Size= 6498 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 174 :MuonGLB.InvalidHits : InvalidHits[MuonGLB_] *
*Entries : 500 : Total Size= 6516 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 175 :GenJetIC5A_size : GenJetIC5A_size/I *
*Entries : 500 : Total Size= 2694 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *

*Br 176 :GenJetIC5A : GenJetIC5A_ *
*Entries : 500 : Total Size= 229596 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 177 :GenJetIC5A.fUniqueID : fUniqueID[GenJetIC5A_] *
*Entries : 500 : Total Size= 19294 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 178 :GenJetIC5A.fBits : fBits[GenJetIC5A_] *
*Entries : 500 : Total Size= 19270 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 179 :GenJetIC5A.E : E[GenJetIC5A_] *
*Entries : 500 : Total Size= 19246 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 180 :GenJetIC5A.Px : Px[GenJetIC5A_] *
*Entries : 500 : Total Size= 19252 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 181 :GenJetIC5A.Py : Py[GenJetIC5A_] *
*Entries : 500 : Total Size= 19252 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 182 :GenJetIC5A.Pz : Pz[GenJetIC5A_] *
*Entries : 500 : Total Size= 19252 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 183 :GenJetIC5A.PT : PT[GenJetIC5A_] *
*Entries : 500 : Total Size= 19252 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 184 :GenJetIC5A.Eta : Eta[GenJetIC5A_] *
*Entries : 500 : Total Size= 19258 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 185 :GenJetIC5A.Phi : Phi[GenJetIC5A_] *
*Entries : 500 : Total Size= 19258 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 186 :GenJetIC5A.Constituents : Constituents[GenJetIC5A_] *
*Entries : 500 : Total Size= 114155 bytes File Size = 1728 *
*Baskets : 1 : Basket Size= 64000 bytes Compression= 36.39 *

*Br 187 :JetIC5A_size : JetIC5A_size/I *
*Entries : 500 : Total Size= 2676 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *

*Br 188 :JetIC5A : JetIC5A_ *
*Entries : 500 : Total Size= 124424 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 189 :JetIC5A.fUniqueID : fUniqueID[JetIC5A_] *
*Entries : 500 : Total Size= 12554 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 190 :JetIC5A.fBits : fBits[JetIC5A_] *
*Entries : 500 : Total Size= 12530 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 191 :JetIC5A.E : E[JetIC5A_] *
*Entries : 500 : Total Size= 12506 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 192 :JetIC5A.Px : Px[JetIC5A_] *
*Entries : 500 : Total Size= 12512 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 193 :JetIC5A.Py : Py[JetIC5A_] *
*Entries : 500 : Total Size= 12512 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 194 :JetIC5A.Pz : Pz[JetIC5A_] *
*Entries : 500 : Total Size= 12512 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 195 :JetIC5A.PT : PT[JetIC5A_] *
*Entries : 500 : Total Size= 12512 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 196 :JetIC5A.Eta : Eta[JetIC5A_] *
*Entries : 500 : Total Size= 12518 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 197 :JetIC5A.Phi : Phi[JetIC5A_] *
*Entries : 500 : Total Size= 12518 bytes One basket in memory *
*Baskets : 0 : Basket Size= 64000 bytes Compression= 1.00 *

*Br 198 :JetIC5A.Constituents : Constituents[JetIC5A_] *
*Entries : 500 : Total Size= 68795 bytes File Size = 2132 *
*Baskets : 1 : Basket Size= 64000 bytes Compression= 29.11 *

*Br 199 :JetIC5B_size : JetIC5B_size/I *
*Entries : 500 : Total Size= 2676 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *

*Br 200 :JetIC5B : JetIC5B_ *
*Entries : 500 : Total Size= 124

Instead of:

chain.SetBranchStatus("MuonGLB",1); Could you do:

chain.SetBranchStatus("MuonGL*",1); To activate all branches of MuonGLB to the output Tree

Rene

Hi Rene,

I think I have a similar problem – but can’t fix it. What I have is a certain class structure (the infamous ExRootAnalysis of CMS) in a Tree.
What I want to do is read an event, check/calculate something and write it to a new tree. What I do in short is:
I read the source trees into a chain and activate all branches:

TChain theChain("Analysis");
theChain.SetBranchStatus("Gen",1);
theChain.SetBranchStatus("Event",1);
[...all Branches follow]

I then clone it as an empty tree

CloneTree = theChain.CloneTree(0);

In the event loop over the source tree I get every entry and calculate something with some of the branches. Based upon this I fill the clone tree.

Now the problem is: the cloned tree has the perfectly right structure, all branches and leafs in place. But some of the branches are simply not filled, that is: they have no entries.

What I don’t understand is, that there is no system to which branches are (not) filled. Say I use the branches “A” and “B” to calculate something and never use branch “C” and “D”.
When I look into the created file with the new tree, then I find that the entries in the branches “A” and “C” perfectly match what I filled in there. But unfortunately the branches “B” and “D” are empty, as in “no entries”.
As far as I checked internally is everything alright (addresses right and accessible). I truly don’t know any further.

Any ideas?

Thanks for any help,
Christoph

Hi,

You do not mention any SetBranchStatus with 0 as a parameter (hence all you branch status are no-op as far as I can tell). If this is the case, there are not explanation for your observation expect if you read explicitly the branches (aka branchA->GetEntry instead of theChain->GetEntry) [and in this case of the branch you read you be properly filled.

Another possibility is the way you set the addresses, you must set the address through the original chain (theChain) and you must be very carefully if setting any addresses other than the top level.

The simpliest is probably that you sent me your code.

Cheers,
Philippe

Hi Philippe,

its really not much more than the following, I snip the unimportant parts.

 vector<TString> inFileList; // gets initialized with the list of filenames
  TChain theChain("Analysis");
 for(vector<TString>::iterator iter = inFileList.begin(); iter < inFileList.end(); iter++)
    {   if(!( theChain.Add( (*iter) ) > 0) ) ;       } // omitted the error message for failure

  ExRootTreeReader *treeReader = new ExRootTreeReader(&theChain); // the "support" structure
  theChain.SetBranchStatus("MuonGLB",1); // ...and all the other branches

   // define the clone
     TFile theCloneFile = new TFile("theClone.root","recreate");
     TTree* theCloneTree = theChain.CloneTree(0);

// now do the loop
  Long64_t allEntries = treeReader->GetEntries(); 
  for(Long64_t currentevent = 0; currentevent < allEntries; currentevent++)
    {
      treeReader->ReadEntry(currentevent);
        // now do something on the MuonGLB branch
        // e.g. count the muons, store into 
        // int numberOfMuons;
        // and do something similar on a jet branch
      if( (numberOfMuons > 0) && (numberOfJets > 4) )
         theCloneTree->Fill();
  } // end event loop

The produced Tree has the perfectly right jet objects in the Jet branch, but not a single member in the “MuonGLB” branch. The same for two unmentioned (but activated) other branches.

Cheers,
Christoph

Hi Christoph,

The problem must be coming from the implementation of ExRootTreeReader and whether it issues any SetBranchStatus and what it does in ExRootTreeReader::ReadEntry.

Your code in itself seems fine except that instead of

theChain.SetBranchStatus("MuonGLB",1); // ...and all the other branches
you might be meaning:

Cheers,
Philippe.

Sorry for resurrecting this post, but i have almost the same problem.

I need to filter some of the events produced in a private sample.
The code given below is simply checks the number of jets in each event and tries to save some of them.

The branch structure and leaves are all there in the output file, I even see the size information for each branch.
The output of the root file seems like it is filled but the leaves are empty.

Here is the code i used i wonder if you could take a look?

Thank you in advance.


void testv2()
{
	gROOT->Reset();
	//gSystem->Load("libExRootAnalysis");
	gSystem->Load("libDelphes");
 
    TChain theChain("Delphes");
    theChain.Add("tag_1_delphes_events_s.root");

    // Create object of class ExRootTreeReader
    ExRootTreeReader *treeReader = new ExRootTreeReader(&theChain);
    Long64_t allEntries = treeReader->GetEntries();

    cout << "There are " <<allEntries<< " events" <<endl;
 
	// Get pointers to branches used in this analysis
	TClonesArray *branchJet 	 = treeReader->UseBranch("Jet");
	
	theChain.SetBranchStatus("Jet*",1);

	TFile *myfile = new TFile("filtered_events.root","recreate");

	TTree* theCloneTree = theChain.CloneTree(0);
	

    // now do the loop
    for(Long64_t currentevent = 0; currentevent < 1000; currentevent++)
    {
        treeReader->ReadEntry(currentevent);
		
		int counter_jet=0;
		if(branchJet->GetEntries() > 0)
		{
			Jet *jet;
			for (int i=0; i< branchJet->GetEntries(); i++)
			{
				jet = (Jet*) branchJet->At(i);
				if (jet ->PT > 50 ) counter_jet++;
				
			}
		}
		
        if ( counter_jet > 3 ) theCloneTree->Fill();

    } // end event loop
     
	theCloneTree->Write();
    myfile->Close();
	
}

Hi,

On first approximation this looks ‘okay’ but depend on the actual implementation of ExRootTreeReader. Most likely, for some reason, the input and output branches are not looking at the same addresses.

Cheers,
Philippe.