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

In This Package:

GenKinematics::__init__ Namespace Reference


Functions

def configure
def run

Variables

string DATETIME_FORMAT = '%Y-%m-%dT%H:%M:%S'

Function Documentation

def GenKinematics::__init__::configure (   argv = []  ) 

Configure this module with LED position

Definition at line 24 of file __init__.py.

00024                         :
00025     """Configure this module with LED position"""
00026 
00027     import GaudiKernel.SystemOfUnits as units
00028     import sys, getopt
00029     from time import gmtime, mktime, strftime, strptime, timezone
00030     opts,args = getopt.getopt(argv,
00031                               "p:w:z:n:i:f:m:s:",["no-geometry"])
00032     wallTime = 0
00033     axis = 0
00034     xpos = 0.0
00035     ypos = 0.0
00036     zpos = 0.0
00037     intensity = 35000 # photons per LED flash
00038     intensityMode = "Gaus" # use Gaussian distribution to smear LED intensity
00039     intensitySpread = 350 # sigma/FWHM (for Gaus/Lorentz distribution, respectively) of intensity smearing in photons
00040     ledName = "DayaBayAD1_ACU_A_Center_LED"
00041     ledFrequency = 500.0 * units.hertz
00042     pmtDataPath = None
00043     placeGeometry = True
00044     for opt,arg in opts:
00045         if opt == "-p":
00046             pmtDataPath = arg
00047         if opt == "-i":
00048             intensity = int(arg)
00049             print "======================================================"
00050             print "Diffuser Ball intensity  = ",intensity," photons per flash"
00051             print "======================================================"
00052         if opt == "-m":
00053             intensityMode = arg
00054             print "======================================================"
00055             print "Diffuser Ball intensity is spread using a ",intensityMode," distribution"
00056             print "======================================================"
00057         if opt == "-s":
00058             intensitySpread = int(arg)
00059             print "======================================================"
00060             print "Diffuser Ball intensity is spread with sigma/FWHM = ",intensitySpread," photons"
00061             print "======================================================"
00062         if opt == "-f":
00063             ledFrequency = float(arg)
00064             print "======================================================"
00065             print "Diffuser Ball frequency  = ",ledFrequency," hertz"
00066             print "======================================================"
00067         if opt == "-z":
00068             zpos = float(arg)
00069             print "======================================================"
00070             print "Diffuser Ball Z position = ", zpos, " cm"
00071             print "======================================================"
00072             zpos *= units.cm
00073         if opt == "-n":
00074             ledName = arg
00075             print "======================================================"
00076             print "LED Source = ", ledName
00077             print "======================================================"
00078         if opt == "--no-geometry":
00079             placeGeometry = False
00080             print "======================================================"
00081             print "Photons only; ACU diffuser ball geometry will not be added."
00082             print "======================================================"
00083 
00084     detectorMap = {"DayaBayAD1":"/dd/Structure/AD/db-oil1",
00085                    "DayaBayAD2":"/dd/Structure/AD/db-oil2",
00086                    "LingAoAD1":"/dd/Structure/AD/la-oil1",
00087                    "LingAoAD2":"/dd/Structure/AD/la-oil2",
00088                    "FarAD1":"/dd/Structure/AD/far-oil1",
00089                    "FarAD2":"/dd/Structure/AD/far-oil2",
00090                    "FarAD3":"/dd/Structure/AD/far-oil3",
00091                    "FarAD4":"/dd/Structure/AD/far-oil4"
00092                    }
00093 
00094     # Get LED Source information
00095     from GaudiPython import gbl
00096     CalibSourceId = gbl.DayaBay.CalibSourceId
00097     ledId = CalibSourceId( ledName )
00098     xpos = ledId.nominalX()
00099     ypos = ledId.nominalY()
00100     volume = None
00101     if detectorMap.has_key( ledId.detName() ):
00102         # Set the correct coordinate system volume
00103         volume = detectorMap[ ledId.detName() ]
00104     else:
00105         print "ERROR: Unknown detector: ", ledId.detName()
00106         sys.exit(1)
00107 
00108     if ledId.isWallMounted():
00109         zpos = ledId.nominalZ()
00110         placeGeometry = False
00111 
00112     import GenTools
00113     from GenTools.Helpers import DiffuserBall
00114     ball = DiffuserBall( name=ledName,
00115                          useGeometry = placeGeometry )
00116     ball.setVolume( volume )
00117     ball.setPosition( [xpos, ypos, zpos] )
00118     ball.ball.PhotonsPerEvent = intensity
00119     ball.ball.PhotonsPerEventMode = intensityMode
00120     ball.ball.PhotonsPerEventSpread = intensitySpread
00121     ball.timerator.LifeTime = 1.0 / ledFrequency
00122     gtc = GenTools.Configure()
00123     gtc.generator.TimeStamp = int(wallTime)
00124     gtc.register(ball)
00125 
00126     # Set run info
00127     from RunDataSvc.RunDataSvcConf import RunDataSvc
00128     runDataSvc = RunDataSvc()
00129     runDataSvc.SimRunType = "Calibration"
00130     runDataSvc.SimCalibSources = [ ledName ]
00131     runDataSvc.SimLedFrequency = { ledName : ledFrequency }
00132     runDataSvc.SimCalibZPosition = { ledName : zpos }    
00133 
00134     import DetSim
00135     detsim = DetSim.Configure(physlist = DetSim.physics_list_basic)
00136 
00137     #import ElecSim
00138     #elecsim = ElecSim.Configure()
00139     #if pmtDataPath != None:
00140     #    # change PMT properties
00141     #    elecsim.dataSvc.setPmtSimData( pmtDataPath )
00142 
00143     # Don't save the information for every generated optical photon;
00144     # the data volume is too large.
00145     
00146     from DybAlg.DybAlgConf import DybGenPrune
00147     genPrune = DybGenPrune()
00148     from Gaudi.Configuration import ApplicationMgr
00149     appMgr = ApplicationMgr()
00150     appMgr.TopAlg += [genPrune]
00151 
def run(app):

def GenKinematics::__init__::run (   app  ) 

Definition at line 152 of file __init__.py.

00152             :
00153     pass
    pass


Variable Documentation

string GenKinematics::__init__::DATETIME_FORMAT = '%Y-%m-%dT%H:%M:%S' [static]

Definition at line 20 of file __init__.py.

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

Generated on Mon Apr 11 20:06:07 2011 for ElecTutorial by doxygen 1.4.7