| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

GenMuon::Helpers::CosmicHelper Class Reference

List of all members.

Public Member Functions

def __init__
def tools

Detailed Description

A helper for use with GenTools.Configure()

Definition at line 10 of file Helpers.py.


Member Function Documentation

def GenMuon::Helpers::CosmicHelper::__init__ (   self,
  site,
  volume,
  coord_de,
  path 
)

Create a helper to set up kinematics for cosmic muons.  
Options:

site            : set which site (DYB, LA, Mid, Far,SAB)
volume          : keyword for muon generator to determine where to put muon vertices (rock, RPC, ADE)
coord_de        : detector element providing coordinate system to convert to global (eg, '/dd/Structure/AD/db-ade1')
path            : set directory holding muon data, overrides $MuonDataPath

The tools it produces are available via: 
.muon the GtMuoneratorTool
.positioner the GtPositionerTool
.transform the GtTransformTool
.timerator the GtTimeratorTool

Definition at line 13 of file Helpers.py.

00015                                                     :
00016         '''
00017         Create a helper to set up kinematics for cosmic muons.  
00018         Options:
00019 
00020         site            : set which site (DYB, LA, Mid, Far,SAB)
00021         volume          : keyword for muon generator to determine where to put muon vertices (rock, RPC, ADE)
00022         coord_de        : detector element providing coordinate system to convert to global (eg, '/dd/Structure/AD/db-ade1')
00023         path            : set directory holding muon data, overrides $MuonDataPath
00024 
00025         The tools it produces are available via: 
00026         .muon the GtMuoneratorTool
00027         .positioner the GtPositionerTool
00028         .transform the GtTransformTool
00029         .timerator the GtTimeratorTool
00030         '''
00031 
00032         # try to find where the input files are
00033         if not path:
00034             print 'No muon data path given, checking $MuonDataPath' 
00035             path = os.getenv('MuonDataPath')
00036         if not path:
00037             for where in [os.getenv('NEWMUONGENERATORROOT','data/NewMuonGenerator/data'),
00038                           os.getenv('NEWMUONGENERATORROOT','data/trunk/NewMuonGenerator/data')]:
00039                 print 'No $MuonDataPath, trying to locate %s/' % where
00040                 sr = os.getenv('SITEROOT')
00041                 if sr:
00042                     maybe = os.path.join(sr,where)
00043                     if os.path.exists(maybe):
00044                         path = maybe
00045                         break
00046                     continue
00047                 continue
00048         if not path:
00049             raise ValueError('Could not find input muon data anywhere, go fish.')
00050 
00051         flux_file = os.path.join(path,'mountain_%s'%site)
00052         url = 'http://dayabay.ihep.ac.cn/svn/dybsvn/data/trunk/NewMuonGenerator/data/'
00053         if not os.path.exists(flux_file):
00054             raise RuntimeError('No flux file "%s" get it from %s' % (flux_file, url) )
00055 
00056         ratio_file = os.path.join(path,'mu_plus_minus_ratio.root')
00057         if not os.path.exists(ratio_file):
00058             print 'No mu+/mu- ratio file found, will rely on paramatrization.'
00059             #raise RuntimeError('No ratio file "%s" get it from %s' % (ratio_file, url) )
00060 
00061         name = 'Cosmic-%s-%s' % (site,volume)
00062 
00063         from GenMuon.GenMuonConf import GtMuoneratorTool
00064         muon = GtMuoneratorTool(name+'_muonerator')
00065         #muon.Rotation = True
00066         muon.WhichSite = site
00067         muon.MuonFile = flux_file
00068         muon.RatioFile = ratio_file
00069         muon.Volume = volume
00070         self.muon = muon
00071 
00072         from GenTools.GenToolsConf import GtPositionerTool, GtTransformTool, GtTimeratorTool
00073         from GaudiKernel import SystemOfUnits as units
00074 
00075         # Set up positioner
00076         pos = GtPositionerTool(name+'_positioner',Volume=coord_de)
00077         pos.Mode = "Relative"
00078         pos.Position = [0,0,0]
00079         self.positioner = pos
00080         
00081         # Set up timerator. note high rate of muons
00082         tim = GtTimeratorTool(name+'_timerator')
00083         muonRate = 1000.   # in Hz
00084         lifet = 1./float(muonRate)
00085         tim.LifeTime = (lifet)*units.s
00086         print "Muon: Rate per second is ",muonRate
00087         self.timerator = tim
00088         
00089         # transform
00090         tra = GtTransformTool(name+'_transformer',Volume=coord_de)
00091         tra.Offset = [0., 0., (0.042)*units.meter]
00092         self.transformer = tra
00093 
        return

def GenMuon::Helpers::CosmicHelper::tools (   self  ) 

Definition at line 94 of file Helpers.py.

00096                    :
00097         return [self.muon,self.positioner,self.timerator,self.transformer]


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 21:00:45 2011 for GenMuon by doxygen 1.4.7