Public Member Functions | |
def | __init__ |
configure Muon generator
Definition at line 3 of file FastMuon.py.
def FastMuon::FastMuon::__init__ | ( | self, | ||
stage = 'null' , |
||||
name = 'Muon' , |
||||
volume = '/dd/Structure/Pool/db-ows' , |
||||
start_time = 0 , |
||||
seed = 1234567 | ||||
) |
Definition at line 6 of file FastMuon.py.
00013 : 00014 00015 # set up Gnrtr itself 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 # set up each tools 00033 from GaudiKernel import SystemOfUnits as units 00034 from GenTools.GenToolsConf import GtPositionerTool, GtTransformTool, GtTimeratorTool, GtHepEvtGenTool 00035 from MuonProphet.MuonProphetConf import MuonProphet 00036 # Set up Gen 00037 00038 musicsite = 'DYB' 00039 00040 nevents=5000 00041 00042 # Get cosmic muon path 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 # set the muon generator command line 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 # If we got an executable and it is relative, look for it in the path 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 #generator 00075 gen=GtHepEvtGenTool(name+'Gen',HepEvtDataSource = hepEvtDataSource) 00076 #gen.OutputLevel = 2 00077 gen.HepEvtDataSource = hepEvtDataSource 00078 00079 # Set up positioner 00080 pos=GtPositionerTool(name+'Pos',Volume=volume) 00081 # I should use relateiv 00082 pos.Mode = "Relative" 00083 #pos.Mode = "Fixed" 00084 pos.Position = [0,0,0] 00085 00086 # Set up timerator 00087 tim=GtTimeratorTool(name+'Tim') 00088 tim.LifeTime = 0.000595*units.s 00089 00090 # transform 00091 tra=GtTransformTool(name+'Tra',Volume=volume) 00092 tra.Offset = [0., 0., (0.042)*units.meter] 00093 00094 ## More surprise from muon starts from here. 00095 # muon prophet 00096 prophet=MuonProphet(); 00097 # The can completely turn the tool off. 00098 #prophet.Active=False; 00099 prophet.Site = "DayaBay" 00100 # Note that the number of parameters of 00101 # Tools, Yields, YieldMeasuredAt and Lifetimes must be the same. 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 # trigger related configuration 00108 prophet.TrkLengthInWaterThres = 20*units.cm 00109 prophet.WaterPoolTriggerEff = 0.9999 00110 00111 #prophet.OutputLevel=2 00112 00113 # Set false, otherwise all times will be reset so the signal vertex is at t=0. 00114 from G4DataHelpers.G4DataHelpersConf import HepMCtoG4 00115 convertor = HepMCtoG4() 00116 convertor.ZeroTime = False 00117 pass