from Gaudi.Configuration import * from Configurables import ApplicationMgr, HepMCDumper from Configurables import HepMCFileReader, GenAlg readertool = HepMCFileReader("ReaderTool", Filename="Test/TestGeometry/data/testHepMCrandom.dat") reader = GenAlg("Reader", SignalProvider=readertool) reader.hepmc.Path = "hepmc" from Configurables import HepMCToEDMConverter hepmc_converter = HepMCToEDMConverter("Converter") hepmc_converter.hepmc.Path="hepmc" hepmc_converter.genparticles.Path="allGenParticles" hepmc_converter.genvertices.Path="allGenVertices" dumper = HepMCDumper("Dumper") dumper.hepmc.Path="hepmc" from Configurables import GeoSvc geoservice = GeoSvc("GeoSvc", detectors=['file:Test/TestGeometry/data/TestBoxCaloSD_3readouts.xml'], OutputLevel = INFO) from Configurables import SimG4Svc geantservice = SimG4Svc("SimG4Svc", physicslist='SimG4TestPhysicsList') from Configurables import SimG4Alg, SimG4SaveCalHits, InspectHitsCollectionsTool inspecttool = InspectHitsCollectionsTool("inspect", readoutNames=["ECalHits"], OutputLevel = DEBUG) savecaltool = SimG4SaveCalHits("saveECalHits", readoutNames = ["ECalHits"], OutputLevel = DEBUG) savecaltool.positionedCaloHits.Path = "positionedCaloHits" savecaltool.caloHits.Path = "caloHits" geantsim = SimG4Alg("SimG4Alg", outputs= ["SimG4SaveCalHits/saveECalHits","InspectHitsCollectionsTool/inspect"]) from Configurables import RedoSegmentation
pileupreader = HepMCFileReader( Filename="/eos/project/f/fccsw-web/testsamples/FCC_minbias_100TeV.dat") from Configurables import PythiaInterface, GenAlg ### PYTHIA algorithm pythia8gentool = PythiaInterface("Pythia8Interface", Filename=pythiafile) pythia8gen = GenAlg("Pythia8", SignalProvider=pythia8gentool, PileUpProvider=pileupreader, VertexSmearingTool=smeartool) pythia8gen.PileUpTool = pileuptool pythia8gen.hepmc.Path = "hepmcevent" from Configurables import HepMCToEDMConverter ### Reads an HepMC::GenEvent from the data service and writes a collection of EDM Particles hepmc_converter = HepMCToEDMConverter("Converter") hepmc_converter.hepmc.Path = "hepmcevent" hepmc_converter.hepmcStatusList = [] # convert particles with all statuses hepmc_converter.genparticles.Path = "all_genparticles" hepmc_converter.genvertices.Path = "all_genvertices" from Configurables import GenParticleFilter ### Filters generated particles # accept is a list of particle statuses that should be accepted genfilter = GenParticleFilter("StableParticles", accept=[1], OutputLevel=DEBUG) genfilter.allGenParticles.Path = "all_genparticles" genfilter.filteredGenParticles.Path = "genparticles" from Configurables import JetClustering_fcc__MCParticleCollection_fcc__GenJetCollection_ as JetClustering genjet_clustering = JetClustering("GenJetClustering", OutputLevel=DEBUG) genjet_clustering.particles.Path = 'genparticles'
pgun = MomentumRangeParticleGun("ParticleGun_Electron") pgun.PdgCodes = [11] pgun.MomentumMin = momentum * GeV pgun.MomentumMax = momentum * GeV pgun.PhiMin = 0 pgun.PhiMax = 2 * _pi pgun.ThetaMin = thetaMin * _pi / 180. pgun.ThetaMax = thetaMax * _pi / 180. from Configurables import GenAlg genalg_pgun = GenAlg() genalg_pgun.SignalProvider = pgun genalg_pgun.hepmc.Path = "hepmc" from Configurables import HepMCToEDMConverter hepmc_converter = HepMCToEDMConverter() hepmc_converter.hepmc.Path="hepmc" hepmc_converter.GenParticles.Path="GenParticles" ################## Simulation setup # Detector geometry from Configurables import GeoSvc geoservice = GeoSvc("GeoSvc") # if FCC_DETECTORS is empty, this should use relative path to working directory path_to_detector = os.environ.get("FCCDETECTORS", "") detectors_to_use=[ 'Detector/DetFCCeeIDEA-LAr/compact/FCCee_DectMaster.xml', ] # prefix all xmls with path_to_detector geoservice.detectors = [os.path.join(path_to_detector, _det) for _det in detectors_to_use] geoservice.OutputLevel = WARNING
PhiMin=0.01745, # rad PhiMax=0.01745 # rad ) from Configurables import FlatSmearVertex smearTool = FlatSmearVertex( "VertexSmearingTool", yVertexMin=-36.42, # mm yVertexMax=-26.42, # mm zVertexMin=-52.135, # mm zVertexMax=-42.135, # mm beamDirection=0 # 1, 0, -1 ) from Configurables import HepMCToEDMConverter hepmc2edm = HepMCToEDMConverter("Converter") gen = GenAlg("ParticleGun", SignalProvider=pgun, VertexSmearingTool=smearTool) from Configurables import GeoSvc geoservice = GeoSvc("GeoSvc", detectors=['file:share/compact/DRcalo.xml']) from Configurables import SimG4Svc, SimG4FastSimPhysicsList, SimG4FastSimOpFiberRegion, SimG4OpticalPhysicsList regionTool = SimG4FastSimOpFiberRegion("fastfiber") opticalPhysicsTool = SimG4OpticalPhysicsList("opticalPhysics", fullphysics="SimG4FtfpBert") physicslistTool = SimG4FastSimPhysicsList("Physics", fullphysics=opticalPhysicsTool) from Configurables import SimG4DRcaloActions actionTool = SimG4DRcaloActions("SimG4DRcaloActions")
tVertexSigma = 30 * units.picosecond) pileuptool = ConstPileUp(numPileUpEvents=2) pileupreader = HepMCFileReader(Filename="/eos/project/f/fccsw-web/testsamples/FCC_minbias_100TeV.dat") from Configurables import PythiaInterface, GenAlg ### PYTHIA algorithm pythia8gentool = PythiaInterface("Pythia8Interface", Filename=pythiafile) pythia8gen = GenAlg("Pythia8", SignalProvider=pythia8gentool, PileUpProvider=pileupreader, VertexSmearingTool=smeartool) pythia8gen.PileUpTool = pileuptool pythia8gen.hepmc.Path = "hepmcevent" from Configurables import HepMCToEDMConverter ### Reads an HepMC::GenEvent from the data service and writes a collection of EDM Particles hepmc_converter = HepMCToEDMConverter("Converter") hepmc_converter.hepmc.Path="hepmcevent" hepmc_converter.hepmcStatusList = [] # convert particles with all statuses hepmc_converter.genparticles.Path="all_genparticles" hepmc_converter.genvertices.Path="all_genvertices" from Configurables import GenParticleFilter ### Filters generated particles # accept is a list of particle statuses that should be accepted genfilter = GenParticleFilter("StableParticles", accept=[1], OutputLevel=DEBUG) genfilter.allGenParticles.Path = "all_genparticles" genfilter.filteredGenParticles.Path = "genparticles" from Configurables import JetClustering_fcc__MCParticleCollection_fcc__GenJetCollection_ as JetClustering genjet_clustering = JetClustering("GenJetClustering", OutputLevel=DEBUG) genjet_clustering.particles.Path='genparticles'
smeartool.xVertexMax = 10 * units.mm smeartool.yVertexMin = -10 * units.mm smeartool.yVertexMax = 10 * units.mm smeartool.zVertexMin = -30 * units.mm smeartool.zVertexMax = 30 * units.mm pileuptool = ConstPileUp("MyPileUpConfig", numPileUpEvents=0) from Configurables import GenAlg gun1 = GenAlg("gun1", SignalProvider=guntool) gun2 = GenAlg("gun2", SignalProvider=guntool2) gun1.hepmc.Path = "hepmc1" gun2.hepmc.Path = "hepmc2" from Configurables import HepMCToEDMConverter hepmc_converter1 = HepMCToEDMConverter("Converter1") hepmc_converter1.hepmc.Path = "hepmc1" hepmc_converter1.genparticles.Path = "signalGenParticles" hepmc_converter1.genvertices.Path = "signalGenVertices" hepmc_converter2 = HepMCToEDMConverter("Converter2") hepmc_converter2.hepmc.Path = "hepmc2" hepmc_converter2.genparticles.Path = "pileupGenParticles" hepmc_converter2.genvertices.Path = "pileupGenVertices" from Configurables import GenMerge mergealg = GenMerge() mergealg.pileupGenParticles.Path = "pileupGenParticles" mergealg.pileupGenVertices.Path = "pileupGenVertices" mergealg.signalGenParticles.Path = "signalGenParticles"
from Configurables import PythiaInterface pythia8gentool = PythiaInterface() pythia8gentool.Filename = os.path.join(os.environ.get("FCCSWSHAREDIR", ""),"Generation/data/Pythia_ttbar.cmd") ## Write the HepMC::GenEvent to the data service from Configurables import GenAlg pythia8gen = GenAlg() pythia8gen.SignalProvider = pythia8gentool pythia8gen.hepmc.Path = "hepmc" ApplicationMgr().TopAlg += [pythia8gen] ### Reads an HepMC::GenEvent from the data service and writes a collection of EDM Particles from Configurables import HepMCToEDMConverter hepmc_converter = HepMCToEDMConverter("Converter") hepmc_converter.hepmc.Path = "hepmc" hepmc_converter.hepmcStatusList = [] # convert particles with all statuses, keeping not just stable final state ones hepmc_converter.genparticles.Path = "genParticles" hepmc_converter.genvertices.Path = "genVertices" ApplicationMgr().TopAlg += [hepmc_converter] # Define all output tools that convert the Delphes collections to FCC-EDM: from Configurables import DelphesSaveChargedParticles muonSaveTool = DelphesSaveChargedParticles("muons") muonSaveTool.delphesArrayName = "MuonMomentumSmearing/muons" muonSaveTool.particles.Path = "muons" muonSaveTool.mcAssociations.Path = "muonsToMC"
from Gaudi.Configuration import * from GaudiKernel import SystemOfUnits as units from Configurables import FCCDataSvc ## Data service podioevent = FCCDataSvc("EventDataSvc") from Configurables import HepMCFromScratch hepmc_producer = HepMCFromScratch() hepmc_producer.hepmc.Path = "hepmc" from Configurables import HepMCToEDMConverter hepmc_converter = HepMCToEDMConverter("Converter") hepmc_converter.hepmcStatusList = [] hepmc_converter.hepmc.Path = "hepmc" hepmc_converter.genparticles.Path = "allGenParticles" hepmc_converter.genvertices.Path = "allGenVertices" # convert (final state) EDM back to HepMC from Configurables import EDMToHepMCConverter edm_converter = EDMToHepMCConverter("BackConverter") edm_converter.hepmc.Path = "hepmcconverted" edm_converter.genparticles.Path = "allGenParticles" edm_converter.genvertices.Path = "allGenVertices" from Configurables import HepMCDumper dumper = HepMCDumper("Dumper")
etaMin=etaMin, etaMax=etaMax, phiMin = phiMin, phiMax = phiMax) geantsim.eventProvider = pgun else: from Configurables import PythiaInterface, GenAlg, GaussSmearVertex smeartool = GaussSmearVertex("GaussSmearVertex") if simargs.useVertexSmearTool: smeartool.xVertexSigma = 0.5*units.mm smeartool.yVertexSigma = 0.5*units.mm smeartool.zVertexSigma = 40*units.mm smeartool.tVertexSigma = 180*units.picosecond pythia8gentool = PythiaInterface("Pythia8",Filename=card) pythia8gen = GenAlg("Pythia8", SignalProvider=pythia8gentool, VertexSmearingTool=smeartool) pythia8gen.hepmc.Path = "hepmc" from Configurables import HepMCToEDMConverter hepmc_converter = HepMCToEDMConverter("Converter", hepmcStatusList=[]) # save all the particles from Pythia hepmc_converter.hepmc.Path="hepmc" hepmc_converter.genparticles.Path="allGenParticles" hepmc_converter.genvertices.Path="GenVertices" from Configurables import GenParticleFilter ### Filters generated particles # accept is a list of particle statuses that should be accepted genfilter = GenParticleFilter("StableParticles", accept=[1], OutputLevel=DEBUG) genfilter.allGenParticles.Path = "allGenParticles" genfilter.filteredGenParticles.Path = "GenParticles" from Configurables import SimG4PrimariesFromEdmTool particle_converter = SimG4PrimariesFromEdmTool("EdmConverter") particle_converter.genParticles.Path = "GenParticles" geantsim.eventProvider = particle_converter
from Configurables import FCCDataSvc ## Data service podioevent = FCCDataSvc("EventDataSvc") from Configurables import HepMCFromScratch hepmc_producer = HepMCFromScratch() hepmc_producer.hepmc.Path="hepmc" from Configurables import HepMCToEDMConverter hepmc_converter = HepMCToEDMConverter("Converter") hepmc_converter.hepmcStatusList = [] hepmc_converter.hepmc.Path="hepmc" hepmc_converter.genparticles.Path="allGenParticles" hepmc_converter.genvertices.Path="allGenVertices" # convert (final state) EDM back to HepMC from Configurables import EDMToHepMCConverter edm_converter = EDMToHepMCConverter("BackConverter") edm_converter.hepmc.Path="hepmcconverted" edm_converter.genparticles.Path="allGenParticles" edm_converter.genvertices.Path="allGenVertices" from Configurables import HepMCDumper dumper = HepMCDumper("Dumper")