/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
runIBD15::FullChain::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 21 of file FullChain.py.


Constructor & Destructor Documentation

def runIBD15::FullChain::ConfigureFullChain::__init__ (   self,
  argv 
)

Definition at line 27 of file FullChain.py.

00028                            :
00029         self.parse_args(argv)
00030         return


Member Function Documentation

def runIBD15::FullChain::ConfigureFullChain::parse_args (   self,
  argv 
)

Definition at line 31 of file FullChain.py.

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

def runIBD15::FullChain::ConfigureFullChain::configureKinematic (   self)

Definition at line 76 of file FullChain.py.

00077                                 :
00078         #from Stage.gun import gun
00079         #gun=gun(stage=self.stage_cfg,start_time=self.start_time_seconds)
00080 
00081         #from Stage.Muon import Muon
00082         #muon=Muon(stage=self.stage_cfg,start_time=self.start_time_seconds)
00083 
00084         from MDC09a.runIBD15.IBD import IBD
00085         ibd=IBD(stage=self.stage_cfg,
00086                 name='IBD',
00087                 volume=self.opts.volume,
00088                 start_time=self.start_time_seconds,
00089                 seed=self.opts.seed)
00090 
00091         #from Stage.K40 import K40
00092         #k40=K40(stage=self.stage_cfg,start_time=self.start_time_seconds)
00093 
00094         #from Stage.U import Uranium
00095         #u=Uranium(stage=self.stage_cfg,start_time=self.start_time_seconds)
00096 
00097         #from Stage.Th import Thorium
00098         #th=Thorium(stage=self.stage_cfg,start_time=self.start_time_seconds)
00099 
00100         return

def runIBD15::FullChain::ConfigureFullChain::configureDetector (   self)
Configure the Detector stage

Definition at line 101 of file FullChain.py.

00102                                :
00103         '''Configure the Detector stage'''
00104         
00105         import DetSim
00106         ds = DetSim.Configure(physlist=DetSim.physics_list_basic+DetSim.physics_list_nuclear,site="dayabay",
00107                               use_push_algs = False)
00108 
00109         from DetSimProc.DetSimProcConf import DetSimProc
00110         dsp = DetSimProc()
00111         dsp.ThisStageName = "Detector"
00112         dsp.LowerStageName = "Kinematic"
00113         #dsp.OutputLevel = 2
00114         self.stage_cfg.DetectorSequence.Members.append(dsp)
00115 
00116         ds.historian(trackSelection="(pdg == 2112)",vertexSelection="(pdg == 2112)")
00117         params = {
00118             'start' :"(start > 0)",
00119             'track1':"(id==1)",
00120             'track2':"(id==2)",
00121             'inGdLS':"DetectorElementName == 'db-gds1'",
00122             'inLS':  "DetectorElementName == 'db-lso1'",
00123             'GD':    "MaterialName == '/dd/Materials/GdDopedLS'",
00124             'LS':    "MaterialName == '/dd/Materials/LiquidScintillator'",
00125             'MO':   "MaterialName == '/dd/Materials/MineralOil'",
00126             'IAV':   "DetectorElementName == 'db-iav1'",
00127             'OAV':   "DetectorElementName == 'db-oav1'",
00128             'IWS': "MaterialName == '/dd/Materials/IwsWater'",
00129             'OWS': "MaterialName == '/dd/Materials/OwsWater'",
00130             'lastvtx': "IsStopping == 1",
00131             'firstvtx': "IsStarting == 1",
00132             'NeutronTrk': "pdg == 2112",
00133             'NeutronMom': "creator == 2112",
00134             'NCap': "ProcessName == 'nCapture'",
00135             'Gamma': "pdg == 22",
00136             'Muon': "(pdg == 13 or pdg == -13)"
00137             }
00138         
00139         ds.unobserver(stats=[
00140                 ["EDepInGdLS", "dE", "%(GD)s"%params],
00141                 ["EDepInLS", "dE", "%(LS)s"%params],
00142                 ["EDepInIAV", "dE", "%(IAV)s"%params],
00143                 ["EDepInOAV", "dE", "%(OAV)s"%params],
00144                 ["EDepInOIL", "dE", "%(MO)s"%params],
00145                 
00146                 ["QEDepInGdLS", "qdE", "%(GD)s"%params],
00147                 ["QEDepInLS", "qdE", "%(LS)s"%params],
00148                 ["QEDepInIAV", "qdE", "%(IAV)s"%params],
00149                 ["QEDepInOAV", "qdE", "%(OAV)s"%params],
00150                 ["QEDepInOIL", "qdE", "%(MO)s"%params],
00151                 
00152                 ["tQESumGdLS", "qEt", "%(GD)s"%params],
00153                 ["xQESumGdLS", "qEx", "%(GD)s"%params],
00154                 ["yQESumGdLS", "qEy", "%(GD)s"%params],
00155                 ["zQESumGdLS", "qEz", "%(GD)s"%params],
00156                 
00157                 ["tQESumLS", "qEt", "%(LS)s"%params],
00158                 ["xQESumLS", "qEx", "%(LS)s"%params],
00159                 ["yQESumLS", "qEy", "%(LS)s"%params],
00160                 ["zQESumLS", "qEz", "%(LS)s"%params],
00161                 
00162                 ["tQESumMO", "qEt", "%(MO)s"%params],
00163                 ["xQESumMO", "qEx", "%(MO)s"%params],
00164                 ["yQESumMO", "qEy", "%(MO)s"%params],
00165                 ["zQESumMO", "qEz", "%(MO)s"%params],
00166                 
00167                 ["capTarget", "capTargetZ","%(track2)s and %(NCap)s"%params],
00168                 
00169                 # track 1
00170                 ["pdgId_Trk1","pdg","%(track1)s and %(start)s"%params],
00171                 ["t_Trk1",    "t" , "%(track1)s and %(start)s"%params],
00172                 ["x_Trk1",    "x", "%(track1)s and %(start)s"%params],
00173                 ["y_Trk1",    "y", "%(track1)s and %(start)s"%params],
00174                 ["z_Trk1",    "z", "%(track1)s and %(start)s"%params],
00175                 ["tEnd_Trk1",    "t" , "%(track1)s and %(lastvtx)s"%params],
00176                 ["xEnd_Trk1",    "x", "%(track1)s and %(lastvtx)s"%params],
00177                 ["yEnd_Trk1",    "y", "%(track1)s and %(lastvtx)s"%params],
00178                 ["zEnd_Trk1",    "z", "%(track1)s and %(lastvtx)s"%params],
00179                 ["e_Trk1",    "E",  "%(track1)s and %(start)s"%params],
00180                 ["p_Trk1",    "p",  "%(track1)s and %(start)s"%params],
00181                 ["ke_Trk1",   "KE", "%(track1)s and %(start)s"%params],
00182                 ["vx_Trk1",   "lvx","%(track1)s and %(start)s"%params],
00183                 ["vy_Trk1",   "lvy","%(track1)s and %(start)s"%params],
00184                 ["vz_Trk1",   "lvz","%(track1)s and %(start)s"%params],
00185                 ["TrkLength_GD_Trk1",  "dx","%(track1)s and %(GD)s"%params],
00186                 ["TrkLength_iAV_Trk1", "dx","%(track1)s and %(IAV)s"%params],
00187                 ["TrkLength_LS_Trk1",  "dx","%(track1)s and %(LS)s"%params],
00188                 ["TrkLength_oAV_Trk1", "dx","%(track1)s and %(OAV)s"%params],
00189                 ["TrkLength_Oil_Trk1", "dx","%(track1)s and %(MO)s"%params],
00190                 # track 2
00191                 ["pdgId_Trk2","pdg","%(track2)s and %(start)s"%params],
00192                 ["t_Trk2",    "t" , "%(track2)s and %(start)s"%params],
00193                 ["x_Trk2",    "x", "%(track2)s and %(start)s"%params],
00194                 ["y_Trk2",    "y", "%(track2)s and %(start)s"%params],
00195                 ["z_Trk2",    "z", "%(track2)s and %(start)s"%params],
00196                 ["tEnd_Trk2",    "t" , "%(track2)s and %(lastvtx)s"%params],
00197                 ["xEnd_Trk2",    "x", "%(track2)s and %(lastvtx)s"%params],
00198                 ["yEnd_Trk2",    "y", "%(track2)s and %(lastvtx)s"%params],
00199                 ["zEnd_Trk2",    "z", "%(track2)s and %(lastvtx)s"%params],
00200                 ["e_Trk2",    "E",  "%(track2)s and %(start)s"%params],
00201                 ["p_Trk2",    "p",  "%(track2)s and %(start)s"%params],
00202                 ["ke_Trk2",   "KE", "%(track2)s and %(start)s"%params],
00203                 ["vx_Trk2",   "lvx","%(track2)s and %(start)s"%params],
00204                 ["vy_Trk2",   "lvy","%(track2)s and %(start)s"%params],
00205                 ["vz_Trk2",   "lvz","%(track2)s and %(start)s"%params],
00206                 ["TrkLength_GD_Trk2",  "dx","%(track2)s and %(GD)s"%params],
00207                 ["TrkLength_iAV_Trk2", "dx","%(track2)s and %(IAV)s"%params],
00208                 ["TrkLength_LS_Trk2",  "dx","%(track2)s and %(LS)s"%params],
00209                 ["TrkLength_oAV_Trk2", "dx","%(track2)s and %(OAV)s"%params],
00210                 ["TrkLength_Oil_Trk2", "dx","%(track2)s and %(MO)s"%params]
00211                 ])
00212 
00213         return

def runIBD15::FullChain::ConfigureFullChain::configureElectronic (   self)
Configure the Electronics stage

Definition at line 214 of file FullChain.py.

00215                                  :
00216         '''Configure the Electronics stage'''
00217 
00218         import ElecSim
00219         es = ElecSim.Configure(use_push_algs = False)
00220 
00221         from ElecSimProc.ElecSimProcConf import ElecSimProc
00222         esp = ElecSimProc()
00223         esp.ThisStageName = "Electronic"
00224         esp.LowerStageName = "Detector"
00225         #esp.OutputLevel = 2
00226         self.stage_cfg.ElectronicSequence.Members.append(esp)
00227         return

def runIBD15::FullChain::ConfigureFullChain::configureTrigRead (   self)
Configure the Trigger and Readout stage

Definition at line 228 of file FullChain.py.

00229                                :
00230         '''Configure the Trigger and Readout stage'''
00231         from TrigReadProc.TrigReadProcConf import TrigReadProc
00232         tsp = TrigReadProc()
00233         tsp.ThisStageName = "TrigRead"
00234         tsp.LowerStageName = "Electronic"
00235         #tsp.TrigTools = [...]
00236         #tsp.RoTools = [...]
00237         #tsp.OutputLevel = 2
00238         self.stage_cfg.TrigReadSequence.Members.append(tsp)
00239         return

def runIBD15::FullChain::ConfigureFullChain::configureSingleLoader (   self)
Configure the SingleLoader stage

Definition at line 240 of file FullChain.py.

00241                                    :
00242         '''Configure the SingleLoader stage'''
00243         from SingleLoader.SingleLoaderConf import SingleLoader
00244         sll = SingleLoader()
00245         sll.ThisStageName = "SingleLoader"
00246         sll.LowerStageName = "TrigRead"
00247         #sll.OutputLevel = 2
00248         self.stage_cfg.SingleLoaderSequence.Members.append(sll)

def runIBD15::FullChain::ConfigureFullChain::configureSim15 (   self)

Definition at line 249 of file FullChain.py.

00250                             :
00251         from Stage.StageConf import Sim15
00252         sim15=Sim15()
00253         sim15.TopStage=self.opts.top_stage
00254 
00255         from Gaudi.Configuration import ApplicationMgr
00256         theApp = ApplicationMgr()
00257         theApp.TopAlg.append(sim15)

def runIBD15::FullChain::ConfigureFullChain::configure (   self)

Definition at line 258 of file FullChain.py.

00259                        :
00260 
00261         from Stage import Configure as StageConfigure
00262         self.stage_cfg = StageConfigure()
00263 
00264         stagedic={'Kinematic':1,'Detector':2,'Electronic':3,'TrigRead':4,'SingleLoader':5}
00265 
00266         if not self.opts.top_stage in stagedic:
00267             print 'Error, wrong top stage parameter', self.opts.top_stage
00268 
00269         for stg,idx in stagedic.iteritems():
00270             if idx <= stagedic[self.opts.top_stage]:
00271                 self.stage_cfg.addStages([stg])           ## stage tools are configured here.
00272                 
00273         for stg in self.stage_cfg.stages:
00274             #self.stage_cfg.__dict__[stg].OutputLevel = 2
00275             pass
00276 
00277         if stagedic[self.opts.top_stage]>=1:
00278             self.configureKinematic()
00279         if stagedic[self.opts.top_stage]>=2:
00280             self.configureDetector()
00281         if stagedic[self.opts.top_stage]>=3:
00282             self.configureElectronic()
00283         if stagedic[self.opts.top_stage]>=4:
00284             self.configureTrigRead()
00285         if stagedic[self.opts.top_stage]>=5:
00286             self.configureSingleLoader()
00287 
00288         self.configureSim15()
00289         
00290         return
        

Member Data Documentation

Definition at line 31 of file FullChain.py.

Definition at line 31 of file FullChain.py.

Definition at line 31 of file FullChain.py.

Definition at line 258 of file FullChain.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:05 for MDC09a by doxygen 1.7.4