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

In This Package:

Sim15::FullChainSimple::ConfigureFullChain Class Reference

List of all members.

Public Member Functions

def __init__
def parse_args
def configureKinematic
def configureDetector
def configureElectronic
def configureTrigRead
def configureSingleLoader
def configureSim15
def configure

Public Attributes

 opts
 args
 start_time_seconds
 stage_cfg

Detailed Description

Configure a Full Chain of pull simulations.

Definition at line 26 of file FullChainSimple.py.


Member Function Documentation

def Sim15::FullChainSimple::ConfigureFullChain::__init__ (   self,
  argv 
)

Definition at line 30 of file FullChainSimple.py.

00032                            :
00033         self.parse_args(argv)
        return

def Sim15::FullChainSimple::ConfigureFullChain::parse_args (   self,
  argv 
)

Definition at line 34 of file FullChainSimple.py.

00036                              :
00037         from optparse import OptionParser
00038         import time
00039         parser = OptionParser(usage=self.__doc__)
00040         default_time_format = '%Y-%m-%dT%H:%M:%S'
00041         parser.add_option("-w","--start-time",
00042                           help="Date string to set simulation start, assumed UTC",
00043                           default=time.strftime(default_time_format,time.gmtime(0)))
00044         parser.add_option("-F","--time-format",
00045                           help="Format for parsing time (see man date), " \
00046                               + "default is '%s'"%default_time_format \
00047                               + " ('[YYYY]-[MM]-[DD]T[HH]:[MM]:[SS]')",
00048                           default=default_time_format)
00049         parser.add_option("-T","--top-stage",
00050                           help="Kinematic, Detector, Electronic, TrigRead or SingleLoader",
00051                           default="SingleLoader")
00052         parser.add_option("-s","--seed",
00053                           help="Random seed for generators",
00054                           default=1234567)
00055 
00056 
00057         (options,args) = parser.parse_args(args=argv)
00058         self.opts = options
00059         self.args = args
00060 
00061         timeformat = self.opts.time_format
00062         print "Using time format =",timeformat
00063 
00064         try:
00065             datestring = self.opts.start_time
00066         except AttributeError:
00067             self.start_time_seconds = 0
00068         else:
00069             # This may raise ValueError if string and format don't
00070             # match.  Just let it get thrown.
00071             t = time.strptime(datestring,timeformat)
00072             self.start_time_seconds = time.mktime(t) - time.timezone
00073         print 'Start time in human readable format',self.opts.start_time 
00074         print 'Start time in seconds UTC =',self.start_time_seconds
00075         print 'Top stage =',self.opts.top_stage
00076 
        return

def Sim15::FullChainSimple::ConfigureFullChain::configureKinematic (   self  ) 

Definition at line 77 of file FullChainSimple.py.

00079                                 :
00080         #IBD
00081         from Gnrtr.IBD import EvtGenerator
00082         # from IBD import EvtGenerator
00083         ibd_gds = EvtGenerator(name     = 'IBD_gds',
00084                                seed     = self.opts.seed,
00085                                volume   = '/dd/Structure/AD/db-oil1',
00086                                strategy = 'Material',
00087                                material = 'GdDopedLS',
00088                                mode     = 'Uniform',
00089                                lifetime = 78.4*units.second, #daya bay site
00090                                wallTime = self.start_time_seconds)
00091 
00092         ibd_gds.ThisStageName = "Kinematic"
00093         self.stage_cfg.KinematicSequence.Members.append( ibd_gds )
00094 
00095         from Gnrtr.Radioact import Radioact
00096         #K40
00097         k40_gds = Radioact(name       = 'K40_gds',
00098                            volume     = '/dd/Structure/AD/db-oil1',
00099                            nuclide    = 'K40',
00100                            abundance  = 3.01e17,
00101                            strategy   = 'Material',
00102                            material   = 'GdDopedLS',
00103                            start_time = self.start_time_seconds)
00104 
00105         k40_gds.ThisStageName = "Kinematic"
00106         self.stage_cfg.KinematicSequence.Members.append( k40_gds )
00107         
        return

def Sim15::FullChainSimple::ConfigureFullChain::configureDetector (   self  ) 

Configure the Detector stage

Definition at line 108 of file FullChainSimple.py.

00110                                :
00111         '''Configure the Detector stage'''
00112         
00113         import DetSim
00114         ds = DetSim.Configure(physlist=DetSim.physics_list_basic+DetSim.physics_list_nuclear,site="dayabay",
00115                               use_push_algs = False)
00116 
00117         # QuantumEfficiency*CollectionEfficiency*QEScale = 0.24*1/0.9
00118         from DetSim.DetSimConf import DsPhysConsOptical
00119         optical = DsPhysConsOptical()
00120         #optical.UseScintillation = False
00121         #optical.CerenPhotonScaleWeight = 3.5
00122         #optical.UseCerenkov = False
00123         #optical.ScintPhotonScaleWeight = 3.5
00124 
00125         from DetSimProc.DetSimProcConf import DetSimProc
00126         dsp = DetSimProc()
00127         dsp.ThisStageName = "Detector"
00128         dsp.LowerStageName = "Kinematic"
00129         #dsp.OutputLevel = 2
00130         self.stage_cfg.DetectorSequence.Members.append(dsp)
00131 
00132         ds.historian(trackSelection="(pdg == 2112)",vertexSelection="(pdg == 2112)")
        return

def Sim15::FullChainSimple::ConfigureFullChain::configureElectronic (   self  ) 

Configure the Electronics stage

Definition at line 133 of file FullChainSimple.py.

00135                                  :
00136         '''Configure the Electronics stage'''
00137 
00138         import ElecSim
00139         es = ElecSim.Configure(use_push_algs = False)
00140 
00141         from ElecSimProc.ElecSimProcConf import ElecSimProc
00142         esp = ElecSimProc()
00143         esp.ThisStageName = "Electronic"
00144         esp.LowerStageName = "Detector"
00145         #esp.OutputLevel = 2
00146         self.stage_cfg.ElectronicSequence.Members.append(esp)
00147         # wangzhe
00148         from ElecSim.ElecSimConf import EsIdealFeeTool
00149         feetool = EsIdealFeeTool()
00150         feetool.EnableNonlinearity=False
00151         #feetool.OutputLevel = 2
00152         # wz
        return

def Sim15::FullChainSimple::ConfigureFullChain::configureTrigRead (   self  ) 

Configure the Trigger and Readout stage

Definition at line 153 of file FullChainSimple.py.

00155                                :
00156         '''Configure the Trigger and Readout stage'''
00157         from TrigReadProc.TrigReadProcConf import TrigReadProc
00158         tsp = TrigReadProc()
00159         tsp.ThisStageName = "TrigRead"
00160         tsp.LowerStageName = "Electronic"
00161         #tsp.TrigTools = [...]
00162         #tsp.RoTools = [...]
00163         #tsp.OutputLevel = 2
00164         self.stage_cfg.TrigReadSequence.Members.append(tsp)
        return

def Sim15::FullChainSimple::ConfigureFullChain::configureSingleLoader (   self  ) 

Configure the SingleLoader stage

Definition at line 165 of file FullChainSimple.py.

00167                                    :
00168         '''Configure the SingleLoader stage'''
00169         from SingleLoader.SingleLoaderConf import SingleLoader
00170         sll = SingleLoader()
00171         sll.ThisStageName = "SingleLoader"
00172         sll.LowerStageName = "TrigRead"
00173         #sll.OutputLevel = 2
        self.stage_cfg.SingleLoaderSequence.Members.append(sll)

def Sim15::FullChainSimple::ConfigureFullChain::configureSim15 (   self  ) 

Definition at line 174 of file FullChainSimple.py.

00176                             :
00177         from Stage.StageConf import Sim15
00178         sim15=Sim15()
00179         # Run for a long time by default You can use "nuwa.py -n XXX"
00180         # to limit.  This is actually the default now:
00181         sim15.TimeRange = 365*24*60*60*units.second 
00182         sim15.TopStage=self.opts.top_stage
00183 
00184         from Gaudi.Configuration import ApplicationMgr
00185         theApp = ApplicationMgr()
        theApp.TopAlg.append(sim15)

def Sim15::FullChainSimple::ConfigureFullChain::configure (   self  ) 

Definition at line 186 of file FullChainSimple.py.

00188                        :
00189 
00190         from Stage import Configure as StageConfigure
00191         self.stage_cfg = StageConfigure()
00192 
00193         stagedic={'Kinematic':1,'Detector':2,'Electronic':3,'TrigRead':4,'SingleLoader':5}
00194 
00195         if not self.opts.top_stage in stagedic:
00196             print 'Error, wrong top stage parameter', self.opts.top_stage
00197             print 'Valid stage is Kinematic, Detector, Electronic, TrigRead or SingleLoader'
00198 
00199         for stg,idx in stagedic.iteritems():
00200             if idx <= stagedic[self.opts.top_stage]:
00201                 self.stage_cfg.addStages([stg])           ## stage tools are configured here.
00202                 
00203         for stg in self.stage_cfg.stages:
00204             #self.stage_cfg.__dict__[stg].OutputLevel = 2
00205             pass
00206 
00207         if stagedic[self.opts.top_stage]>=1:
00208             self.configureKinematic()
00209         if stagedic[self.opts.top_stage]>=2:
00210             self.configureDetector()
00211         if stagedic[self.opts.top_stage]>=3:
00212             self.configureElectronic()
00213         if stagedic[self.opts.top_stage]>=4:
00214             self.configureTrigRead()
00215         if stagedic[self.opts.top_stage]>=5:
00216             self.configureSingleLoader()
00217 
00218         self.configureSim15()
00219         
        return


Member Data Documentation

Sim15::FullChainSimple::ConfigureFullChain::opts

Definition at line 56 of file FullChainSimple.py.

Sim15::FullChainSimple::ConfigureFullChain::args

Definition at line 57 of file FullChainSimple.py.

Sim15::FullChainSimple::ConfigureFullChain::start_time_seconds

Definition at line 65 of file FullChainSimple.py.

Sim15::FullChainSimple::ConfigureFullChain::stage_cfg

Definition at line 189 of file FullChainSimple.py.


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 20:36:45 2011 for Sim15 by doxygen 1.4.7