Dear ROOTers,
My name is Ryan.
I made a macro that used to calculate the invariant mass and create histograms.
However, an error occurs when using GetEntry to loop all over the Tree.
The error message in the ROOT interactive session is something like:
ERROR leaf:lep_type, len=1068474710 and max=6
ERROR leaf:lep_flag, len=1068474710 and max=6
ERROR leaf:lep_ptcone30, len=1068474710 and max=6
This is very strange as the macro used to be fine before
Here is my macro script:
TFile *f =TFile::Open("C://root_v5.34.36/bin/Task1.root");
float E,pt,eta,phi;
UInt_t n,type;
//mini is the name of Tree in the root file
mini->SetBranchAddress("lep_E",&E);
mini->SetBranchAddress("lep_pt",&pt);
mini->SetBranchAddress("lep_eta",&eta);
mini->SetBranchAddress("lep_phi",&phi);
mini->SetBranchAddress("lep_n",&n);
mini->SetBranchAddress("lep_type",&type);
TLorentzVector a;
TLorentzVector b;
TH1F *h1 = new TH1F("h1","Invariant Mass of Dielectron",1000,0,400);
TH1F *h2 = new TH1F("h2","Invariant Mass of Dimuon",1000,0,300);
TH1F *h3 = new TH1F("h3","Invariant Mass of eemuonmuon",500,0,500);
h1->GetXaxis()->SetTitle("Dielectron Mass [MeV]");
h2->GetXaxis()->SetTitle("Dimuon Mass [MeV]");
for ( int i=0;i<mini->GetEntries();i++) {
mini->GetEntry(i); // Crash occur at this line
a.SetPtEtaPhiE(pt,eta,phi,E);
b.SetPtEtaPhiE(pt,eta,phi,E);
if(n==2&&type==11) {h1->Fill((a+b).Mag());}
if(n==2&&type==13) {h2->Fill((a+b).Mag());}
if(n==4) {h3->Fill((a+b).Mag());}
}
Can anyone please help me find out the mistake in my marco ?
I am using a native version 5.34/36 of ROOT in window.
Many Thanks,
Ryan