diff --git a/python/SndlhcMuonReco.py b/python/SndlhcMuonReco.py
index f1cc8943f9..d393f25afc 100644
--- a/python/SndlhcMuonReco.py
+++ b/python/SndlhcMuonReco.py
@@ -2,7 +2,7 @@
import numpy as np
import scipy.ndimage
from array import array
-import xml.etree.ElementTree as ET
+import yaml
import matplotlib.pyplot as plt
import shipunit as unit
@@ -213,6 +213,10 @@ def numPlanesHit(systems, detector_ids) :
mufi_us_planes.append( (detector_ids[systems == 2]%10000)//1000 )
return len(np.unique(scifi_stations)) + len(np.unique(mufi_ds_planes)) + len(np.unique(mufi_us_planes))
+
+def checkUnit(param, u):
+ if u not in dir(unit):
+ raise RuntimeError("Unsupported unit '"+u+"' provided for '"+param+"'! Check units in shipunit module.")
class MuonReco(ROOT.FairTask) :
" Muon reconstruction "
@@ -274,90 +278,103 @@ def Init(self) :
self.scale = 1
self.events_run = 0
- # Initialize hough transform - reading parameter xml file
- tree = ET.parse(self.par_file)
- root = tree.getroot()
+ # Initialize hough transform - reading parameter yaml file
+ if self.logger.IsLogNeeded(ROOT.fair.Severity.warn):
+ print("Initialize HT input parameters: YAML file supported! XML support is discontinued!")
+ with open(self.par_file, 'r') as stream:
+ root = yaml.safe_load(stream)
# Output track in genfit::Track or sndRecoTrack format
# Check if genfit::Track format is already forced
if hasattr(self, "genfitTrack"): pass
- else: self.genfitTrack = int(root[0].text)
+ else: self.genfitTrack = root["genfitTrack"]
- self.draw = int(root[1].text)
+ self.draw = int(root['draw'])
track_case_exists = False
- for case in root.findall('tracking_case'):
- if case.get('name') == self.tracking_case:
+ for case in root['tracking_case']:
+ if self.tracking_case in case:
track_case_exists = True
# Use SciFi hits or clusters
- self.Scifi_meas = int(case.find('use_Scifi_clust').text)
+ self.Scifi_meas = int(case[self.tracking_case]['use_Scifi_clust'])
# Maximum absolute value of reconstructed angle (+/- 1 rad is the maximum angle to form a triplet in the SciFi)
- max_angle = float(case.find('max_angle').text)
-
+ u = case[self.tracking_case]['max_angle']['unit']
+ checkUnit('max_angle', u)
+ max_angle = float(case[self.tracking_case]['max_angle']['value'])*eval('unit.'+u)
+
# Hough space representation
Hspace_format_exists = False
- for rep in case.findall('Hough_space_format'):
- if rep.get('name') == self.Hough_space_format:
+ for rep in case[self.tracking_case]['Hough_space_format']:
+ if self.Hough_space_format in rep:
Hspace_format_exists = True
# Number of bins per Hough accumulator axes and range
''' xH and yH are the abscissa and ordinate of the Hough parameter space
xz and yz represent horizontal and vertical projections
in the SNDLHC physics coord. system '''
- n_accumulator_yH = int(rep.find('N_yH_bins').text)
- yH_min_xz = float(rep.find('yH_min_xz').text)
- yH_max_xz = float(rep.find('yH_max_xz').text)
- yH_min_yz = float(rep.find('yH_min_yz').text)
- yH_max_yz = float(rep.find('yH_max_yz').text)
- n_accumulator_xH = int(rep.find('N_xH_bins').text)
- xH_min_xz = float(rep.find('xH_min_xz').text)
- xH_max_xz = float(rep.find('xH_max_xz').text)
- xH_min_yz = float(rep.find('xH_min_yz').text)
- xH_max_yz = float(rep.find('xH_max_yz').text)
+ n_accumulator_yH = int(rep[self.Hough_space_format]['N_yH_bins'])
+ n_accumulator_xH = int(rep[self.Hough_space_format]['N_xH_bins'])
+ yH_min_xz = yH_max_xz = yH_min_yz = yH_max_yz = xH_min_xz = xH_max_xz = xH_min_yz = xH_max_yz = 0
+ items = {'yH_min_xz' : yH_min_xz, 'yH_max_xz': yH_max_xz, 'yH_min_yz': yH_min_yz, \
+ 'yH_max_yz' : yH_max_yz, 'xH_min_xz': xH_min_xz, 'xH_max_xz': xH_max_xz, \
+ 'xH_min_yz' : xH_min_yz, 'xH_max_yz': xH_max_yz}
+ for sub_item in items:
+ u = rep[self.Hough_space_format][sub_item]['unit']
+ checkUnit(sub_item, u)
+ items[sub_item] = float(rep[self.Hough_space_format][sub_item]['value'])*eval('unit.'+u)
+
else: continue
if not Hspace_format_exists:
- raise RuntimeError("Unknown Hough space format, check naming in parameter xml file.")
+ raise RuntimeError("Unknown Hough space format, check naming in parameter yaml file.")
# A scale factor for a back-up Hough space having more/less bins than the default one
# It is useful when fitting some low-E muon tracks, which are curved due to mult. scattering.
- self.HT_space_scale = 1 if case.find('HT_space_scale')==None else float(case.find('HT_space_scale').text)
+ if 'HT_space_scale' not in case[self.tracking_case]:
+ self.HT_space_scale = 1
+ else:
+ self.HT_space_scale = float(case[self.tracking_case]['HT_space_scale'])
# Number of random throws per hit
- self.n_random = int(case.find('n_random').text)
+ self.n_random = int(case[self.tracking_case]['n_random'])
# MuFilter weight. Muon filter hits are thrown more times than scifi
- self.muon_weight = int(case.find('mufi_weight').text)
+ self.muon_weight = int(case[self.tracking_case]['mufi_weight'])
# Minimum number of planes hit in each of the downstream muon filter (if muon filter hits used) or scifi (if muon filter hits not used) views to try to reconstruct a muon
- self.min_planes_hit = int(case.find('min_planes_hit').text)
+ self.min_planes_hit = int(case[self.tracking_case]['min_planes_hit'])
# Maximum number of muons to find. To avoid spending too much time on events with lots of downstream activity.
- self.max_reco_muons = int(case.find('max_reco_muons').text)
+ self.max_reco_muons = int(case[self.tracking_case]['max_reco_muons'])
# How far away from Hough line hits will be assigned to the muon, for Kalman tracking
- self.tolerance = float(case.find('tolerance').text)
+ u = case[self.tracking_case]['tolerance']['unit']
+ checkUnit('tolerance', u)
+ self.tolerance = float(case[self.tracking_case]['tolerance']['value'])*eval('unit.'+u)
# Which hits to use for track fitting.
- self.hits_to_fit = case.find('hits_to_fit').text.strip()
+ self.hits_to_fit = case[self.tracking_case]['hits_to_fit'].strip()
# Which hits to use for triplet condition.
- self.hits_for_triplet = case.find('hits_for_hough').text.strip() if case.find('hits_to_validate')==None else case.find('hits_to_validate').text.strip()
-
+ if 'hits_to_validate' not in case[self.tracking_case]:
+ self.hits_for_triplet = case[self.tracking_case]['hits_for_hough'].strip()
+ else:
+ self.hits_for_triplet = case[self.tracking_case]['hits_to_validate'].strip()
+
# Detector plane masking. If flag is active, a plane will be masked if its N_hits > Nhits_per_plane.
# In any case, plane masking will only be applied if solely Scifi hits are used in HT as it is
# a measure against having many maxima in HT space.
- self.mask_plane = int(case.find('mask_plane').text)
- self.Nhits_per_plane = int(case.find('Nhits_per_plane').text)
+ self.mask_plane = int(case[self.tracking_case]['mask_plane'])
+ self.Nhits_per_plane = int(case[self.tracking_case]['Nhits_per_plane'])
# Enable Gaussian smoothing over the full accumulator space.
- self.smooth_full = int(case.find('smooth_full').text)
+ self.smooth_full = int(case[self.tracking_case]['smooth_full'])
# Gaussian smoothing parameters. The kernel size is determined as 2*int(truncate*sigma+0.5)+1
- self.sigma = int(case.find('sigma').text)
- self.truncate = int(case.find('truncate').text)
+ self.sigma = int(case[self.tracking_case]['sigma'])
+ self.truncate = int(case[self.tracking_case]['truncate'])
# Helpers to pick up one of many HT space maxima
- self.n_quantile = float(case.find('n_quantile').text)
- self.res = int(case.find('res').text)
+ self.n_quantile = float(case[self.tracking_case]['n_quantile'])
+ self.res = int(case[self.tracking_case]['res'])
else: continue
if not track_case_exists:
- raise RuntimeError("Unknown tracking case, check naming in parameter xml file.")
+ raise RuntimeError("Unknown tracking case, check naming in parameter yaml file.")
# Get sensor dimensions from geometry
self.MuFilter_ds_dx = self.mufiDet.GetConfParF("MuFilter/DownstreamBarY") # Assume y dimensions in vertical bars are the same as x dimensions in horizontal bars.
diff --git a/python/TrackingParams.xml b/python/TrackingParams.xml
deleted file mode 120000
index 4bf1360676..0000000000
--- a/python/TrackingParams.xml
+++ /dev/null
@@ -1 +0,0 @@
-TrackingParams_V2_28January2023.xml
\ No newline at end of file
diff --git a/python/TrackingParams.yml b/python/TrackingParams.yml
new file mode 120000
index 0000000000..cf06cda71f
--- /dev/null
+++ b/python/TrackingParams.yml
@@ -0,0 +1 @@
+TrackingParams_V2_28January2023.yml
\ No newline at end of file
diff --git a/python/TrackingParams_V1_28November2022.xml b/python/TrackingParams_V1_28November2022.xml
deleted file mode 100644
index 6551a32e4c..0000000000
--- a/python/TrackingParams_V1_28November2022.xml
+++ /dev/null
@@ -1,293 +0,0 @@
-
-
-
-
-
-
-
-
-
- 0
-
- 0
-
-
-
- sfusds
-
- ds
-
- 0
-
- 3
-
- 0
- 4
-
- 5
-
- 1.
-
- 5
-
- 100
-
- 0.
-
- 1
-
- 3
- 4
-
-
-
-
- 1000
- -80.
- 0.
- 0.
- 80.
- 2500
- -1.57
- 1.57
- -1.57
- 1.57
-
-
- 610
- -105.
- 17.
- 0.
- 122.
- 220
- -1.1
- 1.1
- -1.1
- 1.1
-
-
- 610
- -105.
- 17.
- 0.
- 122.
- 610
- -105.
- 17.
- 0.
- 122.
-
-
- 0
-
- 0
-
-
-
-
- sf
-
- sf
-
- 0
-
- 3
-
- 0
- 4
-
- 1
-
- 1.
-
- 0
-
- 1
-
- 0.1
-
- 0
-
- 3
- 4
-
-
-
- 10000
- -85.
- 85.
- -85.
- 85.
- 10000
- -1.57
- 1.57
- -1.57
- 1.57
-
-
- 7000
- -100.
- 40.
- -35.
- 105.
- 7000
- -1.1
- 1.1
- -1.1
- 1.1
-
-
- 7000
- -100.
- 40.
- -35.
- 105.
- 7000
- -100.
- 40.
- -35.
- 105.
-
-
- 0.6
-
- 50
-
-
-
-
- ds
-
- ds
-
- 0
-
- 3
-
- 0
- 4
-
- 1
-
- 1.
-
- 0
-
- 1
-
- 1.
-
- 1
-
- 3
- 4
-
-
-
- 1152
- -576.
- 576.
- -576.
- 576.
- 2500
- -1.57
- 1.57
- -1.57
- 1.57
-
-
- 610
- -105.
- 17.
- 0.
- 122.
- 220
- -1.1
- 1.1
- -1.1
- 1.1
-
-
- 610
- -105.
- 17.
- 0.
- 122.
- 610
- -105.
- 17.
- 0.
- 122.
-
-
- 0
-
- 0
-
-
-
-
diff --git a/python/TrackingParams_V1_28November2022.yml b/python/TrackingParams_V1_28November2022.yml
new file mode 100644
index 0000000000..3c2ce8895a
--- /dev/null
+++ b/python/TrackingParams_V1_28November2022.yml
@@ -0,0 +1,431 @@
+---
+# Input paramameters used with the SND@LHC Hough transform tracking
+
+# Author: S.Ilieva
+
+# Date: 28 November 2022
+
+# Tracks stored in genfit::Track format, value 1,
+# or sndRecoTrack class, value 0
+genfitTrack: 0
+# Enable option to visualize the polulated Hough space. Usefull for tests.
+draw: 0
+
+tracking_case:
+ - nu_interaction_products:
+# Which detectors to use in the tracks fit, in the format: vesfusds,
+# where [ve] is Veto, [sf] is SciFi, [us] is Upstream Muon Filter,
+# and [ds] is Downstream Muon Filter.
+ hits_to_fit: sfusds
+# Which detectors to use to validate a track fit attempt. Format as above.
+# Detectors specified here are automatically used in the cathegory above.
+ hits_for_hough: ds
+# Use SciFi hits, value 0, or clusters, value 1
+ use_Scifi_clust: 0
+# Minumum number of planes with measurement to start pattern recognition.
+# Also, the required minimum number of planes intersected by
+# the Hough line prediction to proceed to track fitting.
+ min_planes_hit: 3
+# Mask a detector plane if its number of hits is larger than Nhits_per_plane.
+# Masking is only applied to detectors used for Hough transform.
+# Plane masking always leaves at least active planes
+# Plane masking will only be applied if solely Scifi hits are used in HT.
+ mask_plane: 0
+ Nhits_per_plane: 5
+# Maximum number of fitted tracks per event
+ max_reco_muons: 6
+# Maximum absolute value of reconstructed angle
+# (+/- 1 rad is the maximum angle to form a triplet in the SciFi)
+# The unit field is helper and not used in the code!
+ max_angle:
+ unit: rad
+ value: 1.
+# Number of random throws per measurement
+ n_random: 5
+# How many more times muon filter hits are thrown compared to SciFi measurements?
+ mufi_weight: 100
+# How far away from Hough line hits assigned to the muon can be?
+ tolerance:
+ unit: cm
+ value: 0.
+# Enable Gaussian smoothing of the Hough-space image.
+# For 'ds' HT prediction, do a full accumulator smoothing.
+ smooth_full: 1
+# Gaussian filtering parameters.
+# The kernel size is determined as 2*int(truncate*sigma+0.5)+1.
+ sigma: 3
+ truncate: 4
+# Define the chosen Hough parameter space.
+# Choose parametrization. Options are
+# normal (rho, theta) representation, or
+# linear (slope, intecept), or
+# linear (intercept@1st, intercept@last syb-system plane)
+ Hough_space_format:
+ - normal:
+ N_yH_bins: 1000
+ yH_min_xz:
+ unit: cm
+ value: -80.
+ yH_max_xz:
+ unit: cm
+ value: 0.
+ yH_min_yz:
+ unit: cm
+ value: 0.
+ yH_max_yz:
+ unit: cm
+ value: 80.
+ N_xH_bins: 2500
+ xH_min_xz:
+ unit: rad
+ value: -1.57
+ xH_max_xz:
+ unit: rad
+ value: 1.57
+ xH_min_yz:
+ unit: rad
+ value: -1.57
+ xH_max_yz:
+ unit: rad
+ value: 1.57
+ - linearSlopeIntercept:
+ N_yH_bins: 610
+ yH_min_xz:
+ unit: cm
+ value: -105.
+ yH_max_xz:
+ unit: cm
+ value: 17.
+ yH_min_yz:
+ unit: cm
+ value: 0.
+ yH_max_yz:
+ unit: cm
+ value: 122.
+ N_xH_bins: 220
+ xH_min_xz:
+ unit: rad
+ value: -1.1
+ xH_max_xz:
+ unit: rad
+ value: 1.1
+ xH_min_yz:
+ unit: rad
+ value: -1.1
+ xH_max_yz:
+ unit: rad
+ value: 1.1
+ - linearIntercepts:
+ N_yH_bins: 610
+ yH_min_xz:
+ unit: cm
+ value: -105.
+ yH_max_xz:
+ unit: cm
+ value: 17.
+ yH_min_yz:
+ unit: cm
+ value: 0.
+ yH_max_yz:
+ unit: cm
+ value: 122.
+ N_xH_bins: 610
+ xH_min_xz:
+ unit: cm
+ value: -105.
+ xH_max_xz:
+ unit: cm
+ value: 17.
+ xH_min_yz:
+ unit: cm
+ value: 0.
+ xH_max_yz:
+ unit: cm
+ value: 122.
+# Helpers to select one HT space maxima among many.
+# The n-th quantile of found peaks along 'slope' axis(yH axis) must enlose
+# n_quantile portion of all maxima 'slope' bins within a res range.
+# If smoothing is active, n_quantile and res are not used!
+ n_quantile: 0
+# It is advisable to have res consistent with detector angular resolution.
+# The unit is Hough-space pixels.
+ res: 0
+
+ - passing_mu_Sf:
+# Which detectors to use in the tracks fit, in the format: vesfusds,
+# where [ve] is Veto, [sf] is SciFi, [us] is Upstream Muon Filter,
+# and [ds] is Downstream Muon Filter.
+ hits_to_fit: sf
+# Which detectors to use to validate a track fit attempt. Format as above.
+# Detectors specified here are automatically used in the cathegory above.
+ hits_for_hough: sf
+# Use SciFi hits, value 0, or clusters, value 1
+ use_Scifi_clust: 0
+# Minumum number of planes with measurement to start pattern recognition.
+# Also, the required minimum number of planes intersected by
+# the Hough line prediction to proceed to track fitting.
+ min_planes_hit: 3
+# Mask a detector plane if its number of hits is larger than Nhits_per_plane.
+# Masking is only applied to detectors used for Hough transform.
+# Plane masking always leaves at least active planes
+# Plane masking will only be applied if solely Scifi hits are used in HT.
+ mask_plane: 0
+ Nhits_per_plane: 4
+# Maximum number of fitted tracks per event
+ max_reco_muons: 1
+# Maximum absolute value of reconstructed angle
+# (+/- 1 rad is the maximum angle to form a triplet in the SciFi)
+# The unit field is helper and not used in the code!
+ max_angle:
+ unit: rad
+ value: 1.
+# Number of random throws per measurement
+ n_random: 0
+# How many more times muon filter hits are thrown compared to SciFi measurements?
+ mufi_weight: 1
+# How far away from Hough line hits assigned to the muon can be?
+ tolerance:
+ unit: cm
+ value: 0.1
+# Enable Gaussian smoothing of the Hough-space image.
+# For 'ds' HT prediction, do a full accumulator smoothing.
+ smooth_full: 0
+# Gaussian filtering parameters.
+# The kernel size is determined as 2*int(truncate*sigma+0.5)+1.
+ sigma: 3
+ truncate: 4
+# Define the chosen Hough parameter space.
+# Choose parametrization. Options are
+# normal (rho, theta) representation, or
+# linear (slope, intecept), or
+# linear (intercept@1st, intercept@last syb-system plane)
+ Hough_space_format:
+ - normal:
+ N_yH_bins: 10000
+ yH_min_xz:
+ unit: cm
+ value: -85.
+ yH_max_xz:
+ unit: cm
+ value: 85.
+ yH_min_yz:
+ unit: cm
+ value: -85.
+ yH_max_yz:
+ unit: cm
+ value: 85.
+ N_xH_bins: 10000
+ xH_min_xz:
+ unit: rad
+ value: -1.57
+ xH_max_xz:
+ unit: rad
+ value: 1.57
+ xH_min_yz:
+ unit: rad
+ value: -1.57
+ xH_max_yz:
+ unit: rad
+ value: 1.57
+ - linearSlopeIntercept:
+ N_yH_bins: 7000
+ yH_min_xz:
+ unit: cm
+ value: -100.
+ yH_max_xz:
+ unit: cm
+ value: 40.
+ yH_min_yz:
+ unit: cm
+ value: -35.
+ yH_max_yz:
+ unit: cm
+ value: 105.
+ N_xH_bins: 7000
+ xH_min_xz:
+ unit: rad
+ value: -1.1
+ xH_max_xz:
+ unit: rad
+ value: 1.1
+ xH_min_yz:
+ unit: rad
+ value: -1.1
+ xH_max_yz:
+ unit: rad
+ value: 1.1
+ - linearIntercepts:
+ N_yH_bins: 7000
+ yH_min_xz:
+ unit: cm
+ value: -100.
+ yH_max_xz:
+ unit: cm
+ value: 40.
+ yH_min_yz:
+ unit: cm
+ value: -35.
+ yH_max_yz:
+ unit: cm
+ value: 105.
+ N_xH_bins: 7000
+ xH_min_xz:
+ unit: cm
+ value: -100.
+ xH_max_xz:
+ unit: cm
+ value: 40.
+ xH_min_yz:
+ unit: cm
+ value: -35.
+ xH_max_yz:
+ unit: cm
+ value: 105.
+# Helpers to select one HT space maxima among many.
+# The n-th quantile of found peaks along 'slope' axis(yH axis) must enlose
+# n_quantile portion of all maxima 'slope' bins within a res range.
+# If smoothing is active, n_quantile and res are not used!
+ n_quantile: 0.6
+# It is advisable to have res consistent with detector angular resolution.
+# The unit is Hough-space pixels.
+ res: 50
+
+ - passing_mu_DS:
+# Which detectors to use in the tracks fit, in the format: vesfusds,
+# where [ve] is Veto, [sf] is SciFi, [us] is Upstream Muon Filter,
+# and [ds] is Downstream Muon Filter.
+ hits_to_fit: ds
+# Which detectors to use to validate a track fit attempt. Format as above.
+# Detectors specified here are automatically used in the cathegory above.
+ hits_for_hough: ds
+# Use SciFi hits, value 0, or clusters, value 1
+ use_Scifi_clust: 0
+# Minumum number of planes with measurement to start pattern recognition.
+# Also, the required minimum number of planes intersected by
+# the Hough line prediction to proceed to track fitting.
+ min_planes_hit: 3
+# Mask a detector plane if its number of hits is larger than Nhits_per_plane.
+# Masking is only applied to detectors used for Hough transform.
+# Plane masking always leaves at least active planes
+# Plane masking will only be applied if solely Scifi hits are used in HT.
+ mask_plane: 0
+ Nhits_per_plane: 4
+# Maximum number of fitted tracks per event
+ max_reco_muons: 1
+# Maximum absolute value of reconstructed angle
+# (+/- 1 rad is the maximum angle to form a triplet in the SciFi)
+# The unit field is helper and not used in the code!
+ max_angle:
+ unit: rad
+ value: 1.
+# Number of random throws per measurement
+ n_random: 0
+# How many more times muon filter hits are thrown compared to SciFi measurements?
+ mufi_weight: 1
+# How far away from Hough line hits assigned to the muon can be?
+ tolerance:
+ unit: cm
+ value: 1.
+# Enable Gaussian smoothing of the Hough-space image.
+# For 'ds' HT prediction, do a full accumulator smoothing.
+ smooth_full: 1
+# Gaussian filtering parameters.
+# The kernel size is determined as 2*int(truncate*sigma+0.5)+1.
+ sigma: 3
+ truncate: 4
+# Define the chosen Hough parameter space.
+# Choose parametrization. Options are
+# normal (rho, theta) representation, or
+# linear (slope, intecept), or
+# linear (intercept@1st, intercept@last syb-system plane)
+ Hough_space_format:
+ - normal:
+ N_yH_bins: 1152
+ yH_min_xz:
+ unit: cm
+ value: -576.
+ yH_max_xz:
+ unit: cm
+ value: 576.
+ yH_min_yz:
+ unit: cm
+ value: -576.
+ yH_max_yz:
+ unit: cm
+ value: 576.
+ N_xH_bins: 2500
+ xH_min_xz:
+ unit: rad
+ value: -1.57
+ xH_max_xz:
+ unit: rad
+ value: 1.57
+ xH_min_yz:
+ unit: rad
+ value: -1.57
+ xH_max_yz:
+ unit: rad
+ value: 1.57
+ - linearSlopeIntercept:
+ N_yH_bins: 610
+ yH_min_xz:
+ unit: cm
+ value: -105.
+ yH_max_xz:
+ unit: cm
+ value: 17.
+ yH_min_yz:
+ unit: cm
+ value: 0.
+ yH_max_yz:
+ unit: cm
+ value: 122.
+ N_xH_bins: 220
+ xH_min_xz:
+ unit: rad
+ value: -1.1
+ xH_max_xz:
+ unit: rad
+ value: 1.1
+ xH_min_yz:
+ unit: rad
+ value: -1.1
+ xH_max_yz:
+ unit: rad
+ value: 1.1
+ - linearIntercepts:
+ N_yH_bins: 610
+ yH_min_xz:
+ unit: cm
+ value: -105.
+ yH_max_xz:
+ unit: cm
+ value: 17.
+ yH_min_yz:
+ unit: cm
+ value: 0.
+ yH_max_yz:
+ unit: cm
+ value: 122.
+ N_xH_bins: 610
+ xH_min_xz:
+ unit: cm
+ value: -105.
+ xH_max_xz:
+ unit: cm
+ value: 17.
+ xH_min_yz:
+ unit: cm
+ value: 0.
+ xH_max_yz:
+ unit: cm
+ value: 122.
+# Helpers to select one HT space maxima among many.
+# The n-th quantile of found peaks along 'slope' axis(yH axis) must enlose
+# n_quantile portion of all maxima 'slope' bins within a res range.
+# If smoothing is active, n_quantile and res are not used!
+ n_quantile: 0
+# It is advisable to have res consistent with detector angular resolution.
+# The unit is Hough-space pixels.
+ res: 0
+# end
diff --git a/python/TrackingParams_V2_28January2023.xml b/python/TrackingParams_V2_28January2023.xml
deleted file mode 100644
index 838d7c9122..0000000000
--- a/python/TrackingParams_V2_28January2023.xml
+++ /dev/null
@@ -1,302 +0,0 @@
-
-
-
-
-
-
-
-
-
- 0
-
- 0
-
-
-
- sfusds
-
- ds
-
- 0
-
- 3
-
- 0
- 4
-
- 5
-
- 1.
-
- 5
-
- 100
-
- 0.
-
- 1
-
- 3
- 4
-
-
-
-
- 1000
- -80.
- 0.
- 0.
- 80.
- 2500
- -1.57
- 1.57
- -1.57
- 1.57
-
-
- 610
- -105.
- 17.
- 0.
- 122.
- 220
- -1.1
- 1.1
- -1.1
- 1.1
-
-
- 610
- -105.
- 17.
- 0.
- 122.
- 610
- -105.
- 17.
- 0.
- 122.
-
-
- 0
-
- 0
-
- 1
-
-
-
-
- sf
-
- sf
-
- 0
-
- 3
-
- 0
- 4
-
- 1
-
- 1.
-
- 0
-
- 1
-
- 0.1
-
- 0
-
- 3
- 4
-
-
-
- 10000
- -85.
- 85.
- -85.
- 85.
- 10000
- -1.57
- 1.57
- -1.57
- 1.57
-
-
- 7000
- -100.
- 40.
- -35.
- 105.
- 7000
- -1.1
- 1.1
- -1.1
- 1.1
-
-
- 7000
- -100.
- 40.
- -35.
- 105.
- 7000
- -100.
- 40.
- -35.
- 105.
-
-
- 0.5
-
- 50
-
- 0.1
-
-
-
-
- ds
-
- ds
-
- 0
-
- 3
-
- 0
- 4
-
- 1
-
- 1.
-
- 0
-
- 1
-
- 1
-
- 0
-
- 3
- 4
-
-
-
- 1152
- -576.
- 576.
- -576.
- 576.
- 2500
- -1.57
- 1.57
- -1.57
- 1.57
-
-
- 122
- -105.
- 17.
- 0.
- 122.
- 220
- -1.1
- 1.1
- -1.1
- 1.1
-
-
- 610
- -105.
- 17.
- 0.
- 122.
- 610
- -105.
- 17.
- 0.
- 122.
-
-
- 0.5
-
- 5
-
- 1
-
-
-
-
diff --git a/python/TrackingParams_V2_28January2023.yml b/python/TrackingParams_V2_28January2023.yml
new file mode 100644
index 0000000000..6686119441
--- /dev/null
+++ b/python/TrackingParams_V2_28January2023.yml
@@ -0,0 +1,440 @@
+---
+# Input paramameters used with the SND@LHC Hough transform tracking
+
+# Author: S.Ilieva
+
+# Date: 28 Jan 2023
+
+# Tracks stored in genfit::Track format, value 1,
+# or sndRecoTrack class, value 0
+genfitTrack: 0
+# Enable option to visualize the polulated Hough space. Usefull for tests.
+draw: 0
+
+tracking_case:
+ - nu_interaction_products:
+# Which detectors to use in the tracks fit, in the format: vesfusds,
+# where [ve] is Veto, [sf] is SciFi, [us] is Upstream Muon Filter,
+# and [ds] is Downstream Muon Filter.
+ hits_to_fit: sfusds
+# Which detectors to use to validate a track fit attempt. Format as above.
+# Detectors specified here are automatically used in the cathegory above.
+ hits_to_validate: ds
+# Use SciFi hits, value 0, or clusters, value 1
+ use_Scifi_clust: 0
+# Minumum number of planes with measurement to start pattern recognition.
+# Also, the required minimum number of planes intersected by
+# the Hough line prediction to proceed to track fitting.
+ min_planes_hit: 3
+# Mask a detector plane if its number of hits is larger than Nhits_per_plane.
+# Masking is only applied to detectors used for Hough transform.
+# Plane masking always leaves at least active planes
+# Plane masking will only be applied if solely Scifi hits are used in HT.
+ mask_plane: 0
+ Nhits_per_plane: 5
+# Maximum number of fitted tracks per event
+ max_reco_muons: 6
+# Maximum absolute value of reconstructed angle
+# (+/- 1 rad is the maximum angle to form a triplet in the SciFi)
+# The unit field is helper and not used in the code!
+ max_angle:
+ unit: rad
+ value: 1.
+# Number of random throws per measurement
+ n_random: 5
+# How many more times muon filter hits are thrown compared to SciFi measurements?
+ mufi_weight: 100
+# How far away from Hough line hits assigned to the muon can be?
+ tolerance:
+ unit: cm
+ value: 0.
+# Enable Gaussian smoothing of the Hough-space image.
+# For 'ds' HT prediction, do a full accumulator smoothing.
+ smooth_full: 1
+# Gaussian filtering parameters.
+# The kernel size is determined as 2*int(truncate*sigma+0.5)+1.
+ sigma: 3
+ truncate: 4
+# Define the chosen Hough parameter space.
+# Choose parametrization. Options are
+# normal (rho, theta) representation, or
+# linear (slope, intecept), or
+# linear (intercept@1st, intercept@last syb-system plane)
+ Hough_space_format:
+ - normal:
+ N_yH_bins: 1000
+ yH_min_xz:
+ unit: cm
+ value: -80.
+ yH_max_xz:
+ unit: cm
+ value: 0.
+ yH_min_yz:
+ unit: cm
+ value: 0.
+ yH_max_yz:
+ unit: cm
+ value: 80.
+ N_xH_bins: 2500
+ xH_min_xz:
+ unit: rad
+ value: -1.57
+ xH_max_xz:
+ unit: rad
+ value: 1.57
+ xH_min_yz:
+ unit: rad
+ value: -1.57
+ xH_max_yz:
+ unit: rad
+ value: 1.57
+ - linearSlopeIntercept:
+ N_yH_bins: 610
+ yH_min_xz:
+ unit: cm
+ value: -105.
+ yH_max_xz:
+ unit: cm
+ value: 17.
+ yH_min_yz:
+ unit: cm
+ value: 0.
+ yH_max_yz:
+ unit: cm
+ value: 122.
+ N_xH_bins: 220
+ xH_min_xz:
+ unit: rad
+ value: -1.1
+ xH_max_xz:
+ unit: rad
+ value: 1.1
+ xH_min_yz:
+ unit: rad
+ value: -1.1
+ xH_max_yz:
+ unit: rad
+ value: 1.1
+ - linearIntercepts:
+ N_yH_bins: 610
+ yH_min_xz:
+ unit: cm
+ value: -105.
+ yH_max_xz:
+ unit: cm
+ value: 17.
+ yH_min_yz:
+ unit: cm
+ value: 0.
+ yH_max_yz:
+ unit: cm
+ value: 122.
+ N_xH_bins: 610
+ xH_min_xz:
+ unit: cm
+ value: -105.
+ xH_max_xz:
+ unit: cm
+ value: 17.
+ xH_min_yz:
+ unit: cm
+ value: 0.
+ xH_max_yz:
+ unit: cm
+ value: 122.
+# Helpers to select one HT space maxima among many.
+# The n-th quantile of found peaks along 'slope' axis(yH axis) must enlose
+# n_quantile portion of all maxima 'slope' bins within a res range.
+# If smoothing is active, n_quantile and res are not used!
+ n_quantile: 0
+# It is advisable to have res consistent with detector angular resolution.
+# The unit is Hough-space pixels.
+ res: 0
+# A back-up Hough space with 'space_scale'*Nbins in xH and yH axes.
+# It is used in events where the above-defined common HT space is not optimal.
+ HT_space_scale: 1
+
+ - passing_mu_Sf:
+# Which detectors to use in the tracks fit, in the format: vesfusds,
+# where [ve] is Veto, [sf] is SciFi, [us] is Upstream Muon Filter,
+# and [ds] is Downstream Muon Filter.
+ hits_to_fit: sf
+# Which detectors to use to validate a track fit attempt. Format as above.
+# Detectors specified here are automatically used in the cathegory above.
+ hits_to_validate: sf
+# Use SciFi hits, value 0, or clusters, value 1
+ use_Scifi_clust: 0
+# Minumum number of planes with measurement to start pattern recognition.
+# Also, the required minimum number of planes intersected by
+# the Hough line prediction to proceed to track fitting.
+ min_planes_hit: 3
+# Mask a detector plane if its number of hits is larger than Nhits_per_plane.
+# Masking is only applied to detectors used for Hough transform.
+# Plane masking always leaves at least active planes
+# Plane masking will only be applied if solely Scifi hits are used in HT.
+ mask_plane: 0
+ Nhits_per_plane: 4
+# Maximum number of fitted tracks per event
+ max_reco_muons: 1
+# Maximum absolute value of reconstructed angle
+# (+/- 1 rad is the maximum angle to form a triplet in the SciFi)
+# The unit field is helper and not used in the code!
+ max_angle:
+ unit: rad
+ value: 1.
+# Number of random throws per measurement
+ n_random: 0
+# How many more times muon filter hits are thrown compared to SciFi measurements?
+ mufi_weight: 1
+# How far away from Hough line hits assigned to the muon can be?
+ tolerance:
+ unit: cm
+ value: 0.1
+# Enable Gaussian smoothing of the Hough-space image.
+# For 'ds' HT prediction, do a full accumulator smoothing.
+ smooth_full: 0
+# Gaussian filtering parameters.
+# The kernel size is determined as 2*int(truncate*sigma+0.5)+1.
+ sigma: 3
+ truncate: 4
+# Define the chosen Hough parameter space.
+# Choose parametrization. Options are
+# normal (rho, theta) representation, or
+# linear (slope, intecept), or
+# linear (intercept@1st, intercept@last syb-system plane)
+ Hough_space_format:
+ - normal:
+ N_yH_bins: 10000
+ yH_min_xz:
+ unit: cm
+ value: -85.
+ yH_max_xz:
+ unit: cm
+ value: 85.
+ yH_min_yz:
+ unit: cm
+ value: -85.
+ yH_max_yz:
+ unit: cm
+ value: 85.
+ N_xH_bins: 10000
+ xH_min_xz:
+ unit: rad
+ value: -1.57
+ xH_max_xz:
+ unit: rad
+ value: 1.57
+ xH_min_yz:
+ unit: rad
+ value: -1.57
+ xH_max_yz:
+ unit: rad
+ value: 1.57
+ - linearSlopeIntercept:
+ N_yH_bins: 7000
+ yH_min_xz:
+ unit: cm
+ value: -100.
+ yH_max_xz:
+ unit: cm
+ value: 40.
+ yH_min_yz:
+ unit: cm
+ value: -35.
+ yH_max_yz:
+ unit: cm
+ value: 105.
+ N_xH_bins: 7000
+ xH_min_xz:
+ unit: rad
+ value: -1.1
+ xH_max_xz:
+ unit: rad
+ value: 1.1
+ xH_min_yz:
+ unit: rad
+ value: -1.1
+ xH_max_yz:
+ unit: rad
+ value: 1.1
+ - linearIntercepts:
+ N_yH_bins: 7000
+ yH_min_xz:
+ unit: cm
+ value: -100.
+ yH_max_xz:
+ unit: cm
+ value: 40.
+ yH_min_yz:
+ unit: cm
+ value: -35.
+ yH_max_yz:
+ unit: cm
+ value: 105.
+ N_xH_bins: 7000
+ xH_min_xz:
+ unit: cm
+ value: -100.
+ xH_max_xz:
+ unit: cm
+ value: 40.
+ xH_min_yz:
+ unit: cm
+ value: -35.
+ xH_max_yz:
+ unit: cm
+ value: 105.
+# Helpers to select one HT space maxima among many.
+# The n-th quantile of found peaks along 'slope' axis(yH axis) must enlose
+# n_quantile portion of all maxima 'slope' bins within a res range.
+# If smoothing is active, n_quantile and res are not used!
+ n_quantile: 0.5
+# It is advisable to have res consistent with detector angular resolution.
+# The unit is Hough-space pixels.
+ res: 50
+# A back-up Hough space with 'space_scale'*Nbins in xH and yH axes.
+# It is used in events where the above-defined common HT space is not optimal.
+ HT_space_scale: 0.1
+
+ - passing_mu_DS:
+# Which detectors to use in the tracks fit, in the format: vesfusds,
+# where [ve] is Veto, [sf] is SciFi, [us] is Upstream Muon Filter,
+# and [ds] is Downstream Muon Filter.
+ hits_to_fit: ds
+# Which detectors to use to validate a track fit attempt. Format as above.
+# Detectors specified here are automatically used in the cathegory above.
+ hits_to_validate: ds
+# Use SciFi hits, value 0, or clusters, value 1
+ use_Scifi_clust: 0
+# Minumum number of planes with measurement to start pattern recognition.
+# Also, the required minimum number of planes intersected by
+# the Hough line prediction to proceed to track fitting.
+ min_planes_hit: 3
+# Mask a detector plane if its number of hits is larger than Nhits_per_plane.
+# Masking is only applied to detectors used for Hough transform.
+# Plane masking always leaves at least active planes
+# Plane masking will only be applied if solely Scifi hits are used in HT.
+ mask_plane: 0
+ Nhits_per_plane: 4
+# Maximum number of fitted tracks per event
+ max_reco_muons: 1
+# Maximum absolute value of reconstructed angle
+# (+/- 1 rad is the maximum angle to form a triplet in the SciFi)
+# The unit field is helper and not used in the code!
+ max_angle:
+ unit: rad
+ value: 1.
+# Number of random throws per measurement
+ n_random: 0
+# How many more times muon filter hits are thrown compared to SciFi measurements?
+ mufi_weight: 1
+# How far away from Hough line hits assigned to the muon can be?
+ tolerance:
+ unit: cm
+ value: 1
+# Enable Gaussian smoothing of the Hough-space image.
+# For 'ds' HT prediction, do a full accumulator smoothing.
+ smooth_full: 0
+# Gaussian filtering parameters.
+# The kernel size is determined as 2*int(truncate*sigma+0.5)+1.
+ sigma: 3
+ truncate: 4
+# Define the chosen Hough parameter space.
+# Choose parametrization. Options are
+# normal (rho, theta) representation, or
+# linear (slope, intecept), or
+# linear (intercept@1st, intercept@last syb-system plane)
+ Hough_space_format:
+ - normal:
+ N_yH_bins: 1152
+ yH_min_xz:
+ unit: cm
+ value: -576.
+ yH_max_xz:
+ unit: cm
+ value: 576.
+ yH_min_yz:
+ unit: cm
+ value: -576.
+ yH_max_yz:
+ unit: cm
+ value: 576.
+ N_xH_bins: 2500
+ xH_min_xz:
+ unit: rad
+ value: -1.57
+ xH_max_xz:
+ unit: rad
+ value: 1.57
+ xH_min_yz:
+ unit: rad
+ value: -1.57
+ xH_max_yz:
+ unit: rad
+ value: 1.57
+ - linearSlopeIntercept:
+ N_yH_bins: 122
+ yH_min_xz:
+ unit: cm
+ value: -105.
+ yH_max_xz:
+ unit: cm
+ value: 17.
+ yH_min_yz:
+ unit: cm
+ value: 0.
+ yH_max_yz:
+ unit: cm
+ value: 122.
+ N_xH_bins: 220
+ xH_min_xz:
+ unit: rad
+ value: -1.1
+ xH_max_xz:
+ unit: rad
+ value: 1.1
+ xH_min_yz:
+ unit: rad
+ value: -1.1
+ xH_max_yz:
+ unit: rad
+ value: 1.1
+ - linearIntercepts:
+ N_yH_bins: 610
+ yH_min_xz:
+ unit: cm
+ value: -105.
+ yH_max_xz:
+ unit: cm
+ value: 17.
+ yH_min_yz:
+ unit: cm
+ value: 0.
+ yH_max_yz:
+ unit: cm
+ value: 122.
+ N_xH_bins: 610
+ xH_min_xz:
+ unit: cm
+ value: -105.
+ xH_max_xz:
+ unit: cm
+ value: 17.
+ xH_min_yz:
+ unit: cm
+ value: 0.
+ xH_max_yz:
+ unit: cm
+ value: 122.
+# Helpers to select one HT space maxima among many.
+# The n-th quantile of found peaks along 'slope' axis(yH axis) must enlose
+# n_quantile portion of all maxima 'slope' bins within a res range.
+# If smoothing is active, n_quantile and res are not used!
+ n_quantile: 0.5
+# It is advisable to have res consistent with detector angular resolution.
+# The unit is Hough-space pixels.
+ res: 5
+# A back-up Hough space with 'space_scale'*Nbins in xH and yH axes.
+# It is used in events where the above-defined common HT space is not optimal.
+ HT_space_scale: 1
+# end
diff --git a/shipLHC/run_muonRecoSND.py b/shipLHC/run_muonRecoSND.py
index 7e01e4628c..9bead6eb55 100644
--- a/shipLHC/run_muonRecoSND.py
+++ b/shipLHC/run_muonRecoSND.py
@@ -9,7 +9,7 @@
parser.add_argument("-g", "--geoFile", dest="geoFile", help="geofile", required=False)
parser.add_argument("-o", "--withOutput", dest="withOutput", help="persistent output", action='store_true',default=False)
parser.add_argument("-s", "--saveTo", dest="outPath", help="output storage path", type=str,default="",required=False)
-parser.add_argument("-par", "--parFile", dest="parFile", help="parameter file", required=False, default=os.environ['SNDSW_ROOT']+"/python/TrackingParams.xml")
+parser.add_argument("-par", "--parFile", dest="parFile", help="parameter file", required=False, default=os.environ['SNDSW_ROOT']+"/python/TrackingParams.yml")
parser.add_argument("-c", "--case", dest="trackingCase", help="type of tracks to build. Should match the 'tracking_case' name in parFile, use quotes", required=True)
parser.add_argument("-hf", "--HoughSpaceFormat", dest="HspaceFormat", help="Hough space representation. Should match the 'Hough_space_format' name in parFile, use quotes", required=True)
parser.add_argument("-n", "--nEvents", dest="nEvents", type=int, help="number of events to process", default=1100000)
diff --git a/shipLHC/scripts/2dEventDisplay.py b/shipLHC/scripts/2dEventDisplay.py
index 2c585cdc86..7bf8b9cce4 100644
--- a/shipLHC/scripts/2dEventDisplay.py
+++ b/shipLHC/scripts/2dEventDisplay.py
@@ -34,7 +34,7 @@ def pyExit():
parser.add_argument("--server", dest="server", help="xrootd server",default=os.environ["EOSSHIP"])
parser.add_argument("-X", dest="extraInfo", help="print extra event info",default=True)
-parser.add_argument("-par", "--parFile", dest="parFile", help="parameter file", default=os.environ['SNDSW_ROOT']+"/python/TrackingParams.xml")
+parser.add_argument("-par", "--parFile", dest="parFile", help="parameter file", default=os.environ['SNDSW_ROOT']+"/python/TrackingParams.yml")
parser.add_argument("-hf", "--HoughSpaceFormat", dest="HspaceFormat", help="Hough space representation. Should match the 'Hough_space_format' name in parFile, use quotes", default='linearSlopeIntercept')
options = parser.parse_args()
diff --git a/shipLHC/scripts/run_TrackSelections.py b/shipLHC/scripts/run_TrackSelections.py
index 6e4824164c..caa78e4f28 100644
--- a/shipLHC/scripts/run_TrackSelections.py
+++ b/shipLHC/scripts/run_TrackSelections.py
@@ -36,7 +36,7 @@ def pyExit():
parser.add_argument("--save", dest="save", action='store_true',default=False)
parser.add_argument("-ht", "--HoughTracking", dest="HoughTracking", action='store_true', default=False)
-parser.add_argument("-par", "--parFile", dest="parFile", help="parameter file", default=os.environ['SNDSW_ROOT']+"/python/TrackingParams.xml")
+parser.add_argument("-par", "--parFile", dest="parFile", help="parameter file", default=os.environ['SNDSW_ROOT']+"/python/TrackingParams.yml")
parser.add_argument("-hf", "--HoughSpaceFormat", dest="HspaceFormat", help="Hough space representation. Should match the 'Hough_space_format' name in parFile, use quotes", default='linearSlopeIntercept')
parser.add_argument("-sc", "--scale",dest="scaleFactor", help="Randomly run reconstruction.", required=False, default=1, type=int)
@@ -66,7 +66,7 @@ def pyExit():
if options.simpleTracking:
trackTask = SndlhcTracking.Tracking()
trackTask.SetName("simpleTracking")
- # If HT task is also used, pass the track format from its xml
+ # If HT task is also used, pass the track format from its input yaml file
# else consult with the command line genfitFormat option
if options.HoughTracking: pass
else: options.genfitTrack = options.genfitFormat