{ TFile *file0 = TFile::Open("SimAnasen1.root"); file0->ls(); TTree *tree1 = (TTree*)(file0->Get("tree1")); new TBrowser(); tree1->Draw("Tb:thetab","","col"); tree1->Draw("Tb:thetab","vZ>-140 && vZ<-130", "box same"); TH2F *h2 = new TH2F("EPCvEsx3", "EPC x sin(thetab) vs Esx3;Esx3;EPC * sin(thetab * TMath::DegToRad())", 200, 0, 0, 200, 0, 0); //arguments are (name, title, nbinsX, xlow, xup, nbinsY, ylow, yup) tree1->Draw("EPC*sin(thetab * TMath::DegToRad()):Esx3 >> EPCvEsx3", "Esx3 > 0", "colz"); new TCanvas(); TH2F *h3 = new TH2F( "hExReconVsVZ", "Ex_recon vs vZ;vZ (mm);Excitation energy (MeV)", 100, 0, 0, 100, -1, 0 ); tree1->Draw("Ex_recon:vZ>>hExReconVsVZ", "sx3ID >= 0", "colz"); TH2F *h4 = new TH2F( "hExVsVZ", "", 100, 0, 0, 100, -1, 0 ); tree1->Draw("Ex:vZ>>hExVsVZ", "sx3ID >= 0", "box same"); new TCanvas(); tree1->Draw("originalEnergy:Tb", "sx3ID >=0", ""); TF1 *f_diagonal = new TF1("f_diagonal", "x", 0, 200); // assuming the range for Tb is 0 to 200 f_diagonal->SetLineColor(kRed); f_diagonal->SetLineStyle(2); f_diagonal->Draw("same"); }