I’m getting this error when I try to run a python plotting script:
AttributeError: 'TObject' object has no attribute 'SetDirectory'
Here is the part of the script for fetching the histograms / where I’m getting the error:
fileName1 = "20200311_histos.root"
variable1 = "recpt"
file1 = ROOT.TFile.Open(fileName1,"READ")
h1 = file1.Get(variable1)
h1.SetDirectory(0)
if (file1.IsOpen()):
file1.Close()
and the lines used for fetching python / importing ROOT:
#!usr/bin/env python
import os
import sys
import numpy as np
import math
from array import array
import ROOT
(I installed ROOT with homebrew.)
Does anyone know how to solve this?