def setup_Target_GaussJob(physList, targetThick, targetMat, projEng, projID, nEvts=10000): from Configurables import LHCbApp from Configurables import DDDBConf from Configurables import CondDB from Configurables import Gauss target = 'Target_' + str(targetThick) + 'mm' + targetMat Gauss() DDDBConf().DbRoot = "conddb:/TargetsDet.xml" if 'v45' not in os.environ["GAUSSROOT"]: CondDB().LoadCALIBDB = "HLT1" CondDB().Upgrade = True LHCbApp().DDDBtag = "dddb-20140120" LHCbApp().CondDBtag = "sim-20131108-vc-md100" LHCbApp().Simulation = True # For testing only #DDDBConf(DbRoot = "/afs/cern.ch/user/s/seaso/public/Simulation/ #upgrade/Gauss_Target/DB/myDDDB-Upgrade-TargetGeom-January2014/TargetsDet.xml") Gauss.DetectorGeo = {"Detectors": []} Gauss.DetectorSim = {"Detectors": []} Gauss.DetectorMoni = {"Detectors": []} Gauss.DataType = "Upgrade" Gauss.PhysicsList = { "Em": 'NoCuts', "Hadron": physList, "GeneralPhys": True, "LHCbPhys": True } # --- activate special targets geometry appendPostConfigAction(targetGeo) # --- Switch off delta rays Gauss.DeltaRays = False # --- activate GaussTargetMultiplicity tool appendPostConfigAction(addMyTool) # --- Configure the tool from Configurables import GiGa, GiGaTrackActionSequence, GaussTargetMultiplicity giga = GiGa() giga.addTool(GiGaTrackActionSequence("TrackSeq"), name="TrackSeq") giga.TrackSeq.addTool(GaussTargetMultiplicity) giga.TrackSeq.GaussTargetMultiplicity.InteractionVolumeName = [ "/dd/Structure/TargetDet/" + target + "#pv" + target.replace('Target', 'Targ') ] giga.TrackSeq.GaussTargetMultiplicity.InteractionVolumeString = [target] giga.TrackSeq.GaussTargetMultiplicity.TargetMaterial = [targetMat] giga.TrackSeq.GaussTargetMultiplicity.TargetThickness = [targetThick] giga.TrackSeq.GaussTargetMultiplicity.PhysicsList = [physList] giga.TrackSeq.GaussTargetMultiplicity.ProjectileEnergy = [projEng] giga.TrackSeq.GaussTargetMultiplicity.ProjectilePdgID = [particles[projID]] #giga.TrackSeq.GaussTargetMultiplicity.OutputLevel = DEBUG from Configurables import CondDB, LHCbApp, DDDBConf, CondDBAccessSvc from Configurables import Gauss Gauss().Production = 'PGUN' #--Generator phase, set random numbers GaussGen = GenInit("GaussGen") GaussGen.FirstEventNumber = 1 GaussGen.RunNumber = 1082 #--Number of events LHCbApp().EvtMax = nEvts Gauss().Production = 'PGUN' Gauss().OutputType = 'NONE' Gauss().Histograms = 'NONE' #--- Save ntuple with hadronic cross section information ApplicationMgr().ExtSvc += ["NTupleSvc"] NTupleSvc().Output = [ "FILE1 DATAFILE='Multi_{particle}_in{material}.root' TYP='ROOT' OPT='NEW'" .format(particle=projID, material=targetMat) ]
# --- Configure the tool from Configurables import GiGa, GiGaStepActionSequence, MonitorTiming giga = GiGa() giga.addTool(GiGaStepActionSequence("StepSeq"), name="StepSeq") giga.StepSeq.addTool(MonitorTiming) giga.StepSeq.MonitorTiming.OutputLevel = 0 #giga.StepSeq.MonitorTiming.OutputFileName='monitorOut.log' #obsolete: remove! giga.StepSeq.MonitorTiming.TimerFileName = 'Timing.log' giga.StepSeq.MonitorTiming.Volumes = [ 'Velo', 'TT', 'IT', 'OT', 'Spd', 'Prs', 'Ecal', 'Hcal', 'Rich1', 'Rich2', 'Muon', 'Universe', 'Pipe', 'Magnet', 'Converter' ] #giga.StepSeq.MonitorTiming.Volumes=['Velo','TT', 'IT', 'OT', 'Spd', 'Prs', 'Ecal', 'Hcal', 'Rich1', 'Rich2', 'Muon', 'Universe'] #Need to run as post-config option: Add other memebers to StepSeq giga.StepSeq.Members += ['MonitorTiming'] giga.StepSeq.Members += ['RichG4StepAnalysis6/RichStepHpdRefl'] giga.StepSeq.Members += ['RichG4StepAnalysis4/RichStepAgelExit'] giga.StepSeq.Members += ['RichG4StepAnalysis5/RichStepMirrorRefl'] giga.StepSeq.Members += ['GaussStepAction/GaussStep'] giga.StepSeq.Members += ['RichG4StepAnalysis4/RichStepAgelExit'] giga.StepSeq.Members += ['RichG4StepAnalysis5/RichStepMirrorRefl'] giga.StepSeq.Members += ['RichG4StepAnalysis3/RichStep']
def addMyTool(): from Configurables import GiGa, GiGaTrackActionSequence giga = GiGa() giga.addTool(GiGaTrackActionSequence("TrackSeq"), name="TrackSeq") giga.TrackSeq.Members.append("GaussTargetMultiplicity")
# Define the production tool Generation().Special.addTool(ReadLHEfileProduction, name="ReadLHEfileProduction") Generation().Special.ProductionTool = "ReadLHEfileProduction" ## Define the input file in LHE xml format. Generation().Special.ReadLHEfileProduction.InputFile = "LHE_FILE_BASENAME" ############################################################################## # Monopole physics ############################################################################## # Set add monopole physics constructor from GaussMonopoles to the GiGa # physics list. giga = GiGa() giga.addTool(GiGaPhysListModular("ModularPL"), name="ModularPL") giga.ModularPL.addTool(GiGaPhysConstructorMonopole, name="GiGaPhysConstructorMonopole") ############################################################################ ## Add the Ntuple writer to the Simulation Monitor ## Kind of a hack, but works monopoleTupleAlg = MonopoleTupleAlg() GaudiSequencer("SimMonitor").Members += [monopoleTupleAlg] genTupleAlg = GenTupleAlg() GaudiSequencer("GenMonitor").Members += [genTupleAlg] ############################################################################ ## Switch off RICH physics (leave geometry)
## File with options to set up specific run action to write ## geometry in GDML ( Geant4 geometry description language) ## ## @author G.Corti ## @date 2012-07-12 from Configurables import GiGa giga = GiGa() giga.addTool( GiGaRunActionSequence("RunSeq") , name="RunSeq" ) giga.RunSeq.Members.append( "GDMLRunAction" ) # The following lines have the default settings #giga.RunSeq.addTool( GDMLRunAction("GDMLRunAction") , name = "GDMLRunAction" ) #giga.RunSeq.GDMLRunAction.Schema = "$G4GDMLROOT/schema/gdml.xsd"; #giga.RunSeq.GDMLRunAction.Output = "LHCb.gdml";
def trackNeutrinos(): from Configurables import GiGa, GiGaRunActionSequence, TrCutsRunAction giga = GiGa() giga.addTool( GiGaRunActionSequence("RunSeq") , name="RunSeq" ) giga.RunSeq.addTool( TrCutsRunAction("TrCuts") , name = "TrCuts" ) giga.RunSeq.TrCuts.DoNotTrackParticles = []
def addMyTool(): from Configurables import GiGa, GiGaStepActionSequence giga = GiGa() giga.StepSeq.Members.append( "RadLengthColl" )
from Configurables import Gauss, GiGa, GiGaRunManager ### Activate the visualization GiGa().VisManager = "GiGaVisManager/GiGaVis" ### Activate the Geant4 user interactive control (switch off to run in ### "batch", i.e. to have G4 UI prompt) GiGa().UIsession = "GiGaUIsession/GiGaUI" ### setting visualization attributes GiGa().addTool(GiGaRunManager("GiGaMgr"), name="GiGaMgr") GiGa().GiGaMgr.RunTools += ["GiGaSetVisAttributes"] ### When using DAWN swith off some detectors Gauss().DetectorGeo = { 'Detectors': ['Velo', 'PuVeto', 'Muon', 'TT', 'IT', 'OT', 'Rich1', 'Rich2', 'Magnet'] } Gauss().DetectorSim = { 'Detectors': ['Velo', 'PuVeto', 'Muon', 'TT', 'IT', 'OT', 'Rich1', 'Rich2', 'Magnet'] } Gauss().DetectorMoni = { 'Detectors': ['Velo', 'PuVeto', 'Muon', 'TT', 'IT', 'OT', 'Rich1', 'Rich2', 'Magnet'] } ## When Switiching off the Rich siwth off also its physics #Gauss().PhysicsList = {"Em":'NoCuts', "Hadron":'LHEP', "GeneralPhys":True, "LHCbPhys":False} ### To control level of drawing of track while traveling through detector
def switchOffRICH(): from Configurables import GiGaInputStream # Switch off the RICH geometry geo = GiGaInputStream('Geo') geo.StreamItems.remove("/dd/Structure/LHCb/BeforeMagnetRegion/Rich1") geo.StreamItems.remove( "/dd/Geometry/BeforeMagnetRegion/Rich1/Rich1Surfaces") geo.StreamItems.remove("/dd/Structure/LHCb/AfterMagnetRegion/Rich2") geo.StreamItems.remove( "/dd/Geometry/AfterMagnetRegion/Rich2/Rich2Surfaces") geo.StreamItems.remove( "/dd/Geometry/BeforeMagnetRegion/Rich1/RichHPDSurfaces") # Switch off RICH physics from Configurables import (GiGa, GiGaPhysListModular, GiGaPhysConstructorOp, GiGaPhysConstructorHpd) giga = GiGa() giga.addTool(GiGaPhysListModular("ModularPL"), name="ModularPL") giga.ModularPL.addTool(GiGaPhysConstructorOp, name="GiGaPhysConstructorOp") giga.ModularPL.addTool(GiGaPhysConstructorHpd, name="GiGaPhysConstructorHpd") giga.ModularPL.GiGaPhysConstructorOp.RichOpticalPhysicsProcessActivate = False giga.ModularPL.GiGaPhysConstructorHpd.RichHpdPhysicsProcessActivate = False appendPostConfigAction(switchOffRICH)
def addTool(): from Configurables import GiGa, BremVeloCheck giga = GiGa() giga.TrackSeq.Members.append("BremVeloCheck")