10ROOT.gROOT.ProcessLine(
'#include "FairModule.h"')
22 "thickness": 0.1 * u.cm,
23 "material":
"tungsten",
24 "min momentum": 400 * u.GeV,
25 "max momentum": 400 * u.GeV,
29thickness = setup[s][
"thickness"]
30material = setup[s][
"material"]
31minmomentum = setup[s][
"min momentum"]
32maxmomentum = setup[s][
"max momentum"]
44 ROOT.gRandom.SetSeed(0)
45 theSeed = ROOT.gRandom.GetSeed()
47if theSeed > 900000000:
48 theSeed = theSeed % 900000000
49ROOT.gRandom.SetSeed(theSeed)
54timer = ROOT.TStopwatch()
58gFairBaseContFact = ROOT.FairBaseContFact()
59run = ROOT.FairRunSim()
61run.SetSink(ROOT.FairRootFileSink(outFile))
62run.SetUserConfig(
"g4Config.C")
63rtdb = run.GetRuntimeDb()
66run.SetMaterials(
"media.geo")
68cave = ROOT.ShipCave(
"CAVE")
69cave.SetGeometryFileName(
"cave.geo")
77 ROOT.pyFairModule.__init__(self, self)
80 print(
"Construct Block")
81 top = ROOT.gGeoManager.GetTopVolume()
82 geoLoad = ROOT.FairGeoLoader.Instance()
83 geoFace = geoLoad.getGeoInterface()
84 media = geoFace.getMedia()
85 geoBuild = geoLoad.getGeoBuilder()
86 ShipMedium = media.getMedium(material)
87 W = ROOT.gGeoManager.GetMedium(material)
89 geoBuild.createMedium(ShipMedium)
90 W = ROOT.gGeoManager.GetMedium(material)
91 aBox = ROOT.gGeoManager.MakeBox(
"target", W, 100.0 * u.cm, 100.0 * u.cm, thickness)
92 top.AddNode(aBox, 1, ROOT.TGeoTranslation(0, 0, 0))
95 print(
"not implemented!")
98sensPlane = ROOT.exitHadronAbsorber()
99sensPlane.SetEnergyCut(ecut * u.GeV)
100sensPlane.SetZposition(thickness + 10 * u.cm)
101run.AddModule(sensPlane)
105primGen = ROOT.FairPrimaryGenerator()
106myPgun = ROOT.FairBoxGenerator(2212, 1)
107myPgun.SetPRange(minmomentum, maxmomentum)
108myPgun.SetPhiRange(0, 0)
109myPgun.SetThetaRange(0, 0)
110myPgun.SetXYZ(0.0 * u.cm, 0.0 * u.cm, -10.0 * u.cm - (thickness))
111primGen.AddGenerator(myPgun)
112run.SetGenerator(primGen)
114run.SetGenerator(primGen)
117gMC = ROOT.TVirtualMC.GetMC()
119fStack = gMC.GetStack()
120fStack.SetMinPoints(1)
121fStack.SetEnergyCut(-1.0)
128import rootUtils
as ut
130f = ROOT.TFile(
"TLV.root")
131pdg = ROOT.TDatabasePDG.Instance()
133sTree = f.Get(
"cbmsim")
134ut.bookHist(h,
"Ekin",
"Ekin of particles in sens plane", 400000, 0.0, 400)
135ut.bookHist(h,
"EkinLow",
"Ekin of particles in sens plane", 1000, 0.0, 0.001)
136for n
in range(sTree.GetEntries()):
137 rc = sTree.GetEvent(n)
138 for aHit
in sTree.vetoPoint:
139 oTrack = sTree.MCTrack[aHit.GetTrackID()]
140 M = pdg.GetParticle(oTrack.GetPdgCode()).Mass()
141 Ekin = ROOT.TMath.Sqrt(aHit.GetPx() ** 2 + aHit.GetPy() ** 2 + aHit.GetPz() ** 2 + M**2) - M
142 rc = h[
"Ekin"].Fill(Ekin)
143 rc = h[
"EkinLow"].Fill(Ekin)
144ut.bookCanvas(h, key=s, title=s, nx=900, ny=600, cx=1, cy=1)
154rtime = timer.RealTime()
155ctime = timer.CpuTime()
157print(
"Macro finished successfully.")
158print(
"Output file is ", outFile)
159print(
"Real time ", rtime,
" s, CPU time ", ctime,
"s")
None ConstructGeometry(self)
def create_config(str DecayVolumeMedium="helium", float Yheight=6.0, int strawDesign=10, muShieldGeo=None, str shieldName="New_HA_Design", int nuTargetPassive=1, bool SND=True, SND_design=None, TARGET_YAML=None)
None configure(darkphoton=None)