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

Functions

 yBeam (Mproton=0.938272081, pbeam=400.)
 
 na50 (online=True)
 
 muflux ()
 
 debugging (g)
 

Variables

int theSeed = 0
 
dict h = {}
 
 parser = ArgumentParser()
 
 dest
 
 type
 
 int
 
 help
 
 default
 
 float
 
 action
 
 str
 
 options = parser.parse_args()
 
 X = ROOT.FixedTargetGenerator()
 
dict generators = {'p':ROOT.Pythia8.Pythia(),'n':ROOT.Pythia8.Pythia()}
 
dict rc = generators['p'].next()
 
dict processes = generators['p'].info.codesHard()
 
str hname = 'pythia8_PDFpset'+options.PDFpSet+'_Emin'+str(options.Emin)+'_'+generators['p'].info.nameProc(processes[0])
 
 f = ROOT.TFile("ntuple-"+hname+".root","RECREATE")
 
 signal = ROOT.TNtuple("ntuple","ntuple","M:P:Pt:y:p1x:p1y:p1z:p2x:p2y:p2z:cosCS")
 
 timer = ROOT.TStopwatch()
 
dict ntagged = {'p':0,'n':0}
 
 ybeam = yBeam(pbeam = options.fMom)
 
dict py = generators[g]
 
dict nmu = {}
 
 ks = list(nmu)
 
dict Zstar = py.event[nmu[ks[0]]]
 
dict ii = nmu[ks[0]]
 
dict d0 = py.event.daughterList(ii)[0]
 
dict d1 = py.event.daughterList(ii)[1]
 
dict nlep = py.event[d0]
 
dict nantilep = py.event[d1]
 
dict P1pl = nlep.e()+nlep.pz()
 
dict P2pl = nantilep.e()+nantilep.pz()
 
dict P1mi = nlep.e()-nlep.pz()
 
dict P2mi = nantilep.e()-nantilep.pz()
 
dict A = P1pl*P2mi-P2pl*P1mi
 
dict cosCS = Zstar.pz()/abs(Zstar.pz()) * 1./Zstar.m()/ROOT.TMath.Sqrt(Zstar.m2()+Zstar.pT()**2)*A
 
dict M = {}
 
int k = 0
 
dict G = M[0]+M[1]
 
 rtime = timer.RealTime()
 
 ctime = timer.CpuTime()
 
dict sigma = generators[g].info.sigmaGen(processes[0])
 

Function Documentation

◆ debugging()

runPythia8.debugging (   g)

Definition at line 224 of file runPythia8.py.

224def debugging(g):
225 generators[g].settings.listAll()

◆ muflux()

runPythia8.muflux ( )

Definition at line 203 of file runPythia8.py.

203def muflux():
204 Z_Mo = 96.
205 P_Mo = 42
206 fraction = {}
207 for g in generators:
208 processes = generators[g].info.codesHard()
209 name = generators[g].info.nameProc(processes[0])
210 sigma = generators[g].info.sigmaGen(processes[0])
211 yax = h['M_'+g].GetYaxis()
212 xax = h['M_'+g].GetXaxis()
213 Mmin = xax.FindBin(0.)
214 Mmax = xax.FindBin(5.)
215 Ymin = yax.FindBin(0.3)
216 Ymax = yax.FindBin(3.)
217 h['MA'] = h['M_'+g].ProjectionX('MA')
218 h['M'] = h['M_'+g].ProjectionX('M',Ymin,Ymax)
219 print(g,name,sigma,float(h['MA'].GetEntries())/options.NPoT,h['MA'].Integral(Mmin,Mmax)/float(h['MA'].GetEntries()),h['M'].GetEntries()/float(h['MA'].GetEntries()))
220 fraction[g] = h['M'].Integral(Mmin,Mmax)/options.NPoT
221 meanFraction = (fraction['p']*P_Mo+fraction['n']*(Z_Mo-P_Mo))/Z_Mo * sigma
222 print("cross section a la muflux: %5.2F pb"%(0.5*meanFraction*1E9))
223

◆ na50()

runPythia8.na50 (   online = True)

Definition at line 152 of file runPythia8.py.

152def na50(online=True):
153 for g in generators:
154 if online:
155 processes = generators[g].info.codesHard()
156 name = generators[g].info.nameProc(processes[0])
157 sigma = generators[g].info.sigmaGen(processes[0])
158 else:
159 name = ''
160 sigma = h['xsec_'+g].GetBinContent(1)
161 yax = h['M_'+g].GetYaxis()
162 xax = h['M_'+g].GetXaxis()
163 Mmin = xax.FindBin(2.9)
164 Mmax = xax.FindBin(4.5)
165 Ymin = yax.FindBin(-0.425)
166 Ymax = yax.FindBin(0.575)
167 h['MA'] = h['M_'+g].ProjectionX('MA')
168 h['M'] = h['M_'+g].ProjectionX('M',Ymin,Ymax)
169 print("generator sigma mumu-ratio in-mass-range in-y-range")
170 print("%s %s %6.2F nbarn, %5.2F, %5.2G, %5.2F "%(g,name,sigma*1E6,\
171 float(h['MA'].GetEntries())/options.NPoT,\
172 h['MA'].Integral(Mmin,Mmax)/float(h['MA'].GetEntries()),\
173 h['M'].GetEntries()/float(h['MA'].GetEntries())))
174 fraction = h['M'].Integral(Mmin,Mmax)/options.NPoT
175 # multiply with 0.5 assuming no polarization -0.5 < cosCS < 0.5
176 print("cross section a la NA50 for : %s %5.2F pb"%(g,0.5*fraction*sigma*1E9))
177 # via cosCS
178 for g in generators:
179 if online:
180 processes = generators[g].info.codesHard()
181 name = generators[g].info.nameProc(processes[0])
182 sigma = generators[g].info.sigmaGen(processes[0])
183 else:
184 name = ''
185 sigma = h['xsec_'+g].GetBinContent(1)
186 yax = h['cosCSJpsi_'+g].GetYaxis()
187 xax = h['cosCSJpsi_'+g].GetXaxis()
188 Mmin = xax.FindBin(-0.5)
189 Mmax = xax.FindBin(0.5)
190 Ymin = yax.FindBin(-0.425)
191 Ymax = yax.FindBin(0.575)
192 h['MA'] = h['cosCSJpsi_'+g].ProjectionX('MA')
193 h['M'] = h['cosCSJpsi_'+g].ProjectionX('M',Ymin,Ymax)
194 print("generator sigma mumu-in-mass-range% cosCS in-y-range")
195 print("%s %s %6.2F nbarn, %5.2F, %5.2F, %5.2F "%(g,name,sigma*1E6,\
196 float(h['MA'].GetEntries())/options.NPoT*100.,\
197 h['MA'].Integral(Mmin,Mmax)/float(h['MA'].GetEntries()),\
198 h['M'].GetEntries()/float(h['MA'].GetEntries())))
199 fraction = h['M'].Integral(Mmin,Mmax)/options.NPoT
200 # taking polarization into account.
201 print("cross section a la NA50, -0.5<cosCS<0.5: %5.2F pb"%(fraction*sigma*1E9))
202

◆ yBeam()

runPythia8.yBeam (   Mproton = 0.938272081,
  pbeam = 400. 
)

Definition at line 30 of file runPythia8.py.

30def yBeam(Mproton = 0.938272081, pbeam = 400.):
31 Ebeam = ROOT.TMath.Sqrt(pbeam**2+Mproton**2)
32 betaCM = pbeam / (Ebeam + Mproton)
33 y_beam = 0.5*ROOT.TMath.Log( (1+betaCM)/(1-betaCM)) # https://arxiv.org/pdf/1604.02651.pdf
34 return y_beam
35

Variable Documentation

◆ A

dict runPythia8.A = P1pl*P2mi-P2pl*P1mi

Definition at line 122 of file runPythia8.py.

◆ action

runPythia8.action

Definition at line 16 of file runPythia8.py.

◆ cosCS

dict runPythia8.cosCS = Zstar.pz()/abs(Zstar.pz()) * 1./Zstar.m()/ROOT.TMath.Sqrt(Zstar.m2()+Zstar.pT()**2)*A

Definition at line 123 of file runPythia8.py.

◆ ctime

runPythia8.ctime = timer.CpuTime()

Definition at line 144 of file runPythia8.py.

◆ d0

dict runPythia8.d0 = py.event.daughterList(ii)[0]

Definition at line 110 of file runPythia8.py.

◆ d1

dict runPythia8.d1 = py.event.daughterList(ii)[1]

Definition at line 111 of file runPythia8.py.

◆ default

runPythia8.default

Definition at line 11 of file runPythia8.py.

◆ dest

runPythia8.dest

Definition at line 11 of file runPythia8.py.

◆ f

runPythia8.f = ROOT.TFile("ntuple-"+hname+".root","RECREATE")

Definition at line 84 of file runPythia8.py.

◆ float

runPythia8.float

Definition at line 14 of file runPythia8.py.

◆ G

dict runPythia8.G = M[0]+M[1]

Definition at line 133 of file runPythia8.py.

◆ generators

dict runPythia8.generators = {'p':ROOT.Pythia8.Pythia(),'n':ROOT.Pythia8.Pythia()}

Definition at line 36 of file runPythia8.py.

◆ h

dict runPythia8.h = {}

Definition at line 5 of file runPythia8.py.

◆ help

runPythia8.help

Definition at line 11 of file runPythia8.py.

◆ hname

str runPythia8.hname = 'pythia8_PDFpset'+options.PDFpSet+'_Emin'+str(options.Emin)+'_'+generators['p'].info.nameProc(processes[0])

Definition at line 79 of file runPythia8.py.

◆ ii

dict runPythia8.ii = nmu[ks[0]]

Definition at line 109 of file runPythia8.py.

◆ int

runPythia8.int

Definition at line 11 of file runPythia8.py.

◆ k

int runPythia8.k = 0

Definition at line 129 of file runPythia8.py.

◆ ks

runPythia8.ks = list(nmu)

Definition at line 104 of file runPythia8.py.

◆ M

dict runPythia8.M = {}

Definition at line 128 of file runPythia8.py.

◆ nantilep

dict runPythia8.nantilep = py.event[d1]

Definition at line 114 of file runPythia8.py.

◆ nlep

dict runPythia8.nlep = py.event[d0]

Definition at line 113 of file runPythia8.py.

◆ nmu

dict runPythia8.nmu = {}

Definition at line 96 of file runPythia8.py.

◆ ntagged

dict runPythia8.ntagged = {'p':0,'n':0}

Definition at line 90 of file runPythia8.py.

◆ options

runPythia8.options = parser.parse_args()

Definition at line 25 of file runPythia8.py.

◆ P1mi

dict runPythia8.P1mi = nlep.e()-nlep.pz()

Definition at line 120 of file runPythia8.py.

◆ P1pl

dict runPythia8.P1pl = nlep.e()+nlep.pz()

Definition at line 118 of file runPythia8.py.

◆ P2mi

dict runPythia8.P2mi = nantilep.e()-nantilep.pz()

Definition at line 121 of file runPythia8.py.

◆ P2pl

dict runPythia8.P2pl = nantilep.e()+nantilep.pz()

Definition at line 119 of file runPythia8.py.

◆ parser

runPythia8.parser = ArgumentParser()

Definition at line 10 of file runPythia8.py.

◆ processes

dict runPythia8.processes = generators['p'].info.codesHard()

Definition at line 78 of file runPythia8.py.

◆ py

dict runPythia8.py = generators[g]

Definition at line 94 of file runPythia8.py.

◆ rc

dict runPythia8.rc = generators['p'].next()

Definition at line 77 of file runPythia8.py.

◆ rtime

runPythia8.rtime = timer.RealTime()

Definition at line 143 of file runPythia8.py.

◆ sigma

dict runPythia8.sigma = generators[g].info.sigmaGen(processes[0])

Definition at line 148 of file runPythia8.py.

◆ signal

runPythia8.signal = ROOT.TNtuple("ntuple","ntuple","M:P:Pt:y:p1x:p1y:p1z:p2x:p2y:p2z:cosCS")

Definition at line 85 of file runPythia8.py.

◆ str

runPythia8.str

Definition at line 20 of file runPythia8.py.

◆ theSeed

int runPythia8.theSeed = 0

Definition at line 4 of file runPythia8.py.

◆ timer

runPythia8.timer = ROOT.TStopwatch()

Definition at line 87 of file runPythia8.py.

◆ type

runPythia8.type

Definition at line 11 of file runPythia8.py.

◆ X

runPythia8.X = ROOT.FixedTargetGenerator()

Definition at line 27 of file runPythia8.py.

◆ ybeam

runPythia8.ybeam = yBeam(pbeam = options.fMom)

Definition at line 91 of file runPythia8.py.

◆ Zstar

dict runPythia8.Zstar = py.event[nmu[ks[0]]]

Definition at line 106 of file runPythia8.py.