Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ __pycache__/
# C extensions
*.so

# Temporary files
*.log
*.tmp
*~

# Image files
*.pdf
*.png
*.jpg
*.gif

# Distribution / packaging
.Python
build/
Expand Down
6 changes: 6 additions & 0 deletions TrkOnlyPID/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.keras
*.csv
*.root
*.onnx
*.json
figures
35 changes: 35 additions & 0 deletions TrkOnlyPID/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# TrkOnlyPID

## Introduction

TrkOnlyPID is a machine learning algorithm is trained to differentiate between electrons and muons using information only from the tracker.

## Workflow

### Dataset creation
EventNtuple data files are used as input to the training.
The ntuples are skimmed using [make_inputs.py](make_inputs.py) which drops unnessary data as well as adds branches if any are needed.

### Model training
The python code provided in the file [TrkOnlyPIDTrain.py](TrkOnlyPIDTrain.py) is used to:
* skim track information from the input ntuples and store the data in local csv files
* define the neural network architecture
* train the algorithm and save the model weights into an ONNX file named "TrkOnlyPID.onnx"
* test the algorithm, providing performance metrics
* generate plots to provide more information on the dataset, how the training went, and how the model perform

Once the model is trained and the weights are saved in an ONNX file, this file can be used by TMVA:SOFIE to generate the inference code
that can be used in Offline (for details about this process, check [this documentation](https://github.com/Mu2e/MLTrain/blob/main/TrkQual/README.md#converting-a-model-for-use-in-offline)).

## Version history

### v0 (current version)
This version has been trained using MDC2025 datasets:
* signal: nts.mu2e.FlateMinusOnSpill-reco-ntuple.MDC2025-004.root
* background: nts.mu2e.FlatMuMinusOnSpill-reco-ntuple.MDC2025-004.root
It was trained using electrons and muons generated with a flat momentum spectrum from muon stop vertices in the target.
The input features are:
* p(chi^2) of the track
* tracker hit dt/dz slope divided by the expected slope from the track fit assuming an electron mass
* N(active hits) / N(hits)
* N(null ambiguity hits) / N(active hits)
Loading