00001
00002
00003 class FastMuon:
00004 '''
00005 configure Muon generator
00006 '''
00007
00008 def __init__(self,
00009 stage='null',
00010 name='Muon',
00011 volume='/dd/Structure/Pool/db-ows',
00012 start_time=0,
00013 seed=1234567):
00014
00015
00016 from Gnrtr.GnrtrConf import Gnrtr
00017 gnrtr = Gnrtr(name);
00018
00019 gnrtr.GenTools = [ "GtHepEvtGenTool/"+name+"Gen",
00020 "GtPositionerTool/"+name+"Pos",
00021 "GtTimeratorTool/"+name+"Tim",
00022 "MuonProphet/"+name+"Prophet",
00023 "GtTransformTool/"+name+"Tra"
00024 ]
00025
00026 gnrtr.ThisStageName = "Kinematic"
00027 gnrtr.TimeStamp = start_time
00028
00029 if stage != 'null':
00030 stage.KinematicSequence.Members.append(gnrtr)
00031
00032
00033 from GaudiKernel import SystemOfUnits as units
00034 from GenTools.GenToolsConf import GtPositionerTool, GtTransformTool, GtTimeratorTool, GtHepEvtGenTool
00035 from MuonProphet.MuonProphetConf import MuonProphet
00036
00037
00038 musicsite = 'DYB'
00039
00040 nevents=5000
00041
00042 hepEvtDataSource = "Muon.exe -n 1000 -s %s -v RPC -seed %s -r Yes -music_dir /mnt/sda3/wangzhe/dybinst/data/trunk/NewMuonGenerator/data|"%(musicsite,seed)
00043
00044 exe = hepEvtDataSource.split(' ')[0]
00045 NAME = exe[exe.rfind('/')+1:]
00046 dot = NAME.rfind('.')
00047 baseNAME = NAME
00048 if dot > 0: baseNAME = NAME[:dot]
00049 sanitized = baseNAME.replace('.','_')
00050
00051
00052 if hepEvtDataSource[-1] == '|' and hepEvtDataSource[0] != '/':
00053 import os, os.path
00054 path = os.getenv('PATH')
00055 for p in path:
00056 if (os.path.isfile(path+'/'+exe)):
00057 hepEvtDataSource = path+'/'+exe + ' ' + ' '.join(hepEvtDataSource.split(' ')[1:])
00058 break
00059 continue
00060 pass
00061
00062
00063 gen=GtHepEvtGenTool(name+'Gen',HepEvtDataSource = hepEvtDataSource)
00064
00065 gen.HepEvtDataSource = hepEvtDataSource
00066
00067
00068 pos=GtPositionerTool(name+'Pos',Volume=volume)
00069 pos.Mode = "Relative"
00070 pos.Position = [0,0,0]
00071
00072
00073 tim=GtTimeratorTool(name+'Tim')
00074 tim.LifeTime = 0.001123*units.s
00075
00076
00077 prophet=MuonProphet();
00078
00079 prophet.Site = "DayaBay"
00080 prophet.GenTools = [ "Li9He8Decayerator/Li9He8" ]
00081 prophet.GenYields = [ 0.5 ]
00082 prophet.GenLifetimes = [ 0.002*units.s ]
00083
00084
00085 prophet.TrkLengthInWaterThres = 20*units.cm
00086 prophet.WaterPoolTriggerEff = 0.9999
00087
00088
00089 tra=GtTransformTool(name+'Tra',Volume=volume)
00090 tra.Offset = [0., 0., (0.042)*units.meter]
00091
00092
00093 pass
00094
00095 if __name__ == "__main__":
00096 obj=Muon()