-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(examples): Support TGeo detector, add seeding documentation (#…
…658) Add TGeo support for the CKF tracking, truth tracking, and seeding examples. Add duplication plots in the seeding example This PR also contains the documentation for the seed finding example.
- Loading branch information
Showing
23 changed files
with
481 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...ples/Algorithms/TrackFinding/include/ActsExamples/TrackFinding/SpacePointMakerOptions.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// This file is part of the Acts project. | ||
// | ||
// Copyright (C) 2021 CERN for the benefit of the Acts project | ||
// | ||
// 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 | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
#pragma once | ||
|
||
#include "ActsExamples/TrackFinding/SpacePointMaker.hpp" | ||
#include "ActsExamples/Utilities/OptionsFwd.hpp" | ||
|
||
namespace ActsExamples { | ||
namespace Options { | ||
|
||
/// Add SpacePointMaker options. | ||
/// | ||
/// @param desc The options description to add options to | ||
void addSpacePointMakerOptions(Description& desc); | ||
|
||
/// Read SpacePointMaker options to create the algorithm config. | ||
/// | ||
/// @param variables The variables to read from | ||
SpacePointMaker::Config readSpacePointMakerConfig(const Variables& variables); | ||
|
||
} // namespace Options | ||
} // namespace ActsExamples |
50 changes: 50 additions & 0 deletions
50
Examples/Algorithms/TrackFinding/share/geoSelection-genericDetector.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
[ | ||
{ | ||
"layer": 2, | ||
"volume": 8 | ||
}, | ||
{ | ||
"layer": 4, | ||
"volume": 8 | ||
}, | ||
{ | ||
"layer": 6, | ||
"volume": 8 | ||
}, | ||
{ | ||
"layer": 8, | ||
"volume": 8 | ||
}, | ||
{ | ||
"layer": 2, | ||
"volume": 9 | ||
}, | ||
{ | ||
"layer": 4, | ||
"volume": 9 | ||
}, | ||
{ | ||
"layer": 6, | ||
"volume": 9 | ||
}, | ||
{ | ||
"layer": 8, | ||
"volume": 9 | ||
}, | ||
{ | ||
"layer": 14, | ||
"volume": 7 | ||
}, | ||
{ | ||
"layer": 12, | ||
"volume": 7 | ||
}, | ||
{ | ||
"layer": 10, | ||
"volume": 7 | ||
}, | ||
{ | ||
"layer": 8, | ||
"volume": 7 | ||
} | ||
] |
50 changes: 50 additions & 0 deletions
50
Examples/Algorithms/TrackFinding/share/geoSelection-openDataDetector.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
[ | ||
{ | ||
"layer": 2, | ||
"volume": 13 | ||
}, | ||
{ | ||
"layer": 4, | ||
"volume": 13 | ||
}, | ||
{ | ||
"layer": 6, | ||
"volume": 13 | ||
}, | ||
{ | ||
"layer": 8, | ||
"volume": 13 | ||
}, | ||
{ | ||
"layer": 2, | ||
"volume": 14 | ||
}, | ||
{ | ||
"layer": 4, | ||
"volume": 14 | ||
}, | ||
{ | ||
"layer": 6, | ||
"volume": 14 | ||
}, | ||
{ | ||
"layer": 8, | ||
"volume": 14 | ||
}, | ||
{ | ||
"layer": 16, | ||
"volume": 12 | ||
}, | ||
{ | ||
"layer": 14, | ||
"volume": 12 | ||
}, | ||
{ | ||
"layer": 12, | ||
"volume": 12 | ||
}, | ||
{ | ||
"layer": 10, | ||
"volume": 12 | ||
} | ||
] |
35 changes: 35 additions & 0 deletions
35
Examples/Algorithms/TrackFinding/src/SpacePointMakerOptions.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// This file is part of the Acts project. | ||
// | ||
// Copyright (C) 2021 CERN for the benefit of the Acts project | ||
// | ||
// 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 | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
#include "ActsExamples/TrackFinding/SpacePointMakerOptions.hpp" | ||
|
||
#include "ActsExamples/Io/Json/JsonGeometryList.hpp" | ||
|
||
#include <string> | ||
|
||
#include <boost/program_options.hpp> | ||
|
||
void ActsExamples::Options::addSpacePointMakerOptions( | ||
ActsExamples::Options::Description& desc) { | ||
using boost::program_options::value; | ||
|
||
auto opt = desc.add_options(); | ||
opt("geo-selection-config-file", value<std::string>()->default_value(""), | ||
"Json file for space point geometry selection"); | ||
} | ||
|
||
ActsExamples::SpacePointMaker::Config | ||
ActsExamples::Options::readSpacePointMakerConfig( | ||
const ActsExamples::Options::Variables& variables) { | ||
SpacePointMaker::Config cfg; | ||
std::string path{variables["geo-selection-config-file"].as<std::string>()}; | ||
if (not path.empty()) { | ||
cfg.geometrySelection = ActsExamples::readJsonGeometryList(path); | ||
} | ||
return cfg; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
Examples/Io/Json/include/ActsExamples/Io/Json/JsonGeometryList.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// This file is part of the Acts project. | ||
// | ||
// Copyright (C) 2021 CERN for the benefit of the Acts project | ||
// | ||
// 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 | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
#pragma once | ||
|
||
#include "Acts/Geometry/GeometryIdentifier.hpp" | ||
|
||
#include <vector> | ||
|
||
#include <nlohmann/json.hpp> | ||
|
||
namespace ActsExamples { | ||
|
||
void from_json(const nlohmann::json& data, Acts::GeometryIdentifier& geoId); | ||
|
||
void to_json(nlohmann::json& data, const Acts::GeometryIdentifier& geoId); | ||
|
||
void from_json(const nlohmann::json& data, | ||
std::vector<Acts::GeometryIdentifier>& geoIdList); | ||
|
||
void to_json(nlohmann::json& data, | ||
const std::vector<Acts::GeometryIdentifier>& geoIdList); | ||
|
||
std::vector<Acts::GeometryIdentifier> readJsonGeometryList( | ||
const std::string& path); | ||
|
||
void writeJsonGeometryList( | ||
const std::vector<Acts::GeometryIdentifier>& geoIdList, | ||
const std::string& path); | ||
|
||
} // namespace ActsExamples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// This file is part of the Acts project. | ||
// | ||
// Copyright (C) 2021 CERN for the benefit of the Acts project | ||
// | ||
// 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 | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
#include "ActsExamples/Io/Json/JsonGeometryList.hpp" | ||
|
||
#include <fstream> | ||
|
||
void ActsExamples::from_json(const nlohmann::json& data, | ||
Acts::GeometryIdentifier& geoId) { | ||
Acts::GeometryIdentifier::Value null(0u); | ||
geoId.setVolume(data.value("volume", null)); | ||
geoId.setBoundary(data.value("boundary", null)); | ||
geoId.setLayer(data.value("layer", null)); | ||
geoId.setApproach(data.value("approach", null)); | ||
geoId.setSensitive(data.value("sensitive", null)); | ||
} | ||
|
||
void ActsExamples::to_json(nlohmann::json& data, | ||
const Acts::GeometryIdentifier& geoId) { | ||
if (geoId.volume()) | ||
data["volume"] = geoId.volume(); | ||
if (geoId.boundary()) | ||
data["boundary"] = geoId.boundary(); | ||
if (geoId.layer()) | ||
data["layer"] = geoId.layer(); | ||
if (geoId.approach()) | ||
data["approach"] = geoId.approach(); | ||
if (geoId.sensitive()) | ||
data["sensitive"] = geoId.sensitive(); | ||
} | ||
|
||
void ActsExamples::from_json(const nlohmann::json& data, | ||
std::vector<Acts::GeometryIdentifier>& geoIdList) { | ||
for (auto& entry : data) { | ||
Acts::GeometryIdentifier geoId; | ||
from_json(entry, geoId); | ||
geoIdList.push_back(geoId); | ||
} | ||
} | ||
|
||
void ActsExamples::to_json( | ||
nlohmann::json& data, | ||
const std::vector<Acts::GeometryIdentifier>& geoIdList) { | ||
for (auto& geoId : geoIdList) { | ||
nlohmann::json entry; | ||
to_json(entry, geoId); | ||
data.push_back(entry); | ||
} | ||
} | ||
|
||
std::vector<Acts::GeometryIdentifier> ActsExamples::readJsonGeometryList( | ||
const std::string& path) { | ||
nlohmann::json data; | ||
std::vector<Acts::GeometryIdentifier> geoIdList; | ||
std::ifstream infile(path, std::ifstream::in | std::ifstream::binary); | ||
infile.exceptions(std::ofstream::failbit | std::ofstream::badbit); | ||
infile >> data; | ||
from_json(data, geoIdList); | ||
return geoIdList; | ||
} | ||
|
||
void ActsExamples::writeJsonGeometryList( | ||
const std::vector<Acts::GeometryIdentifier>& geoIdList, | ||
const std::string& path) { | ||
nlohmann::json data; | ||
to_json(data, geoIdList); | ||
std::ofstream outfile(path, std::ofstream::out | std::ofstream::binary); | ||
outfile.exceptions(std::ofstream::failbit | std::ofstream::badbit); | ||
outfile << data; | ||
} |
Oops, something went wrong.