Skip to content

DeepMETv2/L1DeepMETv2

Repository files navigation

L1DeepMETv2

GNN based algorithm for online MET reconstruction for CMS L1 trigger. Regress MET from L1Puppi candidates.

This work extends the following efforts for MET reconstruction algorithms:

  • Fully-Connected Neural Network (FCNN) based algorithm in keras for offline MET reconstruction: DeepMETv1
  • Graph Neural Network (GNN) based algorithm in torch for offline MET reconstruction: DeepMETv2
  • FCNN based algorithm in keras for online MET reconstruction: L1MET

Prerequisites

conda install cudatoolkit=10.2
conda install -c pytorch pytorch=1.12.0
export CUDA="cu102"
pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.12.0+${CUDA}.html
pip install torch-sparse -f https://pytorch-geometric.com/whl/torch-1.12.0+${CUDA}.html
pip install torch-cluster -f https://pytorch-geometric.com/whl/torch-1.12.0+${CUDA}.html
pip install torch-spline-conv -f https://pytorch-geometric.com/whl/torch-1.12.0+${CUDA}.html
pip install torch-geometric
pip install coffea
pip install mplhep

Produce Input Data

For producing training input data, we use TTbar process simulation data available in this link. The data files are in .root format and they contain L1 information; the full list of variables available in the .root files can be found in ./data_ttbar/branch_list_L1_TTbar.csv. From the list of variables, we extract the ones that will be used for our training and save it to .npz format under ./data_ttbar/raw/, using ./data_ttbar/generate_npz.py.

L1PuppiCands_pt, L1PuppiCands_eta, L1PuppiCands_phi, L1PuppiCands_puppiWeight, L1PuppiCands_pdgId, L1PuppiCands_charge 

From these six variables, we make the following training inputs into .pt files under ./data_ttbar/processed/ using ./model/data_loader.py:

pt, px (= pt*cos(phi)), py (= pt*sin(phi)), eta, phi, puppiWeight, pdgId, charge 

Get Input Data and Train

Training script train.py will use input data using torch dataloader. Training input in .npz format is available in this link under /raw/. Follow these steps to get the input data and train the algorithm.

  1. From this link, download the /raw/ folder containing .npz files and place the folder under ./data_ttbar/.
  2. When you run the training script right after step 1, the training script will fetch the .npz files from ./data_ttbar/raw and produce dataloader from these files, using the functions defined in ./model/data_loader.py. This dataloader-producing takes some time, so feel free to use the dataloader already produced and saved in this link. From the link, download processed.tar.gz that contains dataloader saved as .pt files: un-compress the file and place the .pt files under ./data_ttbar/processed/.
  3. Run the training script train.py using the following command:
python train.py --data data_ttbar --ckpts ckpts_ttbar

If you have done the step 2, the training script will directly fetch the input dataloader from ./data_ttbar/processed/ and save the training & evaluation output to ./ckpts_ttbar.

Access the train dataloader and test dataloader

dataloader saved as .pt files in data_ttbar is not split into training and test set. What is done at the training/evaluating code is that it splits the full dataloader into 8:2 training-test set on the fly.

The training dataloader and test dataloader with 8:2 split that can be directly used can be downloaded here Once you download them, you can use them in your training/evaluating code as the following:

test_dl = torch.load('dataloader/test_dataloader.pth')

Plot performance plots (response and resolution)

python3 plt.py --ckpts [ckpts directory]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published