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

In This Package:

Pool.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 '''
00003 Configuration helpers for pool validatation simulations.
00004 '''
00005 
00006 class PoolMuons:
00007     ''' Default configuration for sending muons through a pool.  This
00008     makes use of an external HepEVT muon generator, turns off
00009     scintilation to increase processing speed and sets up for the
00010     validation ntuple.  It is based on the original ran*Muon.py
00011     scripts.
00012     '''
00013 
00014     def __init__(self,site="far",histogram_filename = '../mc_ntuple/%sMuonPool.root'):
00015         ''' Construct the default configuration for muon pool
00016         validation.  The site can be set to "far" or "near" (dayabay
00017         near site, near sites non-identicality was not considered).  A
00018         non-default histogram_filename can be specified to hold the
00019         resulting histograms.  If a "%s" is included the site will be
00020         substituted.
00021         
00022         Warning: this hard codes generation of 1000 muons.  Simulating
00023         less is okay, but more is bad.
00024         '''
00025 
00026         # key off site.
00027         volume = "/dd/Structure/Pool/db-ows"
00028         musicsite = 'DYB'
00029         if 'far' == site:
00030             volume = "/dd/Structure/Pool/far-ows"
00031             musicsite = 'Far'
00032         else:
00033             site = 'dayabay'    # normalize
00034 
00035         # let any %s be dereferenced.
00036         try:
00037             histogram_filename = histogram_filename%site
00038         except TypeError:
00039             pass
00040 
00041         import GaudiKernel.SystemOfUnits as units
00042 
00043         # Try to find MUSIC's data directory 
00044         import os
00045         muonroot = os.getenv('MUONROOT',None)
00046         if not muonroot:
00047             print "Can not find $MUONROOT needed to locate MUSIC directory."
00048             import sys
00049             sys.exit(1)
00050             pass
00051         
00052         source = "Muon.exe -n 1000 -s %s -music_dir %s/data|"%(musicsite,
00053                                                                muonroot)
00054 
00055         from GenTools.Helpers import HepEVT
00056         hepevt = HepEVT(source)
00057         hepevt.timerator.LifeTime = 1*units.second
00058         hepevt.transformer.Volume = volume
00059         # Geometry impedeance mismatch between Muon.exe and XmlDetDesc
00060         hepevt.transformer.Offset = [0., 0., (0.042)*units.meter]
00061 
00062         import GenTools
00063         gt = GenTools.Configure(helper=hepevt)
00064 
00065 
00066         # Configure DetSim
00067 
00068         import DetSim
00069         detsim = DetSim.Configure(site)
00070         
00071         from DetSim.DetSimConf import DsPhysConsOptical
00072         optical = DsPhysConsOptical()
00073         optical.CerenPhotonScaleWeight = 3.0
00074         optical.ScintPhotonScaleWeight = 3.0
00075 
00076         # use temps to keep lines succinct
00077         ismuon = "(pdg==13 or pdg==-13) and "
00078         material = "MaterialName == '/dd/Materials/%s"
00079         stats = [
00080             ["MuonTrkLengthInOws","dx",ismuon+material%"OwsWater'"],
00081             ["MuonTrkLengthInIws", "dx", ismuon+material%"IwsWater'"],
00082             ["MuonTrkLengthInLS", "dx", ismuon+material%"LiquidScintillator'"],
00083             ["MuonTrkLengthInGdLS","dx", ismuon+material%"GdDopedLS'"],
00084             ["MuonStop", "dx", ismuon+" (IsStopping>0)"],    
00085             ]
00086         detsim.unobserver(stats=stats)
00087         detsim.historian(trackSelection = "pdg==13 or pdg==-13")
00088 
00089         # Finally, DetSimVali itself
00090         from DetSimValidation.DetSimValidationConf import DetSimVali
00091         dsv = DetSimVali()
00092         self.detsimvali = dsv
00093         
00094         from Gaudi.Configuration import ApplicationMgr
00095         theApp = ApplicationMgr()
00096         theApp.TopAlg.append(dsv)
00097 
00098         from GaudiSvc.GaudiSvcConf import THistSvc
00099         histsvc = THistSvc()
00100         histsvc.Output =["file1 DATAFILE='%s' OPT='RECREATE' TYP='ROOT' "%histogram_filename]
00101         return
00102 
00103 if '__main__' == __name__:
00104     from Gaudi.Configuration import ApplicationMgr
00105     theApp = ApplicationMgr()
00106 
00107     from DybPython.Control import main
00108     nuwa = main()
00109 
00110     import XmlDetDesc
00111     XmlDetDesc.Configure()
00112     
00113     from DetSimValidation import PoolMuons
00114     pool = PoolMuons("far")   # "far" by default otherwise will do far
00115 
00116     print theApp.TopAlg
00117     nuwa.run()
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:56:26 2011 for DetSimValidation by doxygen 1.4.7