def MakeROOTPrimitive(self, name): result = TList() result.SetName(name) if self.__MCtruth: result.Add(self.__MCtruth) for hist in self.__triggers.itervalues(): result.Add(hist) return result
def MakeROOTPrimitive(self): result = TList() result.SetName(self.triggername) self.__eventcount.SetName("events") self.__projectedSpectrum.SetName("spectrum") result.Add(self.__eventcount) result.Add(self.__projectedSpectrum) return result
def ROOTify(self): """ Create simple primitive ROOT object structure """ outputlist = TList() outputlist.SetName("JetSpectraPt%03d" % (int(self.__jetpt))) for spec in self.__spectra: outputlist.Add(spec) return outputlist
def GetRootPrimitive(self, listname): """ Make root primitives (for root IO) """ result = TList() result.SetName(listname) tracklist = TList() tracklist.SetName("trackContainers") for name, tc in self.__trackContainers.iteritems(): tracklist.Add(tc.GetRootPrimitive("trackcontainer_%s" % (name))) clusterlist = TList() clusterlist.SetName("clusterContainers") for name, cc in self.__clusterContainers.iteritems(): clusterlist.Add(cc.GetRootPrimitive("clustercontainer_%s" % (name))) result.Add(tracklist) result.Add(clusterlist) return result
def MakeOutputList(self): result = TList() result.SetName("Results%d" % (self.__limit)) rawspectrum = deepcopy(self.__datamodel.GetRawSpectrum()) rawspectrum.SetName("rawspectrum") fitcurve = deepcopy(self.__datamodel.GetFitCurve()) fitcurve.SetName("parameterisation") ptreach = self.__points.MakeLimitCurve(None, direction="central") ptreach.SetName("ptreach") result.Add(rawspectrum) result.Add(fitcurve) result.Add(ptreach) return result
def GetRootPrimitive(self, name): """ Convert object to a root primitive (so that it can be wirtten to a rootfile) """ result = TList() result.SetName(name) events = self._events.GetROOTHisto() events.SetName("events") result.Add(events) spectrum = self.__spectrum.GetRootPrimitive() spectrum.SetName("spectrum") result.Add(spectrum) return result
def WriteToFile(self, outputname): outputlists = [] for categ in self.__categories.keys(): mylist = TList() mylist.SetName(categ) for entry in self.__categories[categ].itervalues(): mylist.Add(entry) outputlists.append(mylist) outputfile = TFile(outputname, "RECREATE") outputfile.cd() for myobject in outputlists: myobject.Write(myobject.GetName(), TObject.kSingleKey) outputfile.Close()
def ProcessBin(self, mybin): results = BinContent() bindata = self._inputcol.GetData(mybin) for trigger in [ "MinBias", "EMCJHigh", "EMCJLow", "EMCGHigh", "EMCGLow" ]: print "Doing trigger %s" % (trigger) jetcont = bindata.GetData(trigger).GetJetContainer() outputcont = TList() outputcont.SetName(trigger) for jetpt in jetcont.GetListOfJetPts(): print "Inspecting jet pt %f" % (jetpt) jetdat = JetData(jetpt, trigger) projectedRec = jetcont.MakeProjectionRecKine( jetpt, 0, "projectedPtRec") projectedMC = jetcont.MakeProjectionMCKine( jetpt, 0, "projectedPtMC") jetdat.AddSpectrum(projectedRec, False) jetdat.AddSpectrum(projectedMC, True) outputcont.Add(jetdat.ROOTify()) results.AddTrigger(trigger, outputcont) return results
def GetROOTPrimitive(self): output = TList() output.SetName(self.__name) for rootobject in self.__rootobjects: output.Add(rootobject.GetROOTPrimitive()) return output