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 "GtTransformTool/"+name+"Tra",
00023 "MuonProphet/"+name+"Prophet"
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
00043 import os
00044 MuonDataPath = os.getenv('MuonDataPath')
00045 if MuonDataPath is None:
00046 print "Muon data path ($MuonDataPath) is not defined."
00047 import sys
00048 sys.exit()
00049 else:
00050 print "Read muon data from ",MuonDataPath
00051
00052
00053
00054 hepEvtDataSource = "Muon.exe -n 1100 -s %s -v rock -seed %s -r Yes -music_dir %s|"%(musicsite,seed,MuonDataPath)
00055
00056 exe = hepEvtDataSource.split(' ')[0]
00057 NAME = exe[exe.rfind('/')+1:]
00058 dot = NAME.rfind('.')
00059 baseNAME = NAME
00060 if dot > 0: baseNAME = NAME[:dot]
00061 sanitized = baseNAME.replace('.','_')
00062
00063
00064 if hepEvtDataSource[-1] == '|' and hepEvtDataSource[0] != '/':
00065 import os, os.path
00066 path = os.getenv('PATH')
00067 for p in path:
00068 if (os.path.isfile(path+'/'+exe)):
00069 hepEvtDataSource = path+'/'+exe + ' ' + ' '.join(hepEvtDataSource.split(' ')[1:])
00070 break
00071 continue
00072 pass
00073
00074
00075 gen=GtHepEvtGenTool(name+'Gen',HepEvtDataSource = hepEvtDataSource)
00076
00077 gen.HepEvtDataSource = hepEvtDataSource
00078
00079
00080 pos=GtPositionerTool(name+'Pos',Volume=volume)
00081
00082 pos.Mode = "Relative"
00083
00084 pos.Position = [0,0,0]
00085
00086
00087 tim=GtTimeratorTool(name+'Tim')
00088 tim.LifeTime = 0.000595*units.s
00089
00090
00091 tra=GtTransformTool(name+'Tra',Volume=volume)
00092 tra.Offset = [0., 0., (0.042)*units.meter]
00093
00094
00095
00096 prophet=MuonProphet();
00097
00098
00099 prophet.Site = "DayaBay"
00100
00101
00102 prophet.GenTools = [ "Li9He8Decayerator/Li9He8" ]
00103 prophet.GenYields = [ 0.5*units.cm2/units.gram ]
00104 prophet.GenYieldMeasuredAt = [260*units.GeV]
00105 prophet.GenLifetimes = [ 0.002*units.s ]
00106
00107
00108 prophet.TrkLengthInWaterThres = 20*units.cm
00109 prophet.WaterPoolTriggerEff = 0.9999
00110
00111
00112
00113
00114 from G4DataHelpers.G4DataHelpersConf import HepMCtoG4
00115 convertor = HepMCtoG4()
00116 convertor.ZeroTime = False
00117
00118 pass
00119
00120 if __name__ == "__main__":
00121 obj=FastMuon()