No attribute 'Write'

Hi Everyone
i trying to create some histograms and want to save them into a root file.

kinPlots = HistGroup('kinPlots')

    kinPlots.Add('MET_pt',self.a.GetActiveNode().DataFrame.Histo1D<float>(('MET_pt','MET_pt',40,0,1000),'MET_pt','weight__nominal'))
    kinPlots.Add('Lead_pt',self.a.GetActiveNode().DataFrame.Histo1D<float>(('Lead_pt','Lead_pt',34,300,2000),'Lead_pt','weight__nominal'))
    kinPlots.Add('Sublead_pt',self.a.GetActiveNode().DataFrame.Histo1D<float>(('Sublead_pt','Sublead_pt',36,200,2000),'Sublead_pt','weight__nominal'))
    kinPlots.Add('DeltaPhi_Higgs_Wqq',self.a.GetActiveNode().DataFrame.Histo1D<float>(('DeltaPhi_Higgs_Wqq','DeltaPhi_Higgs_Wqq',30,-3.2,3.2),'DeltaPhi_Higgs_Wqq','weight__nominal'))
    kinPlots.Add('DeltaR_Higgs_Wqq',self.a.GetActiveNode().DataFrame.Histo1D<float>(('DeltaR_Higgs_Wqq','DeltaR_Higgs_Wqq',25,0,5),'DeltaR_Higgs_Wqq','weight__nominal'))
    kinPlots.Add('Higgs_msoftdrop',self.a.GetActiveNode().DataFrame.Histo1D<float>(('Higgs_msoftdrop','Higgs_msoftdrop',40,50,250),'Higgs_msoftdrop','weight__nominal'))
    kinPlots.Add('Wqq_msoftdrop',self.a.GetActiveNode().DataFrame.Histo1D<float>(('Wqq_msoftdrop','Wqq_msoftdrop',40,50,250),'Wqq_msoftdrop','weight__nominal'))

filename = '{}_{}_abc.txt'.format(setname,year) 

    ana = XHYbbWW(filename,ijob,njobs)

outFile = ROOT.TFile.Open('{}_{}_{}_studies.root'.format(ana.setname,ana.year,ana.ijob),'RECREATE')
    outFile.cd()

    kinPlots = KinPlots(ana)
    kinPlots.Do('Write')

but im encountring this error

    kinPlots.Do('Write')
  File "/TIMBER/TIMBER/Analyzer.py", line 1880, in Do
    out = getattr(hist,THmethod)(*argsTuple)
AttributeError: 'bool' object has no attribute 'Write'

any idea how to fix this issue.
thanks in Advance.

Hi,

Interesting question. The error message seems to be quite informative: the method Write is called on a boolean rather than a histogram. The variable seems to be hist at line 1880 of Analyzer.py.
From the context given, it’s not easy to guess further. Some debugging of your code seems to be in order, perhaps starting with some printouts of the variable hist, to then move to something more sophisticated in case no solution is found.

I hope this helps!

Cheers,
D