00001
00002 from GaudiKernel import SystemOfUnits as units
00003
00004 def Muon(name='Muon',
00005 musicsite='DYB',
00006 muonvolumn='RPC',
00007 volume='/dd/Structure/Pool/db-ows',
00008 start_time=0,
00009 lifetime=10*units.s,
00010 prophet=True,
00011 seed=12345):
00012 '''
00013 configure Muon generator
00014 '''
00015
00016
00017 from Gnrtr.GnrtrConf import Gnrtr
00018 gnrtr = Gnrtr(name)
00019
00020 gnrtr.GenTools = [ "GtHepEvtGenTool/"+name+"Gen",
00021 "GtPositionerTool/"+name+"Pos",
00022 "GtTimeratorTool/"+name+"Tim",
00023 "GtTransformTool/"+name+"Tra",
00024 "MuonProphet/"+name+"Prophet"]
00025
00026 gnrtr.TimeStamp = start_time
00027
00028
00029 from GenTools.GenToolsConf import GtPositionerTool, GtTransformTool, GtTimeratorTool, GtHepEvtGenTool
00030
00031
00032
00033 import os
00034 MuonDataPath = os.getenv('MuonDataPath')
00035 if MuonDataPath is None:
00036 print "Muon data path ($MuonDataPath) is not defined."
00037 import sys
00038 sys.exit()
00039 else:
00040 print "Read muon data from ",MuonDataPath
00041
00042
00043
00044 hepEvtDataSource = "Muon.exe -n 20000 -s %s -v %s -seed %s -r Yes -music_dir %s|"%(musicsite,muonvolumn,seed,MuonDataPath)
00045
00046 exe = hepEvtDataSource.split(' ')[0]
00047 NAME = exe[exe.rfind('/')+1:]
00048 dot = NAME.rfind('.')
00049 baseNAME = NAME
00050 if dot > 0: baseNAME = NAME[:dot]
00051 sanitized = baseNAME.replace('.','_')
00052
00053
00054 if hepEvtDataSource[-1] == '|' and hepEvtDataSource[0] != '/':
00055 import os.path
00056 path = os.getenv('PATH')
00057 for p in path:
00058 if (os.path.isfile(path+'/'+exe)):
00059 hepEvtDataSource = path+'/'+exe + ' ' + ' '.join(hepEvtDataSource.split(' ')[1:])
00060 break
00061 continue
00062 pass
00063
00064
00065 gen=GtHepEvtGenTool(name+'Gen',HepEvtDataSource = hepEvtDataSource)
00066
00067 gen.HepEvtDataSource = hepEvtDataSource
00068
00069
00070 pos=GtPositionerTool(name+'Pos',Volume=volume)
00071 pos.Mode = "Relative"
00072 pos.Position = [0,0,0]
00073
00074
00075 tim=GtTimeratorTool(name+'Tim')
00076 tim.LifeTime = lifetime
00077
00078
00079 tra=GtTransformTool(name+'Tra',Volume=volume)
00080 tra.Offset = [0., 0., (0.042)*units.meter]
00081
00082
00083 from MuonProphet.MuonProphetConf import MuonProphet
00084 prophet=MuonProphet( name+"Prophet" );
00085
00086 prophet.Active = prophet
00087 prophet.Site = "DayaBay"
00088
00089
00090 prophet.GenTools = [ "Li9He8Decayerator/Li9He8" ]
00091 prophet.GenYields = [ 0.5*units.cm2/units.gram ]
00092 prophet.GenYieldMeasuredAt = [260*units.GeV]
00093 prophet.GenLifetimes = [ 0.002*units.s ]
00094
00095
00096 prophet.TrkLengthInWaterThres = 20*units.cm
00097 prophet.WaterPoolTriggerEff = 0.9999
00098
00099
00100 return gnrtr
00101
00102 if __name__ == "__main__":
00103 obj=Muon()
00104