diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..5e497d9 --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,131 @@ +name: Build Docker Images +on: + push: + branches: + - 'master' + tags: + - 'v*' + pull_request: + branches: + - 'master' +jobs: +# +# Build and deploy the docker images + build: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Docker Meta + id: meta + uses: docker/metadata-action@v3 + with: + images: ${{ secrets.DOCKERHUB_REPOSITORY }}/mucoll-dummy + - + name: Run checks + run: | + pwd + ls + docker --version + - + name: Build and Push (mucoll-environment) + id: docker_build_mucoll-environment + uses: docker/build-push-action@v2 + with: + push: true + context: ./CentOS8 + file: ./CentOS8/Dockerfile-environment + tags: ${{ secrets.DOCKERHUB_REPOSITORY }}/mucoll-environment:${{steps.meta.outputs.version}}-centos8 + - + name: Build and Push (mucoll-ilc-base) + id: docker_build_mucoll-ilc-base + uses: docker/build-push-action@v2 + with: + push: true + context: ./CentOS8 + file: ./CentOS8/Dockerfile-ilc-base + build-args: | + VERSION=${{ steps.meta.outputs.version }} + REPOSITORY=${{ secrets.DOCKERHUB_REPOSITORY }} + tags: ${{ secrets.DOCKERHUB_REPOSITORY }}/mucoll-ilc-base:${{steps.meta.outputs.version}}-centos8 + - + name: Build and Push (mucoll-ilc-framework) + id: docker_build_mucoll-ilc-framework + uses: docker/build-push-action@v2 + with: + push: true + context: ./CentOS8 + file: ./CentOS8/Dockerfile-ilc-framework + build-args: | + VERSION=${{ steps.meta.outputs.version }} + REPOSITORY=${{ secrets.DOCKERHUB_REPOSITORY }} + tags: ${{ secrets.DOCKERHUB_REPOSITORY }}/mucoll-ilc-framework:${{steps.meta.outputs.version}}-centos8,${{ secrets.DOCKERHUB_REPOSITORY }}/mucoll-ilc-framework:${{github.sha}}-centos8 +# +# Generate test events + sim: + needs: build + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - + id: cache-sim + name: Cache Event Simulation + uses: actions/cache@v2 + with: + path: ./muonGun_sim_MuColl_v1.slcio + key: events-${{ hashFiles('test/sim_steer_muonGun_MuColl_v1.py') }} + - name: Simulate Events + if: steps.cache-sim.outputs.cache-hit != 'true' + run: | + docker run -v ${PWD}:/var/myrun -w /var/myrun ${{ secrets.DOCKERHUB_REPOSITORY }}/mucoll-ilc-framework:${{github.sha}}-centos8 /bin/bash -c " + source /opt/ilcsoft/muonc/init_ilcsoft.sh && + ddsim --steeringFile test/sim_steer_muonGun_MuColl_v1.py + " +# +# Test ACTS + proc: + needs: sim + runs-on: ubuntu-latest + strategy: + matrix: + steer: + - /opt/ilcsoft/muonc/ACTSTracking/*/share/ACTSTracking/example/actstruth_steer.xml + - /opt/ilcsoft/muonc/ACTSTracking/*/share/ACTSTracking/example/actstruthckf_steer.xml + - /opt/ilcsoft/muonc/ACTSTracking/*/share/ACTSTracking/example/actsseed_steer.xml + - /opt/ilcsoft/muonc/ACTSTracking/*/share/ACTSTracking/example/actsseedckf_steer.xml + steps: + - + name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - + name: Cache Event Simulation + uses: actions/cache@v2 + with: + path: ./muonGun_sim_MuColl_v1.slcio + key: events-${{ hashFiles('test/sim_steer_muonGun_MuColl_v1.py') }} + - + name: Run ACTSTracking example + run: | + docker run -v ${PWD}:/var/myrun -w /var/myrun ${{ secrets.DOCKERHUB_REPOSITORY }}/mucoll-ilc-framework:${{github.sha}}-centos8 /bin/bash -c " + source /opt/ilcsoft/muonc/init_ilcsoft.sh && + Marlin ${{ matrix.steer }} --global.LCIOInputFiles=muonGun_sim_MuColl_v1.slcio + " diff --git a/CentOS8/Dockerfile-environment b/CentOS8/Dockerfile-environment index a945ac7..dfa41f0 100644 --- a/CentOS8/Dockerfile-environment +++ b/CentOS8/Dockerfile-environment @@ -1,6 +1,5 @@ ############################################################################### -# Repository: mucoll-environment -# Tag: 1.5-centos8 +# Image: mucoll-environment ############################################################################### FROM centos:centos8 @@ -31,6 +30,12 @@ RUN yum -y install vim-enhanced xorg-x11-xauth screen git subversion rsync make root-geom root-graf3d-eve7 root-gui-browserv7 root-tpython \ root-unuran root-minuit2 root-smatrix gsl-devel geant4-devel clhep-devel HepMC3-devel +## Apache Arrow (https://arrow.apache.org/install/) +RUN yum install -y https://apache.jfrog.io/artifactory/arrow/centos/$(cut -d: -f5 /etc/system-release-cpe | cut -d. -f1)/apache-arrow-release-latest.rpm && \ + yum install -y arrow-devel arrow-glib-devel \ + arrow-dataset-devel \ + parquet-devel parquet-glib-devel + ## all datasets in the container !!!! RUN geant4-dataset-download @@ -42,4 +47,3 @@ RUN alternatives --set python /usr/bin/python3 && \ COPY c++config.h /usr/include/c++/8/x86_64-redhat-linux/bits/c++config.h COPY c++config_32.h /usr/include/c++/8/x86_64-redhat-linux/32/bits/c++config.h - diff --git a/CentOS8/Dockerfile-ilc-base b/CentOS8/Dockerfile-ilc-base index 402383f..43e925f 100644 --- a/CentOS8/Dockerfile-ilc-base +++ b/CentOS8/Dockerfile-ilc-base @@ -1,13 +1,14 @@ ############################################################################### -# Repository: mucoll-ilc-base -# Tag: 1.5-centos8 +# Image: mucoll-ilc-base ############################################################################### -FROM infnpd/mucoll-environment:1.5-centos8 +ARG VERSION=devel +ARG REPOSITORY=infnpd +FROM ${REPOSITORY}/mucoll-environment:${VERSION}-centos8 -RUN cd /opt && git clone https://github.com/MuonColliderSoft/MuonCutil.git && \ +RUN cd /opt && git clone https://github.com/kkrizka/MuonCutil.git && \ git clone https://github.com/MuonColliderSoft/iLCInstall.git && \ - cd /opt/MuonCutil && git checkout 0769c7c790d47a71f7a9a012dcbfb1d2a23d34dd && \ + cd /opt/MuonCutil && git checkout officialacts && \ cd /opt/iLCInstall && git checkout aee417fceb83b6f1892bdd492dca8e358a520c5c && \ sed -i 's|/usr/bin/env python|/usr/bin/env python2|g' ilcsoft-install && \ mkdir releases/development && \ diff --git a/CentOS8/Dockerfile-ilc-framework b/CentOS8/Dockerfile-ilc-framework index 7b1d17b..db85f80 100644 --- a/CentOS8/Dockerfile-ilc-framework +++ b/CentOS8/Dockerfile-ilc-framework @@ -1,9 +1,10 @@ ############################################################################### -# Repository: mucoll-ilc-framework -# Tag: 1.5-centos8 +# Image: mucoll-ilc-framework ############################################################################### -FROM infnpd/mucoll-ilc-base:1.5-centos8 +ARG VERSION=devel +ARG REPOSITORY=infnpd +FROM ${REPOSITORY}/mucoll-ilc-base:${VERSION}-centos8 RUN cd /opt/iLCInstall && \ ./ilcsoft-install releases/development/release-ilcsoft.cfg --install-prefix=/opt/ilcsoft -v -i @@ -15,5 +16,3 @@ RUN cd /opt/ilcsoft/muonc && \ RUN sed -i -e 's|/bin/env python|/usr/bin/env python2|g' /opt/ilcsoft/muonc/CEDViewer/*/bin/ced2go COPY profile.d_ilcsoft.sh /etc/profile.d/ilcsoft.sh - - diff --git a/README.md b/README.md index b0177bf..a8e25a8 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,13 @@ Docker files for Muon Collider software The incremental images for the framework can be built with the following command: ``` cd CentOS8 -docker build -f Dockerfile-environment -t infnpd/mucoll-environment:1.5-centos8 . -docker build -f Dockerfile-ilc-base -t infnpd/mucoll-ilc-base:1.5-centos8 . -docker build -f Dockerfile-ilc-framework -t infnpd/mucoll-ilc-framework:1.5-centos8 . +docker build -f Dockerfile-environment -t infnpd/mucoll-environment:devel-centos8 . +docker build -f Dockerfile-ilc-base -t infnpd/mucoll-ilc-base:devel-centos8 . +docker build -f Dockerfile-ilc-framework -t infnpd/mucoll-ilc-framework:devel-centos8 . ``` A useful way to test the image is running a shell on the container: ``` -docker run -ti --rm --entrypoint /bin/bash infnpd/mucoll-ilc-framework:1.5-centos8 +docker run -ti --rm --entrypoint /bin/bash infnpd/mucoll-ilc-framework:devel-centos8 ``` and inspect its content. diff --git a/test/sim_steer_muonGun_MuColl_v1.py b/test/sim_steer_muonGun_MuColl_v1.py new file mode 100644 index 0000000..8bac680 --- /dev/null +++ b/test/sim_steer_muonGun_MuColl_v1.py @@ -0,0 +1,239 @@ +import os + +from DDSim.DD4hepSimulation import DD4hepSimulation +from g4units import mm, GeV, MeV, m, deg +SIM = DD4hepSimulation() + +## The compact XML file +SIM.compactFile = "/opt/ilcsoft/muonc/detector-simulation/geometries/MuColl_v1/MuColl_v1.xml" +## Lorentz boost for the crossing angle, in radian! +SIM.crossingAngleBoost = 0. +SIM.enableDetailedShowerMode = True +SIM.enableG4GPS = False +SIM.enableG4Gun = False +SIM.enableGun = True +## InputFiles for simulation .stdhep, .slcio, .HEPEvt, .hepevt, .hepmc files are supported +SIM.inputFiles = [] +## Macro file to execute for runType 'run' or 'vis' +SIM.macroFile = [] +## number of events to simulate, used in batch mode +SIM.numberOfEvents = 10 +## Outputfile from the simulation,only lcio output is supported +SIM.outputFile = "muonGun_sim_MuColl_v1.slcio" +## Verbosity use integers from 1(most) to 7(least) verbose +## or strings: VERBOSE, DEBUG, INFO, WARNING, ERROR, FATAL, ALWAYS +SIM.printLevel = 3 +## The type of action to do in this invocation +## batch: just simulate some events, needs numberOfEvents, and input file or gun +## vis: enable visualisation, run the macroFile if it is set +## run: run the macroFile and exit +## shell: enable interactive session +SIM.runType = "batch" +## Skip first N events when reading a file +SIM.skipNEvents = 0 +## Steering file to change default behaviour +SIM.steeringFile = None +## FourVector of translation for the Smearing of the Vertex position: x y z t +SIM.vertexOffset = [0.0, 0.0, 0.0, 0.0] +## FourVector of the Sigma for the Smearing of the Vertex position: x y z t +SIM.vertexSigma = [0.0, 0.0, 0.0, 0.0] + + +################################################################################ +## Action holding sensitive detector actions +## The default tracker and calorimeter actions can be set with +## +## >>> SIM = DD4hepSimulation() +## >>> SIM.action.tracker = "Geant4TrackerAction" +## >>> SIM.action.calo = "Geant4CalorimeterAction" +## +## for specific subdetectors specific sensitive detectors can be set based on pattern matching +## +## >>> SIM = DD4hepSimulation() +## >>> SIM.action.mapActions['tpc'] = "TPCSDAction" +## +## and additional parameters for the sensitive detectors can be set when the map is given a tuple +## +## >>> SIM = DD4hepSimulation() +## >>> SIM.action.mapActions['ecal'] =( "CaloPreShowerSDAction", {"FirstLayerNumber": 1} ) +## +## +################################################################################ + +## set the default tracker action +SIM.action.tracker = "Geant4TrackerWeightedAction" + +## set the default calorimeter action +SIM.action.calo = "Geant4ScintillatorCalorimeterAction" + +## create a map of patterns and actions to be applied to sensitive detectors +## example: SIM.action.mapActions['tpc'] = "TPCSDAction" +SIM.action.mapActions = {} + + +################################################################################ +## Configuration for the magnetic field (stepper) +################################################################################ +SIM.field.delta_chord = 0.25*mm +SIM.field.delta_intersection = 0.001*mm +SIM.field.delta_one_step = 0.01*mm +SIM.field.eps_max = 0.001*mm +SIM.field.eps_min = 5e-05*mm +SIM.field.equation = "Mag_UsualEqRhs" +SIM.field.largest_step = 10.0*m +SIM.field.min_chord_step = 0.01*mm +SIM.field.stepper = "ClassicalRK4" + + +################################################################################ +## Configuration for sensitive detector filters +## +## Set the default filter for tracker or caliromter +## >>> SIM.filter.tracker = "edep1kev" +## >>> SIM.filter.calo = "" +## +## Assign a filter to a sensitive detector via pattern matching +## >>> SIM.filter.mapDetFilter['FTD'] = "edep1kev" +## +## Or more than one filter: +## >>> SIM.filter.mapDetFilter['FTD'] = ["edep1kev", "geantino"] +## +## Don't use the default filter or anything else: +## >>> SIM.filter.mapDetFilter['TPC'] = None ## or "" or [] +## +## Create a custom filter. The dictionary is used to instantiate the filter later on +## >>> SIM.filter.filters['edep3kev'] = dict(name="EnergyDepositMinimumCut/3keV", parameter={"Cut": 3.0*keV} ) +## +## +################################################################################ + +## default filter for calorimeter sensitive detectors; this is applied if no other filter is used for a calorimeter +SIM.filter.calo = "edep0" + +## list of filter objects: map between name and parameter dictionary +SIM.filter.filters = {'edep0': {'parameter': {'Cut': 0.0}, 'name': 'EnergyDepositMinimumCut/Cut0'}, 'geantino': {'parameter': {}, 'name': 'GeantinoRejectFilter/GeantinoRejector'}, 'edep1kev': {'parameter': {'Cut': 0.001}, 'name': 'EnergyDepositMinimumCut'}} + +## a map between patterns and filter objects, using patterns to attach filters to sensitive detector +SIM.filter.mapDetFilter = {} + +## default filter for tracking sensitive detectors; this is applied if no other filter is used for a tracker +SIM.filter.tracker = "edep1kev" + + +################################################################################ +## Configuration for the DDG4 ParticleGun +################################################################################ + +## direction of the particle gun, 3 vector +# SIM.gun.direction = (0, 0, 1) + +## choose the distribution of the random direction for theta +## +## Options for random distributions: +## +## 'uniform' is the default distribution, flat in theta +## 'cos(theta)' is flat in cos(theta) +## 'eta', or 'pseudorapidity' is flat in pseudorapity +## 'ffbar' is distributed according to 1+cos^2(theta) +## +## Setting a distribution will set isotrop = True +## +SIM.gun.distribution = "uniform" +SIM.gun.energy = 10.0*GeV + +## isotropic distribution for the particle gun +## +## use the options phiMin, phiMax, thetaMin, and thetaMax to limit the range of randomly distributed directions +## if one of these options is not None the random distribution will be set to True and cannot be turned off! +## +SIM.gun.isotrop = True +SIM.gun.multiplicity = 1 +SIM.gun.particle = "mu-" +SIM.gun.phiMax = None + +## Minimal azimuthal angle for random distribution +SIM.gun.phiMin = None + +## position of the particle gun, 3 vector +SIM.gun.position = (0.0, 0.0, 0.0) +SIM.gun.thetaMax = 172*deg +SIM.gun.thetaMin = 8*deg + + +################################################################################ +## Configuration for the output levels of DDG4 components +################################################################################ + +## Output level for input sources +SIM.output.inputStage = 3 + +## Output level for Geant4 kernel +SIM.output.kernel = 3 + +## Output level for ParticleHandler +SIM.output.part = 3 + +## Output level for Random Number Generator setup +SIM.output.random = 6 + + +################################################################################ +## Configuration for the Particle Handler/ MCTruth treatment +################################################################################ + +## Keep all created particles +SIM.part.keepAllParticles = False + +## Minimal distance between particle vertex and endpoint of parent after +## which the vertexIsNotEndpointOfParent flag is set +## +SIM.part.minDistToParentVertex = 2.2e-14 + +## MinimalKineticEnergy to store particles created in the tracking region +SIM.part.minimalKineticEnergy = 1.0*MeV + +## Printout at End of Tracking +SIM.part.printEndTracking = True + +## Printout at Start of Tracking +SIM.part.printStartTracking = True + +## List of processes to save, on command line give as whitespace separated string in quotation marks +SIM.part.saveProcesses = ['Decay'] + + +################################################################################ +## Configuration for the PhysicsList +################################################################################ +SIM.physics.decays = False +SIM.physics.list = "QGSP_BERT" + +## location of particle.tbl file containing extra particles and their lifetime information +## +SIM.physics.pdgfile = os.path.join( os.environ.get("DD4HEP"), "DDG4/examples/particle.tbl" ) + +## The global geant4 rangecut for secondary production +## +## Default is 0.7 mm as is the case in geant4 10 +## +## To disable this plugin and be absolutely sure to use the Geant4 default range cut use "None" +## +## Set printlevel to DEBUG to see a printout of all range cuts, +## but this only works if range cut is not "None" +## +SIM.physics.rangecut = 0.7*mm + +SIM.physics.rejectPDGs = {1,2,3,4,5,6,21,23,24,25} + +################################################################################ +## Properties for the random number generator +################################################################################ + +## If True, calculate random seed for each event based on eventID and runID +## allows reproducibility even when SkippingEvents +SIM.random.enableEventSeed = False +SIM.random.file = None +SIM.random.luxury = 1 +SIM.random.replace_gRandom = True +SIM.random.seed = None +SIM.random.type = None