SND@LHC Software
Loading...
Searching...
No Matches
extractNeutrinosAndUpdateWeight Namespace Reference

Functions

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

Variables

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

Function Documentation

◆ finalResult()

extractNeutrinosAndUpdateWeight.finalResult ( )

Definition at line 119 of file extractNeutrinosAndUpdateWeight.py.

119def finalResult():
120 h10={}
121 ut.readHists(h10,'pythia8_Geant4_10.0_c0-67000_nu.root')
122 h1={}
123 ut.readHists(h1,'pythia8_Geant4_1.0_c0-19000_nu.root')
124 c10={}
125 ut.readHists(c10,'pythia8_Geant4_charm_10.0_nu.root')
126 c1={}
127 ut.readHists(c1,'pythia8_Geant4_charm_1.0_nu.root')
128 cmd = "hadd pythia8_Geant4_10.0_withCharm_nu.root pythia8_Geant4_10.0_c0-67000_nu.root pythia8_Geant4_charm_10.0_nu.root"
129 os.system(cmd)
130 cmd = "hadd pythia8_Geant4_1.0_withCharm_nu.root pythia8_Geant4_1.0_c0-19000_nu.root pythia8_Geant4_charm_1.0_nu.root"
131 os.system(cmd)

◆ processFile()

extractNeutrinosAndUpdateWeight.processFile (   fin,
  noCharm = True 
)

Definition at line 48 of file extractNeutrinosAndUpdateWeight.py.

48def processFile(fin,noCharm=True):
49 f = ROOT.TFile.Open(os.environ['EOSSHIP']+path+fin)
50 print("opened file ",fin)
51 sTree = f.cbmsim
52 for n in range(sTree.GetEntries()):
53 sTree.GetEntry(n)
54 for v in sTree.vetoPoint:
55 nu = v.GetTrackID()
56 t = sTree.MCTrack[nu]
57 pdgCode = t.GetPdgCode()
58 if abs(pdgCode) not in neutrinos: continue
59 moID = abs(sTree.MCTrack[t.GetMotherId()].GetPdgCode())
60 if moID in charmExtern and noCharm: continue # take heavy flavours from separate production
61 idhnu=abs(pdgCode)+1000
62 if pdgCode<0: idhnu+=1000
63 l10ptot = ROOT.TMath.Min(ROOT.TMath.Max(ROOT.TMath.Log10(t.GetP()),-0.3),1.69999)
64 l10pt = ROOT.TMath.Min(ROOT.TMath.Max(ROOT.TMath.Log10(t.GetPt()),-2.),0.4999)
65 key = idhnu
66 h[key].Fill(t.GetP(),weight)
67 key = idhnu+100
68 h[key].Fill(l10ptot,l10pt,weight)
69 key=idhnu+200
70 h[key].Fill(l10ptot,l10pt,weight)
71

◆ run()

extractNeutrinosAndUpdateWeight.run ( )

Definition at line 72 of file extractNeutrinosAndUpdateWeight.py.

72def run():
73 tmp = "pythia8_Geant4_10.0_cXX.root"
74 global weight
75 weight = weightMbias
76 for run in range(0,67000,1000):
77 rc = processFile(tmp.replace('XX',str(run)))
78 ut.writeHists(h,'pythia8_Geant4_10.0_c0-67000_nu.root')
79

◆ run1GeV()

extractNeutrinosAndUpdateWeight.run1GeV ( )

Definition at line 80 of file extractNeutrinosAndUpdateWeight.py.

80def run1GeV():
81 tmp = "pythia8_Geant4_1.0_cXX.root"
82 global weight
83 weight = weightMbias1GeV
84 for run in range(0,19000,1000):
85 rc = processFile(tmp.replace('XX',str(run)))
86 ut.writeHists(h,'pythia8_Geant4_1.0_c0-19000_nu.root')
87

◆ run4beauty()

extractNeutrinosAndUpdateWeight.run4beauty ( )

Definition at line 106 of file extractNeutrinosAndUpdateWeight.py.

106def run4beauty():
107 global weight
108 weight = weightBeauty
109 fname = "pythia8_Geant4_beauty_5336B_10.0.root"
110 rc = processFile(fname,False)
111 if rc == 0:
112 fmu = fname.replace('.root',"_mu.root")
113 rc = os.system("xrdcp "+fmu+" $EOSSHIP/eos/experiment/ship/data/Mbias/background-prod-2018/"+fmu)
114 if rc != 0:
115 print("copy to EOS failed, stop",fmu)
116 else:
117 rc = os.system("rm "+fmu)
118

◆ run4Charm()

extractNeutrinosAndUpdateWeight.run4Charm ( )

Definition at line 88 of file extractNeutrinosAndUpdateWeight.py.

88def run4Charm():
89 tmp = "pythia8_Geant4_charm_XX-YY_10.0.root"
90 global weight
91 weight = weightCharm
92 for cycle in [0,1,2]:
93 for run in range(0,100,20):
94 crun = run+cycle*1000
95 fname = tmp.replace('XX',str(crun)).replace('YY',str(crun+19))
96 rc = processFile(fname,False)
97 ut.writeHists(h,'pythia8_Geant4_charm_10.0_nu.root')
98

◆ run4Charm1GeV()

extractNeutrinosAndUpdateWeight.run4Charm1GeV ( )

Definition at line 99 of file extractNeutrinosAndUpdateWeight.py.

99def run4Charm1GeV():
100 fname = "pythia8_Geant4_charm_0-19_1.0.root" # renamed pythia8_Geant4_charm_XX-YY_10.0.root
101 global weight
102 weight = weightCharm1GeV
103 rc = processFile(fname,False)
104 ut.writeHists(h,'pythia8_Geant4_charm_1.0_nu.root')
105

Variable Documentation

◆ charmExtern

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

Definition at line 9 of file extractNeutrinosAndUpdateWeight.py.

◆ h

dict extractNeutrinosAndUpdateWeight.h = {}

Definition at line 27 of file extractNeutrinosAndUpdateWeight.py.

◆ idhnu

int extractNeutrinosAndUpdateWeight.idhnu = 1000+idw

Definition at line 33 of file extractNeutrinosAndUpdateWeight.py.

◆ idw

extractNeutrinosAndUpdateWeight.idw = idnu

Definition at line 32 of file extractNeutrinosAndUpdateWeight.py.

◆ key

int extractNeutrinosAndUpdateWeight.key = idhnu

Definition at line 39 of file extractNeutrinosAndUpdateWeight.py.

◆ name

extractNeutrinosAndUpdateWeight.name = PDG.GetParticle(idw).GetName()

Definition at line 37 of file extractNeutrinosAndUpdateWeight.py.

◆ neutrinos

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

Definition at line 10 of file extractNeutrinosAndUpdateWeight.py.

◆ path

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

Definition at line 4 of file extractNeutrinosAndUpdateWeight.py.

◆ PDG

extractNeutrinosAndUpdateWeight.PDG = ROOT.TDatabasePDG.Instance()

Definition at line 28 of file extractNeutrinosAndUpdateWeight.py.

◆ title

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

Definition at line 38 of file extractNeutrinosAndUpdateWeight.py.

◆ weightBeauty

float extractNeutrinosAndUpdateWeight.weightBeauty = 9.37

Definition at line 24 of file extractNeutrinosAndUpdateWeight.py.

◆ weightCharm

int extractNeutrinosAndUpdateWeight.weightCharm = 326.

Definition at line 19 of file extractNeutrinosAndUpdateWeight.py.

◆ weightCharm1GeV

float extractNeutrinosAndUpdateWeight.weightCharm1GeV = 4895.24

Definition at line 21 of file extractNeutrinosAndUpdateWeight.py.

◆ weightMbias

float extractNeutrinosAndUpdateWeight.weightMbias = 768.75

Definition at line 13 of file extractNeutrinosAndUpdateWeight.py.

◆ weightMbias1GeV

int extractNeutrinosAndUpdateWeight.weightMbias1GeV = 27778.

Definition at line 15 of file extractNeutrinosAndUpdateWeight.py.