/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
Sandglass::ConfigureSandglass Class Reference

List of all members.

Public Member Functions

def __init__
def parse_args
def load
def configureLoadingProc
def configureElectronic
def configureTrigRead
def configureSingleLoader
def configureSim15
def configure

Public Attributes

 opts
 args
 start_time_seconds
 stage_cfg

Detailed Description

Configure a testing ground for LoadingProc to mix SimHeader and ReadoutHeader input.

Definition at line 25 of file Sandglass.py.


Constructor & Destructor Documentation

def Sandglass::ConfigureSandglass::__init__ (   self,
  argv 
)

Definition at line 31 of file Sandglass.py.

00032                            :
00033         self.parse_args(argv)
00034         return
        

Member Function Documentation

def Sandglass::ConfigureSandglass::parse_args (   self,
  argv 
)

Definition at line 35 of file Sandglass.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.localtime()))
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("-g","--generator",
00050                           help="A python module with a function of GetGnrtr returning a Gnrtr object.",
00051                           default="1223")
00052         parser.add_option("-T","--top-stage",
00053                           help="Kinematic, Detector, Electronic, TrigRead or SingleLoader",
00054                           default="SingleLoader")
00055         parser.add_option("-s","--seed",
00056                           help="Random seed for generators",
00057                           default=1234567)
00058         parser.add_option("-f","--frac",
00059                           help="Starting position of input streams",
00060                           default=0.0)
00061 
00062         (options,args) = parser.parse_args(args=argv)
00063         self.opts = options
00064         self.args = args
00065         
00066         # print "Your random seed =", self.opts.seed
00067         timeformat = self.opts.time_format
00068         print "Using time format =",timeformat
00069 
00070         try:
00071             datestring = self.opts.start_time
00072         except AttributeError:
00073             self.start_time_seconds = 0
00074         else:
00075             # This may raise ValueError if string and format don't
00076             # match.  Just let it get thrown.
00077             t = time.strptime(datestring,timeformat)
00078             self.start_time_seconds = time.mktime(t) - time.timezone
00079             print 'Start time in human readable format',self.opts.start_time
00080             print 'Start time in seconds UTC =',self.start_time_seconds
00081             print 'Top stage =',self.opts.top_stage
00082             
00083         return
00084 
        
def Sandglass::ConfigureSandglass::load (   self,
  datapath = "data/",
  filename = "IBD_DYB_AD1_acrylic.root",
  rate = 1.0,
  MyMode = "random",
  MyStart = 0,
  MyStep = 1 
)

Definition at line 85 of file Sandglass.py.

00092                         :
00093 
00094         extension = filename[-5:]
00095         modulename = filename[:-5]
00096         if extension != ".list" and extension != ".root":
00097             print "Invalid input data file ", filename
00098 
00099         from LoadingProc.LoadingProcConf import LoadingProc  
00100         load = LoadingProc("LoadingProc."+modulename)
00101         load.StartSec = self.start_time_seconds
00102         load.StartNano = 0
00103         load.Distribution = "Exponential"
00104         load.Rate = rate
00105         load.HsAssembler = modulename+"Assem"
00106         #load.OutputLevel = 2
00107         assem = Assembler(toolname = modulename+"Assem",
00108                           filename = datapath+filename,
00109                           mode = MyMode,
00110                           start = MyStart,
00111                           step = MyStep)
00112 
00113         # This and lower stage
00114         load.ThisStageName = "Detector"
00115         load.LowerStageName = ""
00116         # Add this processor to Gaudi sequencer
00117         self.stage_cfg.DetectorSequence.Members.append(load)

def Sandglass::ConfigureSandglass::configureLoadingProc (   self)

Definition at line 118 of file Sandglass.py.

00119                                   :
00120         #frac = (int(self.opts.frac)-1)/24.0
00121         frac = int(self.opts.frac)
00122         '''Configure the LoadingProc stage'''
00123 
00124         self.load( datapath = "data/", filename = "IBD_DayaBayAD1.list",      rate = 4334.0/(24.*60.*60.) , MyMode = "random")
00125         self.load( datapath = "data/", filename = "IBD_DayaBayAD2.list",      rate = 4334.0/(24.*60.*60.) , MyMode = "random")
00126 
00127         self.load( datapath = "data/", filename = "U238-gds_DayaBayAD1.list", rate = 3.2    , MyMode = "sequential", MyStart=40*frac)    
00128         self.load( datapath = "data/", filename = "U238-lso_DayaBayAD1.list", rate = 3.4    , MyMode = "sequential", MyStart=50*frac)    
00129         self.load( datapath = "data/", filename = "U238-PMT_DayaBayAD1.list", rate = 3978.0 , MyMode = "sequential", MyStart=17000*frac)
00130         self.load( datapath = "data/", filename = "U238-sst_DayaBayAD1.list", rate = 376.0  , MyMode = "sequential", MyStart=1600*frac)
00131         self.load( datapath = "data/", filename = "U238-gds_DayaBayAD2.list", rate = 3.2    , MyMode = "sequential", MyStart=40*frac)    
00132         self.load( datapath = "data/", filename = "U238-lso_DayaBayAD2.list", rate = 3.4    , MyMode = "sequential", MyStart=50*frac)    
00133         self.load( datapath = "data/", filename = "U238-PMT_DayaBayAD2.list", rate = 3978.0 , MyMode = "sequential", MyStart=17000*frac)
00134         self.load( datapath = "data/", filename = "U238-sst_DayaBayAD2.list", rate = 376.0  , MyMode = "sequential", MyStart=1600*frac)
00135 
00136         self.load( datapath = "data/", filename = "Th232-gds_DayaBayAD1.list",rate = 0.76   , MyMode = "sequential", MyStart=10*frac)   
00137         self.load( datapath = "data/", filename = "Th232-lso_DayaBayAD1.list",rate = 0.81   , MyMode = "sequential", MyStart=11*frac)   
00138         self.load( datapath = "data/", filename = "Th232-PMT_DayaBayAD1.list",rate = 2018.0 , MyMode = "sequential", MyStart=8800*frac)
00139         self.load( datapath = "data/", filename = "Th232-sst_DayaBayAD1.list",rate = 1332.0 , MyMode = "sequential", MyStart=6000*frac)
00140         self.load( datapath = "data/", filename = "Th232-gds_DayaBayAD2.list",rate = 0.76   , MyMode = "sequential", MyStart=10*frac)   
00141         self.load( datapath = "data/", filename = "Th232-lso_DayaBayAD2.list",rate = 0.81   , MyMode = "sequential", MyStart=11*frac)   
00142         self.load( datapath = "data/", filename = "Th232-PMT_DayaBayAD2.list",rate = 2018.0 , MyMode = "sequential", MyStart=8800*frac)
00143         self.load( datapath = "data/", filename = "Th232-sst_DayaBayAD2.list",rate = 1332.0 , MyMode = "sequential", MyStart=6000*frac)
00144 
00145         self.load( datapath = "data/", filename = "K40-gds_DayaBayAD1.list",  rate = 5.2    , MyMode = "sequential", MyStart=70*frac)    
00146         self.load( datapath = "data/", filename = "K40-lso_DayaBayAD1.list",  rate = 5.6    , MyMode = "sequential", MyStart=80*frac)    
00147         self.load( datapath = "data/", filename = "K40-PMT_DayaBayAD1.list",  rate = 817.0  , MyMode = "sequential", MyStart=3600*frac)
00148         self.load( datapath = "data/", filename = "K40-sst_DayaBayAD1.list",  rate = 311.0  , MyMode = "sequential", MyStart=1400*frac)
00149         self.load( datapath = "data/", filename = "K40-gds_DayaBayAD2.list",  rate = 5.2    , MyMode = "sequential", MyStart=70*frac)    
00150         self.load( datapath = "data/", filename = "K40-lso_DayaBayAD2.list",  rate = 5.6    , MyMode = "sequential", MyStart=80*frac)    
00151         self.load( datapath = "data/", filename = "K40-PMT_DayaBayAD2.list",  rate = 817.0  , MyMode = "sequential", MyStart=3600*frac)
00152         self.load( datapath = "data/", filename = "K40-sst_DayaBayAD2.list",  rate = 311.0  , MyMode = "sequential", MyStart=1400*frac)
00153 
00154         self.load( datapath = "data/", filename = "Co60-PMT_DayaBayAD1.list", rate = 1.46   , MyMode = "sequential", MyStart=10*frac)
00155         self.load( datapath = "data/", filename = "Co60-sst_DayaBayAD1.list", rate = 48.0   , MyMode = "sequential", MyStart=600*frac)
00156         self.load( datapath = "data/", filename = "Co60-PMT_DayaBayAD2.list", rate = 1.46   , MyMode = "sequential", MyStart=10*frac)
00157         self.load( datapath = "data/", filename = "Co60-sst_DayaBayAD2.list", rate = 48.0   , MyMode = "sequential", MyStart=600*frac)
00158 
00159         self.load( datapath = "data/", filename = "Muon.list",  rate = 523.0, MyMode = "sequential", MyStart=150000*frac)
00160         #self.load( datapath = "data/", filename = "MuonHitSim_DayaBay.list",  rate = 523.0 , MyMode = "sequential", MyStart=2400*frac )
00161         #self.load( datapath = "data/", filename = "Geant4Muon_DayaBay.list",  rate = 523.0 , MyMode = "sequential", MyStart=2400*frac )

def Sandglass::ConfigureSandglass::configureElectronic (   self)
Configure the Electronics stage

Definition at line 162 of file Sandglass.py.

00163                                  :
00164         '''Configure the Electronics stage'''
00165         
00166         import ElecSim
00167         es = ElecSim.Configure(use_push_algs = False)
00168         #from ElecSim.ElecSimConf import EsFrontEndAlg
00169         #frontEndAlg = EsFrontEndAlg()
00170         #frontEndAlg.Detectors = ["DayaBayAD1","DayaBayAD2","DayaBayIWS","DayaBayOWS"]
00171         
00172         from ElecSimProc.ElecSimProcConf import ElecSimProc
00173         esp = ElecSimProc()
00174         esp.PmtTool = "EsPmtEffectPulseTool"
00175         esp.RpcTool = "EsIdealPulseTool"
00176         esp.FeeTool = "EsIdealFeeTool"
00177         esp.FecTool = "EsIdealFecTool"
00178         esp.Detectors = ["DayaBayAD1","DayaBayAD2","DayaBayIWS","DayaBayOWS"]
00179 
00180         from ElecSim.ElecSimConf import EsIdealFeeTool
00181         feeTool = EsIdealFeeTool()
00182         feeTool.LinearityThreshold = 20000
00183         feeTool.EnableESumH = False
00184         feeTool.EnableESumL = False
00185         feeTool.EnableESumTotal = False
00186         
00187         esp.ThisStageName = "Electronic"
00188         esp.LowerStageName = "Detector"
00189         #esp.OutputLevel = 2
00190         self.stage_cfg.ElectronicSequence.Members.append(esp)
00191         return
    
def Sandglass::ConfigureSandglass::configureTrigRead (   self)
Configure the Trigger and Readout stage

Definition at line 192 of file Sandglass.py.

00193                                :
00194         '''Configure the Trigger and Readout stage'''
00195         from TrigReadProc.TrigReadProcConf import TrigReadProc
00196         tsp = TrigReadProc()
00197         #tsp.TrigTools = [...]
00198         #tsp.RoTools = [...]
00199         #tsp.OutputLevel = 2
00200         from TrigSim.TrigSimConf import TsMultTriggerTool
00201         nhit = TsMultTriggerTool()
00202         nhit.NHitTriggerThreshold={"DayaBayAD1":30,
00203                                    "DayaBayAD2":30,
00204                                    "DayaBayIWS":10,
00205                                    "DayaBayOWS":10,
00206                                    "LingAoAD1":30,
00207                                    "LingAoAD2":30,
00208                                    "LingAoIWS":10,
00209                                    "LingAoOWS":10,
00210                                    "FarAD1":30,
00211                                    "FarAD2":30,
00212                                    "FarAD3":30,
00213                                    "FarAD4":30,
00214                                    "FarIWS":10,
00215                                    "FarOWS":10}
00216 
00217         tsp.ThisStageName = "TrigRead"
00218         tsp.LowerStageName = "Electronic"
00219         #tsp.OutputLevel = 2
00220         self.stage_cfg.TrigReadSequence.Members.append(tsp)
00221         return
    
def Sandglass::ConfigureSandglass::configureSingleLoader (   self)
Configure the SingleLoader stage

Definition at line 222 of file Sandglass.py.

00223                                    :
00224         '''Configure the SingleLoader stage'''
00225         from SingleLoader.SingleLoaderConf import SingleLoader
00226         sll = SingleLoader()
00227         sll.ThisStageName = "SingleLoader"
00228         sll.LowerStageName = "TrigRead"
00229         #sll.OutputLevel = 2
00230         self.stage_cfg.SingleLoaderSequence.Members.append(sll)
        
def Sandglass::ConfigureSandglass::configureSim15 (   self)

Definition at line 231 of file Sandglass.py.

00232                             :
00233         from Stage.StageConf import Sim15
00234         sim15=Sim15()
00235         sim15.TopStage = self.opts.top_stage
00236         #sim15.TimeRange = 60*60*units.s  # 1 hour
00237 
00238         from DybEventMgr.DybEventMgrConf import ArchiveTrimSvc
00239         trimSvc = ArchiveTrimSvc()
00240         trimSvc.DefaultWindowSeconds = 0 #in second
00241         #trimSvc.OutputLevel=0
00242         
00243         from Gaudi.Configuration import ApplicationMgr
00244         theApp = ApplicationMgr()
00245         theApp.TopAlg.append(sim15)

def Sandglass::ConfigureSandglass::configure (   self)

Definition at line 246 of file Sandglass.py.

00247                        :
00248         from Stage import Configure as StageConfigure
00249         self.stage_cfg = StageConfigure()
00250 
00251         stagedic={'Detector':2,'Electronic':3,'TrigRead':4,'SingleLoader':5}
00252 
00253         if not self.opts.top_stage in stagedic:
00254             print 'Error, wrong top stage parameter', self.opts.top_stage
00255             print 'Valid stage is Detector, Electronic, TrigRead or SingleLoader'
00256             
00257         for stg,idx in stagedic.iteritems():
00258             if idx <= stagedic[self.opts.top_stage]:
00259                 self.stage_cfg.addStages([stg])           ## stage tools are configured here.
00260                     
00261         for stg in self.stage_cfg.stages:
00262             #self.stage_cfg.__dict__[stg].OutputLevel = 2
00263             pass
00264 
00265         if stagedic[self.opts.top_stage]>=2:
00266             self.configureLoadingProc()
00267         if stagedic[self.opts.top_stage]>=3:
00268             self.configureElectronic()
00269         if stagedic[self.opts.top_stage]>=4:
00270             self.configureTrigRead()
00271         if stagedic[self.opts.top_stage]>=5:
00272             self.configureSingleLoader()
00273             
00274         self.configureSim15()
00275         
00276         return
        

Member Data Documentation

Definition at line 35 of file Sandglass.py.

Definition at line 35 of file Sandglass.py.

Definition at line 35 of file Sandglass.py.

Definition at line 246 of file Sandglass.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 09:55:01 for FMCP11a by doxygen 1.7.4