/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Public Attributes
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.


Constructor & Destructor Documentation

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

Definition at line 32 of file FullChainSimple.py.

00033                            :
00034         self.parse_args(argv)
00035         return


Member Function Documentation

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

Definition at line 36 of file FullChainSimple.py.

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

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

Definition at line 79 of file FullChainSimple.py.

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

def Sim15::FullChainSimple::ConfigureFullChain::configureDetector (   self)
Configure the Detector stage

Definition at line 110 of file FullChainSimple.py.

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

def Sim15::FullChainSimple::ConfigureFullChain::configureElectronic (   self)
Configure the Electronics stage

Definition at line 135 of file FullChainSimple.py.

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

def Sim15::FullChainSimple::ConfigureFullChain::configureTrigRead (   self)
Configure the Trigger and Readout stage

Definition at line 155 of file FullChainSimple.py.

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

def Sim15::FullChainSimple::ConfigureFullChain::configureSingleLoader (   self)
Configure the SingleLoader stage

Definition at line 167 of file FullChainSimple.py.

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

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

Definition at line 176 of file FullChainSimple.py.

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

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

Definition at line 188 of file FullChainSimple.py.

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

Member Data Documentation

Definition at line 36 of file FullChainSimple.py.

Definition at line 36 of file FullChainSimple.py.

Definition at line 36 of file FullChainSimple.py.

Definition at line 188 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 Fri May 16 2014 10:07:48 for Sim15 by doxygen 1.7.4