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

In This Package:

Default.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 # Available physics lists
00004 physics_list_basic = [
00005     "DsPhysConsGeneral", 
00006     "DsPhysConsOptical",
00007     "DsPhysConsEM",
00008     ]
00009 physics_list_nuclear = [
00010     "DsPhysConsElectroNu",
00011     "DsPhysConsHadron",
00012     "DsPhysConsIon",
00013     ]
00014 
00015 
00016 class Configure:
00017     '''
00018     Do default DetSim configuration.
00019     '''
00020 
00021     # Available geometry broken up by site
00022     giga_far_items = [
00023         "/dd/Structure/Sites/far-rock",
00024         "/dd/Geometry/AdDetails/AdSurfacesAll",
00025         "/dd/Geometry/AdDetails/AdSurfacesFar",
00026         "/dd/Geometry/PoolDetails/FarPoolSurfaces",
00027         "/dd/Geometry/PoolDetails/PoolSurfacesAll",
00028         ]
00029     giga_dayabay_items = [
00030         "/dd/Structure/Sites/db-rock",
00031         "/dd/Geometry/AdDetails/AdSurfacesAll",
00032         "/dd/Geometry/AdDetails/AdSurfacesNear",
00033         "/dd/Geometry/PoolDetails/NearPoolSurfaces",
00034         "/dd/Geometry/PoolDetails/PoolSurfacesAll",
00035         ]
00036     giga_lingao_items = [
00037         "/dd/Structure/Sites/la-rock",
00038         "/dd/Geometry/AdDetails/AdSurfacesAll",
00039         "/dd/Geometry/AdDetails/AdSurfacesNear",
00040         "/dd/Geometry/PoolDetails/NearPoolSurfaces",
00041         "/dd/Geometry/PoolDetails/PoolSurfacesAll",
00042         ]
00043 
00044     def __init__(self,site="far,dayabay,lingao", 
00045                  physlist = physics_list_basic+physics_list_nuclear,
00046                  use_push_algs = True,
00047                  use_sim_subseq=False ):
00048         '''
00049         Configure DetSim.  
00050 
00051         "site" can be "far", "dayabay" or "lingao".  Default is all three
00052 
00053         "physlist" specifies the physics lists.  You can use the
00054         predefined lists in DetSim.configure.: physics_list_basic and
00055         physics_list_nuclear.  Default is to use both.
00056         
00057         After creating this object you may want to call historian() or
00058         unobserver() to add to their configuration.
00059 
00060         '''
00061 
00062         from GaussTools.GaussToolsConf import GiGaPhysListModular
00063         import GaudiKernel.SystemOfUnits as units
00064 
00065         # Note: we must name this with "GiGa." as it is assumed later when the
00066         # properties are looked up.  Really the action of giving it to GiGa
00067         # should take care of this.  More bugs in Configurables
00068         physics_list = GiGaPhysListModular("GiGa.GiGaPhysListModular")
00069         physics_list.CutForElectron = 100*units.micrometer
00070         physics_list.CutForPositron = 100*units.micrometer
00071         physics_list.CutForGamma = 1*units.millimeter
00072         physics_list.PhysicsConstructors = physlist
00073         self.physics_list = physics_list
00074 
00075         from GiGa.GiGaConf import GiGa
00076         giga = GiGa()
00077         giga.PhysicsList = physics_list
00078 
00079         # Start empty step action sequence to hold historian/unobserver
00080         from GaussTools.GaussToolsConf import GiGaStepActionSequence
00081         sa = GiGaStepActionSequence('GiGa.GiGaStepActionSequence')
00082         giga.SteppingAction = sa
00083 
00084         self.giga = giga
00085 
00086         # Tell GiGa the size of the world.
00087         # Set default world material to be vacuum to speed propagation of
00088         # particles in regions of little interest.
00089         from GiGaCnv.GiGaCnvConf import GiGaGeo
00090         giga_geom = GiGaGeo()
00091         giga_geom.XsizeOfWorldVolume = 2.4*units.kilometer
00092         giga_geom.YsizeOfWorldVolume = 2.4*units.kilometer
00093         giga_geom.ZsizeOfWorldVolume = 2.4*units.kilometer
00094         giga_geom.WorldMaterial = "/dd/Materials/Vacuum"
00095         self.gigageo = giga_geom
00096 
00097         # Set up for telling GiGa what geometry to use, but don't
00098         # actually set that.
00099         from GaussTools.GaussToolsConf import GiGaInputStream
00100         giga_items = GiGaInputStream()
00101         giga_items.ExecuteOnce = True
00102         giga_items.ConversionSvcName = "GiGaGeo"
00103         giga_items.DataProviderSvcName = "DetectorDataSvc"
00104         giga_items.StreamItems = [ ]
00105         site = site.lower()
00106         if "far" in site: 
00107             giga_items.StreamItems += self.giga_far_items
00108         if "dayabay" in site: 
00109             giga_items.StreamItems += self.giga_dayabay_items
00110         if "lingao" in site: 
00111             giga_items.StreamItems += self.giga_lingao_items
00112         self.giga_items = giga_items
00113 
00114         # Make sequencer alg to run all this stuff as subalgs
00115         from GaudiAlg.GaudiAlgConf import GaudiSequencer
00116         giga_sequence = GaudiSequencer()
00117         giga_sequence.Members = [ self.giga_items ]
00118         self.giga_sequence=giga_sequence
00119         if use_push_algs:
00120             # DetSim's algs
00121             from DetSim.DetSimConf import DsPushKine, DsPullEvent
00122             self.detsim_push_kine = DsPushKine()
00123             self.detsim_pull_event = DsPullEvent()
00124             giga_sequence.Members += [self.detsim_push_kine,
00125                                       self.detsim_pull_event]
00126             pass
00127         
00128         if not use_sim_subseq:
00129             from Gaudi.Configuration import ApplicationMgr
00130             theApp = ApplicationMgr()
00131             theApp.TopAlg.append(giga_sequence)
00132         
00133         return
00134 
00135     def historian(self,trackSelection="",vertexSelection="",useFastMuEnergyCut=False):
00136         ''' Add the Historian to the simulation and configure its
00137         default track and vertex selection, default is empty.  Its
00138         configurable is returned in order to allow further, direct
00139         modification.
00140         '''
00141         from Historian.HistorianConf import HistorianStepAction
00142         # Must name stepping action with anticipation of its final ownership.
00143         # This works around some inconsistency with configurable tools
00144         hist = HistorianStepAction('GiGa.GiGaStepActionSequence.HistorianStepAction')
00145         hist.TrackSelection = trackSelection
00146         hist.VertexSelection = vertexSelection
00147         hist.UseFastMuEnergyCut = useFastMuEnergyCut
00148 
00149         self.giga.SteppingAction.Members.append(hist)
00150         return hist
00151 
00152     def unobserver(self,stats = []):
00153         ''' Add the Unobserver to the simulation and configure it with
00154         a set of stats (default is empty).  Its configurable is
00155         returned in order to allow further, direct modification.
00156         '''
00157         from Historian.HistorianConf import UnObserverStepAction
00158         # Must name stepping action with anticipation of its final ownership.
00159         # This works around some inconsistency with configurable tools
00160         unobs = UnObserverStepAction('GiGa.GiGaStepActionSequence.UnObserverStepAction')
00161         unobs.Stats = stats
00162         self.giga.SteppingAction.Members.append(unobs)
00163         return unobs
00164         
00165     
00166 def configure(argv=None):
00167     try:
00168         style = argv[0]
00169     except IndexError:
00170         Configure()
00171         return
00172 
00173     if style == 'basic':
00174         Configure(physlist = physics_list_basic)
00175         return
00176 
00177     Configure()
00178     return
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:53:23 2011 for DetSim by doxygen 1.4.7