/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

AD.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 '''
00004 AD related validation setup
00005 '''
00006 
00007 class UniformPositron:
00008     '''Configure GenTools, DetSim and DetSimVali for running uniform
00009     distribution of positrons in an AD.  Does not configure geometry.
00010     '''
00011 
00012     def __init__(self,histogram_filename = 'elec_uni.root'):
00013         ''' Construct the default configuration.  A non-default
00014         histogram_filename can be specified to hold the resulting
00015         histograms.
00016         '''
00017         import GaudiKernel.SystemOfUnits as units
00018 
00019         volume="/dd/Structure/AD/far-lso2"
00020 
00021         # First GenTools
00022         from GenTools.Helpers import Gun
00023         from GenTools.GenToolsConf import GtGunGenTool, GtPositionerTool
00024         gun = Gun(volume,
00025                   gun = GtGunGenTool("gun",
00026                                      ParticlesPerEvent = 1,
00027                                      ParticleName = "e+",
00028                                      Momentum = 5*units.MeV,
00029                                      MomentumMode = "Uniform",
00030                                      MomentumSpread = 4*units.MeV,
00031                                      DirectionMode = "Uniform",
00032                                      Direction = [ 1, 0, 0 ],
00033                                      DirectionSpread = 3),
00034                   positioner = GtPositionerTool("pos",
00035                                                 Strategy = "FullVolume",
00036                                                 Mode = "Uniform",
00037                                                 Spread = 2.6*units.meter,
00038                                                 Position = [0,0,0*units.meter])
00039                   )
00040         gun.timerator.LifeTime = 1*units.second
00041         import GenTools
00042         GenTools.Configure().register(gun)
00043         self.gun = gun
00044 
00045         self.dumper = GenTools.Dumper()
00046 
00047         # Then DetSim, with smaller than default configuration:
00048         import DetSim
00049         detsim = DetSim.Configure(site="far",physlist=DetSim.physics_list_basic)
00050         params = {
00051             'start' :"(start > 0)",
00052             'track1':"(id==1)",
00053             'track2':"(id==2)",
00054             'GD':    "MaterialName == '/dd/Materials/GdDopedLS'",
00055             'LS':    "MaterialName == '/dd/Materials/LiquidScintillator'",
00056             'MO':   "MaterialName == '/dd/Materials/MineralOil'",
00057             'IAV':   "MaterialName == '/dd/Materials/Acrylic'",
00058             'OAV':   "MaterialName == '/dd/Materials/Acrylic'",
00059             'lastvtx': "IsStopping == 1",
00060             'firstvtx': "IsStarting == 1"
00061             }
00062         detsim.unobserver(stats=[
00063                 # track 1
00064                 ["pdgId_Trk1","pdg","%(track1)s and %(start)s"%params],
00065                 ["t_Trk1",    "t" , "%(track1)s and %(start)s"%params],
00066                 ["x_Trk1",    "x", "%(track1)s and %(start)s"%params],
00067                 ["y_Trk1",    "y", "%(track1)s and %(start)s"%params],
00068                 ["z_Trk1",    "z", "%(track1)s and %(start)s"%params],
00069                 ["tEnd_Trk1",    "t" , "%(track1)s and %(lastvtx)s"%params],
00070                 ["xEnd_Trk1",    "x", "%(track1)s and %(lastvtx)s"%params],
00071                 ["yEnd_Trk1",    "y", "%(track1)s and %(lastvtx)s"%params],
00072                 ["zEnd_Trk1",    "z", "%(track1)s and %(lastvtx)s"%params],
00073                 ["e_Trk1",    "E",  "%(track1)s and %(start)s"%params],
00074                 ["p_Trk1",    "p",  "%(track1)s and %(start)s"%params],
00075                 ["ke_Trk1",   "KE", "%(track1)s and %(start)s"%params],
00076                 ["vx_Trk1",   "lvx","%(track1)s and %(start)s"%params],
00077                 ["vy_Trk1",   "lvy","%(track1)s and %(start)s"%params],
00078                 ["vz_Trk1",   "lvz","%(track1)s and %(start)s"%params],
00079                 ["TrkLength_GD_Trk1",  "dx","%(track1)s and %(GD)s"%params],
00080                 ["TrkLength_iAV_Trk1", "dx","%(track1)s and %(IAV)s"%params],
00081                 ["TrkLength_LS_Trk1",  "dx","%(track1)s and %(LS)s"%params],
00082                 ["TrkLength_oAV_Trk1", "dx","%(track1)s and %(OAV)s"%params],
00083                 ["TrkLength_Oil_Trk1", "dx","%(track1)s and %(MO)s"%params],
00084                 # track 2
00085                 ["pdgId_Trk2","pdg","%(track2)s and %(start)s"%params],
00086                 ["t_Trk2",    "t" , "%(track2)s and %(start)s"%params],
00087                 ["x_Trk2",    "x", "%(track2)s and %(start)s"%params],
00088                 ["y_Trk2",    "y", "%(track2)s and %(start)s"%params],
00089                 ["z_Trk2",    "z", "%(track2)s and %(start)s"%params],
00090                 ["tEnd_Trk2",    "t" , "%(track2)s and %(lastvtx)s"%params],
00091                 ["xEnd_Trk2",    "x", "%(track2)s and %(lastvtx)s"%params],
00092                 ["yEnd_Trk2",    "y", "%(track2)s and %(lastvtx)s"%params],
00093                 ["zEnd_Trk2",    "z", "%(track2)s and %(lastvtx)s"%params],
00094                 ["e_Trk2",    "E",  "%(track2)s and %(start)s"%params],
00095                 ["p_Trk2",    "p",  "%(track2)s and %(start)s"%params],
00096                 ["ke_Trk2",   "KE", "%(track2)s and %(start)s"%params],
00097                 ["vx_Trk2",   "lvx","%(track2)s and %(start)s"%params],
00098                 ["vy_Trk2",   "lvy","%(track2)s and %(start)s"%params],
00099                 ["vz_Trk2",   "lvz","%(track2)s and %(start)s"%params],
00100                 ["TrkLength_GD_Trk2",  "dx","%(track2)s and %(GD)s"%params],
00101                 ["TrkLength_iAV_Trk2", "dx","%(track2)s and %(IAV)s"%params],
00102                 ["TrkLength_LS_Trk2",  "dx","%(track2)s and %(LS)s"%params],
00103                 ["TrkLength_oAV_Trk2", "dx","%(track2)s and %(OAV)s"%params],
00104                 ["TrkLength_Oil_Trk2", "dx","%(track2)s and %(MO)s"%params]
00105                 ])
00106                 
00107         self.detsim = detsim
00108 
00109         # Finally, DetSimVali itself
00110         from DetSimValidation.DetSimValidationConf import DetSimVali
00111         dsv = DetSimVali()
00112         dsv.Volume = volume
00113         self.detsimvali = dsv
00114         
00115         from Gaudi.Configuration import ApplicationMgr
00116         theApp = ApplicationMgr()
00117         theApp.TopAlg.append(dsv)
00118 
00119         from GaudiSvc.GaudiSvcConf import THistSvc
00120         histsvc = THistSvc()
00121         histsvc.Output =["file1 DATAFILE='%s' OPT='RECREATE' TYP='ROOT' "%histogram_filename]
00122         return
00123     pass # end of class UniformPositron 
00124 
00125 class IBDPositron:
00126     '''Configure GenTools, DetSim and DetSimVali for running positrons only from IBD events distributed uniformly in an AD.
00127     '''
00128 
00129     def __init__(self,histogram_filename = 'IBDpositron.root',volume = "/dd/Structure/AD/far-lso2",seed = "0",nevts = "200"):
00130         ''' Construct the default configuration.
00131         '''
00132         import GaudiKernel.SystemOfUnits as units
00133 
00134         # First GenTools
00135         ibd = "InverseBeta.exe -seed " + seed + " -n " + nevts + " -eplus_only |"
00136         from GenTools.Helpers import HepEVT
00137         he = HepEVT(hepEvtDataSource = ibd)
00138         he.positioner.Strategy = "FullVolume"
00139         he.positioner.Volume = volume
00140         he.positioner.Mode = "Uniform"
00141         he.positioner.Spread = 2.6*units.meter
00142         he.positioner.Position = [0,0,2.5*units.meter]
00143         he.transformer.Volume = volume
00144         import GenTools
00145         GenTools.Configure().register(he)
00146         self.hepevt = he
00147 
00148         self.dumper = GenTools.Dumper()
00149 
00150         # Then DetSim, with smaller than default configuration:
00151         import DetSim
00152         detsim = DetSim.Configure(site="far",physlist = DetSim.physics_list_basic)
00153         params = {
00154             'start' :"(start > 0)",
00155             'track1':"(id==1)",
00156             'track2':"(id==2)",
00157             'GD':    "MaterialName == '/dd/Materials/GdDopedLS'",
00158             'LS':    "MaterialName == '/dd/Materials/LiquidScintillator'",
00159             'MO':   "MaterialName == '/dd/Materials/MineralOil'",
00160             'IAV':   "DetectorElementName == 'db-iav1'",
00161             'OAV':   "DetectorElementName == 'db-oav1'",
00162             'IWS': "MaterialName == '/dd/Materials/IwsWater'",
00163             'OWS': "MaterialName == '/dd/Materials/OwsWater'",
00164             'lastvtx': "IsStopping == 1",
00165             'firstvtx': "IsStarting == 1",
00166             'NeutronTrk': "pdg == 2112",
00167             'NeutronMom': "creator == 2112",
00168             'Gamma': "pdg == 22",
00169             'Muon': "(pdg == 13 or pdg == -13)"
00170             }
00171         
00172         detsim.unobserver(stats=[
00173                 ["MuonTrkLengthInOws", "dx", "%(Muon)s and %(OWS)s"%params],
00174                 ["MuonTrkLengthInIws", "dx", "%(Muon)s and %(IWS)s"%params],
00175                 ["MuonTrkLengthInLS", "dx", "%(Muon)s and %(LS)s"%params],
00176                 ["MuonTrkLengthInGdLS","dx", "%(Muon)s and %(GD)s"%params],
00177                 ["dEInn","dE", "(pdg!=20022) and %(IWS)s"%params],
00178                 ["dEOut","dE", "(pdg!=20022) and %(OWS)s"%params],
00179                 ["MuonStop", "dx",  "%(Muon)s and %(lastvtx)s"%params],
00180                 
00181                 ["EDepInGdLS", "dE", "%(GD)s"%params],
00182                 ["EDepInLS", "dE", "%(LS)s"%params],
00183                 ["EDepInIAV", "dE", "%(IAV)s"%params],
00184                 ["EDepInOAV", "dE", "%(OAV)s"%params],
00185                 ["EDepInOIL", "dE", "%(MO)s"%params],
00186                 
00187                 ["QEDepInGdLS", "qdE", "%(GD)s"%params],
00188                 ["QEDepInLS", "qdE", "%(LS)s"%params],
00189                 ["QEDepInIAV", "qdE", "%(IAV)s"%params],
00190                 ["QEDepInOAV", "qdE", "%(OAV)s"%params],
00191                 ["QEDepInOIL", "qdE", "%(MO)s"%params],
00192 
00193                 ["tQESumGdLS", "qEt", "%(GD)s"%params],
00194                 ["xQESumGdLS", "qEx", "%(GD)s"%params],
00195                 ["yQESumGdLS", "qEy", "%(GD)s"%params],
00196                 ["zQESumGdLS", "qEz", "%(GD)s"%params],
00197         
00198                 ["tQESumLS", "qEt", "%(LS)s"%params],
00199                 ["xQESumLS", "qEx", "%(LS)s"%params],
00200                 ["yQESumLS", "qEy", "%(LS)s"%params],
00201                 ["zQESumLS", "qEz", "%(LS)s"%params],
00202         
00203                 ["tQESumMO", "qEt", "%(MO)s"%params],
00204                 ["xQESumMO", "qEx", "%(MO)s"%params],
00205                 ["yQESumMO", "qEy", "%(MO)s"%params],
00206                 ["zQESumMO", "qEz", "%(MO)s"%params],
00207         
00208                 ["tGen",   "t","%(NeutronTrk)s and %(firstvtx)s"%params],
00209                 ["xGen",   "x","%(NeutronTrk)s and %(firstvtx)s"%params],
00210                 ["yGen",   "y","%(NeutronTrk)s and %(firstvtx)s"%params],
00211                 ["zGen",   "z","%(NeutronTrk)s and %(firstvtx)s"%params],
00212         
00213                 ["tCap",   "t","%(NeutronTrk)s and %(lastvtx)s"%params],
00214                 ["xCap",   "x","%(NeutronTrk)s and %(lastvtx)s"%params],
00215                 ["yCap",   "y","%(NeutronTrk)s and %(lastvtx)s"%params],
00216                 ["zCap",   "z","%(NeutronTrk)s and %(lastvtx)s"%params],
00217         
00218                 ["capTarget", "capTargetZ","%(track1)s and %(lastvtx)s"%params],
00219                 
00220                 # track 1
00221                 ["pdgId_Trk1","pdg","%(track1)s and %(start)s"%params],
00222                 ["t_Trk1",    "t" , "%(track1)s and %(start)s"%params],
00223                 ["x_Trk1",    "x", "%(track1)s and %(start)s"%params],
00224                 ["y_Trk1",    "y", "%(track1)s and %(start)s"%params],
00225                 ["z_Trk1",    "z", "%(track1)s and %(start)s"%params],
00226                 ["tEnd_Trk1",    "t" , "%(track1)s and %(lastvtx)s"%params],
00227                 ["xEnd_Trk1",    "x", "%(track1)s and %(lastvtx)s"%params],
00228                 ["yEnd_Trk1",    "y", "%(track1)s and %(lastvtx)s"%params],
00229                 ["zEnd_Trk1",    "z", "%(track1)s and %(lastvtx)s"%params],
00230                 ["e_Trk1",    "E",  "%(track1)s and %(start)s"%params],
00231                 ["p_Trk1",    "p",  "%(track1)s and %(start)s"%params],
00232                 ["ke_Trk1",   "KE", "%(track1)s and %(start)s"%params],
00233                 ["vx_Trk1",   "lvx","%(track1)s and %(start)s"%params],
00234                 ["vy_Trk1",   "lvy","%(track1)s and %(start)s"%params],
00235                 ["vz_Trk1",   "lvz","%(track1)s and %(start)s"%params],
00236                 ["TrkLength_GD_Trk1",  "dx","%(track1)s and %(GD)s"%params],
00237                 ["TrkLength_iAV_Trk1", "dx","%(track1)s and %(IAV)s"%params],
00238                 ["TrkLength_LS_Trk1",  "dx","%(track1)s and %(LS)s"%params],
00239                 ["TrkLength_oAV_Trk1", "dx","%(track1)s and %(OAV)s"%params],
00240                 ["TrkLength_Oil_Trk1", "dx","%(track1)s and %(MO)s"%params],
00241                 # track 2
00242                 ["pdgId_Trk2","pdg","%(track2)s and %(start)s"%params],
00243                 ["t_Trk2",    "t" , "%(track2)s and %(start)s"%params],
00244                 ["x_Trk2",    "x", "%(track2)s and %(start)s"%params],
00245                 ["y_Trk2",    "y", "%(track2)s and %(start)s"%params],
00246                 ["z_Trk2",    "z", "%(track2)s and %(start)s"%params],
00247                 ["tEnd_Trk2",    "t" , "%(track2)s and %(lastvtx)s"%params],
00248                 ["xEnd_Trk2",    "x", "%(track2)s and %(lastvtx)s"%params],
00249                 ["yEnd_Trk2",    "y", "%(track2)s and %(lastvtx)s"%params],
00250                 ["zEnd_Trk2",    "z", "%(track2)s and %(lastvtx)s"%params],
00251                 ["e_Trk2",    "E",  "%(track2)s and %(start)s"%params],
00252                 ["p_Trk2",    "p",  "%(track2)s and %(start)s"%params],
00253                 ["ke_Trk2",   "KE", "%(track2)s and %(start)s"%params],
00254                 ["vx_Trk2",   "lvx","%(track2)s and %(start)s"%params],
00255                 ["vy_Trk2",   "lvy","%(track2)s and %(start)s"%params],
00256                 ["vz_Trk2",   "lvz","%(track2)s and %(start)s"%params],
00257                 ["TrkLength_GD_Trk2",  "dx","%(track2)s and %(GD)s"%params],
00258                 ["TrkLength_iAV_Trk2", "dx","%(track2)s and %(IAV)s"%params],
00259                 ["TrkLength_LS_Trk2",  "dx","%(track2)s and %(LS)s"%params],
00260                 ["TrkLength_oAV_Trk2", "dx","%(track2)s and %(OAV)s"%params],
00261                 ["TrkLength_Oil_Trk2", "dx","%(track2)s and %(MO)s"%params]
00262                 ])
00263         
00264         self.detsim = detsim
00265 
00266         # Finally, DetSimVali itself
00267         from DetSimValidation.DetSimValidationConf import DetSimVali
00268         dsv = DetSimVali()
00269         dsv.Volume = volume
00270         self.detsimvali = dsv
00271         
00272         from Gaudi.Configuration import ApplicationMgr
00273         theApp = ApplicationMgr()
00274         theApp.TopAlg.append(dsv)
00275 
00276         from GaudiSvc.GaudiSvcConf import THistSvc
00277         histsvc = THistSvc()
00278         histsvc.Output =["file1 DATAFILE='%s' OPT='RECREATE' TYP='ROOT' "%histogram_filename]
00279         return
00280     pass # end of class IBDPositron
00281 
00282 class IBDNeutron:
00283     '''Configure GenTools, DetSim and DetSimVali for running neutrons only from IBD events distributed uniformly in an AD.
00284     '''
00285 
00286     def __init__(self,histogram_filename = 'IBDneutron.root',volume = "/dd/Structure/Sites/db-rock/db-ows/db-curtain/db-iws/db-ade1/db-sst1/db-oil1/db-oav1/db-lso1",seed = "0",nevts = "200"):
00287         ''' Construct the default configuration.
00288         '''
00289         import GaudiKernel.SystemOfUnits as units
00290 
00291         # First GenTools
00292         ibd = "InverseBeta.exe -seed " + seed + " -n " + nevts + " -neutron_only |"
00293         from GenTools.Helpers import HepEVT
00294         he = HepEVT(hepEvtDataSource = ibd)
00295         he.positioner.Strategy = "FullVolume"
00296         he.positioner.Volume = volume
00297         he.positioner.Mode = "Uniform"
00298         he.positioner.Spread = 2.6*units.meter
00299         he.positioner.Position = [0,0,2.5*units.meter]
00300         he.transformer.Volume = volume
00301         import GenTools
00302         GenTools.Configure().register(he)
00303         self.hepevt = he
00304 
00305         self.dumper = GenTools.Dumper()
00306 
00307         # Then DetSim, with smaller than default configuration:
00308         import DetSim
00309         detsim = DetSim.Configure(site="dayabay")
00310         detsim.historian(trackSelection="(pdg == 2112)",vertexSelection="(pdg == 2112)")
00311         params = {
00312             'start' :"(start > 0)",
00313             'track1':"(id==1)",
00314             'track2':"(id==2)",
00315             'GD':    "MaterialName == '/dd/Materials/GdDopedLS'",
00316             'LS':    "MaterialName == '/dd/Materials/LiquidScintillator'",
00317             'MO':   "MaterialName == '/dd/Materials/MineralOil'",
00318             'IAV':   "DetectorElementName == 'db-iav1'",
00319             'OAV':   "DetectorElementName == 'db-oav1'",
00320             'IWS': "MaterialName == '/dd/Materials/IwsWater'",
00321             'OWS': "MaterialName == '/dd/Materials/OwsWater'",
00322             'lastvtx': "IsStopping == 1",
00323             'firstvtx': "IsStarting == 1",
00324             'NeutronTrk': "pdg == 2112",
00325             'NeutronMom': "creator == 2112",
00326             'Gamma': "pdg == 22",
00327             'Muon': "(pdg == 13 or pdg == -13)"
00328             }
00329         
00330         detsim.unobserver(stats=[
00331                 ["MuonTrkLengthInOws", "dx", "%(Muon)s and %(OWS)s"%params],
00332                 ["MuonTrkLengthInIws", "dx", "%(Muon)s and %(IWS)s"%params],
00333                 ["MuonTrkLengthInLS", "dx", "%(Muon)s and %(LS)s"%params],
00334                 ["MuonTrkLengthInGdLS","dx", "%(Muon)s and %(GD)s"%params],
00335                 ["dEInn","dE", "(pdg!=20022) and %(IWS)s"%params],
00336                 ["dEOut","dE", "(pdg!=20022) and %(OWS)s"%params],
00337                 ["MuonStop", "dx",  "%(Muon)s and %(lastvtx)s"%params],
00338                 
00339                 ["EDepInGdLS", "dE", "%(GD)s"%params],
00340                 ["EDepInLS", "dE", "%(LS)s"%params],
00341                 ["EDepInIAV", "dE", "%(IAV)s"%params],
00342                 ["EDepInOAV", "dE", "%(OAV)s"%params],
00343                 ["EDepInOIL", "dE", "%(MO)s"%params],
00344                 
00345                 ["QEDepInGdLS", "qdE", "%(GD)s"%params],
00346                 ["QEDepInLS", "qdE", "%(LS)s"%params],
00347                 ["QEDepInIAV", "qdE", "%(IAV)s"%params],
00348                 ["QEDepInOAV", "qdE", "%(OAV)s"%params],
00349                 ["QEDepInOIL", "qdE", "%(MO)s"%params],
00350 
00351                 ["tQESumGdLS", "qEt", "%(GD)s"%params],
00352                 ["xQESumGdLS", "qEx", "%(GD)s"%params],
00353                 ["yQESumGdLS", "qEy", "%(GD)s"%params],
00354                 ["zQESumGdLS", "qEz", "%(GD)s"%params],
00355         
00356                 ["tQESumLS", "qEt", "%(LS)s"%params],
00357                 ["xQESumLS", "qEx", "%(LS)s"%params],
00358                 ["yQESumLS", "qEy", "%(LS)s"%params],
00359                 ["zQESumLS", "qEz", "%(LS)s"%params],
00360         
00361                 ["tQESumMO", "qEt", "%(MO)s"%params],
00362                 ["xQESumMO", "qEx", "%(MO)s"%params],
00363                 ["yQESumMO", "qEy", "%(MO)s"%params],
00364                 ["zQESumMO", "qEz", "%(MO)s"%params],
00365         
00366                 ["tGen",   "t","%(NeutronTrk)s and %(firstvtx)s"%params],
00367                 ["xGen",   "x","%(NeutronTrk)s and %(firstvtx)s"%params],
00368                 ["yGen",   "y","%(NeutronTrk)s and %(firstvtx)s"%params],
00369                 ["zGen",   "z","%(NeutronTrk)s and %(firstvtx)s"%params],
00370         
00371                 ["tCap",   "t","%(NeutronTrk)s and %(lastvtx)s"%params],
00372                 ["xCap",   "x","%(NeutronTrk)s and %(lastvtx)s"%params],
00373                 ["yCap",   "y","%(NeutronTrk)s and %(lastvtx)s"%params],
00374                 ["zCap",   "z","%(NeutronTrk)s and %(lastvtx)s"%params],
00375         
00376                 ["capTarget", "capTargetZ","%(track1)s and %(lastvtx)s"%params],
00377                 
00378                 # track 1
00379                 ["pdgId_Trk1","pdg","%(track1)s and %(start)s"%params],
00380                 ["t_Trk1",    "t" , "%(track1)s and %(start)s"%params],
00381                 ["x_Trk1",    "x", "%(track1)s and %(start)s"%params],
00382                 ["y_Trk1",    "y", "%(track1)s and %(start)s"%params],
00383                 ["z_Trk1",    "z", "%(track1)s and %(start)s"%params],
00384                 ["tEnd_Trk1",    "t" , "%(track1)s and %(lastvtx)s"%params],
00385                 ["xEnd_Trk1",    "x", "%(track1)s and %(lastvtx)s"%params],
00386                 ["yEnd_Trk1",    "y", "%(track1)s and %(lastvtx)s"%params],
00387                 ["zEnd_Trk1",    "z", "%(track1)s and %(lastvtx)s"%params],
00388                 ["e_Trk1",    "E",  "%(track1)s and %(start)s"%params],
00389                 ["p_Trk1",    "p",  "%(track1)s and %(start)s"%params],
00390                 ["ke_Trk1",   "KE", "%(track1)s and %(start)s"%params],
00391                 ["vx_Trk1",   "lvx","%(track1)s and %(start)s"%params],
00392                 ["vy_Trk1",   "lvy","%(track1)s and %(start)s"%params],
00393                 ["vz_Trk1",   "lvz","%(track1)s and %(start)s"%params],
00394                 ["TrkLength_GD_Trk1",  "dx","%(track1)s and %(GD)s"%params],
00395                 ["TrkLength_iAV_Trk1", "dx","%(track1)s and %(IAV)s"%params],
00396                 ["TrkLength_LS_Trk1",  "dx","%(track1)s and %(LS)s"%params],
00397                 ["TrkLength_oAV_Trk1", "dx","%(track1)s and %(OAV)s"%params],
00398                 ["TrkLength_Oil_Trk1", "dx","%(track1)s and %(MO)s"%params],
00399                 # track 2
00400                 ["pdgId_Trk2","pdg","%(track2)s and %(start)s"%params],
00401                 ["t_Trk2",    "t" , "%(track2)s and %(start)s"%params],
00402                 ["x_Trk2",    "x", "%(track2)s and %(start)s"%params],
00403                 ["y_Trk2",    "y", "%(track2)s and %(start)s"%params],
00404                 ["z_Trk2",    "z", "%(track2)s and %(start)s"%params],
00405                 ["tEnd_Trk2",    "t" , "%(track2)s and %(lastvtx)s"%params],
00406                 ["xEnd_Trk2",    "x", "%(track2)s and %(lastvtx)s"%params],
00407                 ["yEnd_Trk2",    "y", "%(track2)s and %(lastvtx)s"%params],
00408                 ["zEnd_Trk2",    "z", "%(track2)s and %(lastvtx)s"%params],
00409                 ["e_Trk2",    "E",  "%(track2)s and %(start)s"%params],
00410                 ["p_Trk2",    "p",  "%(track2)s and %(start)s"%params],
00411                 ["ke_Trk2",   "KE", "%(track2)s and %(start)s"%params],
00412                 ["vx_Trk2",   "lvx","%(track2)s and %(start)s"%params],
00413                 ["vy_Trk2",   "lvy","%(track2)s and %(start)s"%params],
00414                 ["vz_Trk2",   "lvz","%(track2)s and %(start)s"%params],
00415                 ["TrkLength_GD_Trk2",  "dx","%(track2)s and %(GD)s"%params],
00416                 ["TrkLength_iAV_Trk2", "dx","%(track2)s and %(IAV)s"%params],
00417                 ["TrkLength_LS_Trk2",  "dx","%(track2)s and %(LS)s"%params],
00418                 ["TrkLength_oAV_Trk2", "dx","%(track2)s and %(OAV)s"%params],
00419                 ["TrkLength_Oil_Trk2", "dx","%(track2)s and %(MO)s"%params]
00420                 ])
00421         
00422         self.detsim = detsim
00423 
00424         # Finally, DetSimVali itself
00425         from DetSimValidation.DetSimValidationConf import DetSimVali
00426         dsv = DetSimVali()
00427         dsv.Volume = volume
00428         self.detsimvali = dsv
00429         
00430         from Gaudi.Configuration import ApplicationMgr
00431         theApp = ApplicationMgr()
00432         theApp.TopAlg.append(dsv)
00433 
00434         from GaudiSvc.GaudiSvcConf import THistSvc
00435         histsvc = THistSvc()
00436         histsvc.Output =["file1 DATAFILE='%s' OPT='RECREATE' TYP='ROOT' "%histogram_filename]
00437         return
00438     pass # end of class IBDNeutron
00439 
00440 class IBDevents:
00441     '''Configure GenTools, DetSim and DetSimVali for running neutrons only from IBD events distributed uniformly in an AD.
00442     '''
00443 
00444     def __init__(self,histogram_filename = 'IBDevents.root',volume = "/dd/Structure/Sites/db-rock/db-ows/db-curtain/db-iws/db-ade1/db-sst1/db-oil1",seed = "0",nevts = "200"):
00445         ''' Construct the default configuration.
00446         '''
00447         import GaudiKernel.SystemOfUnits as units
00448 
00449         # First GenTools
00450         ibd = "InverseBeta.exe -seed " + seed + " -n " + nevts + " |"
00451         from GenTools.Helpers import HepEVT
00452         he = HepEVT(hepEvtDataSource = ibd)
00453         he.positioner.Strategy = "FullVolume"
00454         he.positioner.Volume = volume
00455         he.positioner.Mode = "Uniform"
00456         he.positioner.Spread = 2.6*units.meter
00457         he.positioner.Position = [0,0,2.5*units.meter]
00458         he.transformer.Volume = volume
00459         import GenTools
00460         GenTools.Configure().register(he)
00461         self.hepevt = he
00462 
00463         self.dumper = GenTools.Dumper()
00464 
00465         # Then DetSim, with smaller than default configuration:
00466         import DetSim
00467         detsim = DetSim.Configure(site="dayabay")
00468         detsim.historian(trackSelection="(pdg == 2112)",vertexSelection="(pdg == 2112)")
00469         params = {
00470             'start' :"(start > 0)",
00471             'track1':"(id==1)",
00472             'track2':"(id==2)",
00473             'GD':    "MaterialName == '/dd/Materials/GdDopedLS'",
00474             'LS':    "MaterialName == '/dd/Materials/LiquidScintillator'",
00475             'MO':   "MaterialName == '/dd/Materials/MineralOil'",
00476             'IAV':   "DetectorElementName == 'db-iav1'",
00477             'OAV':   "DetectorElementName == 'db-oav1'",
00478             'IWS': "MaterialName == '/dd/Materials/IwsWater'",
00479             'OWS': "MaterialName == '/dd/Materials/OwsWater'",
00480             'lastvtx': "IsStopping == 1",
00481             'firstvtx': "IsStarting == 1",
00482             'NeutronTrk': "pdg == 2112",
00483             'NeutronMom': "creator == 2112",
00484             'Gamma': "pdg == 22",
00485             'Muon': "(pdg == 13 or pdg == -13)"
00486             }
00487         
00488         detsim.unobserver(stats=[
00489                 ["MuonTrkLengthInOws", "dx", "%(Muon)s and %(OWS)s"%params],
00490                 ["MuonTrkLengthInIws", "dx", "%(Muon)s and %(IWS)s"%params],
00491                 ["MuonTrkLengthInLS", "dx", "%(Muon)s and %(LS)s"%params],
00492                 ["MuonTrkLengthInGdLS","dx", "%(Muon)s and %(GD)s"%params],
00493                 ["dEInn","dE", "(pdg!=20022) and %(IWS)s"%params],
00494                 ["dEOut","dE", "(pdg!=20022) and %(OWS)s"%params],
00495                 ["MuonStop", "dx",  "%(Muon)s and %(lastvtx)s"%params],
00496                 
00497                 ["EDepInGdLS", "dE", "%(GD)s"%params],
00498                 ["EDepInLS", "dE", "%(LS)s"%params],
00499                 ["EDepInIAV", "dE", "%(IAV)s"%params],
00500                 ["EDepInOAV", "dE", "%(OAV)s"%params],
00501                 ["EDepInOIL", "dE", "%(MO)s"%params],
00502                 
00503                 ["QEDepInGdLS", "qdE", "%(GD)s"%params],
00504                 ["QEDepInLS", "qdE", "%(LS)s"%params],
00505                 ["QEDepInIAV", "qdE", "%(IAV)s"%params],
00506                 ["QEDepInOAV", "qdE", "%(OAV)s"%params],
00507                 ["QEDepInOIL", "qdE", "%(MO)s"%params],
00508 
00509                 ["tQESumGdLS", "qEt", "%(GD)s"%params],
00510                 ["xQESumGdLS", "qEx", "%(GD)s"%params],
00511                 ["yQESumGdLS", "qEy", "%(GD)s"%params],
00512                 ["zQESumGdLS", "qEz", "%(GD)s"%params],
00513         
00514                 ["tQESumLS", "qEt", "%(LS)s"%params],
00515                 ["xQESumLS", "qEx", "%(LS)s"%params],
00516                 ["yQESumLS", "qEy", "%(LS)s"%params],
00517                 ["zQESumLS", "qEz", "%(LS)s"%params],
00518         
00519                 ["tQESumMO", "qEt", "%(MO)s"%params],
00520                 ["xQESumMO", "qEx", "%(MO)s"%params],
00521                 ["yQESumMO", "qEy", "%(MO)s"%params],
00522                 ["zQESumMO", "qEz", "%(MO)s"%params],
00523         
00524                 ["tGen",   "t","%(NeutronTrk)s and %(firstvtx)s"%params],
00525                 ["xGen",   "x","%(NeutronTrk)s and %(firstvtx)s"%params],
00526                 ["yGen",   "y","%(NeutronTrk)s and %(firstvtx)s"%params],
00527                 ["zGen",   "z","%(NeutronTrk)s and %(firstvtx)s"%params],
00528         
00529                 ["tCap",   "t","%(NeutronTrk)s and %(lastvtx)s"%params],
00530                 ["xCap",   "x","%(NeutronTrk)s and %(lastvtx)s"%params],
00531                 ["yCap",   "y","%(NeutronTrk)s and %(lastvtx)s"%params],
00532                 ["zCap",   "z","%(NeutronTrk)s and %(lastvtx)s"%params],
00533         
00534                 ["capTarget", "capTargetZ","%(track1)s and %(lastvtx)s"%params],
00535                 
00536                 # track 1
00537                 ["pdgId_Trk1","pdg","%(track1)s and %(start)s"%params],
00538                 ["t_Trk1",    "t" , "%(track1)s and %(start)s"%params],
00539                 ["x_Trk1",    "x", "%(track1)s and %(start)s"%params],
00540                 ["y_Trk1",    "y", "%(track1)s and %(start)s"%params],
00541                 ["z_Trk1",    "z", "%(track1)s and %(start)s"%params],
00542                 ["tEnd_Trk1",    "t" , "%(track1)s and %(lastvtx)s"%params],
00543                 ["xEnd_Trk1",    "x", "%(track1)s and %(lastvtx)s"%params],
00544                 ["yEnd_Trk1",    "y", "%(track1)s and %(lastvtx)s"%params],
00545                 ["zEnd_Trk1",    "z", "%(track1)s and %(lastvtx)s"%params],
00546                 ["e_Trk1",    "E",  "%(track1)s and %(start)s"%params],
00547                 ["p_Trk1",    "p",  "%(track1)s and %(start)s"%params],
00548                 ["ke_Trk1",   "KE", "%(track1)s and %(start)s"%params],
00549                 ["vx_Trk1",   "lvx","%(track1)s and %(start)s"%params],
00550                 ["vy_Trk1",   "lvy","%(track1)s and %(start)s"%params],
00551                 ["vz_Trk1",   "lvz","%(track1)s and %(start)s"%params],
00552                 ["TrkLength_GD_Trk1",  "dx","%(track1)s and %(GD)s"%params],
00553                 ["TrkLength_iAV_Trk1", "dx","%(track1)s and %(IAV)s"%params],
00554                 ["TrkLength_LS_Trk1",  "dx","%(track1)s and %(LS)s"%params],
00555                 ["TrkLength_oAV_Trk1", "dx","%(track1)s and %(OAV)s"%params],
00556                 ["TrkLength_Oil_Trk1", "dx","%(track1)s and %(MO)s"%params],
00557                 # track 2
00558                 ["pdgId_Trk2","pdg","%(track2)s and %(start)s"%params],
00559                 ["t_Trk2",    "t" , "%(track2)s and %(start)s"%params],
00560                 ["x_Trk2",    "x", "%(track2)s and %(start)s"%params],
00561                 ["y_Trk2",    "y", "%(track2)s and %(start)s"%params],
00562                 ["z_Trk2",    "z", "%(track2)s and %(start)s"%params],
00563                 ["tEnd_Trk2",    "t" , "%(track2)s and %(lastvtx)s"%params],
00564                 ["xEnd_Trk2",    "x", "%(track2)s and %(lastvtx)s"%params],
00565                 ["yEnd_Trk2",    "y", "%(track2)s and %(lastvtx)s"%params],
00566                 ["zEnd_Trk2",    "z", "%(track2)s and %(lastvtx)s"%params],
00567                 ["e_Trk2",    "E",  "%(track2)s and %(start)s"%params],
00568                 ["p_Trk2",    "p",  "%(track2)s and %(start)s"%params],
00569                 ["ke_Trk2",   "KE", "%(track2)s and %(start)s"%params],
00570                 ["vx_Trk2",   "lvx","%(track2)s and %(start)s"%params],
00571                 ["vy_Trk2",   "lvy","%(track2)s and %(start)s"%params],
00572                 ["vz_Trk2",   "lvz","%(track2)s and %(start)s"%params],
00573                 ["TrkLength_GD_Trk2",  "dx","%(track2)s and %(GD)s"%params],
00574                 ["TrkLength_iAV_Trk2", "dx","%(track2)s and %(IAV)s"%params],
00575                 ["TrkLength_LS_Trk2",  "dx","%(track2)s and %(LS)s"%params],
00576                 ["TrkLength_oAV_Trk2", "dx","%(track2)s and %(OAV)s"%params],
00577                 ["TrkLength_Oil_Trk2", "dx","%(track2)s and %(MO)s"%params]
00578                 ])
00579         
00580         self.detsim = detsim
00581 
00582         # Finally, DetSimVali itself
00583         from DetSimValidation.DetSimValidationConf import DetSimVali
00584         dsv = DetSimVali()
00585         dsv.Volume = volume
00586         self.detsimvali = dsv
00587         
00588         from Gaudi.Configuration import ApplicationMgr
00589         theApp = ApplicationMgr()
00590         theApp.TopAlg.append(dsv)
00591 
00592         from GaudiSvc.GaudiSvcConf import THistSvc
00593         histsvc = THistSvc()
00594         histsvc.Output =["file1 DATAFILE='%s' OPT='RECREATE' TYP='ROOT' "%histogram_filename]
00595         return
00596     pass # end of class IBDevents
00597 
00598 if '__main__' == __name__:
00599     from Gaudi.Configuration import ApplicationMgr
00600     theApp = ApplicationMgr()
00601 
00602     from DybPython.Control import main
00603     nuwa = main()
00604 
00605     import XmlDetDesc
00606     XmlDetDesc.Configure()
00607     
00608     up = UniformPositron()
00609 
00610     print theApp.TopAlg
00611     nuwa.run()
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:19:12 for DetSimValidation by doxygen 1.7.4