|
||||
File indexing completed on 2025-01-30 09:17:42
0001 from DDSim.DD4hepSimulation import DD4hepSimulation 0002 from g4units import mm, GeV, MeV 0003 SIM = DD4hepSimulation() 0004 0005 ## The compact XML file, or multiple compact files, if the last one is the closer. 0006 SIM.compactFile = [] 0007 ## Lorentz boost for the crossing angle, in radian! 0008 SIM.crossingAngleBoost = 0.0 0009 SIM.enableDetailedShowerMode = False 0010 SIM.enableG4GPS = False 0011 SIM.enableG4Gun = False 0012 SIM.enableGun = False 0013 ## InputFiles for simulation .stdhep, .slcio, .HEPEvt, .hepevt, .pairs, .hepmc, .hepmc.gz, .hepmc.xz, .hepmc.bz2, .hepmc3, .hepmc3.gz, .hepmc3.xz, .hepmc3.bz2, .hepmc3.tree.root files are supported 0014 SIM.inputFiles = [] 0015 ## Macro file to execute for runType 'run' or 'vis' 0016 SIM.macroFile = "" 0017 ## number of events to simulate, used in batch mode 0018 SIM.numberOfEvents = 0 0019 ## Outputfile from the simulation: .slcio, edm4hep.root and .root output files are supported 0020 SIM.outputFile = "dummyOutput.slcio" 0021 ## Physics list to use in simulation 0022 SIM.physicsList = None 0023 ## Verbosity use integers from 1(most) to 7(least) verbose 0024 ## or strings: VERBOSE, DEBUG, INFO, WARNING, ERROR, FATAL, ALWAYS 0025 SIM.printLevel = 3 0026 ## The type of action to do in this invocation 0027 ## batch: just simulate some events, needs numberOfEvents, and input file or gun 0028 ## vis: enable visualisation, run the macroFile if it is set 0029 ## qt: enable visualisation in Qt shell, run the macroFile if it is set 0030 ## run: run the macroFile and exit 0031 ## shell: enable interactive session 0032 SIM.runType = "batch" 0033 ## Skip first N events when reading a file 0034 SIM.skipNEvents = 0 0035 ## Steering file to change default behaviour 0036 SIM.steeringFile = None 0037 ## FourVector of translation for the Smearing of the Vertex position: x y z t 0038 SIM.vertexOffset = [0.0, 0.0, 0.0, 0.0] 0039 ## FourVector of the Sigma for the Smearing of the Vertex position: x y z t 0040 SIM.vertexSigma = [0.0, 0.0, 0.0, 0.0] 0041 0042 0043 ################################################################################ 0044 ## Helper holding sensitive detector actions. 0045 ## 0046 ## The default tracker and calorimeter actions can be set with 0047 ## 0048 ## >>> SIM = DD4hepSimulation() 0049 ## >>> SIM.action.tracker=('Geant4TrackerWeightedAction', {'HitPositionCombination': 2, 'CollectSingleDeposits': False}) 0050 ## >>> SIM.action.calo = "Geant4CalorimeterAction" 0051 ## 0052 ## The default sensitive actions for calorimeters and trackers are applied based on the sensitive type. 0053 ## The list of sensitive types can be changed with 0054 ## 0055 ## >>> SIM = DD4hepSimulation() 0056 ## >>> SIM.action.trackerSDTypes = ['tracker', 'myTrackerSensType'] 0057 ## >>> SIM.calor.calorimeterSDTypes = ['calorimeter', 'myCaloSensType'] 0058 ## 0059 ## For specific subdetectors specific sensitive detectors can be set based on patterns in the name of the subdetector. 0060 ## 0061 ## >>> SIM = DD4hepSimulation() 0062 ## >>> SIM.action.mapActions['tpc'] = "TPCSDAction" 0063 ## 0064 ## and additional parameters for the sensitive detectors can be set when the map is given a tuple 0065 ## 0066 ## >>> SIM = DD4hepSimulation() 0067 ## >>> SIM.action.mapActions['ecal'] =( "CaloPreShowerSDAction", {"FirstLayerNumber": 1} ) 0068 ## 0069 ## 0070 ## Additional actions can be set as well with the following syntax variations: 0071 ## 0072 ## >>> SIM = DD4hepSimulation() 0073 ## # single action by name only: 0074 ## >>> SIM.action.run = "Geant4TestRunAction" 0075 ## # multiple actions with comma-separated names: 0076 ## >>> SIM.action.event = "Geant4TestEventAction/Action0,Geant4TestEventAction/Action1" 0077 ## # single action by tuple of name and parameter dict: 0078 ## >>> SIM.action.track = ( "Geant4TestTrackAction", {"Property_int": 10} ) 0079 ## # single action by dict of name and parameter dict: 0080 ## >>> SIM.action.step = { "name": "Geant4TestStepAction", "parameter": {"Property_int": 10} } 0081 ## # multiple actions by list of dict of name and parameter dict: 0082 ## >>> SIM.action.stack = [ { "name": "Geant4TestStackAction", "parameter": {"Property_int": 10} } ] 0083 ## 0084 ## On the command line or in python, these actions can be specified as JSON strings: 0085 ## $ ddsim --action.stack '{ "name": "Geant4TestStackAction", "parameter": { "Property_int": 10 } }' 0086 ## or 0087 ## >>> SIM.action.stack = ''' 0088 ## { 0089 ## "name": "Geant4TestStackAction", 0090 ## "parameter": { 0091 ## "Property_int": 10, 0092 ## "Property_double": "1.0*mm" 0093 ## } 0094 ## } 0095 ## ''' 0096 ## 0097 ## 0098 ################################################################################ 0099 0100 ## set the default calorimeter action 0101 SIM.action.calo = "Geant4ScintillatorCalorimeterAction" 0102 0103 ## List of patterns matching sensitive detectors of type Calorimeter. 0104 SIM.action.calorimeterSDTypes = ['calorimeter'] 0105 0106 ## Create a map of patterns and actions to be applied to sensitive detectors. 0107 ## 0108 ## Example: if the name of the detector matches 'tpc' the TPCSDAction is used. 0109 ## 0110 ## SIM.action.mapActions['tpc'] = "TPCSDAction" 0111 ## 0112 SIM.action.mapActions = {} 0113 0114 ## set the default tracker action 0115 SIM.action.tracker = ('Geant4TrackerWeightedAction', {'HitPositionCombination': 2, 'CollectSingleDeposits': False}) 0116 0117 ## List of patterns matching sensitive detectors of type Tracker. 0118 SIM.action.trackerSDTypes = ['tracker'] 0119 0120 ## single action by name only 0121 SIM.action.run = "Geant4TestRunAction/RunAction1" 0122 0123 ## multiple actions with comma-separated names: 0124 SIM.action.event = "Geant4TestEventAction/EventAction0,Geant4TestEventAction/EventAction1" 0125 0126 ## single action by tuple of name and parameter dict: 0127 SIM.action.track = ( "Geant4TestTrackAction/TrackAction1", {"Property_int": 10} ) 0128 0129 ## single action by dict of name and parameter dict: 0130 SIM.action.step = { "name": "Geant4TestStepAction/StepAction1", "parameter": {"Property_int": 10} } 0131 0132 ## multiple actions by list of dict of name and parameter dict: 0133 SIM.action.stack = [ { "name": "Geant4TestStackAction/StackAction1", "parameter": {"Property_int": 10} } ] 0134 0135 ## On the command line or in python, these actions can be specified as JSON strings: 0136 SIM.action.stack = ''' 0137 { 0138 "name": "Geant4TestStackAction/StackActionJSON1", 0139 "parameter": { 0140 "Property_int": 10, 0141 "Property_double": "1.0*mm" 0142 } 0143 } 0144 ''' 0145 0146 0147 0148 ################################################################################ 0149 ## Configuration for the magnetic field (stepper) 0150 ################################################################################ 0151 SIM.field.delta_chord = 0.25 0152 SIM.field.delta_intersection = 0.001 0153 SIM.field.delta_one_step = 0.01 0154 SIM.field.eps_max = 0.001 0155 SIM.field.eps_min = 5e-05 0156 SIM.field.equation = "Mag_UsualEqRhs" 0157 SIM.field.largest_step = 10000.0 0158 SIM.field.min_chord_step = 0.01 0159 SIM.field.stepper = "ClassicalRK4" 0160 0161 0162 ################################################################################ 0163 ## Configuration for sensitive detector filters 0164 ## 0165 ## Set the default filter for 'tracker' 0166 ## >>> SIM.filter.tracker = "edep1kev" 0167 ## Use no filter for 'calorimeter' by default 0168 ## >>> SIM.filter.calo = "" 0169 ## 0170 ## Assign a filter to a sensitive detector via pattern matching 0171 ## >>> SIM.filter.mapDetFilter['FTD'] = "edep1kev" 0172 ## 0173 ## Or more than one filter: 0174 ## >>> SIM.filter.mapDetFilter['FTD'] = ["edep1kev", "geantino"] 0175 ## 0176 ## Don't use the default filter or anything else: 0177 ## >>> SIM.filter.mapDetFilter['TPC'] = None ## or "" or [] 0178 ## 0179 ## Create a custom filter. The dictionary is used to instantiate the filter later on 0180 ## >>> SIM.filter.filters['edep3kev'] = dict(name="EnergyDepositMinimumCut/3keV", parameter={"Cut": 3.0*keV} ) 0181 ## 0182 ## 0183 ################################################################################ 0184 0185 ## 0186 ## default filter for calorimeter sensitive detectors; 0187 ## this is applied if no other filter is used for a calorimeter 0188 ## 0189 SIM.filter.calo = "edep0" 0190 0191 ## list of filter objects: map between name and parameter dictionary 0192 SIM.filter.filters = {'geantino': {'name': 'GeantinoRejectFilter/GeantinoRejector', 'parameter': {}}, 'edep1kev': {'name': 'EnergyDepositMinimumCut', 'parameter': {'Cut': 0.001}}, 'edep0': {'name': 'EnergyDepositMinimumCut/Cut0', 'parameter': {'Cut': 0.0}}} 0193 0194 ## a map between patterns and filter objects, using patterns to attach filters to sensitive detector 0195 SIM.filter.mapDetFilter = {} 0196 0197 ## default filter for tracking sensitive detectors; this is applied if no other filter is used for a tracker 0198 SIM.filter.tracker = "edep1kev" 0199 0200 0201 ################################################################################ 0202 ## Configuration for the Detector Construction. 0203 ################################################################################ 0204 SIM.geometry.dumpGDML = "" 0205 SIM.geometry.dumpHierarchy = 0 0206 0207 ## Print Debug information about Elements 0208 SIM.geometry.enableDebugElements = False 0209 0210 ## Print Debug information about Materials 0211 SIM.geometry.enableDebugMaterials = False 0212 0213 ## Print Debug information about Placements 0214 SIM.geometry.enableDebugPlacements = False 0215 0216 ## Print Debug information about Reflections 0217 SIM.geometry.enableDebugReflections = False 0218 0219 ## Print Debug information about Regions 0220 SIM.geometry.enableDebugRegions = False 0221 0222 ## Print Debug information about Shapes 0223 SIM.geometry.enableDebugShapes = False 0224 0225 ## Print Debug information about Surfaces 0226 SIM.geometry.enableDebugSurfaces = False 0227 0228 ## Print Debug information about Volumes 0229 SIM.geometry.enableDebugVolumes = False 0230 0231 ## Print information about placements 0232 SIM.geometry.enablePrintPlacements = False 0233 0234 ## Print information about Sensitives 0235 SIM.geometry.enablePrintSensitives = False 0236 0237 0238 ################################################################################ 0239 ## Configuration for the GuineaPig InputFiles 0240 ################################################################################ 0241 0242 ## Set the number of pair particles to simulate per event. 0243 ## Only used if inputFile ends with ".pairs" 0244 ## If "-1" all particles will be simulated in a single event 0245 ## 0246 SIM.guineapig.particlesPerEvent = "-1" 0247 0248 0249 ################################################################################ 0250 ## Configuration for the DDG4 ParticleGun 0251 ################################################################################ 0252 0253 ## direction of the particle gun, 3 vector 0254 SIM.gun.direction = (0, 0, 1) 0255 0256 ## choose the distribution of the random direction for theta 0257 ## 0258 ## Options for random distributions: 0259 ## 0260 ## 'uniform' is the default distribution, flat in theta 0261 ## 'cos(theta)' is flat in cos(theta) 0262 ## 'eta', or 'pseudorapidity' is flat in pseudorapity 0263 ## 'ffbar' is distributed according to 1+cos^2(theta) 0264 ## 0265 ## Setting a distribution will set isotrop = True 0266 ## 0267 SIM.gun.distribution = None 0268 0269 ## Total energy (including mass) for the particle gun. 0270 ## 0271 ## If not None, it will overwrite the setting of momentumMin and momentumMax 0272 SIM.gun.energy = None 0273 0274 ## Maximal pseudorapidity for random distibution (overrides thetaMin) 0275 SIM.gun.etaMax = None 0276 0277 ## Minimal pseudorapidity for random distibution (overrides thetaMax) 0278 SIM.gun.etaMin = None 0279 0280 ## isotropic distribution for the particle gun 0281 ## 0282 ## use the options phiMin, phiMax, thetaMin, and thetaMax to limit the range of randomly distributed directions 0283 ## if one of these options is not None the random distribution will be set to True and cannot be turned off! 0284 ## 0285 SIM.gun.isotrop = False 0286 0287 ## Maximal momentum when using distribution (default = 0.0) 0288 SIM.gun.momentumMax = 10000.0 0289 0290 ## Minimal momentum when using distribution (default = 0.0) 0291 SIM.gun.momentumMin = 0.0 0292 SIM.gun.multiplicity = 1 0293 SIM.gun.particle = "mu-" 0294 0295 ## Maximal azimuthal angle for random distribution 0296 SIM.gun.phiMax = None 0297 0298 ## Minimal azimuthal angle for random distribution 0299 SIM.gun.phiMin = None 0300 0301 ## position of the particle gun, 3 vector 0302 SIM.gun.position = (0.0, 0.0, 0.0) 0303 0304 ## Maximal polar angle for random distribution 0305 SIM.gun.thetaMax = None 0306 0307 ## Minimal polar angle for random distribution 0308 SIM.gun.thetaMin = None 0309 0310 0311 ################################################################################ 0312 ## Configuration for the hepmc3 InputFiles 0313 ################################################################################ 0314 0315 ## Set the name of the attribute contraining color flow information index 0. 0316 SIM.hepmc3.Flow1 = "flow1" 0317 0318 ## Set the name of the attribute contraining color flow information index 1. 0319 SIM.hepmc3.Flow2 = "flow2" 0320 0321 ## Set to false if the input should be opened with the hepmc2 ascii reader. 0322 ## 0323 ## If ``True`` a '.hepmc' file will be opened with the HEPMC3 Reader Factory. 0324 ## 0325 ## Defaults to true if DD4hep was build with HEPMC3 support. 0326 ## 0327 SIM.hepmc3.useHepMC3 = False 0328 0329 0330 ################################################################################ 0331 ## Configuration for Input Files. 0332 ################################################################################ 0333 0334 ## Set one or more functions to configure input steps. 0335 ## 0336 ## The functions must take a ``DD4hepSimulation`` object as their only argument and return the created generatorAction 0337 ## ``gen`` (for example). 0338 ## 0339 ## For example one can add this to the ddsim steering file: 0340 ## 0341 ## def exampleUserPlugin(dd4hepSimulation): 0342 ## '''Example code for user created plugin. 0343 ## 0344 ## :param DD4hepSimulation dd4hepSimulation: The DD4hepSimulation instance, so all parameters can be accessed 0345 ## :return: GeneratorAction 0346 ## ''' 0347 ## from DDG4 import GeneratorAction, Kernel 0348 ## # Geant4InputAction is the type of plugin, Cry1 just an identifier 0349 ## gen = GeneratorAction(Kernel(), 'Geant4InputAction/Cry1' , True) 0350 ## # CRYEventReader is the actual plugin, steeringFile its constructor parameter 0351 ## gen.Input = 'CRYEventReader|' + 'steeringFile' 0352 ## # we can give a dictionary of Parameters that has to be interpreted by the setParameters function of the plugin 0353 ## gen.Parameters = {'DataFilePath': '/path/to/files/data'} 0354 ## gen.enableUI() 0355 ## return gen 0356 ## 0357 ## SIM.inputConfig.userInputPlugin = exampleUserPlugin 0358 ## 0359 ## Repeat function definition and assignment to add multiple input steps 0360 ## 0361 ## 0362 SIM.inputConfig.userInputPlugin = [] 0363 0364 0365 ################################################################################ 0366 ## Configuration for the generator-level InputFiles 0367 ################################################################################ 0368 0369 ## Set the name of the collection containing the MCParticle input. 0370 ## Default is "MCParticle". 0371 ## 0372 SIM.lcio.mcParticleCollectionName = "MCParticle" 0373 0374 0375 ################################################################################ 0376 ## Configuration for the LCIO output file settings 0377 ################################################################################ 0378 0379 ## The event number offset to write in slcio output file. E.g setting it to 42 will start counting events from 42 instead of 0 0380 SIM.meta.eventNumberOffset = 0 0381 0382 ## Event parameters to write in every event. Use C/F/I ids to specify parameter type. E.g parameterName/F=0.42 to set a float parameter 0383 SIM.meta.eventParameters = [] 0384 0385 ## The run number offset to write in slcio output file. E.g setting it to 42 will start counting runs from 42 instead of 0 0386 SIM.meta.runNumberOffset = 0 0387 0388 0389 ################################################################################ 0390 ## Configuration for the output levels of DDG4 components 0391 ################################################################################ 0392 0393 ## Output level for geometry. 0394 SIM.output.geometry = 2 0395 0396 ## Output level for input sources 0397 SIM.output.inputStage = 3 0398 0399 ## Output level for Geant4 kernel 0400 SIM.output.kernel = 3 0401 0402 ## Output level for ParticleHandler 0403 SIM.output.part = 3 0404 0405 ## Output level for Random Number Generator setup 0406 SIM.output.random = 6 0407 0408 0409 ################################################################################ 0410 ## Configuration for Output Files. 0411 ################################################################################ 0412 0413 ## Set a function to configure the outputFile. 0414 ## 0415 ## The function must take a ``DD4hepSimulation`` object as its only argument and return ``None``. 0416 ## 0417 ## For example one can add this to the ddsim steering file: 0418 ## 0419 ## def exampleUserPlugin(dd4hepSimulation): 0420 ## '''Example code for user created plugin. 0421 ## 0422 ## :param DD4hepSimulation dd4hepSimulation: The DD4hepSimulation instance, so all parameters can be accessed 0423 ## :return: None 0424 ## ''' 0425 ## from DDG4 import EventAction, Kernel 0426 ## dd = dd4hepSimulation # just shorter variable name 0427 ## evt_root = EventAction(Kernel(), 'Geant4Output2ROOT/' + dd.outputFile, True) 0428 ## evt_root.HandleMCTruth = True or False 0429 ## evt_root.Control = True 0430 ## if not dd.outputFile.endswith(dd.outputConfig.myExtension): 0431 ## output = dd.outputFile + dd.outputConfig.myExtension 0432 ## evt_root.Output = output 0433 ## evt_root.enableUI() 0434 ## Kernel().eventAction().add(evt_root) 0435 ## return None 0436 ## 0437 ## SIM.outputConfig.userOutputPlugin = exampleUserPlugin 0438 ## # arbitrary options can be created and set via the steering file or command line 0439 ## SIM.outputConfig.myExtension = '.csv' 0440 ## 0441 SIM.outputConfig.userOutputPlugin = None 0442 0443 0444 ################################################################################ 0445 ## Configuration for the Particle Handler/ MCTruth treatment 0446 ################################################################################ 0447 0448 ## Enable lots of printout on simulated hits and MC-truth information 0449 SIM.part.enableDetailedHitsAndParticleInfo = False 0450 0451 ## Keep all created particles 0452 SIM.part.keepAllParticles = False 0453 0454 ## Minimal distance between particle vertex and endpoint of parent after 0455 ## which the vertexIsNotEndpointOfParent flag is set 0456 ## 0457 SIM.part.minDistToParentVertex = 2.2e-14 0458 0459 ## MinimalKineticEnergy to store particles created in the tracking region 0460 SIM.part.minimalKineticEnergy = 1.0 0461 0462 ## Printout at End of Tracking 0463 SIM.part.printEndTracking = False 0464 0465 ## Printout at Start of Tracking 0466 SIM.part.printStartTracking = False 0467 0468 ## List of processes to save, on command line give as whitespace separated string in quotation marks 0469 SIM.part.saveProcesses = ['Decay'] 0470 0471 ## Optionally enable an extended Particle Handler 0472 SIM.part.userParticleHandler = "Geant4TCUserParticleHandler" 0473 0474 0475 ################################################################################ 0476 ## Configuration for the PhysicsList 0477 ################################################################################ 0478 0479 ## If true, add decay processes for all particles. 0480 ## 0481 ## Only enable when creating a physics list not based on an existing Geant4 list! 0482 ## 0483 SIM.physics.decays = False 0484 0485 ## The name of the Geant4 Physics list. 0486 SIM.physics.list = "FTFP_BERT" 0487 0488 ## location of particle.tbl file containing extra particles and their lifetime information 0489 ## 0490 ## For example in $DD4HEP/examples/DDG4/examples/particle.tbl 0491 ## 0492 SIM.physics.pdgfile = None 0493 0494 ## The global geant4 rangecut for secondary production 0495 ## 0496 ## Default is 0.7 mm as is the case in geant4 10 0497 ## 0498 ## To disable this plugin and be absolutely sure to use the Geant4 default range cut use "None" 0499 ## 0500 ## Set printlevel to DEBUG to see a printout of all range cuts, 0501 ## but this only works if range cut is not "None" 0502 ## 0503 SIM.physics.rangecut = 0.7 0504 0505 ## Set of PDG IDs that will not be passed from the input record to Geant4. 0506 ## 0507 ## Quarks, gluons and W's Z's etc should not be treated by Geant4 0508 ## 0509 SIM.physics.rejectPDGs = {1, 2, 3, 4, 5, 6, 3201, 3203, 4101, 4103, 21, 23, 24, 5401, 25, 2203, 5403, 3101, 3103, 4403, 2101, 5301, 2103, 5303, 4301, 1103, 4303, 5201, 5203, 3303, 4201, 4203, 5101, 5103, 5503} 0510 0511 ## Set of PDG IDs for particles that should not be passed to Geant4 if their properTime is 0. 0512 ## 0513 ## The properTime of 0 indicates a documentation to add FSR to a lepton for example. 0514 ## 0515 SIM.physics.zeroTimePDGs = {17, 11, 13, 15} 0516 0517 def setupCerenkovScint(kernel): 0518 from DDG4 import PhysicsList 0519 seq = kernel.physicsList() 0520 0521 scint = PhysicsList(kernel, 'Geant4ScintillationPhysics/ScintillationPhys') 0522 scint.VerboseLevel = 0 0523 scint.TrackSecondariesFirst = True 0524 scint.enableUI() 0525 seq.adopt(scint) 0526 0527 cerenkov = PhysicsList(kernel, 'Geant4CerenkovPhysics/CerenkovPhys') 0528 cerenkov.VerboseLevel = 0 0529 cerenkov.MaxNumPhotonsPerStep = 10 0530 cerenkov.MaxBetaChangePerStep = 10.0 0531 cerenkov.TrackSecondariesFirst = True 0532 cerenkov.enableUI() 0533 seq.adopt(cerenkov) 0534 0535 ph = PhysicsList(kernel, 'Geant4OpticalPhotonPhysics/OpticalGammaPhys') 0536 ph.addParticleConstructor('G4OpticalPhoton') 0537 ph.VerboseLevel = 0 0538 ph.enableUI() 0539 seq.adopt(ph) 0540 0541 return None 0542 0543 0544 SIM.physics.setupUserPhysics(setupCerenkovScint) 0545 0546 0547 ################################################################################ 0548 ## Properties for the random number generator 0549 ################################################################################ 0550 0551 ## If True, calculate random seed for each event basedon eventID and runID 0552 ## Allows reproducibility even whenSkippingEvents 0553 SIM.random.enableEventSeed = False 0554 SIM.random.file = None 0555 SIM.random.luxury = 1 0556 SIM.random.replace_gRandom = True 0557 SIM.random.seed = None 0558 SIM.random.type = None
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |