Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • leggett/acts-core
  • adye/acts-core
  • xju/acts-core
  • corentin/acts-core
  • keli/acts-core
  • gli/acts-core
  • xai/acts-core
  • bschlag/acts-core
  • berkeleylab/acts/acts-core
  • emoyse/acts-core
  • smh/acts-core
  • pagessin/acts-core
  • chamont/acts-core
  • sroe/a-common-tracking-sw
  • calaf/a-common-tracking-sw
  • hgraslan/acts-core
16 results
Show changes
Commits on Source (62)
Showing
with 795 additions and 775 deletions
--- ---
BasedOnStyle: Google
Language: Cpp Language: Cpp
AccessModifierOffset: -2 AllowShortBlocksOnASingleLine: false
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlinesLeft: false
AlignOperands: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: true AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: true AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: All PointerAlignment: Left
AlwaysBreakAfterReturnType: All
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: true
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: true
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: All
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
ColumnLimit: 80 ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories: IncludeCategories:
- Regex: '^<.*>' - Regex: '^<.*>'
Priority: 1 Priority: 1
...@@ -54,38 +17,4 @@ IncludeCategories: ...@@ -54,38 +17,4 @@ IncludeCategories:
Priority: 3 Priority: 3
- Regex: '.*' - Regex: '.*'
Priority: 4 Priority: 4
IndentCaseLabels: false ---
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: Inner
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 2
UseTab: Never
...
...@@ -17,7 +17,7 @@ before_script: ...@@ -17,7 +17,7 @@ before_script:
format: format:
stage: build stage: build
image: gitlab-registry.cern.ch/acts/machines/check:latest image: gitlab-registry.cern.ch/acts/machines/check_llvm8:latest
before_script: [] before_script: []
script: script:
- CI/check_format . - CI/check_format .
...@@ -32,7 +32,7 @@ license: ...@@ -32,7 +32,7 @@ license:
before_script: [] before_script: []
script: script:
- apk add --no-cache git - apk add --no-cache git
- CI/check_license.py . --check-years - CI/check_license.py .
include_guards: include_guards:
stage: build stage: build
......
...@@ -17,5 +17,5 @@ docker run --rm -ti \ ...@@ -17,5 +17,5 @@ docker run --rm -ti \
-v ${WD}:/work_dir:rw \ -v ${WD}:/work_dir:rw \
--user "${USER_ID}:${GROUP_ID}" \ --user "${USER_ID}:${GROUP_ID}" \
-w "/work_dir" \ -w "/work_dir" \
gitlab-registry.cern.ch/acts/machines/check:latest \ gitlab-registry.cern.ch/acts/machines/check_llvm8:latest \
CI/check_format . CI/check_format .
...@@ -10,23 +10,28 @@ from fnmatch import fnmatch ...@@ -10,23 +10,28 @@ from fnmatch import fnmatch
EXCLUDE = ["./Plugins/Json/include/Acts/Plugins/Json/lib/*"] EXCLUDE = ["./Plugins/Json/include/Acts/Plugins/Json/lib/*"]
class bcolors: class bcolors:
HEADER = '\033[95m' HEADER = "\033[95m"
OKBLUE = '\033[94m' OKBLUE = "\033[94m"
OKGREEN = '\033[92m' OKGREEN = "\033[92m"
WARNING = '\033[93m' WARNING = "\033[93m"
FAIL = '\033[91m' FAIL = "\033[91m"
ENDC = '\033[0m' ENDC = "\033[0m"
BOLD = '\033[1m' BOLD = "\033[1m"
UNDERLINE = '\033[4m' UNDERLINE = "\033[4m"
CROSS_SYMBOL = u"\u2717" CROSS_SYMBOL = u"\u2717"
def err(string): def err(string):
if sys.stdout.isatty(): if sys.stdout.isatty():
return bcolors.FAIL + bcolors.BOLD + string + bcolors.ENDC return bcolors.FAIL + bcolors.BOLD + string + bcolors.ENDC
else: else:
return string return string
class CommitInfo: class CommitInfo:
date = None date = None
year = None year = None
...@@ -34,8 +39,13 @@ class CommitInfo: ...@@ -34,8 +39,13 @@ class CommitInfo:
subject = None subject = None
body = None body = None
def check_git_dates(src): def check_git_dates(src):
output = check_output(["git", "log", '--format={{{%an|%ad|%s|%b}}}', "--", src]).decode("utf-8").strip() output = (
check_output(["git", "log", "--format={{{%an|%ad|%s|%b}}}", "--", src])
.decode("utf-8")
.strip()
)
# find single outputs # find single outputs
commits = re.findall(r"{{{((?:.|\n)*?)}}}", output) commits = re.findall(r"{{{((?:.|\n)*?)}}}", output)
...@@ -57,7 +67,7 @@ def check_git_dates(src): ...@@ -57,7 +67,7 @@ def check_git_dates(src):
addcommit.author = add[0] addcommit.author = add[0]
addcommit.subject = add[2] addcommit.subject = add[2]
addcommit.body = add[3] addcommit.body = add[3]
modcommit = CommitInfo() modcommit = CommitInfo()
modcommit.date = mod[1] modcommit.date = mod[1]
modcommit.year = int(mmod.group(1)) modcommit.year = int(mmod.group(1))
...@@ -71,14 +81,46 @@ def check_git_dates(src): ...@@ -71,14 +81,46 @@ def check_git_dates(src):
def main(): def main():
p = argparse.ArgumentParser() p = argparse.ArgumentParser()
p.add_argument("input") p.add_argument("input")
p.add_argument("--fix", action="store_true", help="Attempt to fix any license issues found.") p.add_argument(
p.add_argument("--check-years", action="store_true", help="Check the license year info using git info for each file.") "--fix", action="store_true", help="Attempt to fix any license issues found."
p.add_argument("--fail-year-mismatch", action="store_true", help="Fail if year in license statement is not valid.") )
p.add_argument(
"--check-years",
action="store_true",
help="Check the license year info using git info for each file.",
)
p.add_argument(
"--fail-year-mismatch",
action="store_true",
help="Fail if year in license statement is not valid.",
)
p.add_argument("--exclude", "-e", action="append", default=EXCLUDE)
args = p.parse_args() args = p.parse_args()
print(args.exclude)
if os.path.isdir(args.input): if os.path.isdir(args.input):
srcs = str(check_output(["find", args.input, "-iname", "*.cpp", "-or", "-iname", "*.hpp", "-or", "-iname", "*.ipp"]), "utf-8").strip().split("\n") srcs = (
str(
check_output(
[
"find",
args.input,
"-iname",
"*.cpp",
"-or",
"-iname",
"*.hpp",
"-or",
"-iname",
"*.ipp",
]
),
"utf-8",
)
.strip()
.split("\n")
)
srcs = filter(lambda p: not p.startswith("./build"), srcs) srcs = filter(lambda p: not p.startswith("./build"), srcs)
else: else:
srcs = [args.input] srcs = [args.input]
...@@ -87,7 +129,7 @@ def main(): ...@@ -87,7 +129,7 @@ def main():
raw = """// This file is part of the Acts project. raw = """// This file is part of the Acts project.
// //
// Copyright (C) {year} Acts project team // Copyright (C) {year} CERN for the benefit of the Acts project
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
...@@ -95,23 +137,25 @@ def main(): ...@@ -95,23 +137,25 @@ def main():
reg = ( reg = (
r"\A// This file is part of the Acts project.\n" r"\A// This file is part of the Acts project.\n"
+r"//\n" + r"//\n"
+r"// Copyright \(C\) (?P<year>.*) Acts project team\n" + r"// Copyright \(C\) (?P<year>.*) CERN for the benefit of the Acts project\n"
+r"//\n" + r"//\n"
+r"// This Source Code Form is subject to the terms of the Mozilla Public\n" + r"// This Source Code Form is subject to the terms of the Mozilla Public\n"
+r"// License, v\. 2\.0\. If a copy of the MPL was not distributed with this\n" + r"// License, v\. 2\.0\. If a copy of the MPL was not distributed with this\n"
+r"// file, You can obtain one at http://mozilla.org/MPL/2.0/.\Z" + r"// file, You can obtain one at http://mozilla.org/MPL/2.0/.\Z"
) )
ref = re.compile(reg, re.M) ref = re.compile(reg, re.M)
clean_re = re.compile(r"(\(C\)) (.*) (Acts)", re.M) clean_re = re.compile(r"(\(C\)) (.*) (Acts)", re.M)
year_re = re.compile(r"^(?P<year1>20\d{2}|(?P<year2>20\d{2})-(?P<year3>20\d{2}))$") year_re = re.compile(r"^(?P<year1>20\d{2}|(?P<year2>20\d{2})-(?P<year3>20\d{2}))$")
extract_re = re.compile(r"(20\d{2})-?(20\d{2})?") extract_re = re.compile(r"(20\d{2})-?(20\d{2})?")
def clean(s): def clean(s):
return clean_re.sub(r"\1 XXXX \3", s) return clean_re.sub(r"\1 XXXX \3", s)
def get_clean_lines(s): def get_clean_lines(s):
return [clean(l)+"\n" for l in s.split("\n")] return [clean(l) + "\n" for l in s.split("\n")]
def validate_years(year1, year2): def validate_years(year1, year2):
if year1 and year2: if year1 and year2:
year1 = int(year1) year1 = int(year1)
...@@ -145,17 +189,16 @@ def main(): ...@@ -145,17 +189,16 @@ def main():
exit = 0 exit = 0
srcs = list(srcs) srcs = list(srcs)
nsrcs = len(srcs) nsrcs = len(srcs)
step = int(nsrcs/20) step = int(nsrcs / 20)
for i, src in enumerate(srcs): for i, src in enumerate(srcs):
if any([fnmatch(src, e) for e in EXCLUDE]): if any([fnmatch(src, e) for e in args.exclude]):
continue continue
if nsrcs > 1 and i % step == 0:
if nsrcs > 1 and i%step == 0: string = "{}/{} -> {:.2f}%".format(i, nsrcs, i / float(nsrcs) * 100.0)
string = "{}/{} -> {:.2f}%".format(i, nsrcs, i/float(nsrcs)*100.)
if sys.stdout.isatty(): if sys.stdout.isatty():
sys.stdout.write(string+"\r") sys.stdout.write(string + "\r")
else: else:
print(string) print(string)
...@@ -170,9 +213,9 @@ def main(): ...@@ -170,9 +213,9 @@ def main():
m = ref.search(license) m = ref.search(license)
if m == None: if m == None:
eprint("Invalid / missing license in "+src+"") eprint("Invalid / missing license in " + src + "")
exp = [l+"\n" for l in raw.format(year="XXXX").split("\n")] exp = [l + "\n" for l in raw.format(year="XXXX").split("\n")]
act = get_clean_lines(license) act = get_clean_lines(license)
diff = difflib.unified_diff(exp, act) diff = difflib.unified_diff(exp, act)
...@@ -185,7 +228,7 @@ def main(): ...@@ -185,7 +228,7 @@ def main():
file_content = f.read() file_content = f.read()
f.seek(0) f.seek(0)
stmnt = raw.format(year=year) stmnt = raw.format(year=year)
f.write(stmnt+"\n\n") f.write(stmnt + "\n\n")
f.write(file_content) f.write(file_content)
exit = 1 exit = 1
...@@ -219,7 +262,7 @@ def main(): ...@@ -219,7 +262,7 @@ def main():
if not validate_years(year1, year2): if not validate_years(year1, year2):
eprint("Year string is not valid in {}".format(src)) eprint("Year string is not valid in {}".format(src))
eprint("Year string is: "+year_act+"\n") eprint("Year string is: " + year_act + "\n")
exit = 1 exit = 1
valid = False valid = False
...@@ -230,16 +273,29 @@ def main(): ...@@ -230,16 +273,29 @@ def main():
if not (year1 and year2): if not (year1 and year2):
year_print("File: {}".format(src)) year_print("File: {}".format(src))
# year_print("o File was modified in a different year ({}) than it was added ({})." # year_print("o File was modified in a different year ({}) than it was added ({})."
# .format(git_mod_year, git_add_year)) # .format(git_mod_year, git_add_year))
year_print("- File was added in {}".format(git_add_year)) year_print(
year_print("- File was modified on {} by {}:\n{}".format( "- File was added in {}".format(git_add_year)
git_mod_commit.date, )
git_mod_commit.author, year_print(
git_mod_commit.subject + git_mod_commit.body)) "- File was modified on {} by {}:\n{}".format(
year_print("=> License should say {}-{}".format(git_add_year, git_mod_year)) git_mod_commit.date,
git_mod_commit.author,
git_mod_commit.subject + git_mod_commit.body,
)
)
year_print(
"=> License should say {}-{}".format(
git_add_year, git_mod_year
)
)
act_year = year1 if year1 else year2 act_year = year1 if year1 else year2
year_print(err("{} But says: {}".format(CROSS_SYMBOL, act_year))) year_print(
err(
"{} But says: {}".format(CROSS_SYMBOL, act_year)
)
)
if args.fail_year_mismatch: if args.fail_year_mismatch:
exit = 1 exit = 1
...@@ -248,17 +304,40 @@ def main(): ...@@ -248,17 +304,40 @@ def main():
year_print("This is not treated as an error\n") year_print("This is not treated as an error\n")
valid = False valid = False
else: else:
if int(year1) != git_add_year or int(year2) != git_mod_year: if (
int(year1) != git_add_year
or int(year2) != git_mod_year
):
year_print("File: {}".format(src)) year_print("File: {}".format(src))
year_print("Year range {}-{} does not match range from git {}-{}".format(year1, year2, git_add_year, git_mod_year)) year_print(
year_print("- File was added in {}".format(git_add_year)) "Year range {}-{} does not match range from git {}-{}".format(
year_print("- File was modified on {} by {}:\n{}".format( year1, year2, git_add_year, git_mod_year
git_mod_commit.date, )
git_mod_commit.author, )
git_mod_commit.subject + git_mod_commit.body)) year_print(
year_print("=> License should say {}-{}".format(git_add_year, git_mod_year)) "- File was added in {}".format(git_add_year)
year_print(err("{} But says: {}-{}".format(CROSS_SYMBOL, year1, year2))) )
year_print(
"- File was modified on {} by {}:\n{}".format(
git_mod_commit.date,
git_mod_commit.author,
git_mod_commit.subject
+ git_mod_commit.body,
)
)
year_print(
"=> License should say {}-{}".format(
git_add_year, git_mod_year
)
)
year_print(
err(
"{} But says: {}-{}".format(
CROSS_SYMBOL, year1, year2
)
)
)
if args.fail_year_mismatch: if args.fail_year_mismatch:
exit = 1 exit = 1
year_print("\n") year_print("\n")
...@@ -269,13 +348,24 @@ def main(): ...@@ -269,13 +348,24 @@ def main():
else: else:
if int(year1) < git_mod_year: if int(year1) < git_mod_year:
year_print("File: {}".format(src)) year_print("File: {}".format(src))
year_print("- Year {} does not match git modification year {}".format(year1, git_mod_year)) year_print(
year_print("- File was modified on {} by {}:\n{}".format( "- Year {} does not match git modification year {}".format(
git_mod_commit.date, year1, git_mod_year
git_mod_commit.author, )
git_mod_commit.subject + git_mod_commit.body)) )
year_print("=> License should say {}".format(git_mod_year)) year_print(
year_print(err("{} But says: {}".format(CROSS_SYMBOL, year1))) "- File was modified on {} by {}:\n{}".format(
git_mod_commit.date,
git_mod_commit.author,
git_mod_commit.subject + git_mod_commit.body,
)
)
year_print(
"=> License should say {}".format(git_mod_year)
)
year_print(
err("{} But says: {}".format(CROSS_SYMBOL, year1))
)
if args.fail_year_mismatch: if args.fail_year_mismatch:
exit = 1 exit = 1
year_print("\n") year_print("\n")
...@@ -318,6 +408,5 @@ def main(): ...@@ -318,6 +408,5 @@ def main():
sys.exit(exit) sys.exit(exit)
if "__main__" == __name__: if "__main__" == __name__:
main() main()
#!/usr/bin/env bash
function krb5logout {
echo "* Destroying Kerberos 5 ticket..."
kdestroy
}
# always log out when script is exited
trap krb5logout EXIT
# abort on error
set -ex
# check for correct number of arguments
if [ $# -ne 3 ]
then
echo "wrong number of arguments"
echo "usage: deploy_tag <ACTS_DIR> <DOC_DIR> <ACTS_MAIL>"
exit 1
fi
# check for required environment variables
: ${CI_COMMIT_REF_NAME:?"'CI_COMMIT_REF_NAME' not set or empty"}
# check for Acts
ACTS_DIR=`readlink -f $1`
if [ ! -d "$ACTS_DIR" ]
then
echo "ACTS_DIR='$ACTS_DIR' not found -> aborting"
exit 1
fi
# check for doxygen documentation
DOC_DIR=`readlink -f $2`
if [ ! -d "$DOC_DIR" ]
then
echo "DOC_DIR='$DOC_DIR' not found -> aborting"
exit 1
fi
# get Acts version tag
VERSION=`basename $CI_COMMIT_REF_NAME`
# create tarball with source and copy it to server
# configure ssh to use kerberos
mkdir -p ~/.ssh/
echo "GSSAPIAuthentication yes
GSSAPITrustDNS yes
StrictHostKeyChecking no
GSSAPIDelegateCredentials yes" > ~/.ssh/config
ACTS_WWW_DIR="/eos/user/a/atsjenkins/www/ACTS"
ssh atsjenkins@lxplus.CERN.CH "mkdir -p $ACTS_WWW_DIR/$VERSION"
# copy doxygen documentation to server
scp -r $DOC_DIR atsjenkins@lxplus.cern.ch:$ACTS_WWW_DIR/$VERSION/doc
# send notification email
ssh atsjenkins@lxplus.CERN.CH "mail -v -s 'New tag Acts-$VERSION' -r 'atsjenkins@cern.ch' $3 <<EOF
Dear Acts enthusiasts,
a new tag '$VERSION' of the Acts project has been released. You can get the source code from git using
git clone https://gitlab.cern.ch/acts/acts-core.git acts
cd acts/
git checkout $VERSION
or you can download a tarball with the source from
https://gitlab.cern.ch/acts/acts-core/repository/$VERSION/archive.tar.gz
Detailed documentation can be found at
https://acts.web.cern.ch/ACTS/$VERSION/doc/index.html
Cheers,
your friendly Acts robot
EOF"
#!/usr/bin/env python3
import argparse
import os
import fs
from fs.osfs import OSFS
from markdown import markdown as mdlib
import textwrap
import json
from util import smtp, def_arguments, get_lxplus_fs, Spinner, gitlab
from release_notes import collect_milestone, make_release_notes, parse_version
sender_email = "Acts Bot <atsjenkins@cern.ch>"
receiver_email = os.getenv("TAG_DEPLOY_EMAIL_RECEIVERS")
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
def markdown(md):
return mdlib(md, extensions=["pymdownx.extra"])
def main():
p = argparse.ArgumentParser()
p = def_arguments(p, acc=True, gl=True)
p.add_argument("--doc-source", required=True)
p.add_argument("--dry-run", action="store_true")
p.add_argument(
"--ref", default=os.getenv("CI_COMMIT_REF_NAME", None), required=True
)
p.add_argument(
"--doc-root",
default=os.getenv("DOC_WEBSITE_ROOT", "/eos/user/a/atsjenkins/www/ACTS/"),
)
p.add_argument(
"--doc-public-url",
default=os.getenv("DOC_WEBSITE_URL", "https://acts.web.cern.ch/ACTS/"),
)
args = p.parse_args()
src_fs = OSFS(os.path.abspath(args.doc_source))
www_fs = get_lxplus_fs(args).opendir(os.path.join(args.doc_root))
if not www_fs.exists(args.ref):
www_fs.makedirs(os.path.join(args.ref, "doc"))
refdir = www_fs.opendir(os.path.join(args.ref, "doc"))
# refdir = OSFS("/tmp/doctest")
with Spinner(f"Publishing doc for {args.ref}"):
if not args.dry_run:
fs.copy.copy_dir(src_fs, ".", refdir, ".")
doc_url = os.path.join(args.doc_public_url, args.ref, "doc")
print("Doc is available at", doc_url)
# write tag info json file
if not args.dry_run:
with www_fs.open("latest_release.json", "w") as f:
json.dump({"subject": "release", "status": args.ref, "color": "yellow"}, f)
gl = gitlab(args)
project = gl.projects.get("acts/acts-core")
version = parse_version(args.ref)
with Spinner(text="Loading milestone"):
milestones = project.milestones.list(all=True)
milestone = None
for ms in milestones:
if ms.title == version:
milestone = ms
break
relnotes = make_release_notes(milestone, *collect_milestone(milestone))
message = MIMEMultipart("alternative")
message["Subject"] = f"New Acts release: {args.ref}"
message["From"] = sender_email
message["To"] = receiver_email
text = """
Dear Acts enthusiasts,
a new tag '{ref}' of the Acts project has been created.
You can get the source code from git using:
git clone https://gitlab.cern.ch/acts/acts-core.git
cd acts-core/
git checkout {ref}
or download a tarball with the source from
https://gitlab.cern.ch/acts/acts-core/-/archive/{ref}/acts-core-{ref}.tar.gz
The documentation is deployed at
https://acts.web.cern.ch/ACTS/{ref}/doc/index.html
Cheers,
your friendly Acts robot
"""
text = textwrap.dedent(text).format(ref=args.ref, relnotes=relnotes)
md = """
Dear Acts enthusiasts,
a new tag of the Acts project has been created.
---
# {ref}
[![](https://badgen.net/badge/release/{ref}/yellow)](https://gitlab.cern.ch/acts/acts-core/tags/{ref})
{relnotes}
---
You can get the source code from git using:
```bash
git clone https://gitlab.cern.ch/acts/acts-core.git
cd acts-core/
git checkout {ref}
```
or download a tarball with the source from
https://gitlab.cern.ch/acts/acts-core/-/archive/{ref}/acts-core-{ref}.tar.gz
The documentation is deployed at
https://acts.web.cern.ch/ACTS/{ref}/doc/index.html
Cheers,<br/>
your friendly Acts robot
"""
md = textwrap.dedent(md).format(
ref=args.ref, relnotes=relnotes, commit=os.getenv("CI_COMMIT_SHA")
)
html = """\
<html>
<body>
{text}
</body>
</html>
""".format(
text=markdown(textwrap.dedent(md))
)
# print(html)
part1 = MIMEText(text, "plain")
part2 = MIMEText(html, "html")
message.attach(part1)
message.attach(part2)
with Spinner("Sending email"):
if not args.dry_run:
with smtp(args) as server:
server.sendmail(sender_email, receiver_email, message.as_string())
if "__main__" == __name__:
main()
...@@ -7,38 +7,52 @@ import requests ...@@ -7,38 +7,52 @@ import requests
import tempfile import tempfile
from urllib.parse import urljoin from urllib.parse import urljoin
# from fs.sshfs import SSHFS
from sshfs import SSHFS
from fs.osfs import OSFS from fs.osfs import OSFS
import fs.copy import fs.copy
import gitlab
import gitlab.exceptions import gitlab.exceptions
from datetime import datetime from datetime import datetime
from dateutil.parser import parse from dateutil.parser import parse
from concurrent.futures import ThreadPoolExecutor, wait from concurrent.futures import ThreadPoolExecutor, wait
from util import get_lxplus_fs, def_arguments, Spinner, gitlab
import logging import logging
# logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG) # logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)
def main(): def main():
p = argparse.ArgumentParser() p = argparse.ArgumentParser()
p.add_argument("--deploy-user", default="atsjenkins") p = def_arguments(p, acc=True, gl=True)
p.add_argument("--deploy-pwd", default=os.getenv("ATSJENKINS_PASSWORD"))
p.add_argument("--coverage-source", required=True) p.add_argument("--coverage-source", required=True)
p.add_argument("--commit-hash", default=os.getenv("CI_COMMIT_SHA")) p.add_argument(
p.add_argument("--coverage-commit-limit", default=int(os.getenv("COVERAGE_COMMIT_LIMIT", 10)), type=int) "--ref", default=os.getenv("CI_COMMIT_TAG", os.getenv("CI_COMMIT_SHA", None))
p.add_argument("--coverage-root", default=os.getenv("COVERAGE_WEBSITE_ROOT", "/eos/user/a/atsjenkins/www/ACTS/coverage")) )
p.add_argument("--website-public-url", default=os.getenv("COVERAGE_WEBSITE_URL", "https://acts.web.cern.ch/ACTS/coverage/")) p.add_argument(
"--coverage-commit-limit",
default=int(os.getenv("COVERAGE_COMMIT_LIMIT", 10)),
type=int,
)
p.add_argument(
"--coverage-root",
default=os.getenv(
"COVERAGE_WEBSITE_ROOT", "/eos/user/a/atsjenkins/www/ACTS/coverage"
),
)
p.add_argument(
"--website-public-url",
default=os.getenv(
"COVERAGE_WEBSITE_URL", "https://acts.web.cern.ch/ACTS/coverage/"
),
)
p.add_argument("--project-id", default=3031, type=int) p.add_argument("--project-id", default=3031, type=int)
p.add_argument("--dry-run", "-s", action="store_true") p.add_argument("--dry-run", "-s", action="store_true")
args = p.parse_args() args = p.parse_args()
try: try:
www_fs = SSHFS(host="lxplus.cern.ch", www_fs = get_lxplus_fs(args).opendir(args.coverage_root)
user=args.deploy_user,
passwd=args.deploy_pwd).opendir(args.coverage_root)
# www_fs = OSFS("www") # www_fs = OSFS("www")
listdir = www_fs.listdir(".") listdir = www_fs.listdir(".")
except: except:
...@@ -49,27 +63,45 @@ def main(): ...@@ -49,27 +63,45 @@ def main():
raise raise
sys.exit(1) sys.exit(1)
gl = gitlab.Gitlab("https://gitlab.cern.ch/") gl = gitlab(args)
project = gl.projects.get(args.project_id) project = gl.projects.get(args.project_id)
commit_slug = args.commit_hash[:7] if len(args.ref) == 40:
coverage_dest = os.path.join(args.coverage_root, commit_slug) # is commit hash
print("Going to deploy coverage for", commit_slug, "to", coverage_dest) deploy_name = args.ref[:8]
print("Will be publicly available under", urljoin(args.website_public_url, commit_slug)) else:
# probably tag
deploy_name = args.ref
coverage_dest = os.path.join(args.coverage_root, deploy_name)
print("Going to deploy coverage for", deploy_name, "to", coverage_dest)
print(
"Will be publicly available under",
urljoin(args.website_public_url, deploy_name),
)
src_fs = OSFS(args.coverage_source) src_fs = OSFS(args.coverage_source)
if not args.dry_run: with Spinner(f"Publishing ref {deploy_name}"):
fs.copy.copy_dir(src_fs, ".", www_fs, commit_slug) if not args.dry_run:
fs.copy.copy_dir(src_fs, ".", www_fs, deploy_name)
# cleanup # cleanup
# get all deployed commits # get all deployed commits
deployed_commits = set(filter(www_fs.isdir, www_fs.listdir("."))) with Spinner(text="Getting deployed commits"):
deployed_commits = set()
with ThreadPoolExecutor(max_workers=8) as tp: for item in www_fs.listdir("."):
# deployed_commit_info = p.map(project.commits.get, deployed_commits) if not www_fs.isdir(item):
futures = [tp.submit(project.commits.get, c) for c in deployed_commits] continue
wait(futures) if item.startswith("v"): # skip versions
continue
deployed_commits.add(item)
with Spinner(text="Getting info for deployed commits"):
with ThreadPoolExecutor(max_workers=20) as tp:
# deployed_commit_info = p.map(project.commits.get, deployed_commits)
futures = [tp.submit(project.commits.get, c) for c in deployed_commits]
wait(futures)
deployed_commits_with_time = [] deployed_commits_with_time = []
for commit, future in zip(deployed_commits, futures): for commit, future in zip(deployed_commits, futures):
...@@ -80,10 +112,14 @@ def main(): ...@@ -80,10 +112,14 @@ def main():
except gitlab.exceptions.GitlabGetError as e: except gitlab.exceptions.GitlabGetError as e:
print("Commit", commit, "not found, will remove") print("Commit", commit, "not found, will remove")
deployed_commits_with_time = list(reversed(sorted(deployed_commits_with_time, key=lambda i: i[1]))) deployed_commits_with_time = list(
reversed(sorted(deployed_commits_with_time, key=lambda i: i[1]))
)
# take the n newest commits # take the n newest commits
commits_to_keep = set(h for h,_ in deployed_commits_with_time[:args.coverage_commit_limit]) commits_to_keep = set(
h for h, _ in deployed_commits_with_time[: args.coverage_commit_limit]
)
print("Currently deployed commits:") print("Currently deployed commits:")
for idx, (h, t) in enumerate(deployed_commits_with_time): for idx, (h, t) in enumerate(deployed_commits_with_time):
...@@ -92,17 +128,15 @@ def main(): ...@@ -92,17 +128,15 @@ def main():
else: else:
print(" x", h, "-", t) print(" x", h, "-", t)
print("Keeping commits:", ", ".join(commits_to_keep)) print("Keeping commits:", ", ".join(commits_to_keep))
commits_to_delete = deployed_commits - commits_to_keep commits_to_delete = deployed_commits - commits_to_keep
if len(commits_to_delete) > 0: if len(commits_to_delete) > 0:
print("Removing:", ", ".join(commits_to_delete)) with Spinner("Removing: %s" % ", ".join(commits_to_delete)):
if not args.dry_run:
if not args.dry_run: for commit in commits_to_delete:
for commit in commits_to_delete: www_fs.removetree(commit)
www_fs.removetree(commit)
# install / update indexfile # install / update indexfile
latest_commit = deployed_commits_with_time[0][0] latest_commit = deployed_commits_with_time[0][0]
...@@ -117,12 +151,15 @@ def main(): ...@@ -117,12 +151,15 @@ def main():
Redirecting to <a href"{0}">{0}</a> Redirecting to <a href"{0}">{0}</a>
</body> </body>
</html> </html>
""".format(latest_coverage_url) """.format(
latest_coverage_url
)
with www_fs.open("index.html", "w") as f: with Spinner("Writing index file redirecting to %s" % latest_coverage_url):
print("Writing index file redirecting to", latest_coverage_url)
if not args.dry_run: if not args.dry_run:
f.write(index_content) with www_fs.open("index.html", "w") as f:
f.write(index_content)
if "__main__" == __name__: if "__main__" == __name__:
main() main()
from util import Spinner
import os
import re
import urllib.parse
import requests
def parse_version(name):
return re.match(r"v(\d\.\d\d\.\d\d)", name).group(1)
def get_label_groups():
return os.getenv("RELEASE_NOTES_LABEL_GROUPS", "New Feature;Bug;Improvement").split(
";"
)
def group_items(labels, items):
groups = {l: [] for l in labels}
groups["Uncategorized"] = []
for item in items:
assigned = False
for label in item.labels:
if label in labels:
groups[label].append(item)
assigned = True
break
# is we get here, we didn't group this
if not assigned:
groups["Uncategorized"].append(item)
return groups
def collect_milestone(milestone):
label_groups = get_label_groups()
mrs = []
with Spinner(text=f"Loading merge requests associated with %{milestone.iid}"):
for mr in milestone.merge_requests():
if mr.state == "merged":
mrs.append(mr)
# need to get issues from merged MRs
with Spinner(text=f"Collecting issues from {len(mrs)} merged MRs"):
issue_ids = []
issues = []
for mr in mrs:
for issue in mr.closes_issues():
if issue.id not in issue_ids:
issue_ids.append(issue.id)
issues.append(issue)
issues_grouped = group_items(label_groups, issues)
mrs_grouped = group_items(label_groups, mrs)
return mrs_grouped, issues_grouped
def make_release_notes(milestone, mrs_grouped, issues_grouped):
label_groups = get_label_groups()
# make the Markdown
md = ""
# md = f"# Release {tag.name}\n"
# md += f"Milestone: [%{milestone.title}]({milestone.web_url})\n"
ms_badge = "https://badgen.net/badge/milestone/%s/green" % urllib.parse.quote(
f"%{milestone.title}"
)
md += f"[![]({ms_badge})]({milestone.web_url})\n"
badge = f"![](https://gitlab.cern.ch/acts/acts-core/badges/v{milestone.title}/coverage.svg)"
cov_url = f"https://acts.web.cern.ch/ACTS/coverage/v{milestone.title}/"
r = requests.get(cov_url)
if r.status_code == 200:
md += f"[{badge}]({cov_url})\n\n"
else:
md += f"[{badge}](#)\n\n"
nmrs = sum([len(v) for v in mrs_grouped.values()])
nissues = sum([len(v) for v in issues_grouped.values()])
if nmrs > 0:
md += f"### {nmrs} Merge Requests in this release:\n"
for g in label_groups + ["Uncategorized"]:
if len(mrs_grouped[g]) == 0:
continue
md += f"#### {g}\n"
for mr in mrs_grouped[g]:
md += f"- [!{mr.iid} - {mr.title}]({mr.web_url})\n"
md += "\n"
if nissues > 0:
md += f"### {nissues} issues addressed in this release:\n"
for g in label_groups + ["Uncategorized"]:
if len(issues_grouped[g]) == 0:
continue
md += f"#### {g}\n"
for issue in issues_grouped[g]:
md += f"- [#{issue.iid} - {issue.title}]({issue.web_url})\n"
return md
PyYAML==3.13 PyYAML==3.13
fs~=2.0.7 fs~=2.2
fs.sshfs==0.8.0 fs.sshfs==0.10.3
tabulate==0.8.2 tabulate==0.8.2
codereport==0.2.* codereport==0.2.*
python-gitlab==1.6.0 python-gitlab==1.6.0
python-dateutil==2.7.5 python-dateutil==2.7.5
gcovr==4.1 gcovr==4.1
markdown==3.1
pymdown-extensions==6.0
from fs.sshfs import SSHFS as SSHFSBase
from fs.base import FS
from fs import errors
import paramiko
import socket
class SSHFS(SSHFSBase):
def __init__(self, host, user, passwd, port=22, compress=False, timeout=10, keepalive=10):
FS.__init__(self)
self._user = user
self._host = host
self._port = port
self._client = client = paramiko.SSHClient()
self._locale = None
try:
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(
socket.gethostbyname(host), port, user, passwd,
compress=compress, timeout=timeout,
allow_agent=False,look_for_keys=False
)
if keepalive > 0:
client.get_transport().set_keepalive(keepalive)
self._sftp = client.open_sftp()
self._platform = None
except (paramiko.ssh_exception.SSHException, # protocol errors
paramiko.ssh_exception.NoValidConnectionsError, # connexion errors
socket.gaierror, socket.timeout) as e: # TCP errors
message = "Unable to create filesystem: {}".format(e)
raise errors.CreateFailed(message)
...@@ -4,107 +4,51 @@ import os ...@@ -4,107 +4,51 @@ import os
import json import json
import re import re
import argparse import argparse
import gitlab
import contextlib import contextlib
import sys import sys
import math import math
try: from util import def_arguments, Spinner, gitlab
from halo import Halo from release_notes import (
except: collect_milestone,
Halo = None make_release_notes,
get_label_groups,
parse_version,
@contextlib.contextmanager )
def spinner(text, *args, **kwargs):
if sys.stdout.isatty() and Halo is not None:
with Halo(text, *args, **kwargs):
yield
else:
sys.stdout.write(text + "\n")
yield
def parse_version(tag):
return re.match(r"v(\d\.\d\d\.\d\d)", tag.name).group(1)
def group_items(labels, items):
groups = {l: [] for l in labels}
groups["Uncategorized"] = []
for item in items:
assigned = False
for label in item.labels:
if label in labels:
groups[label].append(item)
assigned = True
break
# is we get here, we didn't group this
if not assigned:
groups["Uncategorized"].append(item)
return groups
def main(): def main():
p = argparse.ArgumentParser() p = argparse.ArgumentParser()
p = def_arguments(p, gl=True)
p.add_argument(
"--access-token",
help="Gitlab access token to update the releases",
default=os.getenv("ATSJENKINS_ACCESS_TOKEN", None),
)
p.add_argument("--dry-run", "-s", action="store_true") p.add_argument("--dry-run", "-s", action="store_true")
p.add_argument("--verbose", "-v", action="store_true") p.add_argument("--verbose", "-v", action="store_true")
label_groups = os.getenv( print("Label groups:", ", ".join(get_label_groups()))
"RELEASE_NOTES_LABEL_GROUPS", "New Feature;Bug;Improvement"
).split(";")
print("Label groups:", ", ".join(label_groups))
args = p.parse_args() args = p.parse_args()
gl = gitlab.Gitlab("https://gitlab.cern.ch", private_token=args.access_token) gl = gitlab(args)
if not args.dry_run:
assert args.access_token is not None
gl.auth()
project = gl.projects.get("acts/acts-core") project = gl.projects.get("acts/acts-core")
with spinner(text="Loading tags"): with Spinner(text="Loading tags"):
tags = project.tags.list(all=True) tags = project.tags.list(all=True)
with spinner(text="Loading milestones"): with Spinner(text="Loading milestones"):
milestones = project.milestones.list(all=True) milestones = project.milestones.list(all=True)
ms_map = {} ms_map = {}
for ms in milestones: for ms in milestones:
ms_map[ms.title] = ms ms_map[ms.title] = ms
for tag in tags: for tag in tags:
version = parse_version(tag) version = parse_version(tag.name)
if not version in ms_map: if not version in ms_map:
print(f"No milestone found for tag f{tag.name} => skipping") print(f"No milestone found for tag f{tag.name} => skipping")
milestone = ms_map[version] milestone = ms_map[version]
print(tag.name, milestone.title) print(tag.name, milestone.title)
mrs = [] mrs_grouped, issues_grouped = collect_milestone(milestone)
with spinner(text=f"Loading merge requests associated with %{milestone.iid}"):
for mr in milestone.merge_requests():
if mr.state == "merged":
mrs.append(mr)
# need to get issues from merged MRs
with spinner(text=f"Collecting issues from {len(mrs)} merged MRs"):
issue_ids = []
issues = []
for mr in mrs:
for issue in mr.closes_issues():
if issue.id not in issue_ids:
issue_ids.append(issue.id)
issues.append(issue)
issues_grouped = group_items(label_groups, issues)
mrs_grouped = group_items(label_groups, mrs)
if args.verbose: if args.verbose:
print("Issues:", ", ".join([str(i.iid) for i in issues])) print("Issues:", ", ".join([str(i.iid) for i in issues]))
...@@ -116,34 +60,12 @@ def main(): ...@@ -116,34 +60,12 @@ def main():
for g, mrs in mrs_grouped.items(): for g, mrs in mrs_grouped.items():
print(g, ", ".join([str(mr.iid) for mr in mrs])) print(g, ", ".join([str(mr.iid) for mr in mrs]))
with spinner(text="Assembling release notes"): with Spinner(text="Assembling release notes"):
# make the Markdown md = make_release_notes(milestone, mrs_grouped, issues_grouped)
md = ""
# md = f"# Release {tag.name}\n"
md += f"Milestone: [%{milestone.title}]({milestone.web_url})\n"
if len(mrs) > 0:
md += f"### {len(mrs)} Merge Requests in this release:\n"
for g in label_groups + ["Uncategorized"]:
if len(mrs_grouped[g]) == 0:
continue
md += f"#### {g}\n"
for mr in mrs_grouped[g]:
md += f"- [!{mr.iid} - {mr.title}]({mr.web_url})\n"
md += "\n"
if len(issues) > 0:
md += f"### {len(issues)} issues addressed in this release:\n"
for g in label_groups + ["Uncategorized"]:
if len(issues_grouped[g]) == 0:
continue
md += f"#### {g}\n"
for issue in issues_grouped[g]:
md += f"- [#{issue.iid} - {issue.title}]({issue.web_url})\n"
# print(md) # print(md)
if not args.dry_run: if not args.dry_run:
with spinner(text=f"Saving release notes on {tag.name}"): with Spinner(text=f"Saving release notes on {tag.name}"):
tag.set_release_description(md) tag.set_release_description(md)
if args.verbose: if args.verbose:
print("---") print("---")
......
from fs.sshfs import SSHFS
import os
import contextlib
import sys
import gitlab as gitlab_api
import smtplib, ssl
try:
from halo import Halo
except:
Halo = None
def get_lxplus_fs(args):
with Spinner(text="Connecting to lxplus", persist=False):
return SSHFS(
host="lxplus.cern.ch",
user=args.user,
passwd=args.pwd,
allow_agent=False,
look_for_keys=False,
)
def def_arguments(p, acc=False, gl=False):
if acc:
p.add_argument("--user", default="atsjenkins", required=True)
p.add_argument(
"--pwd", default=os.getenv("ATSJENKINS_PASSWORD", None), required=True
)
if gl:
p.add_argument(
"--gitlab-access-token",
"-t",
default=os.getenv("ATSJENKINS_ACCESS_TOKEN", None),
required=True,
help="GitLab access token to authenticate with the GitLab API",
)
return p
def gitlab(args):
gl = gitlab_api.Gitlab(
"https://gitlab.cern.ch", private_token=args.gitlab_access_token
)
gl.auth()
return gl
@contextlib.contextmanager
def smtp(args):
server = "smtp.cern.ch"
port = 587 # For SSL
username = "atsjenkins@cern.ch"
try:
context = ssl.create_default_context()
server = smtplib.SMTP(server, port)
server.ehlo() # Can be omitted
server.starttls(context=context) # Secure the connection
server.ehlo() # Can be omitted
server.login(args.user, args.pwd)
yield server
finally:
server.quit()
@contextlib.contextmanager
def Spinner(text, persist=True, *args, **kwargs):
stream = kwargs.get("stream", sys.stdout)
if stream.isatty() and Halo is not None:
spinner = Halo(text, *args, **kwargs)
spinner.start()
try:
yield
if persist:
spinner.succeed()
except:
if persist:
spinner.fail()
raise
finally:
if not persist:
spinner.stop()
else:
sys.stdout.write(text + "\n")
yield
...@@ -27,7 +27,6 @@ option (ACTS_BUILD_DIGITIZATION_PLUGIN "Build Digitization plugin" OFF) ...@@ -27,7 +27,6 @@ option (ACTS_BUILD_DIGITIZATION_PLUGIN "Build Digitization plugin" OFF)
option (ACTS_BUILD_DD4HEP_PLUGIN "Build DD4HEP plugin" OFF) option (ACTS_BUILD_DD4HEP_PLUGIN "Build DD4HEP plugin" OFF)
option (ACTS_BUILD_IDENTIFICATION_PLUGIN "Build Identification plugin" OFF) option (ACTS_BUILD_IDENTIFICATION_PLUGIN "Build Identification plugin" OFF)
option (ACTS_BUILD_JSON_PLUGIN "Build Json plugin" OFF) option (ACTS_BUILD_JSON_PLUGIN "Build Json plugin" OFF)
option (ACTS_BUILD_MATERIAL_PLUGIN "Build Material plugin" OFF)
option (ACTS_BUILD_TGEO_PLUGIN "Build TGeo plugin" OFF) option (ACTS_BUILD_TGEO_PLUGIN "Build TGeo plugin" OFF)
# all other compile-time parameters must be defined here for clear visibility # all other compile-time parameters must be defined here for clear visibility
......
...@@ -330,7 +330,6 @@ Writing new code is not the only way one can contribute to the Acts project. Ano ...@@ -330,7 +330,6 @@ Writing new code is not the only way one can contribute to the Acts project. Ano
You can help reviewing proposed contributions by going to [the "merge requests" section of the Acts Gitlab repository](https://gitlab.cern.ch/acts/acts-core/merge_requests) and having a look at the proposals that are being made here. The present contribution guide should serve as a good indication of what we expect from code submissions. In addition, please look at the merge request itself: You can help reviewing proposed contributions by going to [the "merge requests" section of the Acts Gitlab repository](https://gitlab.cern.ch/acts/acts-core/merge_requests) and having a look at the proposals that are being made here. The present contribution guide should serve as a good indication of what we expect from code submissions. In addition, please look at the merge request itself:
* Does its title and description reflect its contents? * Does its title and description reflect its contents?
* Is it associated with a JIRA ticket so that we can easily document it in the release notes?
* Do the automated continuous integration tests pass without problems? * Do the automated continuous integration tests pass without problems?
* Have all the comments raised by previous reviewers been addressed? * Have all the comments raised by previous reviewers been addressed?
...@@ -338,7 +337,7 @@ If you are confident that a merge request is ready for integration, please make ...@@ -338,7 +337,7 @@ If you are confident that a merge request is ready for integration, please make
### <a name="merging-a-merge-request">Merging a merge request</a> ### <a name="merging-a-merge-request">Merging a merge request</a>
If you have been granted merge rights on the Acts repository, you can merge a merge request into the Acts master branch after it has been approved by someone else. In order to give everyone a chance to review the merge request, please wait for at least two days (48h) after the merge request has been submitted before doing so, even if the merge request has been approved by someone before this delay has elapsed. If you have been granted merge rights on the Acts repository, you can merge a merge request into the Acts master branch after it has been approved by someone else.
Gitlab may warn you that a "Fast-forward merge is not possible". This warning means that the merge request has fallen behind the current Acts master branch, and should be updated through a rebase. Please notify the merge request author in order to make sure that the latest master changes do not affect the merge request, and to have it updated as appropriate. Gitlab may warn you that a "Fast-forward merge is not possible". This warning means that the merge request has fallen behind the current Acts master branch, and should be updated through a rebase. Please notify the merge request author in order to make sure that the latest master changes do not affect the merge request, and to have it updated as appropriate.
...@@ -346,18 +345,3 @@ Gitlab may warn you that a "Fast-forward merge is not possible". This warning me ...@@ -346,18 +345,3 @@ Gitlab may warn you that a "Fast-forward merge is not possible". This warning me
This section gives useful information to the administrators of the Acts project. For normal developers the sections below are irrelevant. This section gives useful information to the administrators of the Acts project. For normal developers the sections below are irrelevant.
### <a name="tag-release">Make a new Acts release</a>
In order to release a new version of Acts the following steps need to be taken:
1. Check out all open JIRA issues for the next release in <a href="https://its.cern.ch/jira/projects/ACTS/versions/">JIRA</a>.
2. Create a new branch called <tt>release-X.YY.ZZ</tt> branching off from <tt>origin/master</tt>.
3. In this branch, update the <tt>ACTS_VERSION</tt> variable in the top-level CMakeLists.txt file to <tt>X.YY.ZZ</tt> and commit the change.
4. Pushing this commit to the remote repository should trigger a CI build. Make sure that everything compiles without any warnings and all tests look fine.
5. Create a new annotated tag locally. The tag should have the format <tt>vX.YY.ZZ</tt> and an associated tag message 'version vX.YY.ZZ'.
6. Push the tag to the remote repository. This should trigger a CI job which rebuilds to documentation and deploys it together with a tar file of the source code to the Acts webpage. Make sure that the new release appears under the **Releases** section on the <a href="http://acts.web.cern.ch/ACTS/">Acts webpage</a>.
7. If there is not yet a JIRA version for the next minor release, create it in the <a href="https://its.cern.ch/jira/plugins/servlet/project-config/ACTS/versions">JIRA project administration</a> area (e.g. if 1.23.02 was just released, version 1.23.03 should exist in JIRA for the next minor release for bug fixes).
8. Got to the <a href="https://its.cern.ch/jira/projects/ACTS/versions/">Acts Releases page in JIRA</a> and release the version. Make sure that a correct release data is set and that all open issues get moved to the next major/minor release.
9. From the JIRA release page, copy (all) the HTML code for the release notes. Login to lxplus using the service account <tt>atsjenkins</tt> (<tt>ssh atsjenkins@lxplus.cern.ch</tt>). Create the file <tt>~/www/ACTS/vX.YY.ZZ/ReleaseNotes.html</tt> with the copied HTML code for the release notes. Please make sure that _sub_-tasks appear as nested lists (JIRA unfortunately puts them all on one level in alphabetical order).
10. Check that the release notes appear on the <a href="http://acts.web.cern.ch/ACTS/">Acts webpage</a> and are available from the respective link in the **Releases** section.
// This file is part of the Acts project. // This file is part of the Acts project.
// //
// Copyright (C) 2016-2018 Acts project team // Copyright (C) 2016-2018 CERN for the benefit of the Acts project
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
...@@ -21,9 +21,8 @@ namespace Acts { ...@@ -21,9 +21,8 @@ namespace Acts {
/// track (parameters) at the C++ type level. This allows other class to employ /// track (parameters) at the C++ type level. This allows other class to employ
/// optimized /// optimized
/// algorithms for either case by using template specializations. /// algorithms for either case by using template specializations.
class ChargedPolicy class ChargedPolicy {
{ public:
public:
/// @brief constructor with given charge /// @brief constructor with given charge
/// ///
/// @param charge electric charge of particle/track (parameters) /// @param charge electric charge of particle/track (parameters)
...@@ -32,47 +31,29 @@ public: ...@@ -32,47 +31,29 @@ public:
/// @brief equality operator /// @brief equality operator
/// ///
/// @return @c true if rhs has the same charge, otherwise @c false /// @return @c true if rhs has the same charge, otherwise @c false
bool bool operator==(const ChargedPolicy& rhs) const {
operator==(const ChargedPolicy& rhs) const
{
return m_dCharge == rhs.m_dCharge; return m_dCharge == rhs.m_dCharge;
} }
/// @brief inequality operator /// @brief inequality operator
/// ///
/// @return @c true if rhs has a different charge, otherwise @c false /// @return @c true if rhs has a different charge, otherwise @c false
bool bool operator!=(const ChargedPolicy& rhs) const { return !(*this == rhs); }
operator!=(const ChargedPolicy& rhs) const
{
return !(*this == rhs);
}
/// @brief retrieve stored value of the electric charge /// @brief retrieve stored value of the electric charge
/// ///
/// @return value for charge /// @return value for charge
double double getCharge() const { return m_dCharge; }
getCharge() const
{
return m_dCharge;
}
/// @brief sets charge /// @brief sets charge
/// ///
/// @param charge new value for the electric charge /// @param charge new value for the electric charge
void void setCharge(double charge) { m_dCharge = charge; }
setCharge(double charge)
{
m_dCharge = charge;
}
/// @brief flip sign of electric charge /// @brief flip sign of electric charge
void void flipSign() { m_dCharge *= -1.; }
flipSign()
{
m_dCharge *= -1.;
}
private: private:
double m_dCharge; ///< value of electric charge double m_dCharge; ///< value of electric charge
}; };
...@@ -88,34 +69,21 @@ private: ...@@ -88,34 +69,21 @@ private:
/// track (parameters) at the C++ type level. This allows other class to employ /// track (parameters) at the C++ type level. This allows other class to employ
/// optimized /// optimized
/// algorithms for either case by using template specializations. /// algorithms for either case by using template specializations.
class NeutralPolicy class NeutralPolicy {
{ public:
public:
/// @brief equality operator /// @brief equality operator
/// ///
/// @return always @c true /// @return always @c true
bool bool operator==(const NeutralPolicy& /*other*/) const { return true; }
operator==(const NeutralPolicy& /*other*/) const
{
return true;
}
/// @brief inequality operator /// @brief inequality operator
/// ///
/// @return always @c false /// @return always @c false
bool bool operator!=(const NeutralPolicy& rhs) const { return !(*this == rhs); }
operator!=(const NeutralPolicy& rhs) const
{
return !(*this == rhs);
}
/// @brief get electric charge /// @brief get electric charge
/// ///
/// @return always 0 /// @return always 0
double double getCharge() const { return 0.; }
getCharge() const
{
return 0.;
}
}; };
} // namespace Acts } // namespace Acts
\ No newline at end of file
// This file is part of the Acts project. // This file is part of the Acts project.
// //
// Copyright (C) 2016-2018 Acts project team // Copyright (C) 2016-2018 CERN for the benefit of the Acts project
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
...@@ -47,8 +47,7 @@ class Surface; ...@@ -47,8 +47,7 @@ class Surface;
/// @tparam Identifier identification object for this measurement /// @tparam Identifier identification object for this measurement
/// @tparam params parameter pack containing the measured parameters /// @tparam params parameter pack containing the measured parameters
template <typename source_link_t, ParID_t... params> template <typename source_link_t, ParID_t... params>
class Measurement class Measurement {
{
// check type conditions // check type conditions
static_assert(std::is_copy_constructible<source_link_t>::value, static_assert(std::is_copy_constructible<source_link_t>::value,
"'Identifier' must be copy-constructible"); "'Identifier' must be copy-constructible");
...@@ -59,13 +58,13 @@ class Measurement ...@@ -59,13 +58,13 @@ class Measurement
static_assert(std::is_move_assignable<source_link_t>::value, static_assert(std::is_move_assignable<source_link_t>::value,
"'Identifier' must be move-assignable"); "'Identifier' must be move-assignable");
private: private:
// private typedefs // private typedefs
/// type of the underlying ParameterSet object /// type of the underlying ParameterSet object
using ParSet_t = ParameterSet<params...>; using ParSet_t = ParameterSet<params...>;
public: public:
/// type of the vector containing the parameter values /// type of the vector containing the parameter values
using ParVector_t = typename ParSet_t::ParVector_t; using ParVector_t = typename ParSet_t::ParVector_t;
/// type of the covariance matrix of the measurement /// type of the covariance matrix of the measurement
...@@ -97,17 +96,14 @@ public: ...@@ -97,17 +96,14 @@ public:
/// measurement /// measurement
template <typename... Tail> template <typename... Tail>
Measurement(std::shared_ptr<const Surface> surface, Measurement(std::shared_ptr<const Surface> surface,
const source_link_t& source, const source_link_t& source, CovMatrix_t cov,
CovMatrix_t cov,
typename std::enable_if<sizeof...(Tail) + 1 == sizeof...(params), typename std::enable_if<sizeof...(Tail) + 1 == sizeof...(params),
ParValue_t>::type head, ParValue_t>::type head,
Tail... values) Tail... values)
: m_oParameters(std::make_unique<const CovMatrix_t>(std::move(cov)), : m_oParameters(std::make_unique<const CovMatrix_t>(std::move(cov)), head,
head, values...),
values...) m_pSurface(std::move(surface)),
, m_pSurface(std::move(surface)) m_sourceLink(source) {
, m_sourceLink(source)
{
assert(m_pSurface); assert(m_pSurface);
} }
...@@ -121,11 +117,9 @@ public: ...@@ -121,11 +117,9 @@ public:
/// ///
/// @param copy is the source for the copy /// @param copy is the source for the copy
Measurement(const Measurement<source_link_t, params...>& copy) Measurement(const Measurement<source_link_t, params...>& copy)
: m_oParameters(copy.m_oParameters) : m_oParameters(copy.m_oParameters),
, m_pSurface(copy.m_pSurface) m_pSurface(copy.m_pSurface),
, m_sourceLink(copy.m_sourceLink) m_sourceLink(copy.m_sourceLink) {}
{
}
/// @brief move constructor /// @brief move constructor
/// ///
...@@ -134,11 +128,9 @@ public: ...@@ -134,11 +128,9 @@ public:
/// ///
/// @param other is the source for the move /// @param other is the source for the move
Measurement(Measurement<source_link_t, params...>&& other) Measurement(Measurement<source_link_t, params...>&& other)
: m_oParameters(std::move(other.m_oParameters)) : m_oParameters(std::move(other.m_oParameters)),
, m_pSurface(std::move(other.m_pSurface)) m_pSurface(std::move(other.m_pSurface)),
, m_sourceLink(std::move(other.m_sourceLink)) m_sourceLink(std::move(other.m_sourceLink)) {}
{
}
/// @brief copy assignment operator /// @brief copy assignment operator
/// ///
...@@ -146,14 +138,13 @@ public: ...@@ -146,14 +138,13 @@ public:
/// @tparam params...The local parameter pack /// @tparam params...The local parameter pack
/// ///
/// @param rhs is the source for the assignment /// @param rhs is the source for the assignment
Measurement<source_link_t, params...>& Measurement<source_link_t, params...>& operator=(
operator=(const Measurement<source_link_t, params...>& rhs) const Measurement<source_link_t, params...>& rhs) {
{
// check for self-assignment // check for self-assignment
if (&rhs != this) { if (&rhs != this) {
m_oParameters = rhs.m_oParameters; m_oParameters = rhs.m_oParameters;
m_pSurface = rhs.m_pSurface; m_pSurface = rhs.m_pSurface;
m_sourceLink = rhs.m_sourceLink; m_sourceLink = rhs.m_sourceLink;
} }
return *this; return *this;
} }
...@@ -164,12 +155,11 @@ public: ...@@ -164,12 +155,11 @@ public:
/// @tparam params...The local parameter pack /// @tparam params...The local parameter pack
/// ///
/// @param rhs is the source for the move assignment /// @param rhs is the source for the move assignment
Measurement<source_link_t, params...>& Measurement<source_link_t, params...>& operator=(
operator=(Measurement<source_link_t, params...>&& rhs) Measurement<source_link_t, params...>&& rhs) {
{
m_oParameters = std::move(rhs.m_oParameters); m_oParameters = std::move(rhs.m_oParameters);
m_pSurface = std::move(rhs.m_pSurface); m_pSurface = std::move(rhs.m_pSurface);
m_sourceLink = std::move(rhs.m_sourceLink); m_sourceLink = std::move(rhs.m_sourceLink);
return *this; return *this;
} }
...@@ -183,9 +173,7 @@ public: ...@@ -183,9 +173,7 @@ public:
/// ///
/// @return value of the stored parameter /// @return value of the stored parameter
template <ParID_t parameter> template <ParID_t parameter>
ParValue_t ParValue_t get() const {
get() const
{
return m_oParameters.template getParameter<parameter>(); return m_oParameters.template getParameter<parameter>();
} }
...@@ -196,20 +184,12 @@ public: ...@@ -196,20 +184,12 @@ public:
/// given for the measured parameters in the order defined by the /// given for the measured parameters in the order defined by the
/// class /// class
/// template argument @c params. /// template argument @c params.
ParVector_t ParVector_t parameters() const { return m_oParameters.getParameters(); }
parameters() const
{
return m_oParameters.getParameters();
}
/// @brief access covariance matrix of the measured parameter values /// @brief access covariance matrix of the measured parameter values
/// ///
/// @return covariance matrix of the measurement /// @return covariance matrix of the measurement
CovMatrix_t CovMatrix_t covariance() const { return *m_oParameters.getCovariance(); }
covariance() const
{
return *m_oParameters.getCovariance();
}
/// @brief retrieve stored uncertainty for given parameter /// @brief retrieve stored uncertainty for given parameter
/// ///
...@@ -221,20 +201,14 @@ public: ...@@ -221,20 +201,14 @@ public:
/// ///
/// @return uncertainty \f$\sigma \ge 0\f$ for given parameter /// @return uncertainty \f$\sigma \ge 0\f$ for given parameter
template <ParID_t parameter> template <ParID_t parameter>
ParValue_t ParValue_t uncertainty() const {
uncertainty() const
{
return m_oParameters.template getUncertainty<parameter>(); return m_oParameters.template getUncertainty<parameter>();
} }
/// @brief number of measured parameters /// @brief number of measured parameters
/// ///
/// @return number of measured parameters /// @return number of measured parameters
static constexpr unsigned int static constexpr unsigned int size() { return ParSet_t::size(); }
size()
{
return ParSet_t::size();
}
/// @brief access associated surface /// @brief access associated surface
/// ///
...@@ -242,11 +216,7 @@ public: ...@@ -242,11 +216,7 @@ public:
/// must still be valid at the same memory location. /// must still be valid at the same memory location.
/// ///
/// @return reference to surface at which the measurement took place /// @return reference to surface at which the measurement took place
const Acts::Surface& const Acts::Surface& referenceSurface() const { return *m_pSurface; }
referenceSurface() const
{
return *m_pSurface;
}
/// @brief link access to the source of the measurement. /// @brief link access to the source of the measurement.
/// ///
...@@ -254,11 +224,7 @@ public: ...@@ -254,11 +224,7 @@ public:
/// object, see description above. /// object, see description above.
/// ///
/// @return source_link_t object /// @return source_link_t object
const source_link_t& const source_link_t& sourceLink() const { return m_sourceLink; }
sourceLink() const
{
return m_sourceLink;
}
/// @brief calculate residual with respect to given track parameters /// @brief calculate residual with respect to given track parameters
/// ///
...@@ -276,9 +242,7 @@ public: ...@@ -276,9 +242,7 @@ public:
/// @return vector with the residual parameter values (in valid range) /// @return vector with the residual parameter values (in valid range)
/// ///
/// @sa ParameterSet::residual /// @sa ParameterSet::residual
ParVector_t ParVector_t residual(const TrackParameters& trackPars) const {
residual(const TrackParameters& trackPars) const
{
return m_oParameters.residual(trackPars.getParameterSet()); return m_oParameters.residual(trackPars.getParameterSet());
} }
...@@ -286,12 +250,11 @@ public: ...@@ -286,12 +250,11 @@ public:
/// ///
/// @return @c true if parameter sets and associated surfaces compare equal, /// @return @c true if parameter sets and associated surfaces compare equal,
/// otherwise @c false /// otherwise @c false
virtual bool virtual bool operator==(
operator==(const Measurement<source_link_t, params...>& rhs) const const Measurement<source_link_t, params...>& rhs) const {
{ return ((m_oParameters == rhs.m_oParameters) &&
return ((m_oParameters == rhs.m_oParameters) (*m_pSurface == *rhs.m_pSurface) &&
&& (*m_pSurface == *rhs.m_pSurface) (m_sourceLink == rhs.m_sourceLink));
&& (m_sourceLink == rhs.m_sourceLink));
} }
/// @brief inequality operator /// @brief inequality operator
...@@ -299,33 +262,24 @@ public: ...@@ -299,33 +262,24 @@ public:
/// @return @c true if both objects are not equal, otherwise @c false /// @return @c true if both objects are not equal, otherwise @c false
/// ///
/// @sa Measurement::operator== /// @sa Measurement::operator==
bool bool operator!=(const Measurement<source_link_t, params...>& rhs) const {
operator!=(const Measurement<source_link_t, params...>& rhs) const
{
return !(*this == rhs); return !(*this == rhs);
} }
/// @projection operator /// @projection operator
static Projection_t static Projection_t projector() { return ParSet_t::projector(); }
projector()
{
return ParSet_t::projector();
}
friend std::ostream& friend std::ostream& operator<<(
operator<<(std::ostream& out, const Measurement<source_link_t, params...>& m) std::ostream& out, const Measurement<source_link_t, params...>& m) {
{
m.print(out); m.print(out);
return out; return out;
} }
protected: protected:
virtual std::ostream& virtual std::ostream& print(std::ostream& out) const {
print(std::ostream& out) const
{
out << sizeof...(params) << "D measurement: "; out << sizeof...(params) << "D measurement: ";
int dummy[sizeof...(params)] = {(out << params << ", ", 0)...}; int dummy[sizeof...(params)] = {(out << params << ", ", 0)...};
dummy[0] = dummy[0]; dummy[0] = dummy[0];
out << std::endl; out << std::endl;
out << "measured values:" << std::endl; out << "measured values:" << std::endl;
out << parameters() << std::endl; out << parameters() << std::endl;
...@@ -334,7 +288,7 @@ protected: ...@@ -334,7 +288,7 @@ protected:
return out; return out;
} }
private: private:
ParSet_t m_oParameters; ///< measured parameter set ParSet_t m_oParameters; ///< measured parameter set
std::shared_ptr<const Surface> std::shared_ptr<const Surface>
m_pSurface; ///< surface at which the measurement took place m_pSurface; ///< surface at which the measurement took place
...@@ -347,11 +301,9 @@ private: ...@@ -347,11 +301,9 @@ private:
* This encodes the source_link_t and hides it from the type generator. * This encodes the source_link_t and hides it from the type generator.
*/ */
template <typename source_link_t> template <typename source_link_t>
struct fittable_measurement_helper struct fittable_measurement_helper {
{
template <Acts::ParID_t... pars> template <Acts::ParID_t... pars>
struct meas_factory struct meas_factory {
{
using type = Measurement<source_link_t, pars...>; using type = Measurement<source_link_t, pars...>;
}; };
......
// This file is part of the Acts project. // This file is part of the Acts project.
// //
// Copyright (C) 2019 Acts project team // Copyright (C) 2019 CERN for the benefit of the Acts project
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
...@@ -16,23 +16,19 @@ class Surface; ...@@ -16,23 +16,19 @@ class Surface;
namespace MeasurementHelpers { namespace MeasurementHelpers {
/// @brief Extract surface from a type erased measurement object /// @brief Extract surface from a type erased measurement object
/// @tparam T The FittableMeasurement type /// @tparam T The FittableMeasurement type
/// @return const pointer to the extracted surface /// @return const pointer to the extracted surface
template <typename T> template <typename T>
const Surface* const Surface* getSurface(const T& fittable_measurement) {
getSurface(const T& fittable_measurement) return std::visit([](const auto& meas) { return &meas.referenceSurface(); },
{ fittable_measurement);
return std::visit([](const auto& meas) { return &meas.referenceSurface(); },
fittable_measurement);
}
template <typename T>
size_t
getSize(const T& fittable_measurement)
{
return std::visit([](const auto& meas) { return meas.size(); },
fittable_measurement);
}
} }
template <typename T>
size_t getSize(const T& fittable_measurement) {
return std::visit([](const auto& meas) { return meas.size(); },
fittable_measurement);
} }
} // namespace MeasurementHelpers
} // namespace Acts
// This file is part of the Acts project. // This file is part of the Acts project.
// //
// Copyright (C) 2016-2018 Acts project team // Copyright (C) 2016-2018 CERN for the benefit of the Acts project
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
namespace Acts { namespace Acts {
using NeutralParameters = SingleTrackParameters<NeutralPolicy>; using NeutralParameters = SingleTrackParameters<NeutralPolicy>;
using NeutralCurvilinearParameters using NeutralCurvilinearParameters =
= SingleCurvilinearTrackParameters<NeutralPolicy>; SingleCurvilinearTrackParameters<NeutralPolicy>;
using NeutralBoundParameters = SingleBoundTrackParameters<NeutralPolicy>; using NeutralBoundParameters = SingleBoundTrackParameters<NeutralPolicy>;
} // namespace Acts } // namespace Acts
\ No newline at end of file
// This file is part of the Acts project. // This file is part of the Acts project.
// //
// Copyright (C) 2016-2018 Acts project team // Copyright (C) 2016-2018 CERN for the benefit of the Acts project
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
...@@ -77,21 +77,18 @@ using FullParameterSet = typename detail::full_parset::type; ...@@ -77,21 +77,18 @@ using FullParameterSet = typename detail::full_parset::type;
* stored in this class * stored in this class
*/ */
template <ParID_t... params> template <ParID_t... params>
class ParameterSet class ParameterSet {
{ private:
private:
// local typedefs and constants // local typedefs and constants
using ParSet_t = ParameterSet<params...>; ///< type of this parameter set using ParSet_t = ParameterSet<params...>; ///< type of this parameter set
static constexpr unsigned int NPars static constexpr unsigned int NPars =
= sizeof...(params); ///< number of parameters stored in this class sizeof...(params); ///< number of parameters stored in this class
// static assert to check that the template parameters are consistent // static assert to check that the template parameters are consistent
static_assert(detail::are_sorted<true, true, ParID_t, params...>::value, static_assert(detail::are_sorted<true, true, ParID_t, params...>::value,
"parameter identifiers are not sorted"); "parameter identifiers are not sorted");
static_assert( static_assert(
detail::are_within<unsigned int, detail::are_within<unsigned int, 0, Acts::NGlobalPars,
0,
Acts::NGlobalPars,
static_cast<unsigned int>(params)...>::value, static_cast<unsigned int>(params)...>::value,
"parameter identifiers must be greater or " "parameter identifiers must be greater or "
"equal to zero and smaller than the total number of parameters"); "equal to zero and smaller than the total number of parameters");
...@@ -100,7 +97,7 @@ private: ...@@ -100,7 +97,7 @@ private:
NPars <= Acts::NGlobalPars, NPars <= Acts::NGlobalPars,
"number of stored parameters can not exceed number of total parameters"); "number of stored parameters can not exceed number of total parameters");
public: public:
// public typedefs // public typedefs
/// matrix type for projecting full parameter vector onto local parameter /// matrix type for projecting full parameter vector onto local parameter
/// space /// space
...@@ -126,8 +123,7 @@ public: ...@@ -126,8 +123,7 @@ public:
ParameterSet(CovPtr_t cov, ParameterSet(CovPtr_t cov,
std::enable_if_t<sizeof...(Tail) + 1 == NPars, ParValue_t> head, std::enable_if_t<sizeof...(Tail) + 1 == NPars, ParValue_t> head,
Tail... values) Tail... values)
: m_vValues(NPars), m_pCovariance(std::move(cov)) : m_vValues(NPars), m_pCovariance(std::move(cov)) {
{
detail::initialize_parset<ParID_t, params...>::init(*this, head, values...); detail::initialize_parset<ParID_t, params...>::init(*this, head, values...);
} }
...@@ -144,8 +140,7 @@ public: ...@@ -144,8 +140,7 @@ public:
* @param values vector with parameter values * @param values vector with parameter values
*/ */
ParameterSet(CovPtr_t cov, const ParVector_t& values) ParameterSet(CovPtr_t cov, const ParVector_t& values)
: m_vValues(NPars), m_pCovariance(std::move(cov)) : m_vValues(NPars), m_pCovariance(std::move(cov)) {
{
detail::initialize_parset<ParID_t, params...>::init(*this, values); detail::initialize_parset<ParID_t, params...>::init(*this, values);
} }
...@@ -156,8 +151,7 @@ public: ...@@ -156,8 +151,7 @@ public:
* object * object
*/ */
ParameterSet(const ParSet_t& copy) ParameterSet(const ParSet_t& copy)
: m_vValues(copy.m_vValues), m_pCovariance(nullptr) : m_vValues(copy.m_vValues), m_pCovariance(nullptr) {
{
if (copy.m_pCovariance) { if (copy.m_pCovariance) {
m_pCovariance = std::make_unique<const CovMatrix_t>(*copy.m_pCovariance); m_pCovariance = std::make_unique<const CovMatrix_t>(*copy.m_pCovariance);
} }
...@@ -170,10 +164,8 @@ public: ...@@ -170,10 +164,8 @@ public:
* object * object
*/ */
ParameterSet(ParSet_t&& copy) ParameterSet(ParSet_t&& copy)
: m_vValues(std::move(copy.m_vValues)) : m_vValues(std::move(copy.m_vValues)),
, m_pCovariance(std::move(copy.m_pCovariance)) m_pCovariance(std::move(copy.m_pCovariance)) {}
{
}
/** /**
* @brief standard destructor * @brief standard destructor
...@@ -185,14 +177,12 @@ public: ...@@ -185,14 +177,12 @@ public:
* *
* @param rhs object whose content is assigned to this @c ParameterSet object * @param rhs object whose content is assigned to this @c ParameterSet object
*/ */
ParSet_t& ParSet_t& operator=(const ParSet_t& rhs) {
operator=(const ParSet_t& rhs)
{
m_vValues = rhs.m_vValues; m_vValues = rhs.m_vValues;
m_pCovariance m_pCovariance =
= (rhs.m_pCovariance (rhs.m_pCovariance
? std::make_unique<const CovMatrix_t>(*rhs.m_pCovariance) ? std::make_unique<const CovMatrix_t>(*rhs.m_pCovariance)
: nullptr); : nullptr);
return *this; return *this;
} }
...@@ -201,10 +191,8 @@ public: ...@@ -201,10 +191,8 @@ public:
* *
* @param rhs object whose content is moved into this @c ParameterSet object * @param rhs object whose content is moved into this @c ParameterSet object
*/ */
ParSet_t& ParSet_t& operator=(ParSet_t&& rhs) {
operator=(ParSet_t&& rhs) m_vValues = std::move(rhs.m_vValues);
{
m_vValues = std::move(rhs.m_vValues);
m_pCovariance = std::move(rhs.m_pCovariance); m_pCovariance = std::move(rhs.m_pCovariance);
return *this; return *this;
} }
...@@ -212,9 +200,7 @@ public: ...@@ -212,9 +200,7 @@ public:
/** /**
* @brief swap two objects * @brief swap two objects
*/ */
friend void friend void swap(ParSet_t& first, ParSet_t& second) noexcept {
swap(ParSet_t& first, ParSet_t& second) noexcept
{
using std::swap; using std::swap;
swap(first.m_vValues, second.m_vValues); swap(first.m_vValues, second.m_vValues);
swap(first.m_pCovariance, second.m_pCovariance); swap(first.m_pCovariance, second.m_pCovariance);
...@@ -230,9 +216,7 @@ public: ...@@ -230,9 +216,7 @@ public:
* @return position of parameter in variadic template parameter set @c params * @return position of parameter in variadic template parameter set @c params
*/ */
template <ParID_t parameter> template <ParID_t parameter>
static constexpr size_t static constexpr size_t getIndex() {
getIndex()
{
return detail::get_position<ParID_t, parameter, params...>::value; return detail::get_position<ParID_t, parameter, params...>::value;
} }
...@@ -248,9 +232,7 @@ public: ...@@ -248,9 +232,7 @@ public:
* parameter set @c params * parameter set @c params
*/ */
template <size_t index> template <size_t index>
static constexpr ParID_t static constexpr ParID_t getParID() {
getParID()
{
return detail::at_index<ParID_t, index, params...>::value; return detail::at_index<ParID_t, index, params...>::value;
} }
...@@ -264,9 +246,7 @@ public: ...@@ -264,9 +246,7 @@ public:
* @return value of the stored parameter * @return value of the stored parameter
*/ */
template <ParID_t parameter> template <ParID_t parameter>
ParValue_t ParValue_t getParameter() const {
getParameter() const
{
return m_vValues(getIndex<parameter>()); return m_vValues(getIndex<parameter>());
} }
...@@ -275,11 +255,7 @@ public: ...@@ -275,11 +255,7 @@ public:
* *
* @return column vector with @c #NPars rows * @return column vector with @c #NPars rows
*/ */
ParVector_t ParVector_t getParameters() const { return m_vValues; }
getParameters() const
{
return m_vValues;
}
/** /**
* @brief sets value for given parameter * @brief sets value for given parameter
...@@ -292,10 +268,8 @@ public: ...@@ -292,10 +268,8 @@ public:
* @return previously stored value of this parameter * @return previously stored value of this parameter
*/ */
template <ParID_t parameter> template <ParID_t parameter>
void void setParameter(ParValue_t value) {
setParameter(ParValue_t value) using parameter_type = typename par_type<parameter>::type;
{
using parameter_type = typename par_type<parameter>::type;
m_vValues(getIndex<parameter>()) = parameter_type::getValue(value); m_vValues(getIndex<parameter>()) = parameter_type::getValue(value);
} }
...@@ -308,9 +282,7 @@ public: ...@@ -308,9 +282,7 @@ public:
* *
* @param values vector of length #NPars * @param values vector of length #NPars
*/ */
void void setParameters(const ParVector_t& values) {
setParameters(const ParVector_t& values)
{
detail::initialize_parset<ParID_t, params...>::init(*this, values); detail::initialize_parset<ParID_t, params...>::init(*this, values);
} }
...@@ -326,9 +298,7 @@ public: ...@@ -326,9 +298,7 @@ public:
* @return @c true if the parameter is stored in this set, otherwise @c false * @return @c true if the parameter is stored in this set, otherwise @c false
*/ */
template <ParID_t parameter> template <ParID_t parameter>
bool bool contains() const {
contains() const
{
return detail::is_contained<ParID_t, parameter, params...>::value; return detail::is_contained<ParID_t, parameter, params...>::value;
} }
...@@ -340,11 +310,7 @@ public: ...@@ -340,11 +310,7 @@ public:
* *
* @return raw pointer to covariance matrix (can be a nullptr) * @return raw pointer to covariance matrix (can be a nullptr)
*/ */
const CovMatrix_t* const CovMatrix_t* getCovariance() const { return m_pCovariance.get(); }
getCovariance() const
{
return m_pCovariance.get();
}
/** /**
* @brief access uncertainty for individual parameter * @brief access uncertainty for individual parameter
...@@ -359,9 +325,7 @@ public: ...@@ -359,9 +325,7 @@ public:
* covariance matrix is set * covariance matrix is set
*/ */
template <ParID_t parameter> template <ParID_t parameter>
ParValue_t ParValue_t getUncertainty() const {
getUncertainty() const
{
if (m_pCovariance) { if (m_pCovariance) {
size_t index = getIndex<parameter>(); size_t index = getIndex<parameter>();
return sqrt((*m_pCovariance)(index, index)); return sqrt((*m_pCovariance)(index, index));
...@@ -377,11 +341,7 @@ public: ...@@ -377,11 +341,7 @@ public:
* *
* @param cov unique pointer to new covariance matrix (nullptr is accepted) * @param cov unique pointer to new covariance matrix (nullptr is accepted)
*/ */
void void setCovariance(CovPtr_t cov) { m_pCovariance = std::move(cov); }
setCovariance(CovPtr_t cov)
{
m_pCovariance = std::move(cov);
}
/** /**
* @brief equality operator * @brief equality operator
...@@ -390,9 +350,7 @@ public: ...@@ -390,9 +350,7 @@ public:
* matrices are * matrices are
* either identical or not set, otherwise @c false * either identical or not set, otherwise @c false
*/ */
bool bool operator==(const ParSet_t& rhs) const {
operator==(const ParSet_t& rhs) const
{
// shortcut comparison with myself // shortcut comparison with myself
if (&rhs == this) { if (&rhs == this) {
return true; return true;
...@@ -403,13 +361,13 @@ public: ...@@ -403,13 +361,13 @@ public:
return false; return false;
} }
// both have covariance matrices set // both have covariance matrices set
if ((m_pCovariance && rhs.m_pCovariance) if ((m_pCovariance && rhs.m_pCovariance) &&
&& (*m_pCovariance != *rhs.m_pCovariance)) { (*m_pCovariance != *rhs.m_pCovariance)) {
return false; return false;
} }
// only one has a covariance matrix set // only one has a covariance matrix set
if ((m_pCovariance && !rhs.m_pCovariance) if ((m_pCovariance && !rhs.m_pCovariance) ||
|| (!m_pCovariance && rhs.m_pCovariance)) { (!m_pCovariance && rhs.m_pCovariance)) {
return false; return false;
} }
...@@ -423,11 +381,7 @@ public: ...@@ -423,11 +381,7 @@ public:
* *
* @sa ParameterSet::operator== * @sa ParameterSet::operator==
*/ */
bool bool operator!=(const ParSet_t& rhs) const { return !(*this == rhs); }
operator!=(const ParSet_t& rhs) const
{
return !(*this == rhs);
}
/** /**
* @brief project vector of full parameter set onto parameter sub-space * @brief project vector of full parameter set onto parameter sub-space
...@@ -454,9 +408,7 @@ public: ...@@ -454,9 +408,7 @@ public:
* vector * vector
* which are also defined for this ParameterSet object * which are also defined for this ParameterSet object
*/ */
ParVector_t ParVector_t project(const FullParameterSet& fullParSet) const {
project(const FullParameterSet& fullParSet) const
{
return projector() * fullParSet.getParameters(); return projector() * fullParSet.getParameters();
} }
...@@ -499,9 +451,7 @@ public: ...@@ -499,9 +451,7 @@ public:
typename T = ParSet_t, typename T = ParSet_t,
std::enable_if_t<not std::is_same<T, FullParameterSet>::value, int> = 0> std::enable_if_t<not std::is_same<T, FullParameterSet>::value, int> = 0>
/// @endcond /// @endcond
ParVector_t ParVector_t residual(const FullParameterSet& fullParSet) const {
residual(const FullParameterSet& fullParSet) const
{
return detail::residual_calculator<params...>::result( return detail::residual_calculator<params...>::result(
m_vValues, projector() * fullParSet.getParameters()); m_vValues, projector() * fullParSet.getParameters());
} }
...@@ -538,9 +488,7 @@ public: ...@@ -538,9 +488,7 @@ public:
* ParameterSet object * ParameterSet object
* with respect to the given other parameter set * with respect to the given other parameter set
*/ */
ParVector_t ParVector_t residual(const ParSet_t& otherParSet) const {
residual(const ParSet_t& otherParSet) const
{
return detail::residual_calculator<params...>::result( return detail::residual_calculator<params...>::result(
m_vValues, otherParSet.m_vValues); m_vValues, otherParSet.m_vValues);
} }
...@@ -555,9 +503,7 @@ public: ...@@ -555,9 +503,7 @@ public:
* @return constant matrix with @c #NPars rows and @c #Acts::NGlobalPars * @return constant matrix with @c #NPars rows and @c #Acts::NGlobalPars
* columns * columns
*/ */
static const ActsMatrix<ParValue_t, NPars, Acts::NGlobalPars> static const ActsMatrix<ParValue_t, NPars, Acts::NGlobalPars> projector() {
projector()
{
return sProjector; return sProjector;
} }
...@@ -566,11 +512,7 @@ public: ...@@ -566,11 +512,7 @@ public:
* *
* @return number of stored parameters * @return number of stored parameters
*/ */
static constexpr unsigned int static constexpr unsigned int size() { return NPars; }
size()
{
return NPars;
}
/** /**
* @brief correct given parameter values * @brief correct given parameter values
...@@ -584,15 +526,13 @@ public: ...@@ -584,15 +526,13 @@ public:
* @param values vector with parameter values to be checked and corrected if * @param values vector with parameter values to be checked and corrected if
* necessary * necessary
*/ */
static void static void correctValues(ParVector_t& values) {
correctValues(ParVector_t& values)
{
detail::value_corrector<params...>::result(values); detail::value_corrector<params...>::result(values);
} }
private: private:
ParVector_t ParVector_t
m_vValues; ///< column vector containing values of local parameters m_vValues; ///< column vector containing values of local parameters
CovPtr_t m_pCovariance; ///< unique pointer to covariance matrix CovPtr_t m_pCovariance; ///< unique pointer to covariance matrix
static const Projection_t sProjector; ///< matrix to project full parameter static const Projection_t sProjector; ///< matrix to project full parameter
...@@ -605,8 +545,6 @@ constexpr unsigned int ParameterSet<params...>::NPars; ...@@ -605,8 +545,6 @@ constexpr unsigned int ParameterSet<params...>::NPars;
template <ParID_t... params> template <ParID_t... params>
const typename ParameterSet<params...>::Projection_t const typename ParameterSet<params...>::Projection_t
ParameterSet<params...>::sProjector ParameterSet<params...>::sProjector = detail::make_projection_matrix<
= detail::make_projection_matrix<Acts::NGlobalPars, Acts::NGlobalPars, static_cast<unsigned int>(params)...>::init();
static_cast<unsigned int>(
params)...>::init();
} // namespace Acts } // namespace Acts
\ No newline at end of file
// This file is part of the Acts project. // This file is part of the Acts project.
// //
// Copyright (C) 2016-2018 Acts project team // Copyright (C) 2016-2018 CERN for the benefit of the Acts project
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
#pragma once #pragma once
#include "Acts/EventData/SingleTrackParameters.hpp" #include "Acts/EventData/SingleTrackParameters.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Surfaces/Surface.hpp" #include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/GeometryContext.hpp"
namespace Acts { namespace Acts {
...@@ -24,11 +24,10 @@ namespace Acts { ...@@ -24,11 +24,10 @@ namespace Acts {
/// @note This class holds shared ownership on the surface it is associated /// @note This class holds shared ownership on the surface it is associated
/// to. /// to.
template <class ChargePolicy> template <class ChargePolicy>
class SingleBoundTrackParameters : public SingleTrackParameters<ChargePolicy> class SingleBoundTrackParameters : public SingleTrackParameters<ChargePolicy> {
{ public:
public:
using ParVector_t = typename SingleTrackParameters<ChargePolicy>::ParVector_t; using ParVector_t = typename SingleTrackParameters<ChargePolicy>::ParVector_t;
using CovPtr_t = typename SingleTrackParameters<ChargePolicy>::CovPtr_t; using CovPtr_t = typename SingleTrackParameters<ChargePolicy>::CovPtr_t;
/// @brief Constructor of track parameters bound to a surface /// @brief Constructor of track parameters bound to a surface
/// This is the constructor from global parameters, enabled only /// This is the constructor from global parameters, enabled only
...@@ -44,21 +43,16 @@ public: ...@@ -44,21 +43,16 @@ public:
/// @param[in] surface The reference surface the parameters are bound to /// @param[in] surface The reference surface the parameters are bound to
template <typename T = ChargePolicy, template <typename T = ChargePolicy,
std::enable_if_t<std::is_same<T, ChargedPolicy>::value, int> = 0> std::enable_if_t<std::is_same<T, ChargedPolicy>::value, int> = 0>
SingleBoundTrackParameters(const GeometryContext& gctx, SingleBoundTrackParameters(const GeometryContext& gctx, CovPtr_t cov,
CovPtr_t cov, const ParVector_t& parValues,
const ParVector_t& parValues,
std::shared_ptr<const Surface> surface) std::shared_ptr<const Surface> surface)
: SingleTrackParameters<ChargePolicy>( : SingleTrackParameters<ChargePolicy>(
std::move(cov), std::move(cov), parValues,
parValues, detail::coordinate_transformation::parameters2globalPosition(
detail::coordinate_transformation::parameters2globalPosition( gctx, parValues, *surface),
gctx, detail::coordinate_transformation::parameters2globalMomentum(
parValues, parValues)),
*surface), m_pSurface(std::move(surface)) {
detail::coordinate_transformation::parameters2globalMomentum(
parValues))
, m_pSurface(std::move(surface))
{
assert(m_pSurface); assert(m_pSurface);
} }
...@@ -79,23 +73,16 @@ public: ...@@ -79,23 +73,16 @@ public:
/// @param[in] surface The reference surface the parameters are bound to /// @param[in] surface The reference surface the parameters are bound to
template <typename T = ChargePolicy, template <typename T = ChargePolicy,
std::enable_if_t<std::is_same<T, ChargedPolicy>::value, int> = 0> std::enable_if_t<std::is_same<T, ChargedPolicy>::value, int> = 0>
SingleBoundTrackParameters(const GeometryContext& gctx, SingleBoundTrackParameters(const GeometryContext& gctx, CovPtr_t cov,
CovPtr_t cov, const ActsVectorD<3>& position,
const ActsVectorD<3>& position, const ActsVectorD<3>& momentum, double dCharge,
const ActsVectorD<3>& momentum,
double dCharge,
std::shared_ptr<const Surface> surface) std::shared_ptr<const Surface> surface)
: SingleTrackParameters<ChargePolicy>( : SingleTrackParameters<ChargePolicy>(
std::move(cov), std::move(cov),
detail::coordinate_transformation::global2parameters(gctx, detail::coordinate_transformation::global2parameters(
position, gctx, position, momentum, dCharge, *surface),
momentum, position, momentum),
dCharge, m_pSurface(std::move(surface)) {
*surface),
position,
momentum)
, m_pSurface(std::move(surface))
{
assert(m_pSurface); assert(m_pSurface);
} }
...@@ -114,21 +101,16 @@ public: ...@@ -114,21 +101,16 @@ public:
/// @param[in] surface The reference surface the parameters are bound to /// @param[in] surface The reference surface the parameters are bound to
template <typename T = ChargePolicy, template <typename T = ChargePolicy,
std::enable_if_t<std::is_same<T, NeutralPolicy>::value, int> = 0> std::enable_if_t<std::is_same<T, NeutralPolicy>::value, int> = 0>
SingleBoundTrackParameters(const GeometryContext& gctx, SingleBoundTrackParameters(const GeometryContext& gctx, CovPtr_t cov,
CovPtr_t cov, const ParVector_t& parValues,
const ParVector_t& parValues,
std::shared_ptr<const Surface> surface) std::shared_ptr<const Surface> surface)
: SingleTrackParameters<ChargePolicy>( : SingleTrackParameters<ChargePolicy>(
std::move(cov), std::move(cov), parValues,
parValues, detail::coordinate_transformation::parameters2globalPosition(
detail::coordinate_transformation::parameters2globalPosition( gctx, parValues, *surface),
gctx, detail::coordinate_transformation::parameters2globalMomentum(
parValues, parValues)),
*surface), m_pSurface(std::move(surface)) {
detail::coordinate_transformation::parameters2globalMomentum(
parValues))
, m_pSurface(std::move(surface))
{
assert(m_pSurface); assert(m_pSurface);
} }
...@@ -150,66 +132,54 @@ public: ...@@ -150,66 +132,54 @@ public:
/// @param[in] surface The reference surface the parameters are bound to /// @param[in] surface The reference surface the parameters are bound to
template <typename T = ChargePolicy, template <typename T = ChargePolicy,
std::enable_if_t<std::is_same<T, NeutralPolicy>::value, int> = 0> std::enable_if_t<std::is_same<T, NeutralPolicy>::value, int> = 0>
SingleBoundTrackParameters(const GeometryContext& gctx, SingleBoundTrackParameters(const GeometryContext& gctx, CovPtr_t cov,
CovPtr_t cov, const ActsVectorD<3>& position,
const ActsVectorD<3>& position, const ActsVectorD<3>& momentum,
const ActsVectorD<3>& momentum,
std::shared_ptr<const Surface> surface) std::shared_ptr<const Surface> surface)
: SingleTrackParameters<ChargePolicy>( : SingleTrackParameters<ChargePolicy>(
std::move(cov), std::move(cov),
detail::coordinate_transformation::global2parameters(gctx, detail::coordinate_transformation::global2parameters(
position, gctx, position, momentum, 0, *surface),
momentum, position, momentum),
0, m_pSurface(std::move(surface)) {}
*surface),
position,
momentum)
, m_pSurface(std::move(surface))
{
}
/// @brief copy constructor - charged/neutral /// @brief copy constructor - charged/neutral
/// @param[in] copy The source parameters /// @param[in] copy The source parameters
SingleBoundTrackParameters( SingleBoundTrackParameters(
const SingleBoundTrackParameters<ChargePolicy>& copy) const SingleBoundTrackParameters<ChargePolicy>& copy)
: SingleTrackParameters<ChargePolicy>(copy) : SingleTrackParameters<ChargePolicy>(copy),
, m_pSurface(copy.m_pSurface) // copy shared_ptr m_pSurface(copy.m_pSurface) // copy shared_ptr
{ {}
}
/// @brief move constructor - charged/neutral /// @brief move constructor - charged/neutral
/// @param[in] other The source parameters /// @param[in] other The source parameters
SingleBoundTrackParameters(SingleBoundTrackParameters<ChargePolicy>&& other) SingleBoundTrackParameters(SingleBoundTrackParameters<ChargePolicy>&& other)
: SingleTrackParameters<ChargePolicy>(std::move(other)) : SingleTrackParameters<ChargePolicy>(std::move(other)),
, m_pSurface(std::move(other.m_pSurface)) m_pSurface(std::move(other.m_pSurface)) {}
{
}
/// @brief desctructor - charged/neutral /// @brief desctructor - charged/neutral
/// checks if the surface is free and in such a case deletes it /// checks if the surface is free and in such a case deletes it
~SingleBoundTrackParameters() override = default; ~SingleBoundTrackParameters() override = default;
/// @brief copy assignment operator - charged/neutral /// @brief copy assignment operator - charged/neutral
SingleBoundTrackParameters<ChargePolicy>& SingleBoundTrackParameters<ChargePolicy>& operator=(
operator=(const SingleBoundTrackParameters<ChargePolicy>& rhs) const SingleBoundTrackParameters<ChargePolicy>& rhs) {
{
// check for self-assignment // check for self-assignment
if (this != &rhs) { if (this != &rhs) {
SingleTrackParameters<ChargePolicy>::operator=(rhs); SingleTrackParameters<ChargePolicy>::operator=(rhs);
m_pSurface = rhs.m_pSurface; m_pSurface = rhs.m_pSurface;
} }
return *this; return *this;
} }
/// @brief move assignment operator - charged/neutral /// @brief move assignment operator - charged/neutral
/// checks if the surface is free and in such a case delete-clones it /// checks if the surface is free and in such a case delete-clones it
SingleBoundTrackParameters<ChargePolicy>& SingleBoundTrackParameters<ChargePolicy>& operator=(
operator=(SingleBoundTrackParameters<ChargePolicy>&& rhs) SingleBoundTrackParameters<ChargePolicy>&& rhs) {
{
// check for self-assignment // check for self-assignment
if (this != &rhs) { if (this != &rhs) {
SingleTrackParameters<ChargePolicy>::operator=(std::move(rhs)); SingleTrackParameters<ChargePolicy>::operator=(std::move(rhs));
m_pSurface = std::move(rhs.m_pSurface); m_pSurface = std::move(rhs.m_pSurface);
} }
return *this; return *this;
...@@ -217,9 +187,7 @@ public: ...@@ -217,9 +187,7 @@ public:
/// @brief clone - charged/netural /// @brief clone - charged/netural
/// virtual constructor for type creation without casting /// virtual constructor for type creation without casting
SingleBoundTrackParameters<ChargePolicy>* SingleBoundTrackParameters<ChargePolicy>* clone() const override {
clone() const override
{
return new SingleBoundTrackParameters<ChargePolicy>(*this); return new SingleBoundTrackParameters<ChargePolicy>(*this);
} }
...@@ -229,19 +197,13 @@ public: ...@@ -229,19 +197,13 @@ public:
/// @param[in] gctx is the Context object that is forwarded to the surface /// @param[in] gctx is the Context object that is forwarded to the surface
/// for local to global coordinate transformation /// for local to global coordinate transformation
template <ParID_t par> template <ParID_t par>
void void set(const GeometryContext& gctx, ParValue_t newValue) {
set(const GeometryContext& gctx, ParValue_t newValue)
{
this->getParameterSet().template setParameter<par>(newValue); this->getParameterSet().template setParameter<par>(newValue);
this->updateGlobalCoordinates(gctx, typename par_type<par>::type()); this->updateGlobalCoordinates(gctx, typename par_type<par>::type());
} }
/// @brief access method to the reference surface /// @brief access method to the reference surface
const Surface& const Surface& referenceSurface() const final { return *m_pSurface; }
referenceSurface() const final
{
return *m_pSurface;
}
/// @brief access to the measurement frame, i.e. the rotation matrix with /// @brief access to the measurement frame, i.e. the rotation matrix with
/// respect to the global coordinate system, in which the local error /// respect to the global coordinate system, in which the local error
...@@ -254,14 +216,12 @@ public: ...@@ -254,14 +216,12 @@ public:
/// surface frame, for measurements with respect to a line this has to be /// surface frame, for measurements with respect to a line this has to be
/// constructed by the point of clostest approach to the line, for /// constructed by the point of clostest approach to the line, for
/// cylindrical surfaces this is (by convention) the tangential plane. /// cylindrical surfaces this is (by convention) the tangential plane.
RotationMatrix3D RotationMatrix3D referenceFrame(const GeometryContext& gctx) const final {
referenceFrame(const GeometryContext& gctx) const final
{
return std::move( return std::move(
m_pSurface->referenceFrame(gctx, this->position(), this->momentum())); m_pSurface->referenceFrame(gctx, this->position(), this->momentum()));
} }
private: private:
std::shared_ptr<const Surface> m_pSurface; std::shared_ptr<const Surface> m_pSurface;
}; };
......