8from typing
import NamedTuple
13ROOT.gROOT.ProcessLine(
'#include "FairModule.h"')
25 """Target block and beam configuration for one photon-conversion study point."""
33 "10":
Setup(2 * u.cm,
"Aluminium", 10 * u.GeV),
34 "100":
Setup(2 * u.cm,
"Aluminium", 100 * u.GeV),
35 "200":
Setup(2 * u.cm,
"Aluminium", 200 * u.GeV),
42thickness, material, momentum = setup[s]
46outFile =
"gconv" + s +
".root"
47theSeed = int(10000 * time.time() % 10000000)
51ROOT.gRandom.SetSeed(theSeed)
56timer = ROOT.TStopwatch()
60run = ROOT.FairRunSim()
62sink = ROOT.FairRootFileSink(outFile)
64ROOT.SetOwnership(sink,
False)
69 os.environ[
"SET_GENERAL_PROCESS_TO_FALSE"] =
"1"
70run.SetUserConfig(
"g4Config.C")
71rtdb = run.GetRuntimeDb()
74run.SetMaterials(
"media.geo")
76cave = ROOT.ShipCave(
"CAVE")
77cave.SetGeometryFileName(
"cave.geo")
85 ROOT.pyFairModule.__init__(self, self)
89 print(
"Construct Block")
90 top = ROOT.gGeoManager.GetTopVolume()
91 geoLoad = ROOT.FairGeoLoader.Instance()
92 geoFace = geoLoad.getGeoInterface()
93 media = geoFace.getMedia()
94 geoBuild = geoLoad.getGeoBuilder()
95 ShipMedium = media.getMedium(material)
96 W = ROOT.gGeoManager.GetMedium(material)
98 geoBuild.createMedium(ShipMedium)
99 W = ROOT.gGeoManager.GetMedium(material)
100 aBox = ROOT.gGeoManager.MakeBox(
"target", W, 100.0 * u.cm, 100.0 * u.cm, thickness)
101 top.AddNode(aBox, 1, ROOT.TGeoTranslation(0, 0, 0))
106 print(
"not implemented!")
112sensPlane = ROOT.exitHadronAbsorber()
113sensPlane.SetEnergyCut(ecut * u.GeV)
114sensPlane.SetZposition(thickness + 10 * u.cm)
115run.AddModule(sensPlane)
117target.makeSensitive(sensPlane)
120primGen = ROOT.FairPrimaryGenerator()
121myPgun = ROOT.FairBoxGenerator(22, 1)
122myPgun.SetPRange(momentum - 0.01, momentum + 0.01)
123myPgun.SetPhiRange(0, 0)
124myPgun.SetThetaRange(0, 0)
125myPgun.SetXYZ(0.0 * u.cm, 0.0 * u.cm, -10.0 * u.cm - (thickness))
126primGen.AddGenerator(myPgun)
127run.SetGenerator(primGen)
129run.SetGenerator(primGen)
132gMC = ROOT.TVirtualMC.GetMC()
134fStack = gMC.GetStack()
135fStack.SetMinPoints(1)
136fStack.SetEnergyCut(-1.0)
139 ROOT.gROOT.ProcessLine(
'#include "Geant4/G4ProcessTable.hh"')
140 ROOT.gROOT.ProcessLine(
'#include "Geant4/G4AnnihiToMuPair.hh"')
141 ROOT.gROOT.ProcessLine(
'#include "Geant4/G4GammaConversionToMuons.hh"')
142 gProcessTable = ROOT.G4ProcessTable.GetProcessTable()
143 procAnnihil = gProcessTable.FindProcess(ROOT.G4String(
"AnnihiToMuPair"), ROOT.G4String(
"e+"))
144 procGMuPair = gProcessTable.FindProcess(ROOT.G4String(
"GammaToMuPair"), ROOT.G4String(
"gamma"))
145 procGMuPair.SetCrossSecFactor(boostFactor)
146 procAnnihil.SetCrossSecFactor(boostFactor)
152ROOT.gROOT.ProcessLine(
'#include "Geant4/G4EmParameters.hh"')
153emP = ROOT.G4EmParameters.Instance()
156import rootUtils
as ut
158f = ROOT.gROOT.GetListOfFiles()[0]
160ut.bookHist(h,
"muons",
"muon mult", 10, -0.5, 9.5)
161ut.bookHist(h,
"electrons",
"e mult", 10, -0.5, 9.5)
162sTree = f.Get(
"cbmsim")
163for n
in range(sTree.GetEntries()):
164 rc = sTree.GetEvent(n)
167 for aHit
in sTree.vetoPoint:
168 if abs(sTree.MCTrack[aHit.GetTrackID()].GetPdgCode()) == 13:
170 if abs(sTree.MCTrack[aHit.GetTrackID()].GetPdgCode()) == 11:
172 rc = h[
"muons"].Fill(nMu)
173 rc = h[
"electrons"].Fill(nEl)
178rtime = timer.RealTime()
179ctime = timer.CpuTime()
181print(
"Macro finished successfully.")
182print(
"Output file is ", outFile)
183print(
"Real time ", rtime,
" s, CPU time ", ctime,
"s")
None makeSensitive(self, sensPlane)
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)