9path =
"/eos/experiment/ship/data/Mbias/background-prod-2018/"
14charmExtern = [4332, 4232, 4132, 4232, 4122, 431, 411, 421, 15]
15neutrinos = [12, 14, 16]
20weightMbias1GeV = 27778.0
26weightCharm1GeV = 4895.24
33PDG = ROOT.TDatabasePDG.Instance()
34for idnu
in range(12, 17, 2):
36 for idadd
in range(-1, 2):
42 name = PDG.GetParticle(idw).GetName()
43 title = name +
" momentum (GeV)"
45 ut.bookHist(h, key, title, 400, 0.0, 400.0)
46 title = name +
" log10-p vs log10-pt"
48 ut.bookHist(h, key, title, 100, -0.3, 1.7, 100, -2.0, 0.5)
49 title = name +
" log10-p vs log10-pt"
51 ut.bookHist(h, key, title, 25, -0.3, 1.7, 100, -2.0, 0.5)
55 f = ROOT.TFile.Open(os.environ[
"EOSSHIP"] + path + fin)
56 print(
"opened file ", fin)
57 sTree = f.Get(
"cbmsim")
58 for n
in range(sTree.GetEntries()):
60 for v
in sTree.vetoPoint:
63 pdgCode = t.GetPdgCode()
64 if abs(pdgCode)
not in neutrinos:
66 moID = abs(sTree.MCTrack[t.GetMotherId()].GetPdgCode())
67 if moID
in charmExtern
and noCharm:
69 idhnu = abs(pdgCode) + 1000
72 l10ptot = ROOT.TMath.Min(ROOT.TMath.Max(ROOT.TMath.Log10(t.GetP()), -0.3), 1.69999)
73 l10pt = ROOT.TMath.Min(ROOT.TMath.Max(ROOT.TMath.Log10(t.GetPt()), -2.0), 0.4999)
75 h[key].Fill(t.GetP(), weight)
77 h[key].Fill(l10ptot, l10pt, weight)
79 h[key].Fill(l10ptot, l10pt, weight)
83 tmp =
"pythia8_Geant4_10.0_cXX.root"
86 for run
in range(0, 67000, 1000):
88 ut.writeHists(h,
"pythia8_Geant4_10.0_c0-67000_nu.root")
92 tmp =
"pythia8_Geant4_1.0_cXX.root"
94 weight = weightMbias1GeV
95 for run
in range(0, 19000, 1000):
97 ut.writeHists(h,
"pythia8_Geant4_1.0_c0-19000_nu.root")
101 tmp =
"pythia8_Geant4_charm_XX-YY_10.0.root"
104 for cycle
in [0, 1, 2]:
105 for run
in range(0, 100, 20):
106 crun = run + cycle * 1000
107 fname = tmp.replace(
"XX", str(crun)).replace(
"YY", str(crun + 19))
109 ut.writeHists(h,
"pythia8_Geant4_charm_10.0_nu.root")
113 fname =
"pythia8_Geant4_charm_0-19_1.0.root"
115 weight = weightCharm1GeV
117 ut.writeHists(h,
"pythia8_Geant4_charm_1.0_nu.root")
122 weight = weightBeauty
123 fname =
"pythia8_Geant4_beauty_5336B_10.0.root"
126 fmu = fname.replace(
".root",
"_mu.root")
127 rc = os.system(
"xrdcp " + fmu +
" $EOSSHIP/eos/experiment/ship/data/Mbias/background-prod-2018/" + fmu)
129 print(
"copy to EOS failed, stop", fmu)
131 rc = os.system(
"rm " + fmu)
136 ut.readHists(h10,
"pythia8_Geant4_10.0_c0-67000_nu.root")
138 ut.readHists(h1,
"pythia8_Geant4_1.0_c0-19000_nu.root")
140 ut.readHists(c10,
"pythia8_Geant4_charm_10.0_nu.root")
142 ut.readHists(c1,
"pythia8_Geant4_charm_1.0_nu.root")
143 cmd =
"hadd pythia8_Geant4_10.0_withCharm_nu.root pythia8_Geant4_10.0_c0-67000_nu.root pythia8_Geant4_charm_10.0_nu.root"
146 "hadd pythia8_Geant4_1.0_withCharm_nu.root pythia8_Geant4_1.0_c0-19000_nu.root pythia8_Geant4_charm_1.0_nu.root"
None processFile(str fin, bool noCharm=True)