11ROOT.gROOT.ProcessLine(
'#include "FairModule.h"')
22setup[
"Fig3"] = {
"thickness": 0.1 * u.cm,
"material":
"lead",
"momentum": 2 * u.GeV,
"maxTheta": 0.2}
23setup[
"Fig4"] = {
"thickness": 0.1 * u.cm,
"material":
"lead",
"momentum": 8 * u.GeV,
"maxTheta": 0.04}
24setup[
"Fig5"] = {
"thickness": 0.1 * u.cm,
"material":
"lead",
"momentum": 14 * u.GeV,
"maxTheta": 0.02}
26setup[
"Fig6"] = {
"thickness": 1.44 * u.cm,
"material":
"copper",
"momentum": 11.7 * u.GeV,
"maxTheta": 0.045}
27setup[
"Fig7"] = {
"thickness": 1.44 * u.cm,
"material":
"copper",
"momentum": 7.3 * u.GeV,
"maxTheta": 0.045}
30thickness = setup[s][
"thickness"]
31material = setup[s][
"material"]
32momentum = setup[s][
"momentum"]
33maxTheta = setup[s][
"maxTheta"]
38outFile =
"msc" + s +
".root"
39theSeed = int(10000 * time.time() % 10000000)
43ROOT.gRandom.SetSeed(theSeed)
48timer = ROOT.TStopwatch()
52run = ROOT.FairRunSim()
54run.SetSink(ROOT.FairRootFileSink(outFile))
55run.SetUserConfig(
"g4Config.C")
56rtdb = run.GetRuntimeDb()
59run.SetMaterials(
"media.geo")
61cave = ROOT.ShipCave(
"CAVE")
62cave.SetGeometryFileName(
"cave.geo")
70 ROOT.pyFairModule.__init__(self, self)
73 print(
"Construct Block")
74 top = ROOT.gGeoManager.GetTopVolume()
75 geoLoad = ROOT.FairGeoLoader.Instance()
76 geoFace = geoLoad.getGeoInterface()
77 media = geoFace.getMedia()
78 geoBuild = geoLoad.getGeoBuilder()
79 ShipMedium = media.getMedium(material)
80 W = ROOT.gGeoManager.GetMedium(material)
82 geoBuild.createMedium(ShipMedium)
83 W = ROOT.gGeoManager.GetMedium(material)
84 aBox = ROOT.gGeoManager.MakeBox(
"target", W, 100.0 * u.cm, 100.0 * u.cm, thickness)
85 top.AddNode(aBox, 1, ROOT.TGeoTranslation(0, 0, 0))
88 print(
"not implemented!")
91sensPlane = ROOT.exitHadronAbsorber()
92sensPlane.SetEnergyCut(ecut * u.GeV)
94 sensPlane.SetOnlyMuons()
95sensPlane.SetZposition(thickness + 10 * u.cm)
96run.AddModule(sensPlane)
100primGen = ROOT.FairPrimaryGenerator()
101myPgun = ROOT.FairBoxGenerator(13, 1)
102myPgun.SetPRange(momentum - 0.01, momentum + 0.01)
103myPgun.SetPhiRange(0, 0)
104myPgun.SetThetaRange(0, 0)
105myPgun.SetXYZ(0.0 * u.cm, 0.0 * u.cm, -10.0 * u.cm - (thickness))
106primGen.AddGenerator(myPgun)
107run.SetGenerator(primGen)
109run.SetGenerator(primGen)
112gMC = ROOT.TVirtualMC.GetMC()
114fStack = gMC.GetStack()
115fStack.SetMinPoints(1)
116fStack.SetEnergyCut(-1.0)
122ROOT.gROOT.ProcessLine(
'#include "Geant4/G4EmParameters.hh"')
123emP = ROOT.G4EmParameters.Instance()
126import rootUtils
as ut
128f = ROOT.gROOT.GetListOfFiles()[0]
130ut.bookHist(h,
"theta",
"scattering angle " + str(momentum) +
"GeV/c;{Theta}(rad)", 500, 0, maxTheta)
131sTree = f.Get(
"cbmsim")
132for n
in range(sTree.GetEntries()):
133 rc = sTree.GetEvent(n)
134 for aHit
in sTree.vetoPoint:
135 if aHit.GetTrackID() != 0:
137 pt = ROOT.TMath.Sqrt(aHit.GetPx() ** 2 + aHit.GetPy() ** 2)
138 scat = ROOT.TMath.ATan2(pt, aHit.GetPz())
139 rc = h[
"theta"].Fill(scat)
140ut.bookCanvas(h, key=s, title=s, nx=900, ny=600, cx=1, cy=1)
143h[
"theta_100"] = h[
"theta"].Clone(
"theta_100")
144h[
"theta_100"] = h[
"theta"].Rebin(5)
145h[
"theta_100"].Scale(1.0 / h[
"theta_100"].GetMaximum())
147h[s].Print(s +
".png")
148h[s].Print(s +
".root")
150f.Write(h[
"theta"].GetName())
151f.Write(h[
"theta_100"].GetName())
155rtime = timer.RealTime()
156ctime = timer.CpuTime()
158print(
"Macro finished successfully.")
159print(
"Output file is ", outFile)
160print(
"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)