Public Member Functions | |
def | __init__ |
Configure GenTools, DetSim and DetSimVali for running uniform distribution of positrons in an AD. Does not configure geometry.
Definition at line 7 of file AD.py.
def DetSimValidation::AD::UniformPositron::__init__ | ( | self, | ||
histogram_filename = 'elec_uni.root' | ||||
) |
Construct the default configuration. A non-default histogram_filename can be specified to hold the resulting histograms.
Definition at line 10 of file AD.py.
00012 : 00013 ''' Construct the default configuration. A non-default 00014 histogram_filename can be specified to hold the resulting 00015 histograms. 00016 ''' 00017 import GaudiKernel.SystemOfUnits as units 00018 00019 volume="/dd/Structure/AD/far-lso2" 00020 00021 # First GenTools 00022 from GenTools.Helpers import Gun 00023 from GenTools.GenToolsConf import GtGunGenTool, GtPositionerTool 00024 gun = Gun(volume, 00025 gun = GtGunGenTool("gun", 00026 ParticlesPerEvent = 1, 00027 ParticleName = "e+", 00028 Momentum = 5*units.MeV, 00029 MomentumMode = "Uniform", 00030 MomentumSpread = 4*units.MeV, 00031 DirectionMode = "Uniform", 00032 Direction = [ 1, 0, 0 ], 00033 DirectionSpread = 3), 00034 positioner = GtPositionerTool("pos", 00035 Strategy = "FullVolume", 00036 Mode = "Uniform", 00037 Spread = 2.6*units.meter, 00038 Position = [0,0,0*units.meter]) 00039 ) 00040 gun.timerator.LifeTime = 1*units.second 00041 import GenTools 00042 GenTools.Configure().register(gun) 00043 self.gun = gun 00044 00045 self.dumper = GenTools.Dumper() 00046 00047 # Then DetSim, with smaller than default configuration: 00048 import DetSim 00049 detsim = DetSim.Configure(site="far",physlist=DetSim.physics_list_basic) 00050 params = { 00051 'start' :"(start > 0)", 00052 'track1':"(id==1)", 00053 'track2':"(id==2)", 00054 'GD': "MaterialName == '/dd/Materials/GdDopedLS'", 00055 'LS': "MaterialName == '/dd/Materials/LiquidScintillator'", 00056 'MO': "MaterialName == '/dd/Materials/MineralOil'", 00057 'IAV': "MaterialName == '/dd/Materials/Acrylic'", 00058 'OAV': "MaterialName == '/dd/Materials/Acrylic'", 00059 'lastvtx': "IsStopping == 1", 00060 'firstvtx': "IsStarting == 1" 00061 } 00062 detsim.unobserver(stats=[ 00063 # track 1 00064 ["pdgId_Trk1","pdg","%(track1)s and %(start)s"%params], 00065 ["t_Trk1", "t" , "%(track1)s and %(start)s"%params], 00066 ["x_Trk1", "x", "%(track1)s and %(start)s"%params], 00067 ["y_Trk1", "y", "%(track1)s and %(start)s"%params], 00068 ["z_Trk1", "z", "%(track1)s and %(start)s"%params], 00069 ["tEnd_Trk1", "t" , "%(track1)s and %(lastvtx)s"%params], 00070 ["xEnd_Trk1", "x", "%(track1)s and %(lastvtx)s"%params], 00071 ["yEnd_Trk1", "y", "%(track1)s and %(lastvtx)s"%params], 00072 ["zEnd_Trk1", "z", "%(track1)s and %(lastvtx)s"%params], 00073 ["e_Trk1", "E", "%(track1)s and %(start)s"%params], 00074 ["p_Trk1", "p", "%(track1)s and %(start)s"%params], 00075 ["ke_Trk1", "KE", "%(track1)s and %(start)s"%params], 00076 ["vx_Trk1", "lvx","%(track1)s and %(start)s"%params], 00077 ["vy_Trk1", "lvy","%(track1)s and %(start)s"%params], 00078 ["vz_Trk1", "lvz","%(track1)s and %(start)s"%params], 00079 ["TrkLength_GD_Trk1", "dx","%(track1)s and %(GD)s"%params], 00080 ["TrkLength_iAV_Trk1", "dx","%(track1)s and %(IAV)s"%params], 00081 ["TrkLength_LS_Trk1", "dx","%(track1)s and %(LS)s"%params], 00082 ["TrkLength_oAV_Trk1", "dx","%(track1)s and %(OAV)s"%params], 00083 ["TrkLength_Oil_Trk1", "dx","%(track1)s and %(MO)s"%params], 00084 # track 2 00085 ["pdgId_Trk2","pdg","%(track2)s and %(start)s"%params], 00086 ["t_Trk2", "t" , "%(track2)s and %(start)s"%params], 00087 ["x_Trk2", "x", "%(track2)s and %(start)s"%params], 00088 ["y_Trk2", "y", "%(track2)s and %(start)s"%params], 00089 ["z_Trk2", "z", "%(track2)s and %(start)s"%params], 00090 ["tEnd_Trk2", "t" , "%(track2)s and %(lastvtx)s"%params], 00091 ["xEnd_Trk2", "x", "%(track2)s and %(lastvtx)s"%params], 00092 ["yEnd_Trk2", "y", "%(track2)s and %(lastvtx)s"%params], 00093 ["zEnd_Trk2", "z", "%(track2)s and %(lastvtx)s"%params], 00094 ["e_Trk2", "E", "%(track2)s and %(start)s"%params], 00095 ["p_Trk2", "p", "%(track2)s and %(start)s"%params], 00096 ["ke_Trk2", "KE", "%(track2)s and %(start)s"%params], 00097 ["vx_Trk2", "lvx","%(track2)s and %(start)s"%params], 00098 ["vy_Trk2", "lvy","%(track2)s and %(start)s"%params], 00099 ["vz_Trk2", "lvz","%(track2)s and %(start)s"%params], 00100 ["TrkLength_GD_Trk2", "dx","%(track2)s and %(GD)s"%params], 00101 ["TrkLength_iAV_Trk2", "dx","%(track2)s and %(IAV)s"%params], 00102 ["TrkLength_LS_Trk2", "dx","%(track2)s and %(LS)s"%params], 00103 ["TrkLength_oAV_Trk2", "dx","%(track2)s and %(OAV)s"%params], 00104 ["TrkLength_Oil_Trk2", "dx","%(track2)s and %(MO)s"%params] 00105 ]) 00106 00107 self.detsim = detsim 00108 00109 # Finally, DetSimVali itself 00110 from DetSimValidation.DetSimValidationConf import DetSimVali 00111 dsv = DetSimVali() 00112 dsv.Volume = volume 00113 self.detsimvali = dsv 00114 00115 from Gaudi.Configuration import ApplicationMgr 00116 theApp = ApplicationMgr() 00117 theApp.TopAlg.append(dsv) 00118 00119 from GaudiSvc.GaudiSvcConf import THistSvc 00120 histsvc = THistSvc() histsvc.Output =["file1 DATAFILE='%s' OPT='RECREATE' TYP='ROOT' "%histogram_filename]