Skip to content
Snippets Groups Projects
Commit 6cfac98a authored by grheine's avatar grheine
Browse files

added setup script

parent 0399f72c
Branches
No related tags found
No related merge requests found
......@@ -2,5 +2,5 @@ examples/tests
**.pyc
src/utils/__pycache__
*.npy
scripts
cleanup_env
scripts/test.py
\ No newline at end of file
#!/bin/bash
echo 'Start setting up environment'
export SOURCING_DIR=$PWD
source /cvmfs/belle.cern.ch/tools/b2setup
b2setup release-06-00-08
# store current path and venv path
OLD_PATH=$PATH # save PATH to fix venv stuff later
export VENV_PATH=$(pwd)/cleanup_env
# create virtual environment and install packages if it does not exist
if [ ! -d "$VENV_PATH" ]; then
echo 'Creating virtual environment'
python3.8 -m venv $VENV_PATH
export PATH=$OLD_PATH:$VENV_PATH/bin
export PYTHONPATH=$PYTHONPATH:$VENV_PATH/lib/python3.8/site-packages/
export PYTHONUSERBASE=$VENV_PATH
pip install -r requirements.txt
fi
# source the virtual environment and set the paths
source $VENV_PATH/bin/activate
export PATH=$OLD_PATH:$VENV_PATH/bin
export PYTHONPATH=$PYTHONPATH:$VENV_PATH/lib/python3.8/site-packages/
export PYTHONUSERBASE=$VENV_PATH
\ No newline at end of file
import basf2 as b2
import mdst
from basf2 import statistics
from modularAnalysis import inputMdstList
from tracking import add_time_extraction
from tracking.path_utils import add_cdc_track_finding, add_mc_matcher, add_prefilter_track_fit_and_track_creator
import torch
import sys
sys.path.append('/work/grheine/Promotion/BelleII')
from gnn_cleanup.src.utils.add_cdc_track_finding import add_cdc_track_finding
from gnn_cleanup.src.modules.HitCleanupModule import HitCleanup
root = '/ceph/grheine/belleII/hitcleanup/data/git_hash=release-06-00-08/background_level=22_26/level=train_samples/sample_setup=dimuon/nevents=100/GeneratorOutput.root'
model_path = 'IN_trained_lowbg.pt'
path = b2.Path()
inputMdstList(filelist=[root], path=path, environmentType='default')
path.add_module('Gearbox')
path.add_module('Geometry')
path.add_module('Progress')
# tracking preparation
if 'RegisterEventLevelTrackingInfo' not in path:
path.add_module('RegisterEventLevelTrackingInfo')
path.add_module('TFCDC_WireHitPreparer',
wirePosition='aligned',
flightTimeEstimation='outwards',
filter='cuts_from_DB')
# path.add_module(HitCleanup(model_path, 0.2))
#track finding modules
add_cdc_track_finding(path)
#track fitting
path.add_module('SetupGenfitExtrapolation', energyLossBrems=False, noiseBrems=False)
add_time_extraction(path, components=['CDC'])
add_mc_matcher(path, components=["CDC"])
add_prefilter_track_fit_and_track_creator(path, trackFitHypotheses=[211])
mdst.add_mdst_output(path, filename='test_mdst.root', additionalBranches=['CDCHits', 'RecoTracks'])
b2.process(path)
print(statistics)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment