Classes | |
class | PositionerAlg |
Functions | |
def | configure |
def | run |
def SimGe68wGEO::configure | ( | argv = [] |
) |
Configure this module with source position
Definition at line 34 of file SimGe68wGEO.py.
00034 : 00035 """Configure this module with source position""" 00036 00037 import sys, getopt 00038 import GaudiKernel.SystemOfUnits as units 00039 from time import gmtime, mktime, strftime, strptime, timezone 00040 opts,args = getopt.getopt(argv, 00041 "z:a:") 00042 from DybPython.Control import nuwa 00043 wallTime = nuwa.opts.time 00044 runNumber = nuwa.opts.run 00045 #wallTime = 0 00046 axis = 'A' 00047 acuName = 'ACU_A_Center' 00048 xpos = 0.0 00049 ypos = 0.0 00050 zpos = 0.0 00051 pmtDataPath = None 00052 for opt,arg in opts: 00053 if opt == "-z": 00054 zpos = float(arg) * units.cm 00055 print "======================================================" 00056 print "Source Z position = ", zpos / units.cm, " cm" 00057 print "======================================================" 00058 if opt == "-a": 00059 axis = arg 00060 print "======================================================" 00061 print "ACU Axis = ", axis 00062 print "======================================================" 00063 if axis == 'B': 00064 xpos = 135.0 * math.cos(112.5 * math.pi / 180.) * units.cm 00065 ypos = 135.0 * math.sin(112.5 * math.pi / 180.) * units.cm 00066 acuName = 'ACU_B_GdlsEdge' 00067 elif axis == 'C': 00068 xpos = 177.25*math.cos( (112.5 + 180) * math.pi / 180.)*units.cm 00069 ypos = 177.25*math.sin( (112.5 + 180) * math.pi / 180.)*units.cm 00070 acuName = 'ACU_C_GammaCatcher' 00071 00072 # Set run info 00073 from RunDataSvc.RunDataSvcConf import RunDataSvc 00074 runDataSvc = RunDataSvc() 00075 runDataSvc.SimRunType = "Calibration" 00076 sourceName = "DayaBayAD1_"+acuName+"_Germanium_68" 00077 runDataSvc.SimCalibSources = [ sourceName ] 00078 runDataSvc.SimCalibZPosition = { sourceName : zpos } 00079 00080 # Add pull-mixing simulation 00081 from Stage import Configure as StageConfigure 00082 stageCfg = StageConfigure() 00083 stageCfg.addStages( ['Kinematic','Detector','Electronic','TrigRead', 00084 'SingleLoader'] ) 00085 00086 # Add kinematic generators 00087 from Gnrtr.GnrtrConf import Gnrtr 00088 from GenTools.Helpers import Gun 00089 from GenTools.Helpers import HepEVT 00090 00091 SimTime=nuwa.opts.executions * 2 * 0.020 00092 00093 # Ge68 00094 00095 seed = runNumber 00096 Ge68lifetime=0.020 00097 Ge68events= SimTime // Ge68lifetime 00098 00099 mygenGe68 = HepEVT("Ge68.exe -n %d -seed %d |" % (Ge68events,seed), name = "Ge68") 00100 mygenGe68.positioner.Volume = "/dd/Structure/CalibrationSources/db-ad1-Ge68SourceActive" 00101 mygenGe68.transformer.Volume = "/dd/Structure/CalibrationSources/db-ad1-Ge68SourceActive" 00102 mygenGe68.positioner.Position = [xpos, ypos, zpos] 00103 mygenGe68.positioner.Strategy = "FullVolume" 00104 mygenGe68.positioner.Mode = "Uniform" 00105 mygenGe68.positioner.Spread = 3.0 * units.cm 00106 mygenGe68.timerator.LifeTime = Ge68lifetime*units.second 00107 00108 gnrtrGe68 = Gnrtr("gnrtrGe68"); 00109 gnrtrGe68.GenTools = mygenGe68.tools() 00110 gnrtrGe68.ThisStageName = "Kinematic" 00111 gnrtrGe68.TimeStamp = int(wallTime) 00112 stageCfg.KinematicSequence.Members.append(gnrtrGe68) 00113 00114 00115 # Rest of Simulation stages 00116 import DetSim 00117 detsim = DetSim.Configure(use_push_algs = False) 00118 detsim.historian(trackSelection="(pdg == -11)",\ 00119 vertexSelection="(pdg == -11)") 00120 params = { 00121 'start' :"(start > 0)", 00122 'track1':"(id==1)", 00123 'track2':"(id==2)", 00124 'GD': "MaterialName == '/dd/Materials/GdDopedLS'", 00125 'LS': "MaterialName == '/dd/Materials/LiquidScintillator'", 00126 'MO': "MaterialName == '/dd/Materials/MineralOil'", 00127 'IAV': "DetectorElementName == 'db-iav1'", 00128 'OAV': "DetectorElementName == 'db-oav1'", 00129 'IWS': "MaterialName == '/dd/Materials/IwsWater'", 00130 'OWS': "MaterialName == '/dd/Materials/OwsWater'", 00131 'lastvtx': "IsStopping == 1", 00132 'firstvtx': "IsStarting == 1", 00133 'Neutron': "pdg == 2112", 00134 'NeutronMom': "creator == 2112", 00135 'Gamma': "pdg == 22", 00136 'Positron': "pdg == -11", 00137 'Muon': "(pdg == 13 or pdg == -13)" 00138 } 00139 00140 detsim.unobserver(stats=[ 00141 ["EDepInGdLS", "dE", "%(GD)s"%params], 00142 ["EDepInLS", "dE", "%(LS)s"%params], 00143 ["EDepInIAV", "dE", "%(IAV)s"%params], 00144 ["EDepInOAV", "dE", "%(OAV)s"%params], 00145 ["EDepInOIL", "dE", "%(MO)s"%params], 00146 00147 ["QEDepInGdLS", "qdE", "%(GD)s"%params], 00148 ["QEDepInLS", "qdE", "%(LS)s"%params], 00149 ["QEDepInIAV", "qdE", "%(IAV)s"%params], 00150 ["QEDepInOAV", "qdE", "%(OAV)s"%params], 00151 ["QEDepInOIL", "qdE", "%(MO)s"%params], 00152 00153 ["tQESumGdLS", "qEt", "%(GD)s"%params], 00154 ["xQESumGdLS", "qEx", "%(GD)s"%params], 00155 ["yQESumGdLS", "qEy", "%(GD)s"%params], 00156 ["zQESumGdLS", "qEz", "%(GD)s"%params], 00157 00158 ["tQESumLS", "qEt", "%(LS)s"%params], 00159 ["xQESumLS", "qEx", "%(LS)s"%params], 00160 ["yQESumLS", "qEy", "%(LS)s"%params], 00161 ["zQESumLS", "qEz", "%(LS)s"%params], 00162 00163 ["tQESumMO", "qEt", "%(MO)s"%params], 00164 ["xQESumMO", "qEx", "%(MO)s"%params], 00165 ["yQESumMO", "qEy", "%(MO)s"%params], 00166 ["zQESumMO", "qEz", "%(MO)s"%params], 00167 00168 # track 1 00169 ["pdgId_Trk1","pdg","%(track1)s and %(start)s"%params], 00170 ["t_Trk1", "t" , "%(track1)s and %(start)s"%params], 00171 ["x_Trk1", "x", "%(track1)s and %(start)s"%params], 00172 ["y_Trk1", "y", "%(track1)s and %(start)s"%params], 00173 ["z_Trk1", "z", "%(track1)s and %(start)s"%params], 00174 ["tEnd_Trk1", "t" , "%(track1)s and %(lastvtx)s"%params], 00175 ["xEnd_Trk1", "x", "%(track1)s and %(lastvtx)s"%params], 00176 ["yEnd_Trk1", "y", "%(track1)s and %(lastvtx)s"%params], 00177 ["zEnd_Trk1", "z", "%(track1)s and %(lastvtx)s"%params], 00178 ["e_Trk1", "E", "%(track1)s and %(start)s"%params], 00179 ["p_Trk1", "p", "%(track1)s and %(start)s"%params], 00180 ["ke_Trk1", "KE", "%(track1)s and %(start)s"%params], 00181 ["vx_Trk1", "vx","%(track1)s and %(start)s"%params], 00182 ["vy_Trk1", "vy","%(track1)s and %(start)s"%params], 00183 ["vz_Trk1", "vz","%(track1)s and %(start)s"%params], 00184 ["TrkLength_GD_Trk1", "dx","%(track1)s and %(GD)s"%params], 00185 ["TrkLength_iAV_Trk1", "dx","%(track1)s and %(IAV)s"%params], 00186 ["TrkLength_LS_Trk1", "dx","%(track1)s and %(LS)s"%params], 00187 ["TrkLength_oAV_Trk1", "dx","%(track1)s and %(OAV)s"%params], 00188 ["TrkLength_Oil_Trk1", "dx","%(track1)s and %(MO)s"%params] 00189 ]) 00190 00191 from DetSimProc.DetSimProcConf import DetSimProc 00192 dsp = DetSimProc() 00193 dsp.ThisStageName = "Detector" 00194 dsp.LowerStageName = "Kinematic" 00195 stageCfg.DetectorSequence.Members.append(dsp) 00196 00197 import ElecSim 00198 elecsim = ElecSim.Configure(use_push_algs = False) 00199 from ElecSimProc.ElecSimProcConf import ElecSimProc 00200 esp = ElecSimProc() 00201 esp.ThisStageName = "Electronic" 00202 esp.LowerStageName = "Detector" 00203 stageCfg.ElectronicSequence.Members.append(esp) 00204 00205 #import TrigSim 00206 #trigsim = TrigSim.Configure() 00207 from TrigReadProc.TrigReadProcConf import TrigReadProc 00208 tsp = TrigReadProc() 00209 tsp.ThisStageName = "TrigRead" 00210 tsp.LowerStageName = "Electronic" 00211 stageCfg.TrigReadSequence.Members.append(tsp) 00212 00213 #import ReadoutSim 00214 #rosim = ReadoutSim.Configure() 00215 from SingleLoader.SingleLoaderConf import SingleLoader 00216 sll = SingleLoader() 00217 sll.ThisStageName = "SingleLoader" 00218 sll.LowerStageName = "TrigRead" 00219 stageCfg.SingleLoaderSequence.Members.append(sll) 00220 00221 from Stage.StageConf import Sim15 00222 sim15=Sim15() 00223 sim15.TopStage="SingleLoader" 00224 00225 from Gaudi.Configuration import ApplicationMgr 00226 theApp = ApplicationMgr() 00227 theApp.TopAlg.append(sim15) 00228 00229 global autoPositioner 00230 autoPositioner = AutoPositionerTool("posAlg.AutoPositioner") 00231 autoPositioner.PhysicalVolume = "pvGe68SourceAssy" 00232 autoPositioner.LogicalVolume = "/dd/Geometry/CalibrationSources/lvGe68SourceAssy" 00233 autoPositioner.CoordinateDetElem = "/dd/Structure/AD/db-oil1" 00234 autoPositioner.Position = [0,0,0] 00235 autoPositioner.Element = "db-ad1-Ge68SourceAssy" 00236 autoPositioner.ElementPath = "/dd/Structure/CalibrationSources" 00237 00238 autoPositioner.SubDetectorElements = [["db-ad1-Ge68SourceActive", 00239 "/dd/Structure/CalibrationSources/db-ad1-Ge68SourceAssy", 00240 "/dd/Geometry/CalibrationSources/lvGe68SourceActive", 00241 "pvGe68SourceShell/pvGe68Source/pvGe68SourceInterior/pvGe68SourceActive"]] 00242 00243 def run(app):
def SimGe68wGEO::run | ( | app | ) |
Definition at line 244 of file SimGe68wGEO.py.
00244 : 00245 00246 global autoPositioner 00247 posAlg = PositionerAlg("posAlg") 00248 posAlg.posToolConf = autoPositioner 00249 print "dir(app)= ",dir(app) 00250 print "dir(app._appMgr)= ",dir(app._appmgr) 00251 app.addAlgorithm(posAlg) 00252 print "Algorithms:" 00253 for alg in app.algorithms(): 00254 print " ",alg 00255 topAlg = app.topAlg 00256 app.topAlg = topAlg[-1:] + topAlg[:-1] 00257 print "Algorithms (fixed):" 00258 for alg in app.algorithms(): 00259 print " ",alg 00260 00261 pass pass