12ROOT.gROOT.ProcessLine(
'#include "FairModule.h"')
23setup[
"10"] = {
"thickness": 2 * u.cm,
"material":
"aluminium",
"momentum": 10 * u.GeV}
24setup[
"100"] = {
"thickness": 2 * u.cm,
"material":
"aluminium",
"momentum": 100 * u.GeV}
25setup[
"200"] = {
"thickness": 2 * u.cm,
"material":
"aluminium",
"momentum": 200 * u.GeV}
31thickness = setup[s][
"thickness"]
32material = setup[s][
"material"]
33momentum = setup[s][
"momentum"]
37outFile =
"gconv" + s +
".root"
38theSeed = int(10000 * time.time() % 10000000)
42ROOT.gRandom.SetSeed(theSeed)
47timer = ROOT.TStopwatch()
51run = ROOT.FairRunSim()
53run.SetSink(ROOT.FairRootFileSink(outFile))
58 os.environ[
"SET_GENERAL_PROCESS_TO_FALSE"] =
"1"
59run.SetUserConfig(
"g4Config.C")
60rtdb = run.GetRuntimeDb()
63run.SetMaterials(
"media.geo")
65cave = ROOT.ShipCave(
"CAVE")
66cave.SetGeometryFileName(
"cave.geo")
74 ROOT.pyFairModule.__init__(self, self)
78 print(
"Construct Block")
79 top = ROOT.gGeoManager.GetTopVolume()
80 geoLoad = ROOT.FairGeoLoader.Instance()
81 geoFace = geoLoad.getGeoInterface()
82 media = geoFace.getMedia()
83 geoBuild = geoLoad.getGeoBuilder()
84 ShipMedium = media.getMedium(material)
85 W = ROOT.gGeoManager.GetMedium(material)
87 geoBuild.createMedium(ShipMedium)
88 W = ROOT.gGeoManager.GetMedium(material)
89 aBox = ROOT.gGeoManager.MakeBox(
"target", W, 100.0 * u.cm, 100.0 * u.cm, thickness)
90 top.AddNode(aBox, 1, ROOT.TGeoTranslation(0, 0, 0))
95 print(
"not implemented!")
101sensPlane = ROOT.exitHadronAbsorber()
102sensPlane.SetEnergyCut(ecut * u.GeV)
103sensPlane.SetZposition(thickness + 10 * u.cm)
104run.AddModule(sensPlane)
106target.makeSensitive(sensPlane)
109primGen = ROOT.FairPrimaryGenerator()
110myPgun = ROOT.FairBoxGenerator(22, 1)
111myPgun.SetPRange(momentum - 0.01, momentum + 0.01)
112myPgun.SetPhiRange(0, 0)
113myPgun.SetThetaRange(0, 0)
114myPgun.SetXYZ(0.0 * u.cm, 0.0 * u.cm, -10.0 * u.cm - (thickness))
115primGen.AddGenerator(myPgun)
116run.SetGenerator(primGen)
118run.SetGenerator(primGen)
121gMC = ROOT.TVirtualMC.GetMC()
123fStack = gMC.GetStack()
124fStack.SetMinPoints(1)
125fStack.SetEnergyCut(-1.0)
128 ROOT.gROOT.ProcessLine(
'#include "Geant4/G4ProcessTable.hh"')
129 ROOT.gROOT.ProcessLine(
'#include "Geant4/G4AnnihiToMuPair.hh"')
130 ROOT.gROOT.ProcessLine(
'#include "Geant4/G4GammaConversionToMuons.hh"')
131 gProcessTable = ROOT.G4ProcessTable.GetProcessTable()
132 procAnnihil = gProcessTable.FindProcess(ROOT.G4String(
"AnnihiToMuPair"), ROOT.G4String(
"e+"))
133 procGMuPair = gProcessTable.FindProcess(ROOT.G4String(
"GammaToMuPair"), ROOT.G4String(
"gamma"))
134 procGMuPair.SetCrossSecFactor(boostFactor)
135 procAnnihil.SetCrossSecFactor(boostFactor)
141ROOT.gROOT.ProcessLine(
'#include "Geant4/G4EmParameters.hh"')
142emP = ROOT.G4EmParameters.Instance()
145import rootUtils
as ut
147f = ROOT.gROOT.GetListOfFiles()[0]
149ut.bookHist(h,
"muons",
"muon mult", 10, -0.5, 9.5)
150ut.bookHist(h,
"electrons",
"e mult", 10, -0.5, 9.5)
151sTree = f.Get(
"cbmsim")
152for n
in range(sTree.GetEntries()):
153 rc = sTree.GetEvent(n)
156 for aHit
in sTree.vetoPoint:
157 if abs(sTree.MCTrack[aHit.GetTrackID()].GetPdgCode()) == 13:
159 if abs(sTree.MCTrack[aHit.GetTrackID()].GetPdgCode()) == 11:
161 rc = h[
"muons"].Fill(nMu)
162 rc = h[
"electrons"].Fill(nEl)
167rtime = timer.RealTime()
168ctime = timer.CpuTime()
170print(
"Macro finished successfully.")
171print(
"Output file is ", outFile)
172print(
"Real time ", rtime,
" s, CPU time ", ctime,
"s")
None makeSensitive(self, sensPlane)
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)