3from b2luigi.basf2_helper
import Basf2PathTask, Basf2nTupleMergeTask
7import modularAnalysis
as ma
10from skim
import BatchesToTextFile
13class ReconstructBatch(Basf2PathTask):
15 looper = luigi.IntParameter()
16 projectName = luigi.Parameter()
17 skim = luigi.Parameter(hashed=
True)
18 runningOnMC = luigi.BoolParameter()
21 yield BatchesToTextFile(
22 runningOnMC=self.runningOnMC, projectName=self.projectName, skim=self.skim
26 yield self.add_to_output(
"reco.root")
28 def create_path(self):
30 mypath = b2.create_path()
31 with open(self.get_input_file_names()[f
"batch{self.looper}.json"][0])
as f:
32 inputMdstList = json.load(f)
34 ma.inputMdstList(filelist=inputMdstList, path=mypath)
38 cut=
"dr < 0.5 and abs(dz) < 3 and thetaInCDCAcceptance and kaonID > 0.01",
40 ma.fillParticleList(decayString=
'pi+:my', cut=
"dr < 0.5 and abs(dz) < 3 and thetaInCDCAcceptance", path=mypath)
42 ma.reconstructDecay(decayString=
"D-:K2Pi -> K+:my pi-:my pi-:my", cut=
"1.844 < M < 1.894", path=mypath)
44 ma.reconstructDecay(decayString=
'B0:PiD-toK2Pi -> D-:K2Pi pi+:my', cut=
'5.0 < Mbc and abs(deltaE) < 1.0', path=mypath)
45 vx.treeFit(
'B0:PiD-toK2Pi', 0, path=mypath, updateAllDaughters=
False, ipConstraint=
True, massConstraint=[411])
48 ma.matchMCTruth(list_name=
'B0:PiD-toK2Pi', path=mypath)
50 some_variables = [
'Mbc',
'deltaE']
51 ma.variablesToNtuple(decayString=
'B0:PiD-toK2Pi', variables=some_variables,
52 filename=self.get_output_file_name(
"reco.root"), path=mypath, treename=
'BtoPiDtoKPiPi')
56class ReconstructionWrapper(Basf2nTupleMergeTask):
57 batch_system =
'local'
58 projectName = luigi.Parameter()
59 skim = luigi.Parameter(hashed=
True)
62 for looper
in range(BatchesToTextFile.NumBatches):
63 yield self.clone(ReconstructBatch, runningOnMC=
True,
64 looper=looper, projectName=self.projectName, skim=self.skim)