3from b2luigi.basf2_helper
import Basf2nTupleMergeTask
4from reconstruction
import ReconstructionWrapper
6import matplotlib.pyplot
as plt
9class MergeFiles(Basf2nTupleMergeTask):
10 batch_system =
'local'
11 projectName = luigi.Parameter()
14 skims = open(f
"../{self.projectName}skims.dat")
15 for skim
in skims.read().splitlines():
16 yield ReconstructionWrapper(skim=skim, projectName=self.projectName)
19class Plot(luigi.Task):
20 batch_system =
'local'
24 data.update({
"bmesons": MergeFiles(projectName=
"bmesons")})
25 data.update({
"qqcontinuum": MergeFiles(projectName=
"qqcontinuum")})
29 yield self.add_to_output(
"Mbc.jpg")
30 yield self.add_to_output(
"deltaE.jpg")
33 treeName =
'BtoPiDtoKPiPi'
34 some_variables = [
"Mbc",
"deltaE"]
35 BBdata = self.requires()[
"bmesons"].get_output_file_name(
"reco.root")
36 QQdata = self.requires()[
"qqcontinuum"].get_output_file_name(
"reco.root")
37 BBtuple = uproot.open(f
"{BBdata}:{treeName}")
38 QQtuple = uproot.open(f
"{QQdata}:{treeName}")
40 for var
in some_variables:
41 plt.hist([QQtuple[var].array(), BBtuple[var].array()], label=[
"uudd Continuum",
"mixed B mesons"], stacked=
True)
42 plt.legend(loc=
'best')
43 plt.xlabel(f
"{var} [GeV]")
44 plt.savefig(self.get_output_file_name(f
"{var}.jpg"), dpi=100)