Skip to content

Commit

Permalink
Add the possibility to patch ParticleID algorithms to standalone conv…
Browse files Browse the repository at this point in the history
…erter (#94)

* Filter out the ParticleID related patch statements before the conversion

* Add documentation
  • Loading branch information
tmadlener authored Sep 5, 2024
1 parent 21e4f40 commit 666f274
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
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

0 comments on commit 666f274

Please sign in to comment.