/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Muon.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
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     # set up Gnrtr itself
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     # set up each tools
00029     from GenTools.GenToolsConf import GtPositionerTool, GtTransformTool, GtTimeratorTool, GtHepEvtGenTool
00030 
00031     # Set up Gen
00032     # Get cosmic muon path
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     # set the muon generator command line
00043     # Muon.exe -n 20000 -s DYB -v RPC -seed 1 -r Yes -music_dir ....../data/trunk/NewMuonGenerator/data"
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     # If we got an executable and it is relative, look for it in the path
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     #generator
00065     gen=GtHepEvtGenTool(name+'Gen',HepEvtDataSource = hepEvtDataSource)
00066     #gen.OutputLevel = 2
00067     gen.HepEvtDataSource = hepEvtDataSource
00068     
00069     # Set up positioner
00070     pos=GtPositionerTool(name+'Pos',Volume=volume)
00071     pos.Mode = "Relative"
00072     pos.Position = [0,0,0]
00073     
00074     # Set up timerator
00075     tim=GtTimeratorTool(name+'Tim')
00076     tim.LifeTime = lifetime
00077     
00078     # transform
00079     tra=GtTransformTool(name+'Tra',Volume=volume)
00080     tra.Offset = [0., 0., (0.042)*units.meter]
00081 
00082     ## More surprise from muon starts from here.
00083     from MuonProphet.MuonProphetConf import MuonProphet
00084     prophet=MuonProphet( name+"Prophet" );
00085     # The can completely turn the tool off.
00086     prophet.Active = prophet
00087     prophet.Site = "DayaBay"
00088     # Note that the number of parameters of
00089     # Tools, Yields, YieldMeasuredAt and Lifetimes must be the same.
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     # trigger related configuration
00096     prophet.TrkLengthInWaterThres = 20*units.cm
00097     prophet.WaterPoolTriggerEff = 0.9999
00098     #prophet.OutputLevel=2 
00099     
00100     return gnrtr
00101 
00102 if __name__ == "__main__":
00103     obj=Muon()
00104     
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:20:44 for Gnrtr by doxygen 1.7.4