SND@LHC Software
Loading...
Searching...
No Matches
shipRoot_conf.py
Go to the documentation of this file.
1import ROOT
2import atexit
3import sys
4import os
5from pythia8_conf_utils import addHNLtoROOT
6from pythia8darkphoton_conf import addDPtoROOT
7
8# Check whether we are in the SND@LHC environment
9if not os.environ.get("SNDSW_ROOT"):
10 print("ERROR: SNDSW_ROOT unset. Exiting.")
11 print("ERROR: Please make sure that you're running in the SND@LHC environment.")
12 quit(1)
13
14# When on Darwin load all needed shared libs as DYLD_LIBRARY_PATH is not
15# passed to system Python out of security reasons...
16if sys.platform == 'darwin':
17 # Load FairRoot libraries
18 ROOT.gSystem.Load('libFairTools')
19 ROOT.gSystem.Load('libParBase')
20 ROOT.gSystem.Load('libGeoBase')
21 ROOT.gSystem.Load('libMbsAPI')
22 ROOT.gSystem.Load('libBase')
23 # Load FairShip libraries
24 ROOT.gSystem.Load('libShipPassive')
25 ROOT.gSystem.Load('libShipField')
26 ROOT.gSystem.Load('libcharmdet')
27 ROOT.gSystem.Load('libveto')
28 ROOT.gSystem.Load('libnutaudet')
29 ROOT.gSystem.Load('libstrawtubes')
30 ROOT.gSystem.Load('libecal')
31 ROOT.gSystem.Load('libhcal')
32 ROOT.gSystem.Load('libmuon')
33 ROOT.gSystem.Load('libpid')
34 ROOT.gSystem.Load('libpreshower')
35 ROOT.gSystem.Load('libgenfit')
36 ROOT.gSystem.Load("libPythia6")
37 ROOT.gSystem.Load("libpythia8")
38 ROOT.gSystem.Load('libShipGen')
39 ROOT.gSystem.Load('libShipData')
40else:
41 ROOT.gSystem.Load("libPythia6")
42 ROOT.gSystem.Load("libpythia8")
43 ROOT.gSystem.Load("libG4clhep")
44
46 ROOT.gInterpreter.ProcessLine('typedef double Double32_t')
47
48# -----prepare python exit-----------------------------------------------
49
50
51def pyExit():
52 for module in sys.modules:
53 if "ROOT.genfit" in module:
54 x = sys.modules['__main__']
55 if hasattr(x, 'run'):
56 del x.run
57 print(
58 "make suicid, until better solution found to ROOT/genfit interference")
59 for f in ROOT.gROOT.GetListOfFiles():
60 if f.IsWritable() and f.IsOpen(): f.Close()
61 os.system('kill '+str(os.getpid()))
62 if hasattr(x,'fMan'): del x.fMan
63 if hasattr(x,'fRun'): del x.fRun
64 return
65 print("Exit normally")
66
67def configure(darkphoton=None):
68 ROOT.gROOT.ProcessLine('#include "ShipGlobals.h"')
69 pdg = ROOT.TDatabasePDG.Instance()
70 # pythia stuff not known to ROOT
71 pdg.AddParticle('system','system', 0., False, 0., 0., 'XXX', 90)
72 pdg.AddParticle('Pomeron','Pomeron', 0., False, 0., 0., 'Pomeron', 990)
73 pdg.AddParticle('p_diffr+','p_diffr+', 0., False, 0., 0., 'XXX', 9902210)
74 pdg.AddParticle('n_diffr0','n_diffr0', 0., False, 0., 0., 'XXX', 9902110)
75 pdg.AddParticle('J/psi[3PJ(8)]' ,'J/psi[3PJ(8)]' ,3.29692,False,0., 0.,'Meson', 9942003)
76 pdg.AddParticle('J/psi[1S0(8)]' ,'J/psi[1S0(8)]' ,3.29692,False,0., 0.,'Meson', 9941003)
77 pdg.AddParticle('f0(980)' ,'f0(980)' ,1.0, False,0.0, 0.,'Meson', 9010221)
78 pdg.AddParticle('psi(3770)' ,'psi(3770)' ,3.77315,False,0.02720, 0, 'Meson', 30443)
79 pdg.AddParticle('psi(3770)[3PJ(8)]','psi(3770)[3PJ(8)]',3.97315,False,0.0, 0, 'Meson', 9942033)
80 pdg.AddParticle('J/psi[3S1(8)]' ,'J/psi[3S1(8)]' ,3.29692,False,0.0, 0, 'Meson', 9940003)
81 pdg.AddParticle('chi_0c[3S1(8)]' ,'chi_0c[3S1(8)]' ,3.61475,False,0.0, 0, 'Meson', 9940011)
82 pdg.AddParticle('psi(2S)[1S0(8)]' ,'psi(2S)[1S0(8)]' ,3.88611,False,0.0, 0, 'Meson', 9941103)
83 pdg.AddParticle('psi(2S)[3S1(8)]' ,'psi(2S)[3S1(8)]' ,3.88611,False,0.0, 0, 'Meson', 9940103)
84 pdg.AddParticle('psi(2S)[3PJ(8)]' ,'psi(2S)[3PJ(8)]' ,3.88611,False,0.0, 0, 'Meson', 9942103)
85 pdg.AddParticle('chi_1c[3S1(8)]' ,'chi_1c[3S1(8)]' ,3.71066,False,0.0, 0, 'Meson', 9940023)
86 pdg.AddParticle('chi_2c[3S1(8)]' ,'chi_2c[3S1(8)]' ,3.75620,False,0.0, 0, 'Meson', 9940005)
87 pdg.AddParticle('Upsilon[3S1(8)]' ,'Upsilon[3S1(8)]' ,9.66030,False,0.0, 0, 'Meson', 9950003)
88 atexit.register(pyExit)
89 if darkphoton==0: return # will be added by pythia8_conf
90 if (darkphoton):
91 addDPtoROOT()
92 else:
93 addHNLtoROOT()
94
configure(darkphoton=None)