#include "TFile.h" #include "TH1.h" #include "TH1D.h" #include "TH2.h" #include "TF1.h" #include "TProfile.h" #include "TString.h" #include "TMath.h" #include "TGraph.h" #include "TCanvas.h" void Projection(){ // / // TFile * b = TFile::Open("test.root"); TH1 *MetvsJetsTtbar = (TH1*)b->Get ("NJETSvsMETTtbar"); TCanvas *proj = new TCanvas("proj", "Ttbar MET", 600, 600); proj->cd(); MetvsJetsTtbar->Draw(); TH1D* px = MetvsJetsTtbar->ProjectionY("px", 160, 180); // where firstYbin = 160 and lastYbin = 180 px->Draw(); proj->Update(); }