I’m trying to create a histogram using data in a given tree, but the baseline code doesn’t seem to create a histogram.
#include "TCanvas.h"
#include "TROOT.h"
#include "TH1.h"
#include "TLegend.h" //used for adding a legend in the histogram at the end
#include "TFile.h"
#include "TTree.h"
void Hist_Drawer() {
auto RCanv = new TCanvas;
TFile f("file name");
f.cd("internal directory");
TTree *treename = (TTree*)gDirectory->Get("Tree");
TH1F *hist1 = new TH1F("hist1","Histogram",100,0,70);
treename->Draw("branch>>hist1","condition");
}
int main() {
Hist_Drawer();
}
It opens the new canvas, but the branch isn’t drawn in the histogram. I’m using this method because I need to draw other histograms and plot them on the same axis while scaling all of the data evenly. Am I doing something wrong with the code?