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 |
Configure a testing ground for LoadingProc to mix SimHeader and ReadoutHeader input.
Definition at line 25 of file Sandglass.py.
def Sandglass::ConfigureSandglass::__init__ | ( | self, | ||
argv | ||||
) |
def Sandglass::ConfigureSandglass::parse_args | ( | self, | ||
argv | ||||
) |
Definition at line 33 of file Sandglass.py.
00035 : 00036 from optparse import OptionParser 00037 import time 00038 parser = OptionParser(usage=self.__doc__) 00039 default_time_format = '%Y-%m-%dT%H:%M:%S' 00040 parser.add_option("-w","--start-time", 00041 help="Date string to set simulation start, assumed UTC", 00042 default=time.strftime(default_time_format,time.localtime())) 00043 parser.add_option("-F","--time-format", 00044 help="Format for parsing time (see man date), " \ 00045 + "default is '%s'"%default_time_format \ 00046 + " ('[YYYY]-[MM]-[DD]T[HH]:[MM]:[SS]')", 00047 default=default_time_format) 00048 parser.add_option("-g","--generator", 00049 help="A python module with a function of GetGnrtr returning a Gnrtr object.", 00050 default="1223") 00051 parser.add_option("-T","--top-stage", 00052 help="Kinematic, Detector, Electronic, TrigRead or SingleLoader", 00053 default="SingleLoader") 00054 parser.add_option("-s","--seed", 00055 help="Random seed for generators", 00056 default=1234567) 00057 parser.add_option("-f","--frac", 00058 help="Starting position of input streams", 00059 default=0.0) 00060 00061 (options,args) = parser.parse_args(args=argv) 00062 self.opts = options 00063 self.args = args 00064 00065 # print "Your random seed =", self.opts.seed 00066 timeformat = self.opts.time_format 00067 print "Using time format =",timeformat 00068 00069 try: 00070 datestring = self.opts.start_time 00071 except AttributeError: 00072 self.start_time_seconds = 0 00073 else: 00074 # This may raise ValueError if string and format don't 00075 # match. Just let it get thrown. 00076 t = time.strptime(datestring,timeformat) 00077 self.start_time_seconds = time.mktime(t) - time.timezone 00078 print 'Start time in human readable format',self.opts.start_time 00079 print 'Start time in seconds UTC =',self.start_time_seconds 00080 print 'Top stage =',self.opts.top_stage 00081 00082 return
def Sandglass::ConfigureSandglass::load | ( | self, | ||
datapath = "data/" , |
||||
filename = "IBD_DYB_AD1_acrylic.root" , |
||||
or, | ||||
IBD_DYB_AD1_acrylic, | ||||
list, | ||||
rate = 1.0 , |
||||
MyMode = "random" , |
||||
MyStart = 0 , |
||||
MyStep = 1 | ||||
) |
Definition at line 83 of file Sandglass.py.
00091 : 00092 00093 extension = filename[-5:] 00094 modulename = filename[:-5] 00095 if extension != ".list" and extension != ".root": 00096 print "Invalid input data file ", filename 00097 00098 from LoadingProc.LoadingProcConf import LoadingProc 00099 load = LoadingProc("LoadingProc."+modulename) 00100 load.StartSec = self.start_time_seconds 00101 load.StartNano = 0 00102 load.Distribution = "Exponential" 00103 load.Rate = rate 00104 load.HsAssembler = modulename+"Assem" 00105 #load.OutputLevel = 2 00106 assem = Assembler(toolname = modulename+"Assem", 00107 filename = datapath+filename, 00108 mode = MyMode, 00109 start = MyStart, 00110 step = MyStep) 00111 00112 # This and lower stage 00113 load.ThisStageName = "Detector" 00114 load.LowerStageName = "" 00115 # Add this processor to Gaudi sequencer self.stage_cfg.DetectorSequence.Members.append(load)
def Sandglass::ConfigureSandglass::configureLoadingProc | ( | self | ) |
Definition at line 116 of file Sandglass.py.
00118 : 00119 #frac = (int(self.opts.frac)-1)/24.0 00120 frac = int(self.opts.frac) 00121 '''Configure the LoadingProc stage''' 00122 00123 self.load( datapath = "data/", filename = "IBD_DayaBayAD1.list", rate = 4334.0/(24.*60.*60.) , MyMode = "random") 00124 self.load( datapath = "data/", filename = "IBD_DayaBayAD2.list", rate = 4334.0/(24.*60.*60.) , MyMode = "random") 00125 00126 self.load( datapath = "data/", filename = "U238-gds_DayaBayAD1.list", rate = 3.2 , MyMode = "sequential", MyStart=40*frac) 00127 self.load( datapath = "data/", filename = "U238-lso_DayaBayAD1.list", rate = 3.4 , MyMode = "sequential", MyStart=50*frac) 00128 self.load( datapath = "data/", filename = "U238-PMT_DayaBayAD1.list", rate = 3978.0 , MyMode = "sequential", MyStart=17000*frac) 00129 self.load( datapath = "data/", filename = "U238-sst_DayaBayAD1.list", rate = 376.0 , MyMode = "sequential", MyStart=1600*frac) 00130 self.load( datapath = "data/", filename = "U238-gds_DayaBayAD2.list", rate = 3.2 , MyMode = "sequential", MyStart=40*frac) 00131 self.load( datapath = "data/", filename = "U238-lso_DayaBayAD2.list", rate = 3.4 , MyMode = "sequential", MyStart=50*frac) 00132 self.load( datapath = "data/", filename = "U238-PMT_DayaBayAD2.list", rate = 3978.0 , MyMode = "sequential", MyStart=17000*frac) 00133 self.load( datapath = "data/", filename = "U238-sst_DayaBayAD2.list", rate = 376.0 , MyMode = "sequential", MyStart=1600*frac) 00134 00135 self.load( datapath = "data/", filename = "Th232-gds_DayaBayAD1.list",rate = 0.76 , MyMode = "sequential", MyStart=10*frac) 00136 self.load( datapath = "data/", filename = "Th232-lso_DayaBayAD1.list",rate = 0.81 , MyMode = "sequential", MyStart=11*frac) 00137 self.load( datapath = "data/", filename = "Th232-PMT_DayaBayAD1.list",rate = 2018.0 , MyMode = "sequential", MyStart=8800*frac) 00138 self.load( datapath = "data/", filename = "Th232-sst_DayaBayAD1.list",rate = 1332.0 , MyMode = "sequential", MyStart=6000*frac) 00139 self.load( datapath = "data/", filename = "Th232-gds_DayaBayAD2.list",rate = 0.76 , MyMode = "sequential", MyStart=10*frac) 00140 self.load( datapath = "data/", filename = "Th232-lso_DayaBayAD2.list",rate = 0.81 , MyMode = "sequential", MyStart=11*frac) 00141 self.load( datapath = "data/", filename = "Th232-PMT_DayaBayAD2.list",rate = 2018.0 , MyMode = "sequential", MyStart=8800*frac) 00142 self.load( datapath = "data/", filename = "Th232-sst_DayaBayAD2.list",rate = 1332.0 , MyMode = "sequential", MyStart=6000*frac) 00143 00144 self.load( datapath = "data/", filename = "K40-gds_DayaBayAD1.list", rate = 5.2 , MyMode = "sequential", MyStart=70*frac) 00145 self.load( datapath = "data/", filename = "K40-lso_DayaBayAD1.list", rate = 5.6 , MyMode = "sequential", MyStart=80*frac) 00146 self.load( datapath = "data/", filename = "K40-PMT_DayaBayAD1.list", rate = 817.0 , MyMode = "sequential", MyStart=3600*frac) 00147 self.load( datapath = "data/", filename = "K40-sst_DayaBayAD1.list", rate = 311.0 , MyMode = "sequential", MyStart=1400*frac) 00148 self.load( datapath = "data/", filename = "K40-gds_DayaBayAD2.list", rate = 5.2 , MyMode = "sequential", MyStart=70*frac) 00149 self.load( datapath = "data/", filename = "K40-lso_DayaBayAD2.list", rate = 5.6 , MyMode = "sequential", MyStart=80*frac) 00150 self.load( datapath = "data/", filename = "K40-PMT_DayaBayAD2.list", rate = 817.0 , MyMode = "sequential", MyStart=3600*frac) 00151 self.load( datapath = "data/", filename = "K40-sst_DayaBayAD2.list", rate = 311.0 , MyMode = "sequential", MyStart=1400*frac) 00152 00153 self.load( datapath = "data/", filename = "Co60-PMT_DayaBayAD1.list", rate = 1.46 , MyMode = "sequential", MyStart=10*frac) 00154 self.load( datapath = "data/", filename = "Co60-sst_DayaBayAD1.list", rate = 48.0 , MyMode = "sequential", MyStart=600*frac) 00155 self.load( datapath = "data/", filename = "Co60-PMT_DayaBayAD2.list", rate = 1.46 , MyMode = "sequential", MyStart=10*frac) 00156 self.load( datapath = "data/", filename = "Co60-sst_DayaBayAD2.list", rate = 48.0 , MyMode = "sequential", MyStart=600*frac) 00157 00158 self.load( datapath = "data/", filename = "Muon.list", rate = 523.0, MyMode = "sequential", MyStart=150000*frac) 00159 #self.load( datapath = "data/", filename = "MuonHitSim_DayaBay.list", rate = 523.0 , MyMode = "sequential", MyStart=2400*frac ) #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 160 of file Sandglass.py.
00162 : 00163 '''Configure the Electronics stage''' 00164 00165 import ElecSim 00166 es = ElecSim.Configure(use_push_algs = False) 00167 #from ElecSim.ElecSimConf import EsFrontEndAlg 00168 #frontEndAlg = EsFrontEndAlg() 00169 #frontEndAlg.Detectors = ["DayaBayAD1","DayaBayAD2","DayaBayIWS","DayaBayOWS"] 00170 00171 from ElecSimProc.ElecSimProcConf import ElecSimProc 00172 esp = ElecSimProc() 00173 esp.PmtTool = "EsPmtEffectPulseTool" 00174 esp.RpcTool = "EsIdealPulseTool" 00175 esp.FeeTool = "EsIdealFeeTool" 00176 esp.FecTool = "EsIdealFecTool" 00177 esp.Detectors = ["DayaBayAD1","DayaBayAD2","DayaBayIWS","DayaBayOWS"] 00178 00179 from ElecSim.ElecSimConf import EsIdealFeeTool 00180 feeTool = EsIdealFeeTool() 00181 feeTool.LinearityThreshold = 20000 00182 feeTool.EnableESumH = False 00183 feeTool.EnableESumL = False 00184 feeTool.EnableESumTotal = False 00185 00186 esp.ThisStageName = "Electronic" 00187 esp.LowerStageName = "Detector" 00188 #esp.OutputLevel = 2 00189 self.stage_cfg.ElectronicSequence.Members.append(esp) return
def Sandglass::ConfigureSandglass::configureTrigRead | ( | self | ) |
Configure the Trigger and Readout stage
Definition at line 190 of file Sandglass.py.
00192 : 00193 '''Configure the Trigger and Readout stage''' 00194 from TrigReadProc.TrigReadProcConf import TrigReadProc 00195 tsp = TrigReadProc() 00196 #tsp.TrigTools = [...] 00197 #tsp.RoTools = [...] 00198 #tsp.OutputLevel = 2 00199 from TrigSim.TrigSimConf import TsMultTriggerTool 00200 nhit = TsMultTriggerTool() 00201 nhit.NHitTriggerThreshold={"DayaBayAD1":30, 00202 "DayaBayAD2":30, 00203 "DayaBayIWS":10, 00204 "DayaBayOWS":10, 00205 "LingAoAD1":30, 00206 "LingAoAD2":30, 00207 "LingAoIWS":10, 00208 "LingAoOWS":10, 00209 "FarAD1":30, 00210 "FarAD2":30, 00211 "FarAD3":30, 00212 "FarAD4":30, 00213 "FarIWS":10, 00214 "FarOWS":10} 00215 00216 tsp.ThisStageName = "TrigRead" 00217 tsp.LowerStageName = "Electronic" 00218 #tsp.OutputLevel = 2 00219 self.stage_cfg.TrigReadSequence.Members.append(tsp) return
def Sandglass::ConfigureSandglass::configureSingleLoader | ( | self | ) |
Configure the SingleLoader stage
Definition at line 220 of file Sandglass.py.
00222 : 00223 '''Configure the SingleLoader stage''' 00224 from SingleLoader.SingleLoaderConf import SingleLoader 00225 sll = SingleLoader() 00226 sll.ThisStageName = "SingleLoader" 00227 sll.LowerStageName = "TrigRead" 00228 #sll.OutputLevel = 2 self.stage_cfg.SingleLoaderSequence.Members.append(sll)
def Sandglass::ConfigureSandglass::configureSim15 | ( | self | ) |
Definition at line 229 of file Sandglass.py.
00231 : 00232 from Stage.StageConf import Sim15 00233 sim15=Sim15() 00234 sim15.TopStage = self.opts.top_stage 00235 #sim15.TimeRange = 60*60*units.s # 1 hour 00236 00237 from DybEventMgr.DybEventMgrConf import ArchiveTrimSvc 00238 trimSvc = ArchiveTrimSvc() 00239 trimSvc.DefaultWindowSeconds = 0 #in second 00240 #trimSvc.OutputLevel=0 00241 00242 from Gaudi.Configuration import ApplicationMgr 00243 theApp = ApplicationMgr() theApp.TopAlg.append(sim15)
def Sandglass::ConfigureSandglass::configure | ( | self | ) |
Definition at line 244 of file Sandglass.py.
00246 : 00247 from Stage import Configure as StageConfigure 00248 self.stage_cfg = StageConfigure() 00249 00250 stagedic={'Detector':2,'Electronic':3,'TrigRead':4,'SingleLoader':5} 00251 00252 if not self.opts.top_stage in stagedic: 00253 print 'Error, wrong top stage parameter', self.opts.top_stage 00254 print 'Valid stage is Detector, Electronic, TrigRead or SingleLoader' 00255 00256 for stg,idx in stagedic.iteritems(): 00257 if idx <= stagedic[self.opts.top_stage]: 00258 self.stage_cfg.addStages([stg]) ## stage tools are configured here. 00259 00260 for stg in self.stage_cfg.stages: 00261 #self.stage_cfg.__dict__[stg].OutputLevel = 2 00262 pass 00263 00264 if stagedic[self.opts.top_stage]>=2: 00265 self.configureLoadingProc() 00266 if stagedic[self.opts.top_stage]>=3: 00267 self.configureElectronic() 00268 if stagedic[self.opts.top_stage]>=4: 00269 self.configureTrigRead() 00270 if stagedic[self.opts.top_stage]>=5: 00271 self.configureSingleLoader() 00272 00273 self.configureSim15() 00274 return
Definition at line 60 of file Sandglass.py.
Definition at line 61 of file Sandglass.py.
Definition at line 70 of file Sandglass.py.
Definition at line 246 of file Sandglass.py.