Public Member Functions | |
def | __init__ |
Default configuration for sending muons through a pool. This makes use of an external HepEVT muon generator, turns off scintilation to increase processing speed and sets up for the validation ntuple. It is based on the original ran*Muon.py scripts.
Definition at line 6 of file Pool.py.
def DetSimValidation::Pool::PoolMuons::__init__ | ( | self, | ||
site = "far" , |
||||
histogram_filename = '../mc_ntuple/%sMuonPool.root' | ||||
) |
Construct the default configuration for muon pool validation. The site can be set to "far" or "near" (dayabay near site, near sites non-identicality was not considered). A non-default histogram_filename can be specified to hold the resulting histograms. If a "%s" is included the site will be substituted. Warning: this hard codes generation of 1000 muons. Simulating less is okay, but more is bad.
Definition at line 9 of file Pool.py.
00014 : 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 from GaudiSvc.GaudiSvcConf import THistSvc