From e7ce5e99c96166de32107831769877446f39ab70 Mon Sep 17 00:00:00 2001 From: Lorenzo Valentini Date: Sun, 23 Apr 2023 21:19:55 +0200 Subject: [PATCH] workflows 3-4-5 --- workflows/3/WF3.py | 33 + workflows/3/fccprodwf3 | 53 ++ workflows/3/p8_ee_ggqq_ecm91.cmd | 27 + workflows/4/WF4.py | 30 + workflows/4/fccprodwf4 | 50 ++ workflows/4/k4simdelphesalg_pythia.py | 54 ++ workflows/4/p8_ee_ggqq_ecm91.cmd | 27 + workflows/5/WF5.py | 30 + workflows/5/fccprodwf5 | 53 ++ workflows/5/geant_fullsim_fccee_lar_pgun.py | 280 ++++++ .../fccconfigkey4hep-devel-2/configLHE.cmnd~ | 18 + .../delphes_card_IDEA.tcl | 797 ++++++++++++++++++ .../edm4hep_output_config.tcl | 13 + .../geant_fullsim_fccee_lar_pgun.py | 280 ++++++ .../k4simdelphesalg_pythia.py | 50 ++ 15 files changed, 1795 insertions(+) create mode 100755 workflows/3/WF3.py create mode 100755 workflows/3/fccprodwf3 create mode 100644 workflows/3/p8_ee_ggqq_ecm91.cmd create mode 100755 workflows/4/WF4.py create mode 100755 workflows/4/fccprodwf4 create mode 100644 workflows/4/k4simdelphesalg_pythia.py create mode 100644 workflows/4/p8_ee_ggqq_ecm91.cmd create mode 100755 workflows/5/WF5.py create mode 100755 workflows/5/fccprodwf5 create mode 100644 workflows/5/geant_fullsim_fccee_lar_pgun.py create mode 100644 workflows/fccconfigkey4hep-devel-2/configLHE.cmnd~ create mode 100644 workflows/fccconfigkey4hep-devel-2/delphes_card_IDEA.tcl create mode 100644 workflows/fccconfigkey4hep-devel-2/edm4hep_output_config.tcl create mode 100644 workflows/fccconfigkey4hep-devel-2/geant_fullsim_fccee_lar_pgun.py create mode 100644 workflows/fccconfigkey4hep-devel-2/k4simdelphesalg_pythia.py diff --git a/workflows/3/WF3.py b/workflows/3/WF3.py new file mode 100755 index 0000000..e89edf7 --- /dev/null +++ b/workflows/3/WF3.py @@ -0,0 +1,33 @@ +#!/bin/env python +"""script to do X""" +from DIRAC.Core.Base.Script import parseCommandLine +parseCommandLine() + +from ILCDIRAC.Interfaces.API.NewInterface.Applications import DelphesApp +from ILCDIRAC.Interfaces.API.NewInterface.UserJob import UserJob +from ILCDIRAC.Interfaces.API.DiracILC import DiracILC + + +def run(): + """Run The Job.""" + job = UserJob() + job.setConfigPackage("fccConfig", 'key4hep-devel-2') + + delphes = DelphesApp() + delphes.setVersion('key4hep-latest') + delphes.setExecutable("DelphesPythia8_EDM4HEP") + delphes.setDetectorCard('delphes_card_IDEA.tcl') + delphes.setOutputCard('edm4hep_output_config.tcl') + delphes.setPythia8CardFile('p8_ee_ggqq_ecm91.cmd') + delphes.setRandomSeed(12340) + delphes.setEnergy(91.2) + delphes.setNumberOfEvents(100) + delphes.setOutputFile('output.root') + + job.append(delphes) + job.submit(DiracILC(), mode='local') + + + +if __name__ =="__main__": + run() diff --git a/workflows/3/fccprodwf3 b/workflows/3/fccprodwf3 new file mode 100755 index 0000000..3afac9f --- /dev/null +++ b/workflows/3/fccprodwf3 @@ -0,0 +1,53 @@ +[Marlin] +#ApplicationAttributeName=Value + +[DDSim] +#ApplicationAttributeName=Value + +[Overlay] +#ApplicationAttributeName=Value + +[Whizard2] +#ApplicationAttributeName=Value + +[KKMC] +#ApplicationAttributeName=Value + +[Production Parameters] + +machine = ee +prodGroup = several + +softwareVersion = key4hep-latest +generatorApplication = delphes +generatorVersion = key4hep-latest +executableName = DelphesPythia8_EDM4HEP +detectorCard = delphes_card_IDEA.tcl +outputCard = edm4hep_output_config.tcl +pythia8CardPath = p8_ee_ggqq_ecm91.cmd + +configVersion = key4hep-devel-2 +configPackage = fccConfig +eventsPerJobs = 1000 + +numberOfTasks = 1, 2 + +campaign = winter2023 +energies = 91.2 +processes = qqbar +detectorModel = IDEA +datatype = delphes + +productionLogLevel = VERBOSE +outputSE = CERN-DIP-4 + +finalOutputSE = CERN-SRM +MoveStatus = Stopped +MoveGroupSize = 10 + +#Productions to create: Gen, Split, Sim, Rec, RecOver +ProdTypes = Gen +move = False + + + diff --git a/workflows/3/p8_ee_ggqq_ecm91.cmd b/workflows/3/p8_ee_ggqq_ecm91.cmd new file mode 100644 index 0000000..95e0949 --- /dev/null +++ b/workflows/3/p8_ee_ggqq_ecm91.cmd @@ -0,0 +1,27 @@ +Random:setSeed = on +Main:numberOfEvents = 3000 ! number of events to generate +Main:timesAllowErrors = 5 ! how many aborts before run stops + + +! 2) Settings related to output in init(), next() and stat(). +Init:showChangedSettings = on ! list changed settings +Init:showChangedParticleData = off ! list changed particle data +Next:numberCount = 100 ! print message every n events +Next:numberShowInfo = 1 ! print event information n times +Next:numberShowProcess = 1 ! print process record n times +Next:numberShowEvent = 0 ! print event record n times +Stat:showPartonLevel = off + +! 3) Beam parameter settings. Values below agree with default ones. +Beams:idA = 11 ! first beam, e- = 11 +Beams:idB = -11 ! second beam, e+ = -11 + +! 4) Hard process : photon collisions at 91.188 GeV +Beams:eCM = 91.188 ! CM energy of collision +PhotonCollision:gmgm2qqbar = on +PhotonCollision:gmgm2ccbar = on +PhotonCollision:gmgm2bbbar = on + +PartonLevel:ISR = on ! initial-state radiation +PartonLevel:FSR = on ! final-state radiation + diff --git a/workflows/4/WF4.py b/workflows/4/WF4.py new file mode 100755 index 0000000..b6d2858 --- /dev/null +++ b/workflows/4/WF4.py @@ -0,0 +1,30 @@ +#!/bin/env python +"""script to do X""" +from DIRAC.Core.Base.Script import parseCommandLine +parseCommandLine() + +from ILCDIRAC.Interfaces.API.NewInterface.Applications import GaudiApp, DelphesApp +from ILCDIRAC.Interfaces.API.NewInterface.UserJob import UserJob +from ILCDIRAC.Interfaces.API.DiracILC import DiracILC + +def run(): + """Run The Job.""" + job = UserJob() + job.setConfigPackage("fccConfig", 'key4hep-devel-2') + + ga = GaudiApp() + ga.setVersion('key4hep-latest') + ga.setExecutable("k4run") + ga.setSteeringFile('k4simdelphesalg_pythia.py') + ga.setPythia8CardFile('p8_ee_ggqq_ecm91.cmd') + ga.setExtraCLIArguments("--GenAlg.PythiaInterface.pythiacard pythia8card.cmd --k4SimDelphesAlg.DelphesCard delphes_card_IDEA.tcl --k4SimDelphesAlg.DelphesOutputSettings edm4hep_output_config.tcl") + ga.setEnergy(91.2) + ga.setNumberOfEvents(50) + ga.setOutputFile('output.root') + + job.append(ga) + job.submit(DiracILC(), mode='local') + + +if __name__ =="__main__": + run() diff --git a/workflows/4/fccprodwf4 b/workflows/4/fccprodwf4 new file mode 100755 index 0000000..cd8e329 --- /dev/null +++ b/workflows/4/fccprodwf4 @@ -0,0 +1,50 @@ +[Marlin] +#ApplicationAttributeName=Value + +[DDSim] +#ApplicationAttributeName=Value + +[Overlay] +#ApplicationAttributeName=Value + +[Whizard2] +#ApplicationAttributeName=Value + +[KKMC] +#ApplicationAttributeName=Value + +[Production Parameters] + +machine = ee +prodGroup = several +softwareVersion = key4hep-latest + +generatorApplication = gaudi +generatorVersion = key4hep-latest +executableName = k4run +gaudiSteeringFile = k4simdelphesalg_pythia.py + +randomSeedFlag = --SimG4Svc.seedValue + +configVersion = key4hep-devel-2 +configPackage = fccConfig +eventsPerJobs = 1000, 2000 + +numberOfTasks = 1, 1 + +campaign = winter2023 +energies = 91.2, 91.2 +processes = qqbar +detectorModel = IDEA +datatype = delphes + +extraCLIArguments = --Pythia8.PythiaInterface.pythiacard pythia8card.cmd --k4SimDelphesAlg.DelphesCard delphes_card_IDEA.tcl --k4SimDelphesAlg.DelphesOutputSettings edm4hep_output_config.tcl + +productionLogLevel = VERBOSE +outputSE = CERN-DIP-4 + +finalOutputSE = CERN-SRM +MoveStatus = Stopped +MoveGroupSize = 10 + +ProdTypes = Gen diff --git a/workflows/4/k4simdelphesalg_pythia.py b/workflows/4/k4simdelphesalg_pythia.py new file mode 100644 index 0000000..b703a32 --- /dev/null +++ b/workflows/4/k4simdelphesalg_pythia.py @@ -0,0 +1,54 @@ +from Gaudi.Configuration import * +from GaudiKernel import SystemOfUnits as units + +from Configurables import ApplicationMgr +app = ApplicationMgr() +app.EvtMax = 100 +app.EvtSel = "NONE" + +from Configurables import k4DataSvc +podioevent = k4DataSvc("EventDataSvc") +app.ExtSvc += [podioevent] + + +from Configurables import PythiaInterface +pythia8gentool = PythiaInterface() +### Example of pythia configuration file to generate events +# take from $K4GEN if defined, locally if not +path_to_pythiafile = os.environ.get("K4GEN", "") +pythiafilename = "Pythia_standard.cmd" +pythiafile = os.path.join(path_to_pythiafile, pythiafilename) +# Example of pythia configuration file to read LH event file +#pythiafile="options/Pythia_LHEinput.cmd" +pythia8gentool.pythiacard = pythiafile +pythia8gentool.doEvtGenDecays = False +pythia8gentool.printPythiaStatistics = True + +from Configurables import GenAlg +gun = GenAlg() +gun.SignalProvider = pythia8gentool +gun.hepmc.Path = "hepmc" +ApplicationMgr().TopAlg += [gun] + + +from Configurables import HepMCToEDMConverter +hepmc_converter = HepMCToEDMConverter() +hepmc_converter.hepmc.Path="hepmc" +hepmc_converter.GenParticles.Path = "GenParticles" +ApplicationMgr().TopAlg += [hepmc_converter] + +from Configurables import k4SimDelphesAlg +delphesalg = k4SimDelphesAlg() +delphesalg.DelphesCard = "delphes_card_IDEA.tcl" +delphesalg.DelphesOutputSettings = "edm4hep_output_config.tcl" +delphesalg.GenParticles.Path = "GenParticles" +delphesalg.OutputLevel = VERBOSE +ApplicationMgr().TopAlg += [delphesalg] + + +from Configurables import PodioOutput +out = PodioOutput("out", filename = "output_k4SimDelphes_pythia.root") +out.outputCommands = ["keep *"] +ApplicationMgr().TopAlg += [out] + + diff --git a/workflows/4/p8_ee_ggqq_ecm91.cmd b/workflows/4/p8_ee_ggqq_ecm91.cmd new file mode 100644 index 0000000..95e0949 --- /dev/null +++ b/workflows/4/p8_ee_ggqq_ecm91.cmd @@ -0,0 +1,27 @@ +Random:setSeed = on +Main:numberOfEvents = 3000 ! number of events to generate +Main:timesAllowErrors = 5 ! how many aborts before run stops + + +! 2) Settings related to output in init(), next() and stat(). +Init:showChangedSettings = on ! list changed settings +Init:showChangedParticleData = off ! list changed particle data +Next:numberCount = 100 ! print message every n events +Next:numberShowInfo = 1 ! print event information n times +Next:numberShowProcess = 1 ! print process record n times +Next:numberShowEvent = 0 ! print event record n times +Stat:showPartonLevel = off + +! 3) Beam parameter settings. Values below agree with default ones. +Beams:idA = 11 ! first beam, e- = 11 +Beams:idB = -11 ! second beam, e+ = -11 + +! 4) Hard process : photon collisions at 91.188 GeV +Beams:eCM = 91.188 ! CM energy of collision +PhotonCollision:gmgm2qqbar = on +PhotonCollision:gmgm2ccbar = on +PhotonCollision:gmgm2bbbar = on + +PartonLevel:ISR = on ! initial-state radiation +PartonLevel:FSR = on ! final-state radiation + diff --git a/workflows/5/WF5.py b/workflows/5/WF5.py new file mode 100755 index 0000000..6383b74 --- /dev/null +++ b/workflows/5/WF5.py @@ -0,0 +1,30 @@ +#!/bin/env python +"""script to do X""" +from DIRAC.Core.Base.Script import parseCommandLine +parseCommandLine() + +from ILCDIRAC.Interfaces.API.NewInterface.Applications import GaudiApp +from ILCDIRAC.Interfaces.API.NewInterface.UserJob import UserJob +from ILCDIRAC.Interfaces.API.DiracILC import DiracILC + +def run(): + """Run The Job.""" + job = UserJob() + job.setConfigPackage("fccConfig", 'key4hep-devel-2') + + ga = GaudiApp() + ga.setVersion('key4hep-latest') + ga.setExecutable("k4run") + ga.setSteeringFile('geant_fullsim_fccee_lar_pgun.py') + ga.setRandomSeedFlag('--SimG4Svc.seedValue') + ga.setRandomSeed(100) + ga.setEnergy(10) + ga.setNumberOfEvents(25) + ga.setOutputFile('output.root') + + job.append(ga) + job.submit(DiracILC(), mode='local') + + +if __name__ =="__main__": + run() diff --git a/workflows/5/fccprodwf5 b/workflows/5/fccprodwf5 new file mode 100755 index 0000000..efd2d7e --- /dev/null +++ b/workflows/5/fccprodwf5 @@ -0,0 +1,53 @@ +[Marlin] +#ApplicationAttributeName=Value + +[DDSim] +#ApplicationAttributeName=Value + +[Overlay] +#ApplicationAttributeName=Value + +[Whizard2] +#ApplicationAttributeName=Value + +[KKMC] +#ApplicationAttributeName=Value + +[Production Parameters] + +machine = ee +prodGroup = several + +softwareVersion = key4hep-latest + +generatorApplication = gaudi +generatorVersion = key4hep-latest +executableName = k4run +gaudiSteeringFile = geant_fullsim_fccee_lar_pgun.py +randomSeedFlag = --SimG4Svc.seedValue + +configVersion = key4hep-devel-2 +configPackage = fccConfig +eventsPerJobs = 1000 + +numberOfTasks = 1 + +campaign = winter2023 +energies = 10 +processes = pi +detectorModel = IDEA-LAr +datatype = + +productionLogLevel = VERBOSE +outputSE = CERN-DIP-4 + +finalOutputSE = CERN-SRM +MoveStatus = Stopped +MoveGroupSize = 10 + +ProdTypes = Gen + + + + + diff --git a/workflows/5/geant_fullsim_fccee_lar_pgun.py b/workflows/5/geant_fullsim_fccee_lar_pgun.py new file mode 100644 index 0000000..25b66c4 --- /dev/null +++ b/workflows/5/geant_fullsim_fccee_lar_pgun.py @@ -0,0 +1,280 @@ +import os +from Gaudi.Configuration import * +from GaudiKernel import SystemOfUnits as units +from GaudiKernel import PhysicalConstants as constants +from GaudiKernel.SystemOfUnits import MeV, GeV, tesla + +from Configurables import ApplicationMgr +ApplicationMgr().EvtSel = 'NONE' +ApplicationMgr().EvtMax = 2 +ApplicationMgr().OutputLevel = INFO +ApplicationMgr().StopOnSignal = True +ApplicationMgr().ExtSvc += ['RndmGenSvc'] + +from Configurables import FCCDataSvc +## Data service +podioevent = FCCDataSvc("EventDataSvc") +ApplicationMgr().ExtSvc += [podioevent] + +from Configurables import MomentumRangeParticleGun +guntool = MomentumRangeParticleGun() +guntool.ThetaMin = 45 * constants.pi / 180. +guntool.ThetaMax = 135 * constants.pi / 180. +guntool.PhiMin = 0. +guntool.PhiMax = 2. * constants.pi +guntool.MomentumMin = 1. *units.GeV +guntool.MomentumMax = 1. *units.GeV +guntool.PdgCodes = [11] # 11 electron, 13 muon, 22 photon, 111 pi0, 211 pi+ + +from Configurables import GenAlg +gen = GenAlg() +gen.SignalProvider=guntool +gen.hepmc.Path = "hepmc" +ApplicationMgr().TopAlg += [gen] + +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="hepmc" +hepmc_converter.GenParticles.Path="GenParticles" +ApplicationMgr().TopAlg += [hepmc_converter] + + + +################## 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 = INFO +ApplicationMgr().ExtSvc += [geoservice] + +# Geant4 service +# Configures the Geant simulation: geometry, physics list and user actions + +# Uncomment if history from Geant4 decays is needed (e.g. to get the photons from pi0) and set actions=actions in SimG4Svc +#from Configurables import SimG4FullSimActions +#actions = SimG4FullSimActions() +#actions.enableHistory=True +#actions.energyCut = 0.2 * GeV +# from Configurables import SimG4SaveParticleHistory +#saveHistTool = SimG4SaveParticleHistory("saveHistory") + +# Geant4 service +# Configures the Geant simulation: geometry, physics list and user actions +from Configurables import SimG4Svc +# giving the names of tools will initialize the tools of that type +geantservice = SimG4Svc("SimG4Svc") +geantservice.detector = "SimG4DD4hepDetector" +geantservice.physicslist = "SimG4FtfpBert" +geantservice.actions = "SimG4FullSimActions" +# Fixed seed to have reproducible results, change it for each job if you split one production into several jobs +# Mind that if you leave Gaudi handle random seed and some job start within the same second (very likely) you will have duplicates +geantservice.randomNumbersFromGaudi = False +geantservice.seedValue = 4242 +# Range cut +geantservice.g4PreInitCommands += ["/run/setCut 0.1 mm"] +ApplicationMgr().ExtSvc += [geantservice] + + + +# Magnetic field +from Configurables import SimG4ConstantMagneticFieldTool +field = SimG4ConstantMagneticFieldTool("SimG4ConstantMagneticFieldTool") +field.FieldComponentZ = -2 * units.tesla +field.FieldOn = True +field.IntegratorStepper="ClassicalRK4" + +# Geant4 algorithm +# Translates EDM to G4Event, passes the event to G4, writes out outputs via tools +# and a tool that saves the calorimeter hits + +# Detector readouts +# ECAL +ecalBarrelReadoutName = "ECalBarrelEta" +ecalBarrelReadoutNamePhiEta = "ECalBarrelPhiEta" +# HCAL +hcalReadoutName = "HCalBarrelReadout" +extHcalReadoutName = "HCalExtBarrelReadout" + +from Configurables import SimG4Alg +from Configurables import SimG4SaveCalHits +saveECalBarrelTool = SimG4SaveCalHits("saveECalBarrelHits") +saveECalBarrelTool.readoutNames = ["ECalBarrelEta"] +saveECalBarrelTool.CaloHits.Path = "ECalBarrelPositionedHits" +SimG4Alg("SimG4Alg").outputs += [saveECalBarrelTool] + + +from Configurables import SimG4SaveCalHits +saveHCalTool = SimG4SaveCalHits("saveHCalBarrelHits") +saveHCalTool.readoutNames = ["HCalBarrelReadout"] +saveHCalTool.CaloHits.Path = "HCalBarrelPositionedHits" +SimG4Alg("SimG4Alg").outputs += [saveHCalTool] + +# next, create the G4 algorithm, giving the list of names of tools ("XX/YY") +from Configurables import SimG4PrimariesFromEdmTool +particle_converter = SimG4PrimariesFromEdmTool("EdmConverter") +particle_converter.GenParticles.Path = "GenParticles" + +from Configurables import SimG4Alg +geantsim = SimG4Alg("SimG4Alg") +geantsim.eventProvider = particle_converter +ApplicationMgr().TopAlg += [geantsim] + +############## Digitization (Merging hits into cells, EM scale calibration) +# EM scale calibration (sampling fraction) +from Configurables import CalibrateInLayersTool + +calibEcalBarrel = CalibrateInLayersTool("CalibrateECalBarrel") +calibEcalBarrel.samplingFraction = [0.36571381189697705] * 1 + [0.09779064189677973] * 1 + [0.12564152224404024] * 1 + [0.14350599973146283] * 1 + [0.1557126972314961] * 1 + [0.16444759076233928] * 1 + [0.17097165096847836] * 1 + [0.17684775359805122] * 1 + [0.18181154293837265] * 1 + [0.18544247938196395] * 1 + [0.18922747431624687] * 1 + [0.21187001375505543] * 1 +calibEcalBarrel.readoutName = "ECalBarrelEta" +calibEcalBarrel.layerFieldName = "layer" + +from Configurables import CalibrateCaloHitsTool +calibHcells = CalibrateCaloHitsTool("CalibrateHCal") +calibHcells.invSamplingFraction = "41.66" + +# Create cells in ECal barrel +# 1. step - merge hits into cells with Eta and module segmentation (phi module is a 'physical' cell i.e. lead + LAr + PCB + LAr +lead) +# 2. step - rewrite the cellId using the Eta-Phi segmentation (merging several modules into one phi readout cell) +from Configurables import CreateCaloCells +createEcalBarrelCellsStep1 = CreateCaloCells("CreateECalBarrelCellsStep1") +createEcalBarrelCellsStep1.doCellCalibration = True +createEcalBarrelCellsStep1.calibTool = calibEcalBarrel +createEcalBarrelCellsStep1.addCellNoise = False +createEcalBarrelCellsStep1.filterCellNoise = False +# todo: add when update on cvmfs +createEcalBarrelCellsStep1.addPosition = True +createEcalBarrelCellsStep1.hits = "ECalBarrelPositionedHits" +createEcalBarrelCellsStep1.cells = "ECalBarrelCellsStep1" +ApplicationMgr().TopAlg += [createEcalBarrelCellsStep1] + +## Use Phi-Theta segmentation in ECal barrel +from Configurables import RedoSegmentation +resegmentEcalBarrel = RedoSegmentation("ReSegmentationEcal") +# old bitfield (readout) +resegmentEcalBarrel.oldReadoutName = "ECalBarrelEta" +# specify which fields are going to be altered (deleted/rewritten) +resegmentEcalBarrel.oldSegmentationIds = ["module"] +# new bitfield (readout), with new segmentation +resegmentEcalBarrel.newReadoutName = "ECalBarrelPhiEta" +resegmentEcalBarrel.inhits = "ECalBarrelCellsStep1" +resegmentEcalBarrel.outhits = "ECalBarrelCellsStep2" +ApplicationMgr().TopAlg += [resegmentEcalBarrel] + +EcalBarrelCellsName = "ECalBarrelCells" +from Configurables import CreateCaloCells +createEcalBarrelCells = CreateCaloCells("CreateECalBarrelCells") +createEcalBarrelCells.doCellCalibration = False +createEcalBarrelCells.addCellNoise = False +createEcalBarrelCells.filterCellNoise = False +createEcalBarrelCells.hits = "ECalBarrelCellsStep2" +createEcalBarrelCells.cells = "ECalBarrelCells" +ApplicationMgr().TopAlg += [createEcalBarrelCells] + +# Ecal barrel cell positions (good for physics, all coordinates set properly) +from Configurables import CellPositionsECalBarrelTool +cellPositionEcalBarrelTool = CellPositionsECalBarrelTool("CellPositionsECalBarrel") +cellPositionEcalBarrelTool.readoutName = "ECalBarrelPhiEta" + +from Configurables import CreateCaloCellPositionsFCCee +createEcalBarrelPositionedCells = CreateCaloCellPositionsFCCee("ECalBarrelPositionedCells") +createEcalBarrelPositionedCells.positionsECalBarrelTool = cellPositionEcalBarrelTool +createEcalBarrelPositionedCells.hits.Path = "ECalBarrelCells" +createEcalBarrelPositionedCells.positionedHits.Path = "ECalBarrelPositionedCells" +ApplicationMgr().TopAlg += [createEcalBarrelPositionedCells] + +# Create cells in HCal +# 1. step - merge hits into cells with the default readout +createHcalBarrelCells = CreateCaloCells("CreateHCaloCells") +createHcalBarrelCells.doCellCalibration = True +createHcalBarrelCells.calibTool = calibHcells +createHcalBarrelCells.addPosition = True +createHcalBarrelCells.addCellNoise = False +createHcalBarrelCells.filterCellNoise = False +createHcalBarrelCells.hits = "HCalBarrelPositionedHits" +createHcalBarrelCells.cells = "HCalBarrelCells" +ApplicationMgr().TopAlg += [createHcalBarrelCells] + +# sliding window clustering #FIXME not yet ready for key4hep +#Empty cells for parts of calorimeter not implemented yet +from Configurables import CreateEmptyCaloCellsCollection +createemptycells = CreateEmptyCaloCellsCollection("CreateEmptyCaloCells") +createemptycells.cells.Path = "emptyCaloCells" +ApplicationMgr().TopAlg += [createemptycells] + +from Configurables import CaloTowerTool +towers = CaloTowerTool("towers") +towers.deltaEtaTower = 0.01 +towers.deltaPhiTower = 2 * constants.pi / 768. +towers.ecalBarrelReadoutName = ecalBarrelReadoutNamePhiEta +towers.ecalEndcapReadoutName = "" +towers.ecalFwdReadoutName = "" +towers.hcalBarrelReadoutName = "" +towers.hcalExtBarrelReadoutName = "" +towers.hcalEndcapReadoutName = "" +towers.hcalFwdReadoutName = "" +towers.ecalBarrelCells.Path = EcalBarrelCellsName +towers.ecalEndcapCells.Path = "emptyCaloCells" +towers.ecalFwdCells.Path = "emptyCaloCells" +towers.hcalBarrelCells.Path = "emptyCaloCells" +towers.hcalExtBarrelCells.Path = "emptyCaloCells" +towers.hcalEndcapCells.Path = "emptyCaloCells" +towers.hcalFwdCells.Path = "emptyCaloCells" + + + +from Configurables import CreateCaloClustersSlidingWindow +createClusters = CreateCaloClustersSlidingWindow("CreateClusters") +# Cluster variables +createClusters.towerTool = towers +createClusters.nEtaWindow = 9 +createClusters.nPhiWindow = 17 +createClusters.nEtaPosition = 5 +createClusters.nPhiPosition = 11 +createClusters.nEtaDuplicates = 7 +createClusters.nPhiDuplicates = 13 +createClusters.nEtaFinal = 9 +createClusters.nPhiFinal = 17 +# Minimal energy to create a cluster in GeV (FCC-ee detectors have to reconstruct low energy particles) +createClusters.energyThreshold = 0.1 +createClusters.attachCells = True +createClusters.clusters.Path = "CaloClusters" +createClusters.clusterCells.Path = "CaloClusterCells" +ApplicationMgr().TopAlg += [createClusters] + + +################ Output +from Configurables import PodioOutput +out = PodioOutput("out") +out.outputCommands = ["keep *", "drop ECalBarrelHits", "drop HCal*", "drop ECalBarrelCellsStep*", "drop ECalBarrelPositionedHits", "drop emptyCaloCells", "drop CaloClusterCells"] +import uuid +out.filename = "output_fullCalo_SimAndDigi.root" +ApplicationMgr().TopAlg += [out] + +#CPU information +from Configurables import AuditorSvc, ChronoAuditor +chra = ChronoAuditor() +audsvc = AuditorSvc() +audsvc.Auditors = [chra] +gen.AuditExecute = True +hepmc_converter.AuditExecute = True +geantsim.AuditExecute = True +createEcalBarrelCellsStep1.AuditExecute = True +resegmentEcalBarrel.AuditExecute = True +createEcalBarrelCells.AuditExecute = True +createHcalBarrelCells.AuditExecute = True +out.AuditExecute = True +#ApplicationMgr().ExtSvc += [audsvc] + +from Configurables import EventCounter +event_counter = EventCounter('event_counter') +event_counter.Frequency = 10 +ApplicationMgr().TopAlg += [event_counter] + diff --git a/workflows/fccconfigkey4hep-devel-2/configLHE.cmnd~ b/workflows/fccconfigkey4hep-devel-2/configLHE.cmnd~ new file mode 100644 index 0000000..a301ff8 --- /dev/null +++ b/workflows/fccconfigkey4hep-devel-2/configLHE.cmnd~ @@ -0,0 +1,18 @@ +! 1) Settings used in the main program. + +Main:numberOfEvents = 10 ! number of events to generate +Main:timesAllowErrors = 3 ! how many aborts before run stops + +! 2) Settings related to output in init(), next() and stat(). + +Init:showChangedSettings = on ! list changed settings +Init:showChangedParticleData = off ! list changed particle data +Next:numberCount = 100 ! print message every n events +Next:numberShowInfo = 1 ! print event information n times +Next:numberShowProcess = 1 ! print process record n times +Next:numberShowEvent = 0 ! print event record n times + +! 3) Set the input LHE file + +Beams:frameType = 4 +Beams:LHEF = examples/Pythia8/events.lhe diff --git a/workflows/fccconfigkey4hep-devel-2/delphes_card_IDEA.tcl b/workflows/fccconfigkey4hep-devel-2/delphes_card_IDEA.tcl new file mode 100644 index 0000000..753c0c1 --- /dev/null +++ b/workflows/fccconfigkey4hep-devel-2/delphes_card_IDEA.tcl @@ -0,0 +1,797 @@ +#################################################################### l +# FCC-ee IDEA detector model +# +# Authors: Elisa Fontanesi, Lorenzo Pezzotti, Massimiliano Antonello +# email: efontane@bo.infn.it, +# lorenzo.pezzotti01@universitadipavia.it, +# m.antonello@uninsubria.it, +##################################################################### +# +####################################### +# Order of execution of various modules +####################################### + +set ExecutionPath { + ParticlePropagator + + ChargedHadronTrackingEfficiency + ElectronTrackingEfficiency + MuonTrackingEfficiency + + TrackMergerPre + TrackSmearing + + TrackMerger + Calorimeter + EFlowMerger + + PhotonEfficiency + PhotonIsolation + + ElectronFilter + ElectronEfficiency + ElectronIsolation + + MuonFilter + MuonEfficiency + MuonIsolation + + MissingET + + NeutrinoFilter + GenJetFinder + GenMissingET + + FastJetFinder + + JetEnergyScale + + JetFlavorAssociation + + BTagging + TauTagging + + UniqueObjectFinder + + ScalarHT + TreeWriter +} + + +################################# +# Propagate particles in cylinder +################################# + +module ParticlePropagator ParticlePropagator { + set InputArray Delphes/stableParticles + + set OutputArray stableParticles + set ChargedHadronOutputArray chargedHadrons + set ElectronOutputArray electrons + set MuonOutputArray muons + + # inner radius of the solenoid, in m + set Radius 2.25 + + # half-length: z of the solenoid, in m + set HalfLength 2.5 + + # magnetic field, in T + set Bz 2.0 +} + +#################################### +# Charged hadron tracking efficiency +#################################### + +module Efficiency ChargedHadronTrackingEfficiency { + set InputArray ParticlePropagator/chargedHadrons + set OutputArray chargedHadrons + # We use only one efficiency, we set only 0 effincency out of eta bounds: + + set EfficiencyFormula { + (abs(eta) > 3.0) * (0.000) + + (energy >= 0.5) * (abs(eta) <= 3.0) * (0.997) + + (energy < 0.5 && energy >= 0.3) * (abs(eta) <= 3.0) * (0.65) + + (energy < 0.3) * (abs(eta) <= 3.0) * (0.06) + } +} + +# (pt <= 0.1) * (0.00) + +# (abs(eta) <= 3.0) * (pt > 0.1) * (1.00) + +# (abs(eta) > 3) * (0.00) + + + +############################## +# Electron tracking efficiency +############################## + +module Efficiency ElectronTrackingEfficiency { + set InputArray ParticlePropagator/electrons + set OutputArray electrons + + + # Current full simulation with CLICdet provides for electrons: + set EfficiencyFormula { + (abs(eta) > 3.0) * (0.000) + + (energy >= 0.5) * (abs(eta) <= 3.0) * (0.997) + + (energy < 0.5 && energy >= 0.3) * (abs(eta) <= 3.0) * (0.65) + + (energy < 0.3) * (abs(eta) <= 3.0) * (0.06) + } +} + + +########################## +# Muon tracking efficiency +########################## + +module Efficiency MuonTrackingEfficiency { + set InputArray ParticlePropagator/muons + set OutputArray muons + + # Current full simulation with CLICdet provides for muons: + set EfficiencyFormula { + (abs(eta) > 3.0) * (0.000) + + (energy >= 0.5) * (abs(eta) <= 3.0) * (0.997) + + (energy < 0.5 && energy >= 0.3) * (abs(eta) <= 3.0) * (0.65) + + (energy < 0.3) * (abs(eta) <= 3.0) * (0.06) + } +} + +############## +# Track merger +############## + +module Merger TrackMergerPre { +# add InputArray InputArray + add InputArray ChargedHadronTrackingEfficiency/chargedHadrons + add InputArray ElectronTrackingEfficiency/electrons + add InputArray MuonTrackingEfficiency/muons + set OutputArray tracks +} + + +######################################## +# Smearing for charged tracks +######################################## + +module TrackCovariance TrackSmearing { + set InputArray TrackMergerPre/tracks + set OutputArray tracks + + set Bz 2.0 + + ## minimum number of hits to accept a track + set NMinHits 6 + + ## uses https://raw.githubusercontent.com/selvaggi/FastTrackCovariance/master/GeoIDEA_BASE.txt + set DetectorGeometry { + + + # Layer type 1 = R (barrel) or 2 = z (forward/backward) + # Layer label + # Minimum dimension z for barrel or R for forward + # Maximum dimension z for barrel or R for forward + # R/z location of layer + # Thickness (meters) + # Radiation length (meters) + # Number of measurements in layers (1D or 2D) + # Stereo angle (rad) - 0(pi/2) = axial(z) layer - Upper side + # Stereo angle (rad) - 0(pi/2) = axial(z) layer - Lower side + # Resolution Upper side (meters) - 0 = no measurement + # Resolution Lower side (meters) - 0 = no measurement + # measurement flag = T, scattering only = F + + + # barrel name zmin zmax r w (m) X0 n_meas th_up (rad) th_down (rad) reso_up (m) reso_down (m) flag + + 1 PIPE -100 100 0.015 0.0012 0.35276 0 0 0 0 0 0 + 1 VTXLOW -0.12 0.12 0.017 0.00028 0.0937 2 0 1.5708 3e-006 3e-006 1 + 1 VTXLOW -0.16 0.16 0.023 0.00028 0.0937 2 0 1.5708 3e-006 3e-006 1 + 1 VTXLOW -0.16 0.16 0.031 0.00028 0.0937 2 0 1.5708 3e-006 3e-006 1 + 1 VTXHIGH -1 1 0.32 0.00047 0.0937 2 0 1.5708 7e-006 7e-006 1 + 1 VTXHIGH -1.05 1.05 0.34 0.00047 0.0937 2 0 1.5708 7e-006 7e-006 1 + + # endcap name rmin rmax z w (m) X0 n_meas th_up (rad) th_down (rad) reso_up (m) reso_down (m) flag + + 2 VTXDSK 0.141 0.3 -0.92 0.00028 0.0937 2 0 1.5708 7e-006 7e-006 1 + 2 VTXDSK 0.138 0.3 -0.9 0.00028 0.0937 2 0 1.5708 7e-006 7e-006 1 + 2 VTXDSK 0.065 0.3 -0.42 0.00028 0.0937 2 0 1.5708 7e-006 7e-006 1 + 2 VTXDSK 0.062 0.3 -0.4 0.00028 0.0937 2 0 1.5708 7e-006 7e-006 1 + 2 VTXDSK 0.062 0.3 0.4 0.00028 0.0937 2 0 1.5708 7e-006 7e-006 1 + 2 VTXDSK 0.065 0.3 0.42 0.00028 0.0937 2 0 1.5708 7e-006 7e-006 1 + 2 VTXDSK 0.138 0.3 0.9 0.00028 0.0937 2 0 1.5708 7e-006 7e-006 1 + 2 VTXDSK 0.141 0.3 0.92 0.00028 0.0937 2 0 1.5708 7e-006 7e-006 1 + + 1 DCHCANI -2.125 2.125 0.345 0.0002 0.237223 0 0 0 0 0 0 + 1 DCH -2 2 0.36 0.0147748 1400 1 0.0203738 0 0.0001 0 1 + 1 DCH -2 2 0.374775 0.0147748 1400 1 -0.0212097 0 0.0001 0 1 + 1 DCH -2 2 0.38955 0.0147748 1400 1 0.0220456 0 0.0001 0 1 + 1 DCH -2 2 0.404324 0.0147748 1400 1 -0.0228814 0 0.0001 0 1 + 1 DCH -2 2 0.419099 0.0147748 1400 1 0.0237172 0 0.0001 0 1 + 1 DCH -2 2 0.433874 0.0147748 1400 1 -0.024553 0 0.0001 0 1 + 1 DCH -2 2 0.448649 0.0147748 1400 1 0.0253888 0 0.0001 0 1 + 1 DCH -2 2 0.463423 0.0147748 1400 1 -0.0262245 0 0.0001 0 1 + 1 DCH -2 2 0.478198 0.0147748 1400 1 0.0270602 0 0.0001 0 1 + 1 DCH -2 2 0.492973 0.0147748 1400 1 -0.0278958 0 0.0001 0 1 + 1 DCH -2 2 0.507748 0.0147748 1400 1 0.0287314 0 0.0001 0 1 + 1 DCH -2 2 0.522523 0.0147748 1400 1 -0.029567 0 0.0001 0 1 + 1 DCH -2 2 0.537297 0.0147748 1400 1 0.0304025 0 0.0001 0 1 + 1 DCH -2 2 0.552072 0.0147748 1400 1 -0.031238 0 0.0001 0 1 + 1 DCH -2 2 0.566847 0.0147748 1400 1 0.0320734 0 0.0001 0 1 + 1 DCH -2 2 0.581622 0.0147748 1400 1 -0.0329088 0 0.0001 0 1 + 1 DCH -2 2 0.596396 0.0147748 1400 1 0.0337442 0 0.0001 0 1 + 1 DCH -2 2 0.611171 0.0147748 1400 1 -0.0345795 0 0.0001 0 1 + 1 DCH -2 2 0.625946 0.0147748 1400 1 0.0354147 0 0.0001 0 1 + 1 DCH -2 2 0.640721 0.0147748 1400 1 -0.0362499 0 0.0001 0 1 + 1 DCH -2 2 0.655495 0.0147748 1400 1 0.0370851 0 0.0001 0 1 + 1 DCH -2 2 0.67027 0.0147748 1400 1 -0.0379202 0 0.0001 0 1 + 1 DCH -2 2 0.685045 0.0147748 1400 1 0.0387552 0 0.0001 0 1 + 1 DCH -2 2 0.69982 0.0147748 1400 1 -0.0395902 0 0.0001 0 1 + 1 DCH -2 2 0.714595 0.0147748 1400 1 0.0404252 0 0.0001 0 1 + 1 DCH -2 2 0.729369 0.0147748 1400 1 -0.04126 0 0.0001 0 1 + 1 DCH -2 2 0.744144 0.0147748 1400 1 0.0420949 0 0.0001 0 1 + 1 DCH -2 2 0.758919 0.0147748 1400 1 -0.0429296 0 0.0001 0 1 + 1 DCH -2 2 0.773694 0.0147748 1400 1 0.0437643 0 0.0001 0 1 + 1 DCH -2 2 0.788468 0.0147748 1400 1 -0.044599 0 0.0001 0 1 + 1 DCH -2 2 0.803243 0.0147748 1400 1 0.0454336 0 0.0001 0 1 + 1 DCH -2 2 0.818018 0.0147748 1400 1 -0.0462681 0 0.0001 0 1 + 1 DCH -2 2 0.832793 0.0147748 1400 1 0.0471025 0 0.0001 0 1 + 1 DCH -2 2 0.847568 0.0147748 1400 1 -0.0479369 0 0.0001 0 1 + 1 DCH -2 2 0.862342 0.0147748 1400 1 0.0487713 0 0.0001 0 1 + 1 DCH -2 2 0.877117 0.0147748 1400 1 -0.0496055 0 0.0001 0 1 + 1 DCH -2 2 0.891892 0.0147748 1400 1 0.0504397 0 0.0001 0 1 + 1 DCH -2 2 0.906667 0.0147748 1400 1 -0.0512738 0 0.0001 0 1 + 1 DCH -2 2 0.921441 0.0147748 1400 1 0.0521079 0 0.0001 0 1 + 1 DCH -2 2 0.936216 0.0147748 1400 1 -0.0529418 0 0.0001 0 1 + 1 DCH -2 2 0.950991 0.0147748 1400 1 0.0537757 0 0.0001 0 1 + 1 DCH -2 2 0.965766 0.0147748 1400 1 -0.0546095 0 0.0001 0 1 + 1 DCH -2 2 0.980541 0.0147748 1400 1 0.0554433 0 0.0001 0 1 + 1 DCH -2 2 0.995315 0.0147748 1400 1 -0.056277 0 0.0001 0 1 + 1 DCH -2 2 1.01009 0.0147748 1400 1 0.0571106 0 0.0001 0 1 + 1 DCH -2 2 1.02486 0.0147748 1400 1 -0.0579441 0 0.0001 0 1 + 1 DCH -2 2 1.03964 0.0147748 1400 1 0.0587775 0 0.0001 0 1 + 1 DCH -2 2 1.05441 0.0147748 1400 1 -0.0596108 0 0.0001 0 1 + 1 DCH -2 2 1.06919 0.0147748 1400 1 0.0604441 0 0.0001 0 1 + 1 DCH -2 2 1.08396 0.0147748 1400 1 -0.0612773 0 0.0001 0 1 + 1 DCH -2 2 1.09874 0.0147748 1400 1 0.0621104 0 0.0001 0 1 + 1 DCH -2 2 1.11351 0.0147748 1400 1 -0.0629434 0 0.0001 0 1 + 1 DCH -2 2 1.12829 0.0147748 1400 1 0.0637763 0 0.0001 0 1 + 1 DCH -2 2 1.14306 0.0147748 1400 1 -0.0646092 0 0.0001 0 1 + 1 DCH -2 2 1.15784 0.0147748 1400 1 0.0654419 0 0.0001 0 1 + 1 DCH -2 2 1.17261 0.0147748 1400 1 -0.0662746 0 0.0001 0 1 + 1 DCH -2 2 1.18739 0.0147748 1400 1 0.0671071 0 0.0001 0 1 + 1 DCH -2 2 1.20216 0.0147748 1400 1 -0.0679396 0 0.0001 0 1 + 1 DCH -2 2 1.21694 0.0147748 1400 1 0.068772 0 0.0001 0 1 + 1 DCH -2 2 1.23171 0.0147748 1400 1 -0.0696042 0 0.0001 0 1 + 1 DCH -2 2 1.24649 0.0147748 1400 1 0.0704364 0 0.0001 0 1 + 1 DCH -2 2 1.26126 0.0147748 1400 1 -0.0712685 0 0.0001 0 1 + 1 DCH -2 2 1.27604 0.0147748 1400 1 0.0721005 0 0.0001 0 1 + 1 DCH -2 2 1.29081 0.0147748 1400 1 -0.0729324 0 0.0001 0 1 + 1 DCH -2 2 1.30559 0.0147748 1400 1 0.0737642 0 0.0001 0 1 + 1 DCH -2 2 1.32036 0.0147748 1400 1 -0.0745958 0 0.0001 0 1 + 1 DCH -2 2 1.33514 0.0147748 1400 1 0.0754274 0 0.0001 0 1 + 1 DCH -2 2 1.34991 0.0147748 1400 1 -0.0762589 0 0.0001 0 1 + 1 DCH -2 2 1.36468 0.0147748 1400 1 0.0770903 0 0.0001 0 1 + 1 DCH -2 2 1.37946 0.0147748 1400 1 -0.0779215 0 0.0001 0 1 + 1 DCH -2 2 1.39423 0.0147748 1400 1 0.0787527 0 0.0001 0 1 + 1 DCH -2 2 1.40901 0.0147748 1400 1 -0.0795837 0 0.0001 0 1 + 1 DCH -2 2 1.42378 0.0147748 1400 1 0.0804147 0 0.0001 0 1 + 1 DCH -2 2 1.43856 0.0147748 1400 1 -0.0812455 0 0.0001 0 1 + 1 DCH -2 2 1.45333 0.0147748 1400 1 0.0820762 0 0.0001 0 1 + 1 DCH -2 2 1.46811 0.0147748 1400 1 -0.0829068 0 0.0001 0 1 + 1 DCH -2 2 1.48288 0.0147748 1400 1 0.0837373 0 0.0001 0 1 + 1 DCH -2 2 1.49766 0.0147748 1400 1 -0.0845677 0 0.0001 0 1 + 1 DCH -2 2 1.51243 0.0147748 1400 1 0.0853979 0 0.0001 0 1 + 1 DCH -2 2 1.52721 0.0147748 1400 1 -0.086228 0 0.0001 0 1 + 1 DCH -2 2 1.54198 0.0147748 1400 1 0.087058 0 0.0001 0 1 + 1 DCH -2 2 1.55676 0.0147748 1400 1 -0.0878879 0 0.0001 0 1 + 1 DCH -2 2 1.57153 0.0147748 1400 1 0.0887177 0 0.0001 0 1 + 1 DCH -2 2 1.58631 0.0147748 1400 1 -0.0895474 0 0.0001 0 1 + 1 DCH -2 2 1.60108 0.0147748 1400 1 0.0903769 0 0.0001 0 1 + 1 DCH -2 2 1.61586 0.0147748 1400 1 -0.0912063 0 0.0001 0 1 + 1 DCH -2 2 1.63063 0.0147748 1400 1 0.0920356 0 0.0001 0 1 + 1 DCH -2 2 1.64541 0.0147748 1400 1 -0.0928647 0 0.0001 0 1 + 1 DCH -2 2 1.66018 0.0147748 1400 1 0.0936937 0 0.0001 0 1 + 1 DCH -2 2 1.67495 0.0147748 1400 1 -0.0945226 0 0.0001 0 1 + 1 DCH -2 2 1.68973 0.0147748 1400 1 0.0953514 0 0.0001 0 1 + 1 DCH -2 2 1.7045 0.0147748 1400 1 -0.09618 0 0.0001 0 1 + 1 DCH -2 2 1.71928 0.0147748 1400 1 0.0970085 0 0.0001 0 1 + 1 DCH -2 2 1.73405 0.0147748 1400 1 -0.0978369 0 0.0001 0 1 + 1 DCH -2 2 1.74883 0.0147748 1400 1 0.0986651 0 0.0001 0 1 + 1 DCH -2 2 1.7636 0.0147748 1400 1 -0.0994932 0 0.0001 0 1 + 1 DCH -2 2 1.77838 0.0147748 1400 1 0.100321 0 0.0001 0 1 + 1 DCH -2 2 1.79315 0.0147748 1400 1 -0.101149 0 0.0001 0 1 + 1 DCH -2 2 1.80793 0.0147748 1400 1 0.101977 0 0.0001 0 1 + 1 DCH -2 2 1.8227 0.0147748 1400 1 -0.102804 0 0.0001 0 1 + 1 DCH -2 2 1.83748 0.0147748 1400 1 0.103632 0 0.0001 0 1 + 1 DCH -2 2 1.85225 0.0147748 1400 1 -0.104459 0 0.0001 0 1 + 1 DCH -2 2 1.86703 0.0147748 1400 1 0.105286 0 0.0001 0 1 + 1 DCH -2 2 1.8818 0.0147748 1400 1 -0.106113 0 0.0001 0 1 + 1 DCH -2 2 1.89658 0.0147748 1400 1 0.10694 0 0.0001 0 1 + 1 DCH -2 2 1.91135 0.0147748 1400 1 -0.107766 0 0.0001 0 1 + 1 DCH -2 2 1.92613 0.0147748 1400 1 0.108593 0 0.0001 0 1 + 1 DCH -2 2 1.9409 0.0147748 1400 1 -0.109419 0 0.0001 0 1 + 1 DCH -2 2 1.95568 0.0147748 1400 1 0.110246 0 0.0001 0 1 + 1 DCH -2 2 1.97045 0.0147748 1400 1 -0.111072 0 0.0001 0 1 + 1 DCH -2 2 1.98523 0.0147748 1400 1 0.111898 0 0.0001 0 1 + 1 DCH -2 2 2 0.0147748 1400 1 -0.112723 0 0.0001 0 1 + 1 DCHCANO -2.125 2.125 2.02 0.02 1.667 0 0 0 0 0 0 + 1 BSILWRP -2.35 2.35 2.04 0.00047 0.0937 2 0 1.5708 7e-006 9e-005 1 + 1 BSILWRP -2.35 2.35 2.06 0.00047 0.0937 2 0 1.5708 7e-006 9e-005 1 + 1 MAG -2.5 2.5 2.25 0.05 0.0658 0 0 0 0 0 0 + 1 BPRESH -2.55 2.55 2.45 0.02 1 2 0 1.5708 7e-005 0.01 1 + + + 2 DCHWALL 0.345 2.02 2.125 0.25 5.55 0 0 0 0 0 0 + 2 DCHWALL 0.345 2.02 -2.125 0.25 5.55 0 0 0 0 0 0 + 2 FSILWRP 0.354 2.02 -2.32 0.00047 0.0937 2 0 1.5708 7e-006 9e-005 1 + 2 FSILWRP 0.35 2.02 -2.3 0.00047 0.0937 2 0 1.5708 7e-006 9e-005 1 + 2 FSILWRP 0.35 2.02 2.3 0.00047 0.0937 2 0 1.5708 7e-006 9e-005 1 + 2 FSILWRP 0.354 2.02 2.32 0.00047 0.0937 2 0 1.5708 7e-006 9e-005 1 + 2 FRAD 0.38 2.09 2.49 0.0043 0.005612 0 0 0 0 0 0 + 2 FRAD 0.38 2.09 -2.49 0.0043 0.005612 0 0 0 0 0 0 + 2 FPRESH 0.39 2.43 -2.55 0.02 1 2 0 1.5708 7e-005 0.01 1 + 2 FPRESH 0.39 2.43 2.55 0.02 1 2 0 1.5708 7e-005 0.01 1 + } + +} + + +############## +# Track merger +############## + +module Merger TrackMerger { +# add InputArray InputArray + add InputArray TrackSmearing/tracks + set OutputArray tracks +} + + +############# +# Calorimeter +############# +module DualReadoutCalorimeter Calorimeter { + set ParticleInputArray ParticlePropagator/stableParticles + set TrackInputArray TrackMerger/tracks + + set TowerOutputArray towers + set PhotonOutputArray photons + + set EFlowTrackOutputArray eflowTracks + set EFlowPhotonOutputArray eflowPhotons + set EFlowNeutralHadronOutputArray eflowNeutralHadrons + + set ECalEnergyMin 0.5 + set HCalEnergyMin 0.5 + set EnergyMin 0.5 + set ECalEnergySignificanceMin 1.0 + set HCalEnergySignificanceMin 1.0 + set EnergySignificanceMin 1.0 + + set SmearTowerCenter true + set pi [expr {acos(-1)}] + + # Lists of the edges of each tower in eta and phi; + # each list starts with the lower edge of the first tower; + # the list ends with the higher edged of the last tower. + # Barrel: deta=0.02 towers up to |eta| <= 0.88 ( up to 45°) + # Endcaps: deta=0.02 towers up to |eta| <= 3.0 (8.6° = 100 mrad) + # Cell size: about 6 cm x 6 cm + + #barrel: + set PhiBins {} + for {set i -120} {$i <= 120} {incr i} { + add PhiBins [expr {$i * $pi/120}] + } + #deta=0.02 units for |eta| <= 0.88 + for {set i -44} {$i < 45} {incr i} { + set eta [expr {$i * 0.02}] + add EtaPhiBins $eta $PhiBins + } + + #endcaps: + set PhiBins {} + for {set i -120} {$i <= 120} {incr i} { + add PhiBins [expr {$i* $pi/120}] + } + #deta=0.02 units for 0.88 < |eta| <= 3.0 + #first, from -3.0 to -0.88 + for {set i 1} {$i <=106} {incr i} { + set eta [expr {-3.00 + $i * 0.02}] + add EtaPhiBins $eta $PhiBins + } + #same for 0.88 to 3.0 + for {set i 1} {$i <=106} {incr i} { + set eta [expr {0.88 + $i * 0.02}] + add EtaPhiBins $eta $PhiBins + } + + # default energy fractions {abs(PDG code)} {Fecal Fhcal} + add EnergyFraction {0} {0.0 1.0} + # energy fractions for e, gamma and pi0 + add EnergyFraction {11} {1.0 0.0} + add EnergyFraction {22} {1.0 0.0} + add EnergyFraction {111} {1.0 0.0} + # energy fractions for muon, neutrinos and neutralinos + add EnergyFraction {12} {0.0 0.0} + add EnergyFraction {13} {0.0 0.0} + add EnergyFraction {14} {0.0 0.0} + add EnergyFraction {16} {0.0 0.0} + add EnergyFraction {1000022} {0.0 0.0} + add EnergyFraction {1000023} {0.0 0.0} + add EnergyFraction {1000025} {0.0 0.0} + add EnergyFraction {1000035} {0.0 0.0} + add EnergyFraction {1000045} {0.0 0.0} + # energy fractions for K0short and Lambda + add EnergyFraction {310} {0.3 0.7} + add EnergyFraction {3122} {0.3 0.7} + + + # set ECalResolutionFormula {resolution formula as a function of eta and energy} + set ECalResolutionFormula { + (abs(eta) <= 0.88 ) * sqrt(energy^2*0.01^2 + energy*0.11^2)+ + (abs(eta) > 0.88 && abs(eta) <= 3.0) * sqrt(energy^2*0.01^2 + energy*0.11^2) + } + + # set HCalResolutionFormula {resolution formula as a function of eta and energy} + set HCalResolutionFormula { + (abs(eta) <= 0.88 ) * sqrt(energy^2*0.01^2 + energy*0.30^2)+ + (abs(eta) > 0.88 && abs(eta) <= 3.0) * sqrt(energy^2*0.01^2 + energy*0.30^2) + } +} + +#################### +# Energy flow merger +#################### + +module Merger EFlowMerger { +# add InputArray InputArray + add InputArray Calorimeter/eflowTracks + add InputArray Calorimeter/eflowPhotons + add InputArray Calorimeter/eflowNeutralHadrons + set OutputArray eflow +} + +################### +# Photon efficiency +################### + +module Efficiency PhotonEfficiency { + set InputArray Calorimeter/eflowPhotons + set OutputArray photons + + # set EfficiencyFormula {efficiency formula as a function of eta and pt} + # efficiency formula for photons + set EfficiencyFormula { + (energy < 2.0) * (0.000)+ + (energy >= 2.0) * (abs(eta) <= 0.88) * (0.99) + + (energy >= 2.0) * (abs(eta) >0.88 && abs(eta) <= 3.0) * (0.99) + + (abs(eta) > 3.0) * (0.000) + } +} + +################## +# Photon isolation +################## + +module Isolation PhotonIsolation { + set CandidateInputArray PhotonEfficiency/photons + set IsolationInputArray EFlowMerger/eflow + + set OutputArray photons + + set DeltaRMax 0.5 + + set PTMin 0.5 + + set PTRatioMax 999. +} + +################# +# Electron filter +################# + +module PdgCodeFilter ElectronFilter { + set InputArray Calorimeter/eflowTracks + set OutputArray electrons + set Invert true + add PdgCode {11} + add PdgCode {-11} +} + + +################# +# Muon filter +################# + +module PdgCodeFilter MuonFilter { + set InputArray Calorimeter/eflowTracks + set OutputArray muons + set Invert true + add PdgCode {13} + add PdgCode {-13} +} + + +##################### +# Electron efficiency +##################### + +module Efficiency ElectronEfficiency { + set InputArray ElectronFilter/electrons + set OutputArray electrons + + # set EfficiencyFormula {efficiency formula as a function of eta and pt} + + # efficiency formula for electrons + set EfficiencyFormula { + (energy < 2.0) * (0.000)+ + (energy >= 2.0) * (abs(eta) <= 0.88) * (0.99) + + (energy >= 2.0) * (abs(eta) >0.88 && abs(eta) <= 3.0) * (0.99) + + (abs(eta) > 3.0) * (0.000) + } +} + +#################### +# Electron isolation +#################### + +module Isolation ElectronIsolation { + set CandidateInputArray ElectronEfficiency/electrons + set IsolationInputArray EFlowMerger/eflow + + set OutputArray electrons + + set DeltaRMax 0.5 + + set PTMin 0.5 + + set PTRatioMax 0.12 +} + + +################# +# Muon efficiency +################# + +module Efficiency MuonEfficiency { + set InputArray MuonFilter/muons + set OutputArray muons + + # set EfficiencyFormula {efficiency as a function of eta and pt} + + # efficiency formula for muons + set EfficiencyFormula { + (energy < 2.0) * (0.000)+ + (energy >= 2.0) * (abs(eta) <= 0.88) * (0.99) + + (energy >= 2.0) * (abs(eta) >0.88 && abs(eta) <= 3.0) * (0.99) + + (abs(eta) > 3.0) * (0.000) + } +} + +################ +# Muon isolation +################ + +module Isolation MuonIsolation { + set CandidateInputArray MuonEfficiency/muons + set IsolationInputArray EFlowMerger/eflow + + set OutputArray muons + + set DeltaRMax 0.5 + + set PTMin 0.5 + + set PTRatioMax 0.25 +} + +################### +# Missing ET merger +################### + +module Merger MissingET { +# add InputArray InputArray + add InputArray EFlowMerger/eflow + set MomentumOutputArray momentum +} + +################## +# Scalar HT merger +################## + +module Merger ScalarHT { +# add InputArray InputArray + add InputArray UniqueObjectFinder/jets + add InputArray UniqueObjectFinder/electrons + add InputArray UniqueObjectFinder/photons + add InputArray UniqueObjectFinder/muons + set EnergyOutputArray energy +} + +##################### +# Neutrino Filter +##################### + +module PdgCodeFilter NeutrinoFilter { + + set InputArray Delphes/stableParticles + set OutputArray filteredParticles + + set PTMin 0.0 + + add PdgCode {12} + add PdgCode {14} + add PdgCode {16} + add PdgCode {-12} + add PdgCode {-14} + add PdgCode {-16} +} + + +##################### +# MC truth jet finder +##################### + +module FastJetFinder GenJetFinder { + set InputArray NeutrinoFilter/filteredParticles + + set OutputArray jets + + # algorithm: 1 CDFJetClu, 2 MidPoint, 3 SIScone, 4 kt, 5 Cambridge/Aachen, 6 antikt + set JetAlgorithm 6 + set ParameterR 0.4 + set JetPTMin 1.0 +} + + +######################### +# Gen Missing ET merger +######################## + +module Merger GenMissingET { +# add InputArray InputArray + add InputArray NeutrinoFilter/filteredParticles + set MomentumOutputArray momentum +} + +############ +# Jet finder +############ + +module FastJetFinder FastJetFinder { +# set InputArray Calorimeter/towers + set InputArray EFlowMerger/eflow + + set OutputArray jets + + # algorithm: 1 CDFJetClu, 2 MidPoint, 3 SIScone, 4 kt, 5 Cambridge/Aachen, 6 antikt + set JetAlgorithm 6 + set ParameterR 0.4 + set JetPTMin 1.0 +} + +################## +# Jet Energy Scale +################## + +module EnergyScale JetEnergyScale { + set InputArray FastJetFinder/jets + set OutputArray jets + + # scale formula for jets + set ScaleFormula {1.08} +} + +######################## +# Jet Flavor Association +######################## + +module JetFlavorAssociation JetFlavorAssociation { + + set PartonInputArray Delphes/partons + set ParticleInputArray Delphes/allParticles + set ParticleLHEFInputArray Delphes/allParticlesLHEF + set JetInputArray JetEnergyScale/jets + + set DeltaR 0.5 + set PartonPTMin 1.0 + set PartonEtaMax 3.0 +} + +########### +# b-tagging +########### + +module BTagging BTagging { + set JetInputArray JetEnergyScale/jets + + set BitNumber 0 + + # add EfficiencyFormula {abs(PDG code)} {efficiency formula as a function of eta and pt} + + # default efficiency formula (misidentification rate) + add EfficiencyFormula {0} {0.01} + + # efficiency formula for c-jets (misidentification rate) + add EfficiencyFormula {4} {0.10} + + # efficiency formula for b-jets + add EfficiencyFormula {5} {0.80} +} + +############# +# tau-tagging +############# + +module TauTagging TauTagging { + set ParticleInputArray Delphes/allParticles + set PartonInputArray Delphes/partons + set JetInputArray JetEnergyScale/jets + + set DeltaR 0.5 + set TauPTMin 1.0 + set TauEtaMax 3.0 + + # default efficiency formula (misidentification rate) + add EfficiencyFormula {0} {0.001} + # efficiency formula for tau-jets + add EfficiencyFormula {15} {0.6} +} + + +##################################################### +# Find uniquely identified photons/electrons/tau/jets +##################################################### + +module UniqueObjectFinder UniqueObjectFinder { +# earlier arrays take precedence over later ones +# add InputArray InputArray OutputArray + add InputArray PhotonIsolation/photons photons + add InputArray ElectronIsolation/electrons electrons + add InputArray MuonIsolation/muons muons + add InputArray JetEnergyScale/jets jets +} + + + +################## +# ROOT tree writer +################## + +# Tracks, towers and eflow objects are not stored by default in the output. +# If needed (for jet constituent or other studies), uncomment the relevant +# "add Branch ..." lines. + +module TreeWriter TreeWriter { + # add Branch InputArray BranchName BranchClass + + add Branch Delphes/allParticles Particle GenParticle + + add Branch TrackMerger/tracks Track Track + add Branch Calorimeter/towers Tower Tower + + add Branch Calorimeter/eflowTracks EFlowTrack Track + add Branch Calorimeter/eflowPhotons EFlowPhoton Tower + add Branch Calorimeter/eflowNeutralHadrons EFlowNeutralHadron Tower + + add Branch Calorimeter/photons CaloPhoton Photon + add Branch PhotonEfficiency/photons PhotonEff Photon + add Branch PhotonIsolation/photons PhotonIso Photon + + add Branch GenJetFinder/jets GenJet Jet + add Branch GenMissingET/momentum GenMissingET MissingET + + add Branch UniqueObjectFinder/jets Jet Jet + add Branch UniqueObjectFinder/electrons Electron Electron + add Branch UniqueObjectFinder/photons Photon Photon + add Branch UniqueObjectFinder/muons Muon Muon + + add Branch JetEnergyScale/jets AntiKtJet Jet + + add Branch MissingET/momentum MissingET MissingET + add Branch ScalarHT/energy ScalarHT ScalarHT +} diff --git a/workflows/fccconfigkey4hep-devel-2/edm4hep_output_config.tcl b/workflows/fccconfigkey4hep-devel-2/edm4hep_output_config.tcl new file mode 100644 index 0000000..d01d575 --- /dev/null +++ b/workflows/fccconfigkey4hep-devel-2/edm4hep_output_config.tcl @@ -0,0 +1,13 @@ + +module EDM4HepOutput EDM4HepOutput { + add ReconstructedParticleCollections EFlowTrack EFlowPhoton EFlowNeutralHadron + add GenParticleCollections Particle + add JetCollections Jet + add MuonCollections Muon + add ElectronCollections Electron + add PhotonCollections Photon + add MissingETCollections MissingET + add ScalarHTCollections ScalarHT + set RecoParticleCollectionName ReconstructedParticles + set MCRecoAssociationCollectionName MCRecoAssociations +} diff --git a/workflows/fccconfigkey4hep-devel-2/geant_fullsim_fccee_lar_pgun.py b/workflows/fccconfigkey4hep-devel-2/geant_fullsim_fccee_lar_pgun.py new file mode 100644 index 0000000..25b66c4 --- /dev/null +++ b/workflows/fccconfigkey4hep-devel-2/geant_fullsim_fccee_lar_pgun.py @@ -0,0 +1,280 @@ +import os +from Gaudi.Configuration import * +from GaudiKernel import SystemOfUnits as units +from GaudiKernel import PhysicalConstants as constants +from GaudiKernel.SystemOfUnits import MeV, GeV, tesla + +from Configurables import ApplicationMgr +ApplicationMgr().EvtSel = 'NONE' +ApplicationMgr().EvtMax = 2 +ApplicationMgr().OutputLevel = INFO +ApplicationMgr().StopOnSignal = True +ApplicationMgr().ExtSvc += ['RndmGenSvc'] + +from Configurables import FCCDataSvc +## Data service +podioevent = FCCDataSvc("EventDataSvc") +ApplicationMgr().ExtSvc += [podioevent] + +from Configurables import MomentumRangeParticleGun +guntool = MomentumRangeParticleGun() +guntool.ThetaMin = 45 * constants.pi / 180. +guntool.ThetaMax = 135 * constants.pi / 180. +guntool.PhiMin = 0. +guntool.PhiMax = 2. * constants.pi +guntool.MomentumMin = 1. *units.GeV +guntool.MomentumMax = 1. *units.GeV +guntool.PdgCodes = [11] # 11 electron, 13 muon, 22 photon, 111 pi0, 211 pi+ + +from Configurables import GenAlg +gen = GenAlg() +gen.SignalProvider=guntool +gen.hepmc.Path = "hepmc" +ApplicationMgr().TopAlg += [gen] + +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="hepmc" +hepmc_converter.GenParticles.Path="GenParticles" +ApplicationMgr().TopAlg += [hepmc_converter] + + + +################## 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 = INFO +ApplicationMgr().ExtSvc += [geoservice] + +# Geant4 service +# Configures the Geant simulation: geometry, physics list and user actions + +# Uncomment if history from Geant4 decays is needed (e.g. to get the photons from pi0) and set actions=actions in SimG4Svc +#from Configurables import SimG4FullSimActions +#actions = SimG4FullSimActions() +#actions.enableHistory=True +#actions.energyCut = 0.2 * GeV +# from Configurables import SimG4SaveParticleHistory +#saveHistTool = SimG4SaveParticleHistory("saveHistory") + +# Geant4 service +# Configures the Geant simulation: geometry, physics list and user actions +from Configurables import SimG4Svc +# giving the names of tools will initialize the tools of that type +geantservice = SimG4Svc("SimG4Svc") +geantservice.detector = "SimG4DD4hepDetector" +geantservice.physicslist = "SimG4FtfpBert" +geantservice.actions = "SimG4FullSimActions" +# Fixed seed to have reproducible results, change it for each job if you split one production into several jobs +# Mind that if you leave Gaudi handle random seed and some job start within the same second (very likely) you will have duplicates +geantservice.randomNumbersFromGaudi = False +geantservice.seedValue = 4242 +# Range cut +geantservice.g4PreInitCommands += ["/run/setCut 0.1 mm"] +ApplicationMgr().ExtSvc += [geantservice] + + + +# Magnetic field +from Configurables import SimG4ConstantMagneticFieldTool +field = SimG4ConstantMagneticFieldTool("SimG4ConstantMagneticFieldTool") +field.FieldComponentZ = -2 * units.tesla +field.FieldOn = True +field.IntegratorStepper="ClassicalRK4" + +# Geant4 algorithm +# Translates EDM to G4Event, passes the event to G4, writes out outputs via tools +# and a tool that saves the calorimeter hits + +# Detector readouts +# ECAL +ecalBarrelReadoutName = "ECalBarrelEta" +ecalBarrelReadoutNamePhiEta = "ECalBarrelPhiEta" +# HCAL +hcalReadoutName = "HCalBarrelReadout" +extHcalReadoutName = "HCalExtBarrelReadout" + +from Configurables import SimG4Alg +from Configurables import SimG4SaveCalHits +saveECalBarrelTool = SimG4SaveCalHits("saveECalBarrelHits") +saveECalBarrelTool.readoutNames = ["ECalBarrelEta"] +saveECalBarrelTool.CaloHits.Path = "ECalBarrelPositionedHits" +SimG4Alg("SimG4Alg").outputs += [saveECalBarrelTool] + + +from Configurables import SimG4SaveCalHits +saveHCalTool = SimG4SaveCalHits("saveHCalBarrelHits") +saveHCalTool.readoutNames = ["HCalBarrelReadout"] +saveHCalTool.CaloHits.Path = "HCalBarrelPositionedHits" +SimG4Alg("SimG4Alg").outputs += [saveHCalTool] + +# next, create the G4 algorithm, giving the list of names of tools ("XX/YY") +from Configurables import SimG4PrimariesFromEdmTool +particle_converter = SimG4PrimariesFromEdmTool("EdmConverter") +particle_converter.GenParticles.Path = "GenParticles" + +from Configurables import SimG4Alg +geantsim = SimG4Alg("SimG4Alg") +geantsim.eventProvider = particle_converter +ApplicationMgr().TopAlg += [geantsim] + +############## Digitization (Merging hits into cells, EM scale calibration) +# EM scale calibration (sampling fraction) +from Configurables import CalibrateInLayersTool + +calibEcalBarrel = CalibrateInLayersTool("CalibrateECalBarrel") +calibEcalBarrel.samplingFraction = [0.36571381189697705] * 1 + [0.09779064189677973] * 1 + [0.12564152224404024] * 1 + [0.14350599973146283] * 1 + [0.1557126972314961] * 1 + [0.16444759076233928] * 1 + [0.17097165096847836] * 1 + [0.17684775359805122] * 1 + [0.18181154293837265] * 1 + [0.18544247938196395] * 1 + [0.18922747431624687] * 1 + [0.21187001375505543] * 1 +calibEcalBarrel.readoutName = "ECalBarrelEta" +calibEcalBarrel.layerFieldName = "layer" + +from Configurables import CalibrateCaloHitsTool +calibHcells = CalibrateCaloHitsTool("CalibrateHCal") +calibHcells.invSamplingFraction = "41.66" + +# Create cells in ECal barrel +# 1. step - merge hits into cells with Eta and module segmentation (phi module is a 'physical' cell i.e. lead + LAr + PCB + LAr +lead) +# 2. step - rewrite the cellId using the Eta-Phi segmentation (merging several modules into one phi readout cell) +from Configurables import CreateCaloCells +createEcalBarrelCellsStep1 = CreateCaloCells("CreateECalBarrelCellsStep1") +createEcalBarrelCellsStep1.doCellCalibration = True +createEcalBarrelCellsStep1.calibTool = calibEcalBarrel +createEcalBarrelCellsStep1.addCellNoise = False +createEcalBarrelCellsStep1.filterCellNoise = False +# todo: add when update on cvmfs +createEcalBarrelCellsStep1.addPosition = True +createEcalBarrelCellsStep1.hits = "ECalBarrelPositionedHits" +createEcalBarrelCellsStep1.cells = "ECalBarrelCellsStep1" +ApplicationMgr().TopAlg += [createEcalBarrelCellsStep1] + +## Use Phi-Theta segmentation in ECal barrel +from Configurables import RedoSegmentation +resegmentEcalBarrel = RedoSegmentation("ReSegmentationEcal") +# old bitfield (readout) +resegmentEcalBarrel.oldReadoutName = "ECalBarrelEta" +# specify which fields are going to be altered (deleted/rewritten) +resegmentEcalBarrel.oldSegmentationIds = ["module"] +# new bitfield (readout), with new segmentation +resegmentEcalBarrel.newReadoutName = "ECalBarrelPhiEta" +resegmentEcalBarrel.inhits = "ECalBarrelCellsStep1" +resegmentEcalBarrel.outhits = "ECalBarrelCellsStep2" +ApplicationMgr().TopAlg += [resegmentEcalBarrel] + +EcalBarrelCellsName = "ECalBarrelCells" +from Configurables import CreateCaloCells +createEcalBarrelCells = CreateCaloCells("CreateECalBarrelCells") +createEcalBarrelCells.doCellCalibration = False +createEcalBarrelCells.addCellNoise = False +createEcalBarrelCells.filterCellNoise = False +createEcalBarrelCells.hits = "ECalBarrelCellsStep2" +createEcalBarrelCells.cells = "ECalBarrelCells" +ApplicationMgr().TopAlg += [createEcalBarrelCells] + +# Ecal barrel cell positions (good for physics, all coordinates set properly) +from Configurables import CellPositionsECalBarrelTool +cellPositionEcalBarrelTool = CellPositionsECalBarrelTool("CellPositionsECalBarrel") +cellPositionEcalBarrelTool.readoutName = "ECalBarrelPhiEta" + +from Configurables import CreateCaloCellPositionsFCCee +createEcalBarrelPositionedCells = CreateCaloCellPositionsFCCee("ECalBarrelPositionedCells") +createEcalBarrelPositionedCells.positionsECalBarrelTool = cellPositionEcalBarrelTool +createEcalBarrelPositionedCells.hits.Path = "ECalBarrelCells" +createEcalBarrelPositionedCells.positionedHits.Path = "ECalBarrelPositionedCells" +ApplicationMgr().TopAlg += [createEcalBarrelPositionedCells] + +# Create cells in HCal +# 1. step - merge hits into cells with the default readout +createHcalBarrelCells = CreateCaloCells("CreateHCaloCells") +createHcalBarrelCells.doCellCalibration = True +createHcalBarrelCells.calibTool = calibHcells +createHcalBarrelCells.addPosition = True +createHcalBarrelCells.addCellNoise = False +createHcalBarrelCells.filterCellNoise = False +createHcalBarrelCells.hits = "HCalBarrelPositionedHits" +createHcalBarrelCells.cells = "HCalBarrelCells" +ApplicationMgr().TopAlg += [createHcalBarrelCells] + +# sliding window clustering #FIXME not yet ready for key4hep +#Empty cells for parts of calorimeter not implemented yet +from Configurables import CreateEmptyCaloCellsCollection +createemptycells = CreateEmptyCaloCellsCollection("CreateEmptyCaloCells") +createemptycells.cells.Path = "emptyCaloCells" +ApplicationMgr().TopAlg += [createemptycells] + +from Configurables import CaloTowerTool +towers = CaloTowerTool("towers") +towers.deltaEtaTower = 0.01 +towers.deltaPhiTower = 2 * constants.pi / 768. +towers.ecalBarrelReadoutName = ecalBarrelReadoutNamePhiEta +towers.ecalEndcapReadoutName = "" +towers.ecalFwdReadoutName = "" +towers.hcalBarrelReadoutName = "" +towers.hcalExtBarrelReadoutName = "" +towers.hcalEndcapReadoutName = "" +towers.hcalFwdReadoutName = "" +towers.ecalBarrelCells.Path = EcalBarrelCellsName +towers.ecalEndcapCells.Path = "emptyCaloCells" +towers.ecalFwdCells.Path = "emptyCaloCells" +towers.hcalBarrelCells.Path = "emptyCaloCells" +towers.hcalExtBarrelCells.Path = "emptyCaloCells" +towers.hcalEndcapCells.Path = "emptyCaloCells" +towers.hcalFwdCells.Path = "emptyCaloCells" + + + +from Configurables import CreateCaloClustersSlidingWindow +createClusters = CreateCaloClustersSlidingWindow("CreateClusters") +# Cluster variables +createClusters.towerTool = towers +createClusters.nEtaWindow = 9 +createClusters.nPhiWindow = 17 +createClusters.nEtaPosition = 5 +createClusters.nPhiPosition = 11 +createClusters.nEtaDuplicates = 7 +createClusters.nPhiDuplicates = 13 +createClusters.nEtaFinal = 9 +createClusters.nPhiFinal = 17 +# Minimal energy to create a cluster in GeV (FCC-ee detectors have to reconstruct low energy particles) +createClusters.energyThreshold = 0.1 +createClusters.attachCells = True +createClusters.clusters.Path = "CaloClusters" +createClusters.clusterCells.Path = "CaloClusterCells" +ApplicationMgr().TopAlg += [createClusters] + + +################ Output +from Configurables import PodioOutput +out = PodioOutput("out") +out.outputCommands = ["keep *", "drop ECalBarrelHits", "drop HCal*", "drop ECalBarrelCellsStep*", "drop ECalBarrelPositionedHits", "drop emptyCaloCells", "drop CaloClusterCells"] +import uuid +out.filename = "output_fullCalo_SimAndDigi.root" +ApplicationMgr().TopAlg += [out] + +#CPU information +from Configurables import AuditorSvc, ChronoAuditor +chra = ChronoAuditor() +audsvc = AuditorSvc() +audsvc.Auditors = [chra] +gen.AuditExecute = True +hepmc_converter.AuditExecute = True +geantsim.AuditExecute = True +createEcalBarrelCellsStep1.AuditExecute = True +resegmentEcalBarrel.AuditExecute = True +createEcalBarrelCells.AuditExecute = True +createHcalBarrelCells.AuditExecute = True +out.AuditExecute = True +#ApplicationMgr().ExtSvc += [audsvc] + +from Configurables import EventCounter +event_counter = EventCounter('event_counter') +event_counter.Frequency = 10 +ApplicationMgr().TopAlg += [event_counter] + diff --git a/workflows/fccconfigkey4hep-devel-2/k4simdelphesalg_pythia.py b/workflows/fccconfigkey4hep-devel-2/k4simdelphesalg_pythia.py new file mode 100644 index 0000000..1a43df2 --- /dev/null +++ b/workflows/fccconfigkey4hep-devel-2/k4simdelphesalg_pythia.py @@ -0,0 +1,50 @@ +import os +from Gaudi.Configuration import * +from GaudiKernel import SystemOfUnits as units + +from Configurables import ApplicationMgr +ApplicationMgr().EvtSel = 'NONE' +ApplicationMgr().EvtMax = 10 + +from Configurables import k4DataSvc +podioevent = k4DataSvc("EventDataSvc") +ApplicationMgr().ExtSvc += [podioevent] + + +from Configurables import PythiaInterface +pythia8gentool = PythiaInterface() +### Example of pythia configuration file to generate events +# take from $K4GEN if defined, locally if not +path_to_pythiafile = os.environ.get("K4GEN", "") +pythiafilename = "Pythia_standard.cmd" +pythiafile = os.path.join(path_to_pythiafile, pythiafilename) +# Example of pythia configuration file to read LH event file +#pythiafile="options/Pythia_LHEinput.cmd" +pythia8gentool.pythiacard = pythiafile +pythia8gentool.doEvtGenDecays = False +pythia8gentool.printPythiaStatistics = True + +from Configurables import GenAlg +pythia8gen = GenAlg("Pythia8") +pythia8gen.SignalProvider = pythia8gentool +pythia8gen.hepmc.Path = "hepmc" +ApplicationMgr().TopAlg += [pythia8gen] + +from Configurables import HepMCToEDMConverter +hepmc_converter = HepMCToEDMConverter() +hepmc_converter.hepmc.Path="hepmc" +hepmc_converter.GenParticles.Path="GenParticles" +ApplicationMgr().TopAlg += [hepmc_converter] + +from Configurables import k4SimDelphesAlg +delphesalg = k4SimDelphesAlg() +delphesalg.DelphesCard = "delphes_card_IDEA.tcl" +delphesalg.DelphesOutputSettings = "edm4hep_output_config.tcl" +delphesalg.GenParticles.Path = "GenParticles" +delphesalg.OutputLevel = VERBOSE +ApplicationMgr().TopAlg += [delphesalg] + +from Configurables import PodioOutput +out = PodioOutput("out", filename = "output_k4SimDelphes_pythia.root") +out.outputCommands = ["keep *"] +ApplicationMgr().TopAlg += [out]