Hi all,
I try to access the variables in a ntuple. The (reduced) print output is
*Tree :T1 : CMSSW HF tree *
*Entries : 7471 : Total = 655910281 bytes File Size = 190654569 *
*Branch :TAna01Event *
*Entries : 7471 : BranchElement (see below) *
…
*Br 0 :fUniqueID : UInt_t *
*Entries : 7471 : Total Size= 30896 bytes File Size = 871 *
*Baskets : 7 : Basket Size= 23552 bytes Compression= 34.90 *
…
*Br 1 :fBits : UInt_t *
*Entries : 7471 : Total Size= 60792 bytes File Size = 16065 *
*Baskets : 7 : Basket Size= 37376 bytes Compression= 3.75 *
…
*Br 2 :fBeamSpot : TAnaVertex *
*Entries : 7471 : Total Size= 1017288 bytes File Size = 82959 *
*Baskets : 9 : Basket Size= 478208 bytes Compression= 12.26 *
…
*Br 140 :fnMuons : Int_t *
*Entries : 13895 : Total Size= 60129 bytes File Size = 18509 *
*Baskets : 46 : Basket Size= 6144 bytes Compression= 3.18 *
…
*Br 141 :fMuons : Int_t fMuons_ *
*Entries : 13895 : Total Size= 137799 bytes File Size = 18463 *
*Baskets : 46 : Basket Size= 64000 bytes Compression= 3.19 *
…
*Br 142 :fMuons.TAnaTrack : BASE TAnaTrack[fMuons_] *
*Entries : 13895 : Total Size= 44413627 bytes File Size = 17586332 *
*Baskets : 60 : Basket Size= 2447872 bytes Compression= 2.53 *
…
*Br 169 :fMuons.fChi2LocalMomentum : Float_t fChi2LocalMomentum[fMuons_] *
*Entries : 13895 : Total Size= 445467 bytes File Size = 207951 *
*Baskets : 46 : Basket Size= 27136 bytes Compression= 2.14 *
…
*Br 170 :fMuons.fNumberOfLostTrkHits : Int_t fNumberOfLostTrkHits[fMuons_] *
*Entries : 13895 : Total Size= 445567 bytes File Size = 88543 *
*Baskets : 46 : Basket Size= 27136 bytes Compression= 5.02 *
…
Br 171 :fMuons.fNumberOfValidTrkHits : Int_t fNumberOfValidTrkHits[fMuons_]
*Entries : 13895 : Total Size= 445617 bytes File Size = 117051 *
*Baskets : 46 : Basket Size= 27136 bytes Compression= 3.80 *
…
*Br 172 :fMuons.fSegmentComp : Float_t fSegmentComp[fMuons_] *
*Entries : 13895 : Total Size= 445167 bytes File Size = 183186 *
*Baskets : 46 : Basket Size= 27136 bytes Compression= 2.42 *
…
So far I have tried this to access variables:
TFile * f1=TFile::Open("XX.root");
f1->cd();
TTree *T = (TTree*)f1->Get("T1");
Int_t fnMuons_;
Float_t fSegmentComp[fnMuons_];
int nevent = T->GetEntries();
T->SetBranchAddress("fnMuons", &fnMuons_);
T->SetBranchAddress("fMuons.fSegmentComp", &fSegmentComp);
for (Long64_t i=0;i<nevent;i++) {
T->GetEntry(i);
for (Int_t n=0; n< fnMuons_; n++){
cout << fSegmentComp[n]<< endl;
cout << fnMuons_ << endl;
}
}
But all I got is
Processing readEvents.C…
Warning in TClass::Init: no dictionary for class TAna01Event is available
Warning in TClass::Init: no dictionary for class TAnaVertex is available
Warning in TClass::Init: no dictionary for class TGenCand is available
Warning in TClass::Init: no dictionary for class TSimpleTrack is available
Warning in TClass::Init: no dictionary for class TAnaTrack is available
Warning in TClass::Init: no dictionary for class TAnaMuon is available
Warning in TClass::Init: no dictionary for class xpTrack is available
Warning in TClass::Init: no dictionary for class TTrgObjv2 is available
Warning in TClass::Init: no dictionary for class TAnaJet is available
Warning in TClass::Init: no dictionary for class TAnaCand is available
Error in TBufferFile::CheckByteCount: object of class TAnaVertex read too few bytes: 124 instead of 128
I think I am missing something while trying to access the variables.
Any help would be appreciated…