FairShip
Loading...
Searching...
No Matches
extractNeutrinosAndUpdateWeight Namespace Reference

Functions

None processFile (str fin, bool noCharm=True)
None run ()
None run1GeV ()
None run4Charm ()
None run4Charm1GeV ()
None run4beauty ()
None finalResult ()

Variables

str path = "/eos/experiment/ship/data/Mbias/background-prod-2018/"
list charmExtern = [4332, 4232, 4132, 4322, 4122, 431, 411, 421, 15]
list neutrinos = [12, 14, 16]
float weightMbias = 768.75
float weightMbias1GeV = 27778.0
float weightCharm = 326.0
float weightCharm1GeV = 4895.24
float weightBeauty = 9.37
float weight = weightMbias
dict h = {}
 PDG = ROOT.TDatabasePDG.Instance()
 idw = idnu
int idhnu = 1000 + idw
 _p = ut.get_particle(idw)
 name = _p.GetName()
str title = name + " momentum (GeV)"
int key = idhnu

Function Documentation

◆ finalResult()

None extractNeutrinosAndUpdateWeight.finalResult ( )

Definition at line 139 of file extractNeutrinosAndUpdateWeight.py.

139def finalResult() -> None:
140 h10 = {}
141 ut.readHists(h10, "pythia8_Geant4_10.0_c0-67000_nu.root")
142 h1 = {}
143 ut.readHists(h1, "pythia8_Geant4_1.0_c0-19000_nu.root")
144 c10 = {}
145 ut.readHists(c10, "pythia8_Geant4_charm_10.0_nu.root")
146 c1 = {}
147 ut.readHists(c1, "pythia8_Geant4_charm_1.0_nu.root")
148 cmd = "hadd pythia8_Geant4_10.0_withCharm_nu.root pythia8_Geant4_10.0_c0-67000_nu.root pythia8_Geant4_charm_10.0_nu.root"
149 os.system(cmd)
150 cmd = (
151 "hadd pythia8_Geant4_1.0_withCharm_nu.root pythia8_Geant4_1.0_c0-19000_nu.root pythia8_Geant4_charm_1.0_nu.root"
152 )
153 os.system(cmd)

◆ processFile()

None extractNeutrinosAndUpdateWeight.processFile ( str fin,
bool noCharm = True )

Definition at line 59 of file extractNeutrinosAndUpdateWeight.py.

59def processFile(fin: str, noCharm: bool = True) -> None:
60 f = ROOT.TFile.Open(os.environ["EOSSHIP"] + path + fin)
61 print("opened file ", fin)
62 sTree = f.Get("cbmsim")
63 for n in range(sTree.GetEntries()):
64 sTree.GetEntry(n)
65 for v in sTree.vetoPoint:
66 nu = v.GetTrackID()
67 t = sTree.MCTrack[nu]
68 pdgCode = t.GetPdgCode()
69 if abs(pdgCode) not in neutrinos:
70 continue
71 moID = abs(sTree.MCTrack[t.GetMotherId()].GetPdgCode())
72 if moID in charmExtern and noCharm:
73 continue # take heavy flavours from separate production
74 idhnu = abs(pdgCode) + 1000
75 if pdgCode < 0:
76 idhnu += 1000
77 l10ptot = ROOT.TMath.Min(ROOT.TMath.Max(ROOT.TMath.Log10(t.GetP()), -0.3), 1.69999)
78 l10pt = ROOT.TMath.Min(ROOT.TMath.Max(ROOT.TMath.Log10(t.GetPt()), -2.0), 0.4999)
79 key = idhnu
80 h[key].Fill(t.GetP(), weight)
81 key = idhnu + 100
82 h[key].Fill(l10ptot, l10pt, weight)
83 key = idhnu + 200
84 h[key].Fill(l10ptot, l10pt, weight)
85
86

◆ run()

None extractNeutrinosAndUpdateWeight.run ( )

Definition at line 87 of file extractNeutrinosAndUpdateWeight.py.

87def run() -> None:
88 tmp = "pythia8_Geant4_10.0_cXX.root"
89 global weight
90 weight = weightMbias
91 for run in range(0, 67000, 1000):
92 processFile(tmp.replace("XX", str(run)))
93 ut.writeHists(h, "pythia8_Geant4_10.0_c0-67000_nu.root")
94
95

◆ run1GeV()

None extractNeutrinosAndUpdateWeight.run1GeV ( )

Definition at line 96 of file extractNeutrinosAndUpdateWeight.py.

96def run1GeV() -> None:
97 tmp = "pythia8_Geant4_1.0_cXX.root"
98 global weight
99 weight = weightMbias1GeV
100 for run in range(0, 19000, 1000):
101 processFile(tmp.replace("XX", str(run)))
102 ut.writeHists(h, "pythia8_Geant4_1.0_c0-19000_nu.root")
103
104

◆ run4beauty()

None extractNeutrinosAndUpdateWeight.run4beauty ( )

Definition at line 125 of file extractNeutrinosAndUpdateWeight.py.

125def run4beauty() -> None:
126 global weight
127 weight = weightBeauty
128 fname = "pythia8_Geant4_beauty_5336B_10.0.root"
129 rc = processFile(fname, False)
130 if rc == 0:
131 fmu = fname.replace(".root", "_mu.root")
132 rc = os.system("xrdcp " + fmu + " $EOSSHIP/eos/experiment/ship/data/Mbias/background-prod-2018/" + fmu)
133 if rc != 0:
134 print("copy to EOS failed, stop", fmu)
135 else:
136 rc = os.system("rm " + fmu)
137
138

◆ run4Charm()

None extractNeutrinosAndUpdateWeight.run4Charm ( )

Definition at line 105 of file extractNeutrinosAndUpdateWeight.py.

105def run4Charm() -> None:
106 tmp = "pythia8_Geant4_charm_XX-YY_10.0.root"
107 global weight
108 weight = weightCharm
109 for cycle in [0, 1, 2]:
110 for run in range(0, 100, 20):
111 crun = run + cycle * 1000
112 fname = tmp.replace("XX", str(crun)).replace("YY", str(crun + 19))
113 processFile(fname, False)
114 ut.writeHists(h, "pythia8_Geant4_charm_10.0_nu.root")
115
116

◆ run4Charm1GeV()

None extractNeutrinosAndUpdateWeight.run4Charm1GeV ( )

Definition at line 117 of file extractNeutrinosAndUpdateWeight.py.

117def run4Charm1GeV() -> None:
118 fname = "pythia8_Geant4_charm_0-19_1.0.root" # renamed pythia8_Geant4_charm_XX-YY_10.0.root
119 global weight
120 weight = weightCharm1GeV
121 processFile(fname, False)
122 ut.writeHists(h, "pythia8_Geant4_charm_1.0_nu.root")
123
124

Variable Documentation

◆ _p

extractNeutrinosAndUpdateWeight._p = ut.get_particle(idw)
protected

Definition at line 46 of file extractNeutrinosAndUpdateWeight.py.

◆ charmExtern

list extractNeutrinosAndUpdateWeight.charmExtern = [4332, 4232, 4132, 4322, 4122, 431, 411, 421, 15]

Definition at line 14 of file extractNeutrinosAndUpdateWeight.py.

◆ h

dict extractNeutrinosAndUpdateWeight.h = {}

Definition at line 36 of file extractNeutrinosAndUpdateWeight.py.

◆ idhnu

int extractNeutrinosAndUpdateWeight.idhnu = 1000 + idw

Definition at line 42 of file extractNeutrinosAndUpdateWeight.py.

◆ idw

extractNeutrinosAndUpdateWeight.idw = idnu

Definition at line 41 of file extractNeutrinosAndUpdateWeight.py.

◆ key

int extractNeutrinosAndUpdateWeight.key = idhnu

Definition at line 49 of file extractNeutrinosAndUpdateWeight.py.

◆ name

extractNeutrinosAndUpdateWeight.name = _p.GetName()

Definition at line 47 of file extractNeutrinosAndUpdateWeight.py.

◆ neutrinos

list extractNeutrinosAndUpdateWeight.neutrinos = [12, 14, 16]

Definition at line 15 of file extractNeutrinosAndUpdateWeight.py.

◆ path

str extractNeutrinosAndUpdateWeight.path = "/eos/experiment/ship/data/Mbias/background-prod-2018/"

Definition at line 9 of file extractNeutrinosAndUpdateWeight.py.

◆ PDG

extractNeutrinosAndUpdateWeight.PDG = ROOT.TDatabasePDG.Instance()

Definition at line 37 of file extractNeutrinosAndUpdateWeight.py.

◆ title

str extractNeutrinosAndUpdateWeight.title = name + " momentum (GeV)"

Definition at line 48 of file extractNeutrinosAndUpdateWeight.py.

◆ weight

float extractNeutrinosAndUpdateWeight.weight = weightMbias

Definition at line 33 of file extractNeutrinosAndUpdateWeight.py.

◆ weightBeauty

float extractNeutrinosAndUpdateWeight.weightBeauty = 9.37

Definition at line 29 of file extractNeutrinosAndUpdateWeight.py.

◆ weightCharm

float extractNeutrinosAndUpdateWeight.weightCharm = 326.0

Definition at line 24 of file extractNeutrinosAndUpdateWeight.py.

◆ weightCharm1GeV

float extractNeutrinosAndUpdateWeight.weightCharm1GeV = 4895.24

Definition at line 26 of file extractNeutrinosAndUpdateWeight.py.

◆ weightMbias

float extractNeutrinosAndUpdateWeight.weightMbias = 768.75

Definition at line 18 of file extractNeutrinosAndUpdateWeight.py.

◆ weightMbias1GeV

float extractNeutrinosAndUpdateWeight.weightMbias1GeV = 27778.0

Definition at line 20 of file extractNeutrinosAndUpdateWeight.py.