25fileNameUrl =
"http://root.cern.ch/files/tutorials/df014_CsvDataSource_MuRun2010B.csv"
26fileName =
"df014_CsvDataSource_MuRun2010B_py.csv"
27if not os.path.isfile(fileName):
28 ROOT.TFile.Cp(fileNameUrl, fileName)
30MakeCsvDataFrame = ROOT.RDF.MakeCsvDataFrame
37filteredEvents = df.Filter(
"Q1 * Q2 == -1") \
38 .Define(
"m",
"sqrt(pow(E1 + E2, 2) - (pow(px1 + px2, 2) + pow(py1 + py2, 2) + pow(pz1 + pz2, 2)))")
41invMass = filteredEvents.Histo1D((
"invMass",
"CMS Opendata: #mu#mu mass;#mu#mu mass [GeV];Events", 512, 2, 110),
"m")
52fullSpectrum = filteredEvents.Histo1D((
"Spectrum",
"Subset of CMS Run 2010B;#mu#mu mass [GeV];Events", 1024, 2, 110),
"m")
58jpsiCut =
'm < %s && m > %s' % (jpsiHigh, jpsiLow)
59jpsi = filteredEvents.Filter(jpsiCut) \
60 .Histo1D((
"jpsi",
"Subset of CMS Run 2010B: J/#psi window;#mu#mu mass [GeV];Events", 128, jpsiLow, jpsiHigh),
"m")
63dualCanvas = ROOT.TCanvas(
"DualCanvas",
"DualCanvas", 800, 512)
64dualCanvas.Divide(2, 1)
65leftPad = dualCanvas.cd(1)
68fullSpectrum.Draw(
"Hist")
RDataFrame MakeCsvDataFrame(std::string_view fileName, bool readHeaders=true, char delimiter=',', Long64_t linesChunkSize=-1LL)
Factory method to create a CSV RDataFrame.