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()
61sink = ROOT.FairRootFileSink(outFile)
63ROOT.SetOwnership(sink,
False)
64run.SetUserConfig(
"g4Config.C")
65rtdb = run.GetRuntimeDb()
68run.SetMaterials(
"media.geo")
70cave = ROOT.ShipCave(
"CAVE")
71cave.SetGeometryFileName(
"cave.geo")
79 ROOT.pyFairModule.__init__(self, self)
82 print(
"Construct Block")
83 top = ROOT.gGeoManager.GetTopVolume()
84 geoLoad = ROOT.FairGeoLoader.Instance()
85 geoFace = geoLoad.getGeoInterface()
86 media = geoFace.getMedia()
87 geoBuild = geoLoad.getGeoBuilder()
88 ShipMedium = media.getMedium(material)
89 W = ROOT.gGeoManager.GetMedium(material)
91 geoBuild.createMedium(ShipMedium)
92 W = ROOT.gGeoManager.GetMedium(material)
93 aBox = ROOT.gGeoManager.MakeBox(
"target", W, 100.0 * u.cm, 100.0 * u.cm, thickness)
94 top.AddNode(aBox, 1, ROOT.TGeoTranslation(0, 0, 0))
97 print(
"not implemented!")
100sensPlane = ROOT.exitHadronAbsorber()
101sensPlane.SetEnergyCut(ecut * u.GeV)
102sensPlane.SetZposition(thickness + 10 * u.cm)
103run.AddModule(sensPlane)
107primGen = ROOT.FairPrimaryGenerator()
108myPgun = ROOT.FairBoxGenerator(2212, 1)
109myPgun.SetPRange(minmomentum, maxmomentum)
110myPgun.SetPhiRange(0, 0)
111myPgun.SetThetaRange(0, 0)
112myPgun.SetXYZ(0.0 * u.cm, 0.0 * u.cm, -10.0 * u.cm - (thickness))
113primGen.AddGenerator(myPgun)
114run.SetGenerator(primGen)
116run.SetGenerator(primGen)
119gMC = ROOT.TVirtualMC.GetMC()
121fStack = gMC.GetStack()
122fStack.SetMinPoints(1)
123fStack.SetEnergyCut(-1.0)
130import rootUtils
as ut
132f = ROOT.TFile(
"TLV.root")
133pdg = ROOT.TDatabasePDG.Instance()
135sTree = f.Get(
"cbmsim")
136ut.bookHist(h,
"Ekin",
"Ekin of particles in sens plane", 400000, 0.0, 400)
137ut.bookHist(h,
"EkinLow",
"Ekin of particles in sens plane", 1000, 0.0, 0.001)
138for n
in range(sTree.GetEntries()):
139 rc = sTree.GetEvent(n)
140 for aHit
in sTree.vetoPoint:
141 oTrack = sTree.MCTrack[aHit.GetTrackID()]
142 _p = ut.get_particle(oTrack.GetPdgCode())
144 Ekin = ROOT.TMath.Sqrt(aHit.GetPx() ** 2 + aHit.GetPy() ** 2 + aHit.GetPz() ** 2 + M**2) - M
145 rc = h[
"Ekin"].Fill(Ekin)
146 rc = h[
"EkinLow"].Fill(Ekin)
147ut.bookCanvas(h, key=s, title=s, nx=900, ny=600, cx=1, cy=1)
157rtime = timer.RealTime()
158ctime = timer.CpuTime()
160print(
"Macro finished successfully.")
161print(
"Output file is ", outFile)
162print(
"Real time ", rtime,
" s, CPU time ", ctime,
"s")
None ConstructGeometry(self)
create_config(str DecayVolumeMedium="helium", float Yheight=6.0, int strawDesign=10, str shieldName="TRY_2026", int nuTargetPassive=1, bool SND=True, SND_design=None, TARGET_YAML=None)
None configure(darkphoton=None)