From 89f6555709218f89816a1356533387cc9af77bfa Mon Sep 17 00:00:00 2001 From: Juraj Smiesko Date: Wed, 21 Jan 2026 16:58:13 +0100 Subject: [PATCH] Reviving example workflows 01 and 03 --- init_fcc.sh | 3 - .../FCC_Dirac_Workflow1.py | 145 +++ .../Pythia_LHEinput.cmd | 30 + .../delphes_card_IDEA.tcl | 1008 +++++++++++++++++ .../edm4hep_output_config.tcl | 13 + .../03-delphes-pythia8/03-delphes-pyhia8.py | 72 ++ .../p8_ee_ggqq_ecm91.cmd | 10 +- .../test_fccprod_wf3.conf | 0 workflows/1/FCC_Dirac_Workflow1.py | 107 -- workflows/3/WF3.py | 33 - init_dirac.sh => workflows/setup_dirac.sh | 0 .../setup_proxy.sh | 0 12 files changed, 1272 insertions(+), 149 deletions(-) delete mode 100644 init_fcc.sh create mode 100644 workflows/01-ditau-with-kkmcee-and-delphes/FCC_Dirac_Workflow1.py create mode 100644 workflows/01-ditau-with-kkmcee-and-delphes/Pythia_LHEinput.cmd create mode 100644 workflows/01-ditau-with-kkmcee-and-delphes/delphes_card_IDEA.tcl create mode 100644 workflows/01-ditau-with-kkmcee-and-delphes/edm4hep_output_config.tcl create mode 100755 workflows/03-delphes-pythia8/03-delphes-pyhia8.py rename workflows/{3 => 03-delphes-pythia8}/p8_ee_ggqq_ecm91.cmd (73%) rename workflows/{3 => 03-delphes-pythia8}/test_fccprod_wf3.conf (100%) mode change 100755 => 100644 delete mode 100644 workflows/1/FCC_Dirac_Workflow1.py delete mode 100755 workflows/3/WF3.py rename init_dirac.sh => workflows/setup_dirac.sh (100%) rename init_dirac_proxy.sh => workflows/setup_proxy.sh (100%) diff --git a/init_fcc.sh b/init_fcc.sh deleted file mode 100644 index b12bef6..0000000 --- a/init_fcc.sh +++ /dev/null @@ -1,3 +0,0 @@ -# Enable the FCC software. Currently this is equivalent to enabling Key4HEP. -# In the future we may have something more specific to FCC -source /cvmfs/fcc.cern.ch/sw/latest/setup.sh diff --git a/workflows/01-ditau-with-kkmcee-and-delphes/FCC_Dirac_Workflow1.py b/workflows/01-ditau-with-kkmcee-and-delphes/FCC_Dirac_Workflow1.py new file mode 100644 index 0000000..5238f82 --- /dev/null +++ b/workflows/01-ditau-with-kkmcee-and-delphes/FCC_Dirac_Workflow1.py @@ -0,0 +1,145 @@ +''' +Example workflow 1 from the FCC Tutorial: +https://hep-fcc.github.io/fcc-tutorials/main/distributed-computing/workflows/01/DiTauKKMCeeDelphesStandAlone.html +''' + +# standard library imports +import os +from shutil import copy2 +# DIRAC imports +from DIRAC import gLogger, S_OK +from DIRAC.Core.Base import Script +# iLCDirac imports +from ILCDIRAC.Interfaces.API.DiracILC import DiracILC +from ILCDIRAC.Interfaces.API.NewInterface.UserJob import UserJob +from ILCDIRAC.Interfaces.API.NewInterface import Applications + + +def copywithreplace(filein: str, fileout: str, + repls: list[tuple[str, str]] = []): + ''' + Copy the contents of the file with possible string replacements. + ''' + # If no replacements, just copy the file + if repls is None: + copy2(filein, fileout) + return + + # Load the contents of the input file + with open(filein, 'rt', encoding='utf-8') as infile: + # open the output file to write the result to + lines = infile.readlines() + with open(fileout, 'wt', encoding='utf-8') as outfile: + # for each line in the input file + for line in lines: + # Apply each requested replacement + lout = line + for rpl in repls: + lout = lout.replace(str(rpl[0]), str(rpl[1])) + outfile.write(lout) + + +# Define a simple class to hold the script parameters +class Params: + def __init__(self): + self.where = 'local' + def run_on_wms(self, _): + self.where = 'wms' + return S_OK() + def run_locally(self, _): + self.where = 'local' + return S_OK() + + +def main(): + # Setup argument parsing + cli_params = Params() + + Script.registerSwitch('w', 'wms', 'Run on DIRAC WMS', + cli_params.run_on_wms) + Script.registerSwitch('l', 'local', 'Run locally', + cli_params.run_locally) + + Script.parseCommandLine() + + gLogger.notice('Submitting Example Workflow 1') + gLogger.notice(' - execution location: ', cli_params.where) + + # Creating an instance of an user job + + job = UserJob() + + job.setOutputSandbox(['*.log', '*.sh', '*.py', '*.xml']) + outputdatafile = 'kktautau_delphes_edm4hep_output.root' + job.setOutputData(outputdatafile, '', 'CERN-DST-EOS') + + job.setJobGroup('KKMC_EDM4HEP_Run') + job.setName('KKMC_EDM4HEP') + job.setLogLevel('DEBUG') + + # KKMCee generation + + kkmc_app = Applications.KKMC() + kkmc_app.setVersion('key4hep_250128') + kkmc_app.setEvtType('Tau') + kkmc_app.setEnergy(91.2) + nevts = 10000 + outputfile = f'kktautau_delphes_{nevts}.lhe' + kkmc_app.setNumberOfEvents(nevts) + kkmc_app.setOutputFile(outputfile) + + # Register KKMC application to the Job instance + job.append(kkmc_app) + + # Delphes simulation + + script_dir = os.path.dirname(os.path.realpath(__file__)) + + # Delphes IDEA card + # copy of $DELPHES/cards/delphes_card_IDEA.tcl + idea_card = 'delphes_card_IDEA.tcl' + copy2(os.path.join(script_dir, idea_card), idea_card) + # Delphes EDM4hep output card + # copy of $K4SIMDELPHES/edm4hep_output_config.tcl + edm4hep_output_def = 'edm4hep_output_config.tcl' + copy2(os.path.join(script_dir, edm4hep_output_def), edm4hep_output_def) + # Pythia card + # copy of $K4GEN/Pythia_LHEinput.cmd + pythia_card = 'Pythia_LHEinput.cmd' + replacements = [ + ('Main:numberOfEvents = 100', + f'Main:numberOfEvents = {nevts}'), + ('Beams:LHEF = Generation/data/events.lhe', + f'Beams:LHEF = {outputfile}') + ] + copywithreplace(os.path.join(script_dir, pythia_card), pythia_card, + replacements) + + # Set the sandbox content + job.setInputSandbox( + ['./' + idea_card, './' + edm4hep_output_def, './' + pythia_card] + ) + + ga = Applications.GenericApplication() + ga.setSetupScript( + '/cvmfs/sw.hsf.org/key4hep/releases/2025-01-28/' + 'x86_64-almalinux9-gcc14.2.0-opt/key4hep-stack/' + '2025-01-28-q6hyek/setup.sh' + ) + ga.setScript( + '/cvmfs/sw.hsf.org/key4hep/releases/2025-01-28/' + 'x86_64-almalinux9-gcc14.2.0-opt/k4simdelphes/00-07-04-naw5vm/' + 'bin/DelphesPythia8_EDM4HEP' + ) + ga.setArguments( + f'{idea_card} {edm4hep_output_def} {pythia_card} {outputdatafile}' + ) + + job.append(ga) + + dilc = DiracILC() + print(job.submit(dilc, mode=cli_params.where)) + + +if __name__ == '__main__': + main() diff --git a/workflows/01-ditau-with-kkmcee-and-delphes/Pythia_LHEinput.cmd b/workflows/01-ditau-with-kkmcee-and-delphes/Pythia_LHEinput.cmd new file mode 100644 index 0000000..ada9c99 --- /dev/null +++ b/workflows/01-ditau-with-kkmcee-and-delphes/Pythia_LHEinput.cmd @@ -0,0 +1,30 @@ +! +! File: Pythia_LHEinput.cmd +! +! This file contains commands to be read in for a Pythia8 run. +! Lines not beginning with a letter or digit are comments. +! Names are case-insensitive - but spellings-sensitive! +! Adjusted from Pythia example: main42.cmnd + +! 1) Settings that will be used in a main program. +Main:numberOfEvents = 100 ! number of events to generate +Main:timesAllowErrors = 100 ! abort run after this many flawed events + +! 2) Settings related to output in init(), next() and stat() functions. +Init:showChangedSettings = on ! list changed settings +Init:showAllSettings = off ! list all settings +Init:showChangedParticleData = on ! list changed particle data +Init:showAllParticleData = off ! list all particle data +Next:numberCount = 10 ! print message every n events +Next:numberShowLHA = 1 ! print LHA information n times +Next:numberShowInfo = 1 ! print event information n times +Next:numberShowProcess = 1 ! print process record n times +Next:numberShowEvent = 1 ! print event record n times +Stat:showPartonLevel = off ! additional statistics on MPI + +! 4) Read-in Les Houches Event file - alternative beam and process selection. +Beams:frameType = 4 ! read info from a LHEF +Beams:LHEF = Generation/data/events.lhe ! the LHEF to read from + +! 5) Other settings. Can be expanded as desired. +! Note: may overwrite some of the values above, so watch out. diff --git a/workflows/01-ditau-with-kkmcee-and-delphes/delphes_card_IDEA.tcl b/workflows/01-ditau-with-kkmcee-and-delphes/delphes_card_IDEA.tcl new file mode 100644 index 0000000..d83a173 --- /dev/null +++ b/workflows/01-ditau-with-kkmcee-and-delphes/delphes_card_IDEA.tcl @@ -0,0 +1,1008 @@ +set RandomSeed 123 + +#################################################################### l +# FCC-ee IDEA detector model +# +# Authors: Elisa Fontanesi, Lorenzo Pezzotti, Massimiliano Antonello, Michele Selvaggi +# email: efontane@bo.infn.it, +# lorenzo.pezzotti01@universitadipavia.it, +# m.antonello@uninsubria.it, +# michele.selvaggi@cern.ch +##################################################################### + +## MOD2: set vtx mode timing to MC truth + +set B 2.0 +set R 2.25 +set HL 2.5 + +## Drift chamber coordinates +set DCHZMIN -2.125 +set DCHZMAX 2.125 +set DCHRMIN 0.345 +set DCHRMAX 2.02 + + +####################################### +# Order of execution of various modules +####################################### + +set ExecutionPath { + + TruthVertexFinder + ParticlePropagator + + ChargedHadronTrackingEfficiency + ElectronTrackingEfficiency + MuonTrackingEfficiency + + TrackMergerPre + TrackSmearing + ClusterCounting + TimeSmearing + TimeOfFlight + + TrackMerger + ForwardLooperTracks + Calorimeter + + TimeSmearingNeutrals + TimeOfFlightNeutralHadron + + EFlowTrackMerger + EFlowMerger + + PhotonEfficiency + PhotonIsolation + + MuonFilter + TowerMerger + + ElectronFilter + ElectronEfficiency + ElectronIsolation + + MuonEfficiency + MuonIsolation + + MissingET + + NeutrinoFilter + GenJetFinder + GenMissingET + + FastJetFinder + JetEnergyScale + + GenJetFinderDurhamN2 + FastJetFinderDurhamN2 + + JetFlavorAssociation + + BTagging + CTagging + TauTagging + + TreeWriter +} + +################################# +# Truth Vertex Finder +################################# + +module TruthVertexFinder TruthVertexFinder { + + ## below this distance two vertices are assumed to be merged + set Resolution 1E-06 + + set InputArray Delphes/stableParticles + set VertexOutputArray vertices +} + + +################################# +# 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 $R + + # half-length: z of the solenoid, in m + set HalfLength $HL + + # magnetic field, in T + set Bz $B +} + +#################################### +# Charged hadron tracking efficiency +#################################### + +module Efficiency ChargedHadronTrackingEfficiency { + set InputArray ParticlePropagator/chargedHadrons + set OutputArray chargedHadrons + set UseMomentumVector true + + set EfficiencyFormula { + (abs(eta) > 2.56) * (0.000) + + (pt < 0.1) * (abs(eta) <= 2.56) * (0.000) + + (pt >= 0.1) * (abs(eta) <= 2.56) * (1.000) + } +} + + + +############################## +# Electron tracking efficiency +############################## + +module Efficiency ElectronTrackingEfficiency { + set InputArray ParticlePropagator/electrons + set OutputArray electrons + set UseMomentumVector true + + set EfficiencyFormula { + (abs(eta) > 2.56) * (0.000) + + (pt < 0.1) * (abs(eta) <= 2.56) * (0.000) + + (pt >= 0.1) * (abs(eta) <= 2.56) * (1.000) + } +} + + +########################## +# Muon tracking efficiency +########################## + +module Efficiency MuonTrackingEfficiency { + set InputArray ParticlePropagator/muons + set OutputArray muons + set UseMomentumVector true + + set EfficiencyFormula { + (abs(eta) > 2.56) * (0.000) + + (pt < 0.1) * (abs(eta) <= 2.56) * (0.000) + + (pt >= 0.1) * (abs(eta) <= 2.56) * (1.000) + } +} + +############## +# 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 + + ## minimum number of hits to accept a track + set NMinHits 6 + + ## magnetic field + set Bz $B + + ## scale factors + set ElectronScaleFactor {1.25} + + + 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.01 0.00241 0.35276 0 0 0 0 0 0 + 1 VTXLOW -0.0965 0.0965 0.0137 0.000309 0.0937 2 0 1.5708 3e-06 3e-06 1 + 1 VTXLOW -0.1609 0.1609 0.0237 0.000309 0.0937 2 0 1.5708 3e-06 3e-06 1 + 1 VTXLOW -0.257 0.257 0.0340 0.000309 0.0937 2 0 1.5708 3e-06 3e-06 1 + 1 VTXHIGH -0.1631 0.1631 0.141 0.000415 0.0937 2 0 1.5708 3e-06 3e-06 1 + 1 VTXHIGH -0.340 0.340 0.315 0.000415 0.0937 2 0 1.5708 7e-06 7e-06 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 579 1 0.0203738 0 0.0001 0 1 + 1 DCH -2 2 0.374775 0.0147748 579 1 -0.0212097 0 0.0001 0 1 + 1 DCH -2 2 0.38955 0.0147748 579 1 0.0220456 0 0.0001 0 1 + 1 DCH -2 2 0.404324 0.0147748 579 1 -0.0228814 0 0.0001 0 1 + 1 DCH -2 2 0.419099 0.0147748 579 1 0.0237172 0 0.0001 0 1 + 1 DCH -2 2 0.433874 0.0147748 579 1 -0.024553 0 0.0001 0 1 + 1 DCH -2 2 0.448649 0.0147748 579 1 0.0253888 0 0.0001 0 1 + 1 DCH -2 2 0.463423 0.0147748 579 1 -0.0262245 0 0.0001 0 1 + 1 DCH -2 2 0.478198 0.0147748 579 1 0.0270602 0 0.0001 0 1 + 1 DCH -2 2 0.492973 0.0147748 579 1 -0.0278958 0 0.0001 0 1 + 1 DCH -2 2 0.507748 0.0147748 579 1 0.0287314 0 0.0001 0 1 + 1 DCH -2 2 0.522523 0.0147748 579 1 -0.029567 0 0.0001 0 1 + 1 DCH -2 2 0.537297 0.0147748 579 1 0.0304025 0 0.0001 0 1 + 1 DCH -2 2 0.552072 0.0147748 579 1 -0.031238 0 0.0001 0 1 + 1 DCH -2 2 0.566847 0.0147748 579 1 0.0320734 0 0.0001 0 1 + 1 DCH -2 2 0.581622 0.0147748 579 1 -0.0329088 0 0.0001 0 1 + 1 DCH -2 2 0.596396 0.0147748 579 1 0.0337442 0 0.0001 0 1 + 1 DCH -2 2 0.611171 0.0147748 579 1 -0.0345795 0 0.0001 0 1 + 1 DCH -2 2 0.625946 0.0147748 579 1 0.0354147 0 0.0001 0 1 + 1 DCH -2 2 0.640721 0.0147748 579 1 -0.0362499 0 0.0001 0 1 + 1 DCH -2 2 0.655495 0.0147748 579 1 0.0370851 0 0.0001 0 1 + 1 DCH -2 2 0.67027 0.0147748 579 1 -0.0379202 0 0.0001 0 1 + 1 DCH -2 2 0.685045 0.0147748 579 1 0.0387552 0 0.0001 0 1 + 1 DCH -2 2 0.69982 0.0147748 579 1 -0.0395902 0 0.0001 0 1 + 1 DCH -2 2 0.714595 0.0147748 579 1 0.0404252 0 0.0001 0 1 + 1 DCH -2 2 0.729369 0.0147748 579 1 -0.04126 0 0.0001 0 1 + 1 DCH -2 2 0.744144 0.0147748 579 1 0.0420949 0 0.0001 0 1 + 1 DCH -2 2 0.758919 0.0147748 579 1 -0.0429296 0 0.0001 0 1 + 1 DCH -2 2 0.773694 0.0147748 579 1 0.0437643 0 0.0001 0 1 + 1 DCH -2 2 0.788468 0.0147748 579 1 -0.044599 0 0.0001 0 1 + 1 DCH -2 2 0.803243 0.0147748 579 1 0.0454336 0 0.0001 0 1 + 1 DCH -2 2 0.818018 0.0147748 579 1 -0.0462681 0 0.0001 0 1 + 1 DCH -2 2 0.832793 0.0147748 579 1 0.0471025 0 0.0001 0 1 + 1 DCH -2 2 0.847568 0.0147748 579 1 -0.0479369 0 0.0001 0 1 + 1 DCH -2 2 0.862342 0.0147748 579 1 0.0487713 0 0.0001 0 1 + 1 DCH -2 2 0.877117 0.0147748 579 1 -0.0496055 0 0.0001 0 1 + 1 DCH -2 2 0.891892 0.0147748 579 1 0.0504397 0 0.0001 0 1 + 1 DCH -2 2 0.906667 0.0147748 579 1 -0.0512738 0 0.0001 0 1 + 1 DCH -2 2 0.921441 0.0147748 579 1 0.0521079 0 0.0001 0 1 + 1 DCH -2 2 0.936216 0.0147748 579 1 -0.0529418 0 0.0001 0 1 + 1 DCH -2 2 0.950991 0.0147748 579 1 0.0537757 0 0.0001 0 1 + 1 DCH -2 2 0.965766 0.0147748 579 1 -0.0546095 0 0.0001 0 1 + 1 DCH -2 2 0.980541 0.0147748 579 1 0.0554433 0 0.0001 0 1 + 1 DCH -2 2 0.995315 0.0147748 579 1 -0.056277 0 0.0001 0 1 + 1 DCH -2 2 1.01009 0.0147748 579 1 0.0571106 0 0.0001 0 1 + 1 DCH -2 2 1.02486 0.0147748 579 1 -0.0579441 0 0.0001 0 1 + 1 DCH -2 2 1.03964 0.0147748 579 1 0.0587775 0 0.0001 0 1 + 1 DCH -2 2 1.05441 0.0147748 579 1 -0.0596108 0 0.0001 0 1 + 1 DCH -2 2 1.06919 0.0147748 579 1 0.0604441 0 0.0001 0 1 + 1 DCH -2 2 1.08396 0.0147748 579 1 -0.0612773 0 0.0001 0 1 + 1 DCH -2 2 1.09874 0.0147748 579 1 0.0621104 0 0.0001 0 1 + 1 DCH -2 2 1.11351 0.0147748 579 1 -0.0629434 0 0.0001 0 1 + 1 DCH -2 2 1.12829 0.0147748 579 1 0.0637763 0 0.0001 0 1 + 1 DCH -2 2 1.14306 0.0147748 579 1 -0.0646092 0 0.0001 0 1 + 1 DCH -2 2 1.15784 0.0147748 579 1 0.0654419 0 0.0001 0 1 + 1 DCH -2 2 1.17261 0.0147748 579 1 -0.0662746 0 0.0001 0 1 + 1 DCH -2 2 1.18739 0.0147748 579 1 0.0671071 0 0.0001 0 1 + 1 DCH -2 2 1.20216 0.0147748 579 1 -0.0679396 0 0.0001 0 1 + 1 DCH -2 2 1.21694 0.0147748 579 1 0.068772 0 0.0001 0 1 + 1 DCH -2 2 1.23171 0.0147748 579 1 -0.0696042 0 0.0001 0 1 + 1 DCH -2 2 1.24649 0.0147748 579 1 0.0704364 0 0.0001 0 1 + 1 DCH -2 2 1.26126 0.0147748 579 1 -0.0712685 0 0.0001 0 1 + 1 DCH -2 2 1.27604 0.0147748 579 1 0.0721005 0 0.0001 0 1 + 1 DCH -2 2 1.29081 0.0147748 579 1 -0.0729324 0 0.0001 0 1 + 1 DCH -2 2 1.30559 0.0147748 579 1 0.0737642 0 0.0001 0 1 + 1 DCH -2 2 1.32036 0.0147748 579 1 -0.0745958 0 0.0001 0 1 + 1 DCH -2 2 1.33514 0.0147748 579 1 0.0754274 0 0.0001 0 1 + 1 DCH -2 2 1.34991 0.0147748 579 1 -0.0762589 0 0.0001 0 1 + 1 DCH -2 2 1.36468 0.0147748 579 1 0.0770903 0 0.0001 0 1 + 1 DCH -2 2 1.37946 0.0147748 579 1 -0.0779215 0 0.0001 0 1 + 1 DCH -2 2 1.39423 0.0147748 579 1 0.0787527 0 0.0001 0 1 + 1 DCH -2 2 1.40901 0.0147748 579 1 -0.0795837 0 0.0001 0 1 + 1 DCH -2 2 1.42378 0.0147748 579 1 0.0804147 0 0.0001 0 1 + 1 DCH -2 2 1.43856 0.0147748 579 1 -0.0812455 0 0.0001 0 1 + 1 DCH -2 2 1.45333 0.0147748 579 1 0.0820762 0 0.0001 0 1 + 1 DCH -2 2 1.46811 0.0147748 579 1 -0.0829068 0 0.0001 0 1 + 1 DCH -2 2 1.48288 0.0147748 579 1 0.0837373 0 0.0001 0 1 + 1 DCH -2 2 1.49766 0.0147748 579 1 -0.0845677 0 0.0001 0 1 + 1 DCH -2 2 1.51243 0.0147748 579 1 0.0853979 0 0.0001 0 1 + 1 DCH -2 2 1.52721 0.0147748 579 1 -0.086228 0 0.0001 0 1 + 1 DCH -2 2 1.54198 0.0147748 579 1 0.087058 0 0.0001 0 1 + 1 DCH -2 2 1.55676 0.0147748 579 1 -0.0878879 0 0.0001 0 1 + 1 DCH -2 2 1.57153 0.0147748 579 1 0.0887177 0 0.0001 0 1 + 1 DCH -2 2 1.58631 0.0147748 579 1 -0.0895474 0 0.0001 0 1 + 1 DCH -2 2 1.60108 0.0147748 579 1 0.0903769 0 0.0001 0 1 + 1 DCH -2 2 1.61586 0.0147748 579 1 -0.0912063 0 0.0001 0 1 + 1 DCH -2 2 1.63063 0.0147748 579 1 0.0920356 0 0.0001 0 1 + 1 DCH -2 2 1.64541 0.0147748 579 1 -0.0928647 0 0.0001 0 1 + 1 DCH -2 2 1.66018 0.0147748 579 1 0.0936937 0 0.0001 0 1 + 1 DCH -2 2 1.67495 0.0147748 579 1 -0.0945226 0 0.0001 0 1 + 1 DCH -2 2 1.68973 0.0147748 579 1 0.0953514 0 0.0001 0 1 + 1 DCH -2 2 1.7045 0.0147748 579 1 -0.09618 0 0.0001 0 1 + 1 DCH -2 2 1.71928 0.0147748 579 1 0.0970085 0 0.0001 0 1 + 1 DCH -2 2 1.73405 0.0147748 579 1 -0.0978369 0 0.0001 0 1 + 1 DCH -2 2 1.74883 0.0147748 579 1 0.0986651 0 0.0001 0 1 + 1 DCH -2 2 1.7636 0.0147748 579 1 -0.0994932 0 0.0001 0 1 + 1 DCH -2 2 1.77838 0.0147748 579 1 0.100321 0 0.0001 0 1 + 1 DCH -2 2 1.79315 0.0147748 579 1 -0.101149 0 0.0001 0 1 + 1 DCH -2 2 1.80793 0.0147748 579 1 0.101977 0 0.0001 0 1 + 1 DCH -2 2 1.8227 0.0147748 579 1 -0.102804 0 0.0001 0 1 + 1 DCH -2 2 1.83748 0.0147748 579 1 0.103632 0 0.0001 0 1 + 1 DCH -2 2 1.85225 0.0147748 579 1 -0.104459 0 0.0001 0 1 + 1 DCH -2 2 1.86703 0.0147748 579 1 0.105286 0 0.0001 0 1 + 1 DCH -2 2 1.8818 0.0147748 579 1 -0.106113 0 0.0001 0 1 + 1 DCH -2 2 1.89658 0.0147748 579 1 0.10694 0 0.0001 0 1 + 1 DCH -2 2 1.91135 0.0147748 579 1 -0.107766 0 0.0001 0 1 + 1 DCH -2 2 1.92613 0.0147748 579 1 0.108593 0 0.0001 0 1 + 1 DCH -2 2 1.9409 0.0147748 579 1 -0.109419 0 0.0001 0 1 + 1 DCH -2 2 1.95568 0.0147748 579 1 0.110246 0 0.0001 0 1 + 1 DCH -2 2 1.97045 0.0147748 579 1 -0.111072 0 0.0001 0 1 + 1 DCH -2 2 1.98523 0.0147748 579 1 0.111898 0 0.0001 0 1 + 1 DCH -2 2 2 0.0147748 579 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 VTXFILLER 0.315 0.345 -0.369 0.000168 0.02 0 0 0 0 0 0 + 2 VTXFILLER 0.141 0.156 -0.195 0.000244 0.02 0 0 0 0 0 0 + 2 VTXDSK 0.108 0.3 -0.93 0.000909 0.0937 2 0 1.5708 7e-06 7e-06 1 + 2 VTXDSK 0.073 0.3 -0.62 0.000909 0.0937 2 0 1.5708 7e-06 7e-06 1 + 2 VTXDSK 0.034 0.28 -0.3023 0.000909 0.0937 2 0 1.5708 7e-06 7e-06 1 + 2 VTXDSK 0.034 0.28 0.3023 0.000909 0.0937 2 0 1.5708 7e-06 7e-06 1 + 2 VTXDSK 0.073 0.3 0.62 0.000909 0.0937 2 0 1.5708 7e-06 7e-06 1 + 2 VTXDSK 0.108 0.3 0.93 0.000909 0.0937 2 0 1.5708 7e-06 7e-06 1 + 2 VTXFILLER 0.141 0.156 0.195 0.000244 0.02 0 0 0 0 0 0 + 2 VTXFILLER 0.315 0.345 0.369 0.000168 0.02 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 DCHWALL 0.345 2.02 -2.125 0.25 5.55 0 0 0 0 0 0 + 2 FSILWRP 0.30 2.02 -2.32 0.00047 0.0937 2 0 1.5708 7e-006 9e-005 1 + 2 FSILWRP 0.30 2.02 -2.3 0.00047 0.0937 2 0 1.5708 7e-006 9e-005 1 + 2 FSILWRP 0.30 2.02 2.3 0.00047 0.0937 2 0 1.5708 7e-006 9e-005 1 + 2 FSILWRP 0.30 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 + + } + +} + +################### +# Cluster Counting +################### + +module ClusterCounting ClusterCounting { + + add InputArray TrackSmearing/tracks + set OutputArray tracks + + set Bz $B + + ## check that these are consistent with DCHCANI/DCHNANO parameters in TrackCovariance module + set Rmin $DCHRMIN + set Rmax $DCHRMAX + set Zmin $DCHZMIN + set Zmax $DCHZMAX + + # gas mix option: + # 0: Helium 90% - Isobutane 10% + # 1: Helium 100% + # 2: Argon 50% - Ethane 50% + # 3: Argon 100% + + set GasOption 0 + +} + + +######################################## +# Time Smearing MIP +######################################## + +module TimeSmearing TimeSmearing { + set InputArray ClusterCounting/tracks + set OutputArray tracks + + # assume constant 30 ps resolution for now + set TimeResolution { + (abs(eta) > 0.0 && abs(eta) <= 3.0)* 30E-12 + } +} + + +######################################## +# Time Of Flight Measurement +######################################## + +module TimeOfFlight TimeOfFlight { + set InputArray TimeSmearing/tracks + set VertexInputArray TruthVertexFinder/vertices + + set OutputArray tracks + + # 0: assume vertex time tV from MC Truth (ideal case) + # 1: assume vertex time tV = 0 + # 2: calculate vertex time as vertex TOF, assuming tPV=0 + + set VertexTimeMode 0 +} + +############## +# Track merger +############## + +module Merger TrackMerger { +# add InputArray InputArray + add InputArray TimeOfFlight/tracks + set OutputArray tracks +} + + +###################### +# Looper Selection +###################### + +module Efficiency ForwardLooperTracks { + set InputArray TrackMerger/tracks + set OutputArray tracks + set UseMomentumVector False + + ## select looping tracks that end up in position |eta| > 3.142 (lost by calo) + set EfficiencyFormula { + (abs(eta) > 3.0 ) * (1.000) + + (abs(eta) <= 3.0 ) * (0.000) + } + +} + + +############# +# 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 ECalMinSignificance 2.0 + set HCalMinSignificance 2.5 + + set SmearLogNormal false + + set SmearTowerCenter true + #set SmearTowerCenter false + 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 + + set EtaPhiRes 0.02 + set EtaMax 3.0 + + set pi [expr {acos(-1)}] + + set nbins_phi [expr {$pi/$EtaPhiRes} ] + set nbins_phi [expr {int($nbins_phi)} ] + + set PhiBins {} + for {set i -$nbins_phi} {$i <= $nbins_phi} {incr i} { + add PhiBins [expr {$i * $pi/$nbins_phi}] + } + + set nbins_eta [expr {$EtaMax/$EtaPhiRes} ] + set nbins_eta [expr {int($nbins_eta)} ] + + for {set i -$nbins_eta} {$i <= $nbins_eta} {incr i} { + set eta [expr {$i * $EtaPhiRes}] + 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 {130} {0.3 0.7} + add EnergyFraction {3122} {0.3 0.7} + + + ## ECAL crystals for the EM part from 2008.00338 + # set ECalResolutionFormula {resolution formula as a function of eta and energy} + set ECalResolutionFormula { + (abs(eta) <= 0.88 ) * sqrt(energy^2*0.005^2 + energy*0.03^2 + 0.002^2)+ + (abs(eta) > 0.88 && abs(eta) <= 3.0) * sqrt(energy^2*0.005^2 + energy*0.03^2 + 0.002^2) + } + + + # Dual Readout + # 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.3^2 + 0.05^2)+ + (abs(eta) > 0.88 && abs(eta) <= 3.0) * sqrt(energy^2*0.01^2 + energy*0.3^2 + 0.05^2) + } +} + +######################################## +# Time Smearing Neutrals +######################################## + +module TimeSmearing TimeSmearingNeutrals { + set InputArray Calorimeter/eflowNeutralHadrons + set OutputArray eflowNeutralHadrons + + # assume constant 30 ps resolution for now + set TimeResolution { + (abs(eta) > 0.0 && abs(eta) <= 3.0)* 30E-12 + } +} + +######################################## +# Time Of Flight Measurement +######################################## + +module TimeOfFlight TimeOfFlightNeutralHadron { + set InputArray TimeSmearingNeutrals/eflowNeutralHadrons + set VertexInputArray TruthVertexFinder/vertices + + set OutputArray eflowNeutralHadrons + + # 0: assume vertex time tV from MC Truth (ideal case) + # 1: assume vertex time tV = 0 + # 2: calculate vertex time as vertex TOF, assuming tPV=0 + + ## TBF (add option to take hard vertex time) + set VertexTimeMode 1 +} + + +############################ +# Energy flow track merger +############################ + +module Merger EFlowTrackMerger { +# add InputArray InputArray + add InputArray Calorimeter/eflowTracks + add InputArray ForwardLooperTracks/tracks + set OutputArray eflowTracks +} + + + +#################### +# Energy flow merger +#################### + +module Merger EFlowMerger { +# add InputArray InputArray + add InputArray EFlowTrackMerger/eflowTracks + add InputArray Calorimeter/eflowPhotons + add InputArray TimeOfFlightNeutralHadron/eflowNeutralHadrons + set OutputArray eflow +} + + +#################### +# Tower merger +#################### + +module Merger TowerMerger { +# add InputArray InputArray + add InputArray Calorimeter/towers + add InputArray MuonFilter/muons + set OutputArray towers +} + + +################### +# 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 9999. +} + +################# +# Electron filter +################# + +module PdgCodeFilter ElectronFilter { + set InputArray EFlowTrackMerger/eflowTracks + set OutputArray electrons + set Invert true + add PdgCode {11} + add PdgCode {-11} +} + +################# +# Muon filter +################# + +module PdgCodeFilter MuonFilter { + set InputArray EFlowTrackMerger/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 9999 +} + +################# +# 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 9999. +} + +################### +# Missing ET merger +################### + +module Merger MissingET { +# add InputArray InputArray + add InputArray EFlowMerger/eflow + set MomentumOutputArray momentum +} + + +##################### +# 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} +} + +################################### +# Gen Jet finder Durham exclusive +################################### + +module FastJetFinder GenJetFinderDurhamN2 { + + set InputArray NeutrinoFilter/filteredParticles + set OutputArray jets + + # algorithm: 11 ee-durham kT algorithm + # ref: https://indico.cern.ch/event/1173562/contributions/4929025/attachments/2470068/4237859/2022-06-FCC-jets.pdf + # to run exclusive njet mode set NJets to int + # to run exclusive dcut mode set DCut to float + # if DCut > 0 will run in dcut mode + + set JetAlgorithm 11 + set ExclusiveClustering true + set NJets 2 + # set DCut 10.0 +} + +################################ +# Jet finder Durham exclusive +################################ + +module FastJetFinder FastJetFinderDurhamN2 { +# set InputArray Calorimeter/towers + set InputArray EFlowMerger/eflow + + set OutputArray jets + + # algorithm: 11 ee-durham kT algorithm + # ref: https://indico.cern.ch/event/1173562/contributions/4929025/attachments/2470068/4237859/2022-06-FCC-jets.pdf + # to run exclusive njet mode set NJets to int + # to run exclusive dcut mode set DCut to float + # if DCut > 0 will run in dcut mode + + set JetAlgorithm 11 + set ExclusiveClustering true + set NJets 2 + # set DCut 10.0 + +} + + + + +##################### +# MC truth jet finder +##################### + +module FastJetFinder GenJetFinder { + set InputArray NeutrinoFilter/filteredParticles + set OutputArray jets + + set JetAlgorithm 10 + set ParameterR 1.5 + set ParameterP -1.0 + 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 10 + set ParameterR 1.5 + set ParameterP -1.0 + set JetPTMin 1.0 + + +} + +################## +# Jet Energy Scale +################## + +module EnergyScale JetEnergyScale { + set InputArray FastJetFinder/jets + set OutputArray jets + + # scale formula for jets + set ScaleFormula {1.00} +} + +######################## +# 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.005} + + # efficiency formula for c-jets (misidentification rate) + add EfficiencyFormula {4} {0.01} + + # efficiency formula for b-jets + add EfficiencyFormula {5} {0.85} +} + +########### +# c-tagging +########### + +module BTagging CTagging { + set JetInputArray JetEnergyScale/jets + + set BitNumber 1 + + # 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 {5} {0.05} + + # efficiency formula for b-jets + add EfficiencyFormula {4} {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.01} + # efficiency formula for tau-jets + add EfficiencyFormula {15} {0.85} +} + + + +################## +# 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 TruthVertexFinder/vertices GenVertex Vertex + + add Branch EFlowTrackMerger/eflowTracks EFlowTrack Track + add Branch TrackSmearing/tracks Track Track + add Branch Calorimeter/eflowPhotons EFlowPhoton Tower + add Branch TimeOfFlightNeutralHadron/eflowNeutralHadrons EFlowNeutralHadron Tower + + add Branch EFlowMerger/eflow ParticleFlowCandidate ParticleFlowCandidate + add Branch Calorimeter/towers Tower Tower + + add Branch ElectronEfficiency/electrons Electron Electron + add Branch MuonEfficiency/muons Muon Muon + add Branch PhotonEfficiency/photons Photon Photon + + add Branch JetEnergyScale/jets Jet Jet + add Branch MissingET/momentum MissingET MissingET + + add Branch GenJetFinder/jets GenJet Jet + add Branch GenMissingET/momentum GenMissingET MissingET + + add Branch GenJetFinderDurhamN2/jets GenJetDurhamN2 Jet + add Branch FastJetFinderDurhamN2/jets JetDurhamN2 Jet + + # add Info InfoName InfoValue + add Info Bz $B +} diff --git a/workflows/01-ditau-with-kkmcee-and-delphes/edm4hep_output_config.tcl b/workflows/01-ditau-with-kkmcee-and-delphes/edm4hep_output_config.tcl new file mode 100644 index 0000000..5fce728 --- /dev/null +++ b/workflows/01-ditau-with-kkmcee-and-delphes/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 RecoMCParticleLinkCollectionName RecoMCLink +} diff --git a/workflows/03-delphes-pythia8/03-delphes-pyhia8.py b/workflows/03-delphes-pythia8/03-delphes-pyhia8.py new file mode 100755 index 0000000..88283e2 --- /dev/null +++ b/workflows/03-delphes-pythia8/03-delphes-pyhia8.py @@ -0,0 +1,72 @@ +#!/bin/env python + +''' +Generates Delphes+Pythia8 ee->ggqq @ 91.188 GeV sample. +''' +import os +import shutil + +from DIRAC import gLogger, S_OK +from DIRAC.Core.Base.Script import Script + +from ILCDIRAC.Interfaces.API.NewInterface.Applications import DelphesApp +from ILCDIRAC.Interfaces.API.NewInterface.UserJob import UserJob +from ILCDIRAC.Interfaces.API.DiracILC import DiracILC + +# Class to hold the script parameters +class Params: + def __init__(self): + self.where = 'local' + + def run_on_wms(self, _): + self.where = 'wms' + return S_OK() + + def run_locally(self, _): + self.where = 'local' + return S_OK() + + +def submit(cli_params): + ''' + The definition of the DIRAC job itself. + ''' + + p8_card = 'p8_ee_ggqq_ecm91.cmd' + shutil.copy2(f'../{p8_card}', os.getcwd()) + output_data_file = 'output.root' + + job = UserJob() + job.setConfigPackage('fccConfig', 'key4hep-devel-6') + job.setOutputData(output_data_file, '', 'CNAF-DISK') + + delphes = DelphesApp() + delphes.setVersion('key4hep-latest') + delphes.setExecutableName('DelphesPythia8_EDM4HEP') + delphes.setDetectorCard('card_IDEA.tcl') + delphes.setOutputCard('edm4hep_IDEA.tcl') + delphes.setPythia8Card(p8_card) + delphes.setRandomSeed(36) + delphes.setEnergy(91.188) + delphes.setNumberOfEvents(100) + delphes.setOutputFile(output_data_file) + + job.append(delphes) + job.submit(DiracILC(), mode=cli_params.where) + + +if __name__ == "__main__": + # Setup argument parsing + cli_params = Params() + + Script.registerSwitch('w', 'wms', 'Run on DIRAC WMS', + cli_params.run_on_wms) + Script.registerSwitch('l', 'local', 'Run locally', + cli_params.run_locally) + + Script.parseCommandLine() + + gLogger.notice('Submitting Workflow 3') + gLogger.notice(' - execution location: ', cli_params.where) + + submit(cli_params) diff --git a/workflows/3/p8_ee_ggqq_ecm91.cmd b/workflows/03-delphes-pythia8/p8_ee_ggqq_ecm91.cmd similarity index 73% rename from workflows/3/p8_ee_ggqq_ecm91.cmd rename to workflows/03-delphes-pythia8/p8_ee_ggqq_ecm91.cmd index 95e0949..efcd7b6 100644 --- a/workflows/3/p8_ee_ggqq_ecm91.cmd +++ b/workflows/03-delphes-pythia8/p8_ee_ggqq_ecm91.cmd @@ -1,27 +1,25 @@ 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: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 +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 +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/3/test_fccprod_wf3.conf b/workflows/03-delphes-pythia8/test_fccprod_wf3.conf old mode 100755 new mode 100644 similarity index 100% rename from workflows/3/test_fccprod_wf3.conf rename to workflows/03-delphes-pythia8/test_fccprod_wf3.conf diff --git a/workflows/1/FCC_Dirac_Workflow1.py b/workflows/1/FCC_Dirac_Workflow1.py deleted file mode 100644 index bbfe748..0000000 --- a/workflows/1/FCC_Dirac_Workflow1.py +++ /dev/null @@ -1,107 +0,0 @@ -###################################################################################### -### This script steers the execution of workflow 1 in DIRAC (iLCDirac) -###################################################################################### - -# Create sandbox files -import os -from shutil import copy2 -import array - -# Utility function -def copywithreplace(filein, fileout, repls): - # If no replacements, just copy the file - if len(repls) == 0: - copy2(filein, fileout) - return - # input file - fin = open(filein, "rt") - # output file to write the result to - fout = open(fileout, "wt") - # for each line in the input file - for line in fin: - # Apply each requested replacement - ltmp = line - for r in repls: - lout = ltmp.replace(str(r[0]), str(r[1])) - ltmp = lout - fout.write(lout) - # close input and output files - fin.close() - fout.close() - -# DIRAC part -from DIRAC import S_OK, S_ERROR -from DIRAC.Core.Base import Script - -# Define a simple class to hold the script parameters -class Params(object): - def __init__(self): - self.wms = 'wms' - def setWMS(self, value): - self.wms = value - return S_OK() - -# Instantiate the params class -cliParams = Params() -Script.registerSwitch('w', 'wms', "WMS where to run", cliParams.setWMS) -Script.parseCommandLine(ignoreErrors=False) -# Get the list of services (the switch above appearer as servicesList[0]) -servicesList = Script.getPositionalArgs() -print servicesList - -from ILCDIRAC.Interfaces.API.DiracILC import DiracILC -from ILCDIRAC.Interfaces.API.NewInterface.UserJob import UserJob -from ILCDIRAC.Interfaces.API.NewInterface.Applications import KKMC, GenericApplication - -dIlc = DiracILC() - -job = UserJob() -job.setOutputSandbox(['*.log', '*.sh', '*.py', '*.xml']) -outputdatafile='kktautau_delphes_edm4hep_output.root' -job.setOutputData(outputdatafile, '','CERN-DST-EOS' ) - -job.setJobGroup( "KKMC_EDM4HEP_Run" ) -job.setName( "KKMC_EDM4HEP" ) -job.setLogLevel("DEBUG") - -kkmc = KKMC() -kkmc.setVersion('Key4hep-2021-04-30') -kkmc.setEvtType('Tau') -kkmc.setEnergy(91.2) -nevts = 10000 -outputfile = 'kktautau_delphes_' + str(nevts) + '.LHE' -kkmc.setNumberOfEvents(nevts) -kkmc.setOutputFile(outputfile) - -job.append(kkmc) - -# Delphes card -delphescardpath=os.path.expandvars('$DELPHES/cards/delphes_card_IDEA.tcl') -delphescard=os.path.basename(delphescardpath) -copy2(delphescardpath, delphescard) -# EDM4hep output definition -edm4hepoutdefpath=os.path.expandvars('$K4SIMDELPHES/edm4hep_output_config.tcl') -edm4hepoutdef=os.path.basename(edm4hepoutdefpath) -copy2(edm4hepoutdefpath, edm4hepoutdef) -# Pythia card -pythiacardpath=os.path.expandvars('$K4GEN/Pythia_LHEinput.cmd') -pythiacard=os.path.basename(pythiacardpath) -replacements = [['Main:numberOfEvents = 100','Main:numberOfEvents = ' + str(nevts)], - ['Beams:LHEF = Generation/data/events.lhe','Beams:LHEF = ' + outputfile]] -copywithreplace(pythiacardpath, pythiacard, replacements) - -# Set the sandbox content -job.setInputSandbox(['./' + delphescard, './' + edm4hepoutdef, './' + pythiacard]) - -ga = GenericApplication() -ga.setSetupScript("/cvmfs/sw.hsf.org/spackages2/key4hep-stack/2021-04-30/x86_64-centos7-gcc8.3.0-opt/t5gcd6ltt2ikybap2ndoztsg5uyorxzg/setup.sh") -ga.setScript("/cvmfs/sw.hsf.org/spackages2/k4simdelphes/00-01-05/x86_64-centos7-gcc8.3.0-opt/beesqo4r5wuqrrijyz57kxbqcdp5pp4v/bin/DelphesPythia8_EDM4HEP") -ga.setArguments(delphescard + ' ' + edm4hepoutdef + ' ' + pythiacard + ' ' + outputdatafile) - -job.append(ga) - -submitmode='wms' -if len(servicesList) > 0: - submitmode= servicesList[0] -print job.submit(dIlc, mode=submitmode) - diff --git a/workflows/3/WF3.py b/workflows/3/WF3.py deleted file mode 100755 index 9115b58..0000000 --- a/workflows/3/WF3.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/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.setExecutableName("DelphesPythia8_EDM4HEP") - delphes.setDetectorCard('card_IDEA.tcl') - delphes.setOutputCard('edm4hep_IDEA.tcl') - delphes.setPythia8Card('p8_ee_Zbb_ecm91.cmd') - delphes.setRandomSeed(36) - delphes.setEnergy(91.188) - delphes.setNumberOfEvents(100) - delphes.setOutputFile('output.root') - - job.append(delphes) - job.submit(DiracILC(), mode='local') - - - -if __name__ =="__main__": - run() diff --git a/init_dirac.sh b/workflows/setup_dirac.sh similarity index 100% rename from init_dirac.sh rename to workflows/setup_dirac.sh diff --git a/init_dirac_proxy.sh b/workflows/setup_proxy.sh similarity index 100% rename from init_dirac_proxy.sh rename to workflows/setup_proxy.sh