I am currently doing research in high energy physics and would like to implement a neural network to determine the best "kinematic cuts" to apply to particles before using those particles for calculation.

Currently, I am using Monte-Carlo simulation to generate 1e5 particle events. An event is defined as two protons colliding with E_cm = 13 TeV. When those protons collide, they chaotically produce many other particles, some stable, some not. Through Monte-Carlo simulation, I am able to ensure that in every event, a specific particle decay occurs. The products of this decay are what I would like to study.

Through an extensive list of particles from each event, it is my goal to collect these specific particles reliably. Since the data is ambiguous (there is no 'for sure' way to know which particles actually came from the decay), we employ kinematic cuts that help to weed out more unlikely candidates. In one case, the particles I am studying tend to have higher transverse momentum (pT) than the rest of the particles so it is helpful to ignore particles with pT below a certain threshold: a particle must have pT greater than (for example) 2 GeV to be considered for calculation. So the 'pT kinematic cut' is 2 GeV. These kinematic cuts can be thought of as filters! Any particle with pT <= 2 will not pass through this filter.

This brings in a problem! If we use a more aggressive filter (ie. particles must have pT > 5 GeV), our output calculations are more precise and accurate! BUT, many events will have correct particles that do not pass the filters. Such events will be lost, hence we lose selection efficiency. On the other hand, a less aggressive filter (ie. particles must have pT > 1 GeV) lets in so many background particles that many wrong combinations end up being collected.

Now, I would like to implement a neural network that tests different values of these kinematic cuts such that accuracy and precision of calculation are optimized as well as selection efficiency.

I am using C++, Pythia8, and my code fully relies on std::vector and std::tuple. Usually sorting vector<tuple<##>>

I tried openNN but it simply wouldn't work. A program that allows me to input my code with tweakables and desired output would be ideal.

1 Answer 1


Apologies if I'm misreading your question, but it sounds like you're looking for software to optimise a single parameter, the pT kinematic cut threshold.

A neural network is not a good tool to optimise a single parameter. Neural networks (and especially deep learning systems) derive their power from their dense layers connecting many input neurons to many output neurons, which lets them approximate functions of arbitrary shape. With a single input neuron, there just isn't much to do that can't be done by simpler methods. Furthermore, neural networks take lots of known examples (which set of parameters gives which level of precision) to train before they start giving you good predictions back. Even after you've trained the neural network, you'll still need to somehow get from the neural network's predictions of accuracy and precision for a given parameter set to the optimal parameter set value, for which you may still need to use an optimisation method.

One-dimensional optimisation can be conducted by means of binary search, golden section search, successive parabolic interpolation, a combination of the methods, or even by an evaluation of the function you're minimising on a regular grid (which can be helpful when the function is noisy and/or contains a lot of local minima).

One of simple ways to perform this optimisation is to type the C++ code from the Numerical Recipes book, chapters 10.2-10.4. GSL (a C library, available from C++) also has a ready-made optimiser available.

Optimisation of a function of multiple variables (maximise precision(pT, ...) or accuracy(pT, ...)) is a more complicated problem. Many optimisation methods need good gradients in order to determine the optimal direction of the step. Some need the second derivative (Hessian matrix) in order to determine the magnitude of the step. A nice collection of optimisation methods usable from C++ is the NLopt library. I've had good results with the CRS2 algorithm, which is gradient-free, but you may be more successful with something else.

I suppose that you don't have analytical derivatives for your function, but you could always try numerical differentiation (the time taken to compute such a gradient is proportional to the number of parameters) or automatic differentiation (see also: Ceres solver which uses C++ templates for dual numbers).

  • 1
    Thank you for your response! pT is just one example of a kinematic cut that I implement. In reality there are multiple parameters that should be trained, such as minimum angular distance between particles or maximum angular trajectory in detector. Changing these prerequisite parameters never alters the particle data, but it does change which particles are selected for calculations. Then, based on the calculations (average mass, std deviation from average mass, etc.), I would like to train the prerequisite parameters such that the calculations yield accurate/precise/plentiful values.
    – mangoman
    Commented Feb 2, 2023 at 22:21
  • I've updated the answer to include multivariate optimisation. Do you have a way to independently judge the precision of a given run? If yes, you have an optimisation problem. I don't know (corrections welcome!) a neural network architecture that would optimise a function for you (it may approximate it, speeding up optimisation that follows, but training will take a truckload of time). If not, there isn't much to train upon. Unsupervised learning will give you some answers, but they may be not the answers you're looking for.
    – aitap
    Commented Feb 4, 2023 at 11:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.