Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the possibility to patch ParticleID algorithms to standalone converter #94

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions doc/LCIO2EDM4hep.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,26 @@ The easiest way to obtain such a file is to use the `check_missing_cols`
executable that comes with LCIO using the `--minimal` flag. The output of this
can be directly consumed by `lcio2edm4hep`

### Patching missing ParticleID information on the fly

EDM4hep also assumes that the `ParticleID` objects that are attached to elements
of a `ReconstructedParticle` are consistent, i.e. the same PID algo names have
been used throughout the processing. In order to guarantee this for the
conversion it is possible to attach missing information on the fly, the grammar
for this is

```
pid-algo-name reco-coll-name|[parameter-names[,param-names]]
```

This will use the (LCIO) `PIDHandler` to add a PID algorithm with name
`pid-algo-name` to the collection `reco-coll-name`. Optionally if any parameter
names are present it will also set the parameter names for this PID algorithm.

```{note}
This is only available from LCIO versions **larger** than `v02-22-01`!
```

#### Example:
1. Get the patch file
```bash
Expand Down
7 changes: 5 additions & 2 deletions standalone/lcio2edm4hep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,11 @@ int main(int argc, char* argv[]) {
const auto collsToConvert = [&namesTypes]() {
std::vector<std::pair<std::string, std::string>> names{};
names.reserve(namesTypes.size());
for (const auto& [lcioName, edm4hepName, _] : namesTypes) {
names.emplace_back(lcioName, edm4hepName);
for (const auto& [lcioName, edm4hepName, type] : namesTypes) {
// filter out the ParticleID patching from collection names to convert
if (type.find('|') == std::string::npos) {
names.emplace_back(lcioName, edm4hepName);
}
}
return names;
}();
Expand Down
Loading