Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:10:44

0001 #!/usr/bin/env python3
0002 
0003 # This file is part of the ACTS project.
0004 #
0005 # Copyright (C) 2016 CERN for the benefit of the ACTS project
0006 #
0007 # This Source Code Form is subject to the terms of the Mozilla Public
0008 # License, v. 2.0. If a copy of the MPL was not distributed with this
0009 # file, You can obtain one at https://mozilla.org/MPL/2.0/.
0010 
0011 # Configuration taken from: https://arxiv.org/pdf/1904.06778.pdf
0012 # See also https://github.com/acts-project/acts/issues/946
0013 
0014 import argparse
0015 import math
0016 import subprocess
0017 
0018 args = argparse.ArgumentParser()
0019 args.add_argument("sourcedir")
0020 args = args.parse_args()
0021 
0022 volumes = [7, 8, 9, 12, 13, 14, 16, 17, 18]
0023 
0024 
0025 base_cli = [
0026     "python",
0027     args.sourcedir + "/Examples/Algorithms/Digitization/scripts/smearing-config.py",
0028 ]
0029 
0030 for vid in volumes:
0031     # 50μm×50μmand further out two different strip detectors withshort80μm×1200μmand long strips0.12 mm×10.8 mmare placed.
0032     if vid in [7, 8, 9]:  # Pixel
0033         resx, resy = 0.05, 0.05
0034     elif vid in [12, 13, 14]:  # Short strip
0035         resx, resy = 0.08, 1.2
0036     elif vid in [16, 17, 18]:  # Long strip
0037         resx, resy = 0.12, 10.8
0038     else:
0039         raise RuntimeError("Invalid volume id")
0040 
0041     resx /= math.sqrt(12)
0042     resy /= math.sqrt(12)
0043 
0044     base_cli += [
0045         "--digi-smear-volume={}".format(vid),
0046         "--digi-smear-indices=0:1",
0047         "--digi-smear-types=0:0",
0048         "--digi-smear-parameters={}:{}".format(resx, resy),
0049     ]
0050 
0051 output = subprocess.check_output(base_cli).decode("utf-8")
0052 
0053 ref_path = (
0054     args.sourcedir
0055     + "/Examples/Algorithms/Digitization/share/default-smearing-config-generic.json"
0056 )
0057 
0058 with open(ref_path, "r") as ifile:
0059     ref = ifile.read()
0060 
0061 for i, (line_ref, line_gen) in enumerate(zip(ref.split("\n"), output.split("\n"))):
0062     lhs = line_ref.strip()
0063     rhs = line_gen.strip()
0064 
0065     if lhs != rhs:
0066         raise RuntimeError(f"Mismatched line #{i}: Ref=<{lhs}>, Gen=<{rhs}>")