2from __future__
import print_function
3import ROOT,os,sys,getopt,time,shipRoot_conf
4ROOT.gROOT.ProcessLine(
'#include "FairModule.h"')
8from ShipGeoConfig
import ConfigRegistry
15setup[
'TLV'] = {
'thickness': 0.1*u.cm,
'material':
'tungsten',
'min momentum': 400*u.GeV,
'max momentum': 400*u.GeV}
18thickness = setup[s][
'thickness']
19material = setup[s][
'material']
20minmomentum = setup[s][
'min momentum']
21maxmomentum = setup[s][
'max momentum']
30ROOT.gRandom.SetSeed(theSeed)
32ship_geo = ConfigRegistry.loadpy(
"$FAIRSHIP/geometry/geometry_config.py", Yheight = 10, tankDesign = 5, muShieldDesign = 7, nuTauTargetDesign=1)
35timer = ROOT.TStopwatch()
39gFairBaseContFact = ROOT.FairBaseContFact()
40run = ROOT.FairRunSim()
42run.SetOutputFile(outFile)
43run.SetUserConfig(
"g4Config.C")
44rtdb = run.GetRuntimeDb()
47run.SetMaterials(
"media.geo")
49cave= ROOT.ShipCave(
"CAVE")
50cave.SetGeometryFileName(
"cave.geo")
56 def __init__(self): ROOT.pyFairModule.__init__(self,self)
58 print(
"Construct Block")
59 top=ROOT.gGeoManager.GetTopVolume()
60 geoLoad=ROOT.FairGeoLoader.Instance()
61 geoFace=geoLoad.getGeoInterface()
62 media=geoFace.getMedia()
63 geoBuild=geoLoad.getGeoBuilder()
64 ShipMedium=media.getMedium(material)
65 W = ROOT.gGeoManager.GetMedium(material)
67 rc = geoBuild.createMedium(ShipMedium)
68 W = ROOT.gGeoManager.GetMedium(material)
69 aBox = ROOT.gGeoManager.MakeBox(
"target", W, 100.*u.cm, 100.*u.cm, thickness)
70 top.AddNode(aBox, 1, ROOT.TGeoTranslation(0, 0, 0 ))
72 print(
"not implemented!")
74sensPlane = ROOT.exitHadronAbsorber()
75sensPlane.SetEnergyCut(ecut*u.GeV)
76sensPlane.SetZposition(thickness+10*u.cm)
77run.AddModule(sensPlane)
81primGen = ROOT.FairPrimaryGenerator()
82myPgun = ROOT.FairBoxGenerator(2212,1)
83myPgun.SetPRange(minmomentum,maxmomentum)
84myPgun.SetPhiRange(0,0)
85myPgun.SetThetaRange(0,0)
86myPgun.SetXYZ(0.*u.cm, 0.*u.cm, -10.*u.cm - (thickness) )
87primGen.AddGenerator(myPgun)
88run.SetGenerator(primGen)
90run.SetGenerator(primGen)
93gMC = ROOT.TVirtualMC.GetMC()
95fStack = gMC.GetStack()
97fStack.SetEnergyCut(-1.)
104import rootUtils
as ut
106f=ROOT.TFile(
'TLV.root')
107pdg = ROOT.TDatabasePDG.Instance()
110ut.bookHist(h,
'Ekin',
'Ekin of particles in sens plane',400000,0.,400)
111ut.bookHist(h,
'EkinLow',
'Ekin of particles in sens plane',1000,0.,0.001)
112for n
in range(sTree.GetEntries()):
113 rc = sTree.GetEvent(n)
114 for aHit
in sTree.vetoPoint:
115 oTrack = sTree.MCTrack[aHit.GetTrackID()]
116 M = pdg.GetParticle(oTrack.GetPdgCode()).Mass()
117 Ekin = ROOT.TMath.Sqrt( aHit.GetPx()**2+aHit.GetPy()**2+aHit.GetPz()**2 + M**2) - M
118 rc = h[
'Ekin'].Fill(Ekin)
119 rc = h[
'EkinLow'].Fill(Ekin)
120ut.bookCanvas(h,key=s,title=s,nx=900,ny=600,cx=1,cy=1)
130rtime = timer.RealTime()
131ctime = timer.CpuTime()
133print(
"Macro finished succesfully.")
134print(
"Output file is ", outFile)
135print(
"Real time ",rtime,
" s, CPU time ",ctime,
"s")
configure(darkphoton=None)