Implementation of muon shield optimisation Oliver Lantwin [ - - PowerPoint PPT Presentation

implementation of muon shield optimisation
SMART_READER_LITE
LIVE PREVIEW

Implementation of muon shield optimisation Oliver Lantwin [ - - PowerPoint PPT Presentation

Implementation of muon shield optimisation Oliver Lantwin [ oliver.lantwin@cern.ch ] 11th SHiP Collaboration Meeting, cern 8th June 2017 Introduction Oliver Lantwin (icl) 11th SHiP Collaboration Meeting, cern 2/16 Give overview of


slide-1
SLIDE 1

Implementation of muon shield

  • ptimisation

Oliver Lantwin

[oliver.lantwin@cern.ch]

11th SHiP Collaboration Meeting, cern 8th June 2017

slide-2
SLIDE 2

Introduction

▶ Give overview of implementation ▶ Touch on technologies used ▶ Outlook onto challenges and plans

Oliver Lantwin (icl) 11th SHiP Collaboration Meeting, cern 2/16

slide-3
SLIDE 3

Implementation: Summary

▶ Runs on Skygrid at Yandex ▶ Use FairShip for all simulations and geometry

Oliver Lantwin (icl) 11th SHiP Collaboration Meeting, cern 3/16

slide-4
SLIDE 4
  • lantwin/FairShip:optimisation_shield

▶ Replace the entire geometry:

▶ Bare minimum geometry besides shield ▶ Sensitive plane instead of trackers at zT1

Figure: Geometry used

▶ Many changes to the way ShipMuonShield is created to make it easier

to understand (for me at least), and to modify without breaking anything

▶ Add logic to allow initialisation of ShipMuonShield from a ROOT-file Oliver Lantwin (icl) 11th SHiP Collaboration Meeting, cern 4/16

slide-5
SLIDE 5

Skygrid

▶ Cluster of 1600 cpu cores available for use by SHiP ▶ Jobs are run in Docker containers:

▶ Idea: Job that takes a given input and reproducibly produces a given output

in a functional way → easy to troubleshoot and test

▶ Optimised for long-running jobs, e.g. large mc productions, as use of Docker

results in non-negligible start-up time of jobs

Oliver Lantwin (icl) 11th SHiP Collaboration Meeting, cern 5/16

slide-6
SLIDE 6

SHiP Docker containers

▶ Container image based on CentOS 7 ▶ Usable for general purpose FairShip work ▶ Great for reproducibly running studies

▶ Can track exactly which software runs

▶ Special version with olantwin/FairShip:optimisation_shield

branch maintained by me (olantwin/ship-shield)

▶ Use Docker container to ensure FairShip is set up correctly, no need to

install FairShip on cluster

▶ We could use Docker for archiving analyses and testing software

throughout SHiP

Oliver Lantwin (icl) 11th SHiP Collaboration Meeting, cern 6/16

slide-7
SLIDE 7

Optimisation algorithm used

scikit-optimize

▶ Bayesian optimisation library for the scientific python stack ▶ Considered both Gaussian-process-based and tree-based algorithms,

as the latter can handle integral parameters. Return to Gaussian-process implementation for now.

Oliver Lantwin (icl) 11th SHiP Collaboration Meeting, cern 7/16

slide-8
SLIDE 8

Overall architecture

Start of optimisation Optimisation algorithm chooses next parameter vector Create parameter file Set up simulation in FairShip 1600× run muon background simulation for fraction of muon sample 1600× analyse simulation of muon sample fraction Combine geometry information with results of simulation Calculate geometry weight and length in FairShip Finishing conditions reached? Optimisation done Yes No

Figure: Flow chart of optimisation process; red blocks run in a short-lived Docker containers, one long-lived process for everything else

Oliver Lantwin (icl) 11th SHiP Collaboration Meeting, cern 8/16

slide-9
SLIDE 9

Preparation

▶ Split muon sample into input files for the jobs: 1 1600 × #totalmuons per

job.

▶ Download input files from eos and store locally on the cluster

▶ Optimisation does not use eos at all any more, as polling for files etc.

proved to be unreliable

▶ Define physical bounds of magnet parameters (maybe too generous, as

many physically allowed magnets are very large)

Oliver Lantwin (icl) 11th SHiP Collaboration Meeting, cern 9/16

slide-10
SLIDE 10

Translating the parameter vector to the geometry (and back)

How do 56 numbers turn into a geometry configuration?

▶ Create ROOT-file with a TVectorD of 56 doubles and pass it to

shipDet_conf.py, geometry_config.py and ShipMuonShield.cxx, which were all modified to parse information needed from this file.

▶ Use pytest to implement a closure test and algorithm to reconstruct

this parameter vector from the geometry. Can initialise and reconstruct completely random geometries within bounds → within floating point arithmetic errors we achieve perfect closure

▶ pytest a joy to use. We should use it more to prevent code breaking! C +,

equivalent?

Oliver Lantwin (icl) 11th SHiP Collaboration Meeting, cern 10/16

slide-11
SLIDE 11

Simulation

▶ Stripped down version of run_simScript.py in a self-contained

function, as it is impossible to import run_simScript without side-effects

▶ Use TGeant4 with the SHiP-default set of physics processes enabled

▶ Investigated using more basic physics processes as well (in addition with a

full simulation), but set aside for now

▶ Use -.FollowMuon option in FairShip to

▶ discard any non-muons, muons simulated with full fidelity ▶ keep information about muon tracks in muon shield

▶ Annoyance/Problem: FairRoot uses some C +, singletons (e.g.

FairRunSim), which can not be created more than once per process and deleting/retrieving them does not seem to work in Python… → Workaround: Only one simulation per process, use subprocess/thread if necessary

Oliver Lantwin (icl) 11th SHiP Collaboration Meeting, cern 11/16

slide-12
SLIDE 12

Extracting geometry measurements

  • 1. Initialise geometry in FairShip
  • 2. Use TGeo to extract shape of muon shield, measure exact length as

seen by simulation

  • 3. Have TGeo calculate weight of muon shield (exclude supports)

Oliver Lantwin (icl) 11th SHiP Collaboration Meeting, cern 12/16

slide-13
SLIDE 13

Analysis

In the simulation process:

▶ Create histograms for offline checks of optimisation ▶ Select muons in acceptance (see next slide) ▶ Return sum of muon penalty weights (1 float per job)

Results passed back by the software managing the cluster In the steering process:

▶ Combine geometry measurements and simulation results in cost

function Cost function ∝ W × (1 + ∑ χ2

µ)

AHNL W := Muon shield mass (from geometry) χ2

µ := χ2of muon hits in bending plane (from simulation)

AHNL := Signal acceptance (from geometry, approximated via length of magnet)

Oliver Lantwin (icl) 11th SHiP Collaboration Meeting, cern 13/16

slide-14
SLIDE 14

χ2

χ2(x/cm) = √ 1 − (x + 300)/560

300 − 200 − 100 − 100 200 0.2 0.4 0.6 0.8 1

chi2(x)

Figure: χ2 as a function of x [cm] for µ−

▶ for µ+ flip sign of x as it’s supposed to be on the other side of the

magnet

▶ defined only for -300 < x < 260 cm (~dimensions of tracking station) ▶ Cut on |y| < 5 m

Oliver Lantwin (icl) 11th SHiP Collaboration Meeting, cern 14/16

slide-15
SLIDE 15

Challenges

Performance currently limited by constant costs:

▶ Need to initialise a new FairRoot simulation for every single simulation

run (and also to initialise the geometry)

▶ Partially because of the singleton issue mentioned above ▶ Partially because updating the geometry in FairRoot is either complicated

  • r impossible

▶ Starting up and retrieving results from Docker containers

Figure: Cluster usage for optimisation iterations

Possible solutions:

▶ Try several configurations in parallel in order to make simulation time

dominant? → needs to be supported by algorithm

▶ Reuse Docker containers (and ideally processes) for simulation to avoid

constant costs as much as possible?

Oliver Lantwin (icl) 11th SHiP Collaboration Meeting, cern 15/16

slide-16
SLIDE 16

Planned changes

▶ Move to scikit-optimize ask-and-tell interface to allow for

restart/replay, multiple simultaneous evaluations (maybe not possible)

▶ Once ready, move to Skoltech version of Bayesian Optimisation, which

can

▶ Predict multiple configurations ▶ Handle different fidelity of observations (e.g. full statistics vs. resampled

muons; full Geant4 processes vs. subset; etc.)

Oliver Lantwin (icl) 11th SHiP Collaboration Meeting, cern 16/16