Allen merge requestshttps://gitlab.cern.ch/lhcb/Allen/-/merge_requests2024-03-05T16:08:10+01:00https://gitlab.cern.ch/lhcb/Allen/-/merge_requests/952Add NeutralBasicParticles for photon lines2024-03-05T16:08:10+01:00Thomas BoettcherAdd NeutralBasicParticles for photon linesThis MR:
- Adds `NeutralBasicParticle`, `NeutralBasicParticles`, and `MultiEventNeutralBasicParticles` to the event model.
- Expands `CompositeParticle` to include diphotons.
- Encodes `NeutralBasicParticle`s in the SelReports as `CaloCl...This MR:
- Adds `NeutralBasicParticle`, `NeutralBasicParticles`, and `MultiEventNeutralBasicParticles` to the event model.
- Expands `CompositeParticle` to include diphotons.
- Encodes `NeutralBasicParticle`s in the SelReports as `CaloCluster` objects, saving `E`, `X`, `Y`, `Z`, and no substructure.
- Creates the `CaloClusterLine` line type and uses this for the single calo cluster line.
- Generalizes the `TwoTrackLine` line type to the `CompositeParticleLine` type and uses this line type for diphoton lines.
@dcampora @dovombru @kaarichaThomas BoettcherChristina AgapopoulouThomas Boettcherhttps://gitlab.cern.ch/lhcb/Allen/-/merge_requests/690Overhaul of physics event model2024-02-13T11:42:22+01:00Thomas BoettcherOverhaul of physics event modelCurrently, selections are made based on `ParKalmanFilter::FittedTrack` and `VertexFit::TrackMVAVertex` objects. In this MR, these are replaced by `BasicParticle` and `CompositeParticle` views. The views include pointers to Kalman/vertex ...Currently, selections are made based on `ParKalmanFilter::FittedTrack` and `VertexFit::TrackMVAVertex` objects. In this MR, these are replaced by `BasicParticle` and `CompositeParticle` views. The views include pointers to Kalman/vertex fit results and the PV associated to the particle. `BasicParticle`s also include pointers to particle ID information and information about the hits used to create the underlying tracks. `CompositeParticle`s are composable and (in theory) can be constructed from arbitrary combinations of `BasicParticle`s and other `CompositeParticle`s.
Because of difficulties handling recursive function calls in HIP, the `CompositeParticle` member functions only explicitly handle two levels of recursion, for example a composition that looks like:
```
CompositeParticle
CompositeParticle
BasicParticle
BasicParticle
BasicParticle
```
`CompositeParticle`s with arbitrary substructure can still be constructed and used in selections, but some built-in member functions will not be able to traverse the decay tree automatically.
The new event model consists of the following views:
- SciFi views similar to those used in the VELO and UT event models (also introduced in https://gitlab.cern.ch/lhcb/Allen/-/merge_requests/678)
- `Allen::Views::Physics::KalmanState`: a view for accessing kalman fit results
- `Allen::Views::Physics::KalmanStates`: a view for accessing all `KalmanState`s in an event
- `Allen::Views::Physics::SecondaryVertex`: a view for accessing SV fit results
- `Allen::Views::Physics::SecondaryVertices`: a view of accessing all `SecondaryVertex`s in an event
- `Allen::Views::Physics::Track`: Includes pointers to the velo, UT, and SciFi segments of a track, if they exist. This was introduced in order to avoid using virtual functions to access LHCbIDs, which was causing compilation errors with HIP and runtime failures with CUDA.
- `Allen::Views::Physics::Particle`: Base particle struct. Has a data member for storing the number of substructures. If a `Particle` has 1 substructure, it is always a `BasicParticle`. If it has more than 1 substructure, it is always a `CompositeParticle`
- `Allen::Views::Physics::ParticleContainer`: A view for accessing all of the `Particle`s in an event.
- `Allen::Views::Physics::IMultiEventParticleContainer`: A view for accessing particles from multiple events.
- `Allen::Views::Physics::BasicParticle`: A charged particle view. Includes pointers to the underlying `Track`, `KalmanState`, lepton ID results, and associated PV (minimum IP chi2)
- `Allen::Views::Physics::BasicParticles`: A view for accessing all `BasicParticle`s in an event
- `Allen::Views::Physics::MultiEventBasicParticles`: A view for accessing `BasicParticle`s from multiple events. The input particle container for 1-track lines.
- `Allen::Views::Physics::CompositeParticle`: A composite particle view. Includes pointers to pointers to the constituent particles, a `SecondaryVertex`, and the associated PV (minimum FD chi2)
- `Allen::Views::Physics::CompositeParticles`: A view for accessing all `CompositeParticle`s in an event
- `Allen::Views::Physics::MultiEventCompositeParticles`: A view for accessing `CompositeParticle`s from multiple events. The input particle container for 2-track lines.
A few new algorithms are introduced:
- `make_lepton_id`: Combines electron ID and muon ID results. See note below on lepton ID.
- `make_long_track_particles`: Creates `BasicParticle` and `BasicParticles` views from SciFi tracks, kalman fit results, and associated PVs
- `particle_container_life_support`: Dummy algorithm that is used to trick the sequence into keeping particle containers alive until after the SelReports are created
There are some other changes in this MR to note:
- `BasicParticle::ip()` returns the IP with respect to the PV that minimizes IP chi2, not the PV that minimizes IP. This is because only the pointer to the associated PV is stored. The minimum IP could still be calculated within a selection if it's necessary.
- Electron ID and muon ID results are now stored as `uint8_t`. The muon ID result is stored in the first bit and the electron ID result is stored in the second bit. The algorithm `make_lepton_id` combines them into a single `uint8_t`. This allows `BasicParticle`s to be constructed in a single algorithm `make_long_track_particles` regardless of whether or not electron ID was performed. This change does not affect selection rates.
- The TwoKsLine has been almost completely rewritten. The event model changes make this line extremely slow without some optimization.
All selections have been updated to use the new event model, but not all unused `Parameters` have been removed from the selection header files. The SelReport writer has been generalized to handle arbitrary `CompositeParticle`s, as well as particle containers from multiple different reconstruction sequences. This will allow creating SelReports for a high-pT muon line running with no GEC, for example. In addition, the more flexible event model can produce SelReports for tracks missing a UT segment. This solves all remaining to-do items for https://gitlab.cern.ch/lhcb/Allen/-/issues/173, except for implementing SelReports for ECAL clusters.
For now, the old `ParKalmanFilter::FittedTrack` and `VertexFit::TrackMVAVertex` objects are still created so they can still be used in checkers and converters.
FYI @dcamporahttps://gitlab.cern.ch/lhcb/Allen/-/merge_requests/1208Use IP for PV association of composites2023-06-26T07:38:23+02:00Marian Stahlmarian.stahl@cern.chUse IP for PV association of compositesRight now FDchi2 is used, which is not optimal (in particular for long lived particles).<br>
See also @ldufour's talk https://indico.cern.ch/event/1248973/contributions/5266961/attachments/2593570/4476380/230214_IP_assoc.pdf
For HLT2 ve...Right now FDchi2 is used, which is not optimal (in particular for long lived particles).<br>
See also @ldufour's talk https://indico.cern.ch/event/1248973/contributions/5266961/attachments/2593570/4476380/230214_IP_assoc.pdf
For HLT2 version: https://gitlab.cern.ch/lhcb/Rec/-/merge_requests/3460RTA/2023.06.1Mika Anton VesterinenAnton PoluektovMika Anton Vesterinenhttps://gitlab.cern.ch/lhcb/Allen/-/merge_requests/1216Added missing default initial values for PV classes2023-05-22T16:43:38+02:00Patrick SpradlinAdded missing default initial values for PV classes## Related
Follow-up to merge of https://gitlab.cern.ch/lhcb/Allen/-/merge_requests/794 and https://gitlab.cern.ch/lhcb/Moore/-/merge_requests/2278.
Related to https://gitlab.cern.ch/lhcb/Allen/-/issues/422, **but does not close it.**
...## Related
Follow-up to merge of https://gitlab.cern.ch/lhcb/Allen/-/merge_requests/794 and https://gitlab.cern.ch/lhcb/Moore/-/merge_requests/2278.
Related to https://gitlab.cern.ch/lhcb/Allen/-/issues/422, **but does not close it.**
## Description
Following the merge of https://gitlab.cern.ch/lhcb/Allen/-/merge_requests/794 and https://gitlab.cern.ch/lhcb/Moore/-/merge_requests/2278, the RTA Software Manager noted that the new test introduced by https://gitlab.cern.ch/lhcb/Moore/-/merge_requests/2278, `RecoConf.allen_gaudi_pv_with_mcchecking`, produced unstable stdout for some architectures (see [the discussion on the MR](https://gitlab.cern.ch/lhcb/Allen/-/merge_requests/794#note_6729964)).
This instability was traced to unitialized date members in Allen's PV class. This MR provides default initialization for those data members, which should stabilize the test.
In local testing, this MR successfully stabilized the output of `RecoConf.allen_gaudi_pv_with_mcchecking` on the `x86_64_v2-centos7-clang12+detdesc-opt` platform without the need for an updated reference. A `ci-test` is required to check whether other platforms may require a reference update.Roel AaijRoel Aaijhttps://gitlab.cern.ch/lhcb/Allen/-/merge_requests/1124Update Gaudi-Allen track converters to v3::Tracks2023-05-16T16:52:24+02:00Patrick SpradlinUpdate Gaudi-Allen track converters to v3::Tracks## Related
Test and merge with https://gitlab.cern.ch/lhcb/Rec/-/merge_requests/3370 and Moore!2157.
Progress on Issue #371: This MR will remove most of the uses of v2::Tracks in the GaudiAllen interface.
## Description
Revises the ...## Related
Test and merge with https://gitlab.cern.ch/lhcb/Rec/-/merge_requests/3370 and Moore!2157.
Progress on Issue #371: This MR will remove most of the uses of v2::Tracks in the GaudiAllen interface.
## Description
Revises the GaudiAllen track converters to create [`LHCb::Event::v3::Tracks`](https://gitlab.cern.ch/lhcb/LHCb/-/blob/a40311ae9b06dd1734e600beb098d155fa3b4e4a/Event/TrackEvent/include/Event/Track_v3.h). The following table relates the previous collection of converters to [`LHCb::Event::v2::Tracks`](https://gitlab.cern.ch/lhcb/LHCb/-/blob/a40311ae9b06dd1734e600beb098d155fa3b4e4a/Event/TrackEvent/include/Event/Track_v2.h) to the new converters to v3::Tracks that replace them. The inputs have been conserved; the output types are the what i consider to be the closest valid matches among the [defined `LHCb::Event::v3::Tracks` track types](https://gitlab.cern.ch/lhcb/LHCb/-/blob/a40311ae9b06dd1734e600beb098d155fa3b4e4a/Event/TrackEvent/include/Event/Track_v3.h).
| Allen track input | v2 converter | v3 converter | Output LHCb::Event::v3::TrackType |
| -- | -- | -- | -- |
| Allen::Views::Velo::Consolidated::MultiEventTracks | GaudiAllenVeloToV2Tracks | GaudiAllenVeloToV3Tracks | Velo, VeloBackward |
| Allen::Views::UT::Consolidated::MultiEventTracks | GaudiAllenUTToV2Tracks | GaudiAllenUTToV3Tracks | Upstream |
| Allen::Views::Physics::MultiEventBasicParticles | GaudiAllenForwardToV2Tracks | GaudiAllenMEBasicParticlesToV3Tracks | FittedForward |
Much of the implementation of the v3::Tracks converters in this MR is an attempt to imitate various of the conversion components in the LHCb and Rec projects: [LHCb/Event/TrackEvent/include/Event/SOATrackConversion.h](https://gitlab.cern.ch/lhcb/LHCb/-/blob/master/Event/TrackEvent/include/Event/SOATrackConversion.h), [Rec/Pr/PrConverters/src/SOATrackConverters.cpp](https://gitlab.cern.ch/lhcb/Rec/-/blob/master/Pr/PrConverters/src/SOATrackConverters.cpp). Peculiarities of the Allen input and my inexperience with metaprogramming have thus far inhibited a clean generalized solution, but i have done my current best.
## Consolidation of source files
All three of the new v3::Tracks converters are defined in a single source file, `Rec/Allen/src/GaudiAllenTrackViewsToV3Tracks.cpp`. This replaces the three independent source files---one for each track type---[GaudiAllenVeloToV2Tracks.cpp](https://gitlab.cern.ch/lhcb/Allen/-/blob/6e80b69710bcb096223559f8ce969c72b9cb3e11/Rec/Allen/src/GaudiAllenVeloToV2Tracks.cpp), [GaudiAllenUTToV2Tracks.cpp](https://gitlab.cern.ch/lhcb/Allen/-/blob/6e80b69710bcb096223559f8ce969c72b9cb3e11/Rec/Allen/src/GaudiAllenUTToV2Tracks.cpp), and [GaudiAllenForwardToV2Tracks.cpp](https://gitlab.cern.ch/lhcb/Allen/-/blob/6e80b69710bcb096223559f8ce969c72b9cb3e11/Rec/Allen/src/GaudiAllenForwardToV2Tracks.cpp). The source files were consolidated in order to share code components, make the suite of converters more consistent, and move toward a more generalized converter implementation.
## Bifurcation of Velo output container (Velo and VeloBackward)
The previous v2 converter, [GaudiAllenVeloToV2Tracks.cpp](https://gitlab.cern.ch/lhcb/Allen/-/blob/6e80b69710bcb096223559f8ce969c72b9cb3e11/Rec/Allen/src/GaudiAllenVeloToV2Tracks.cpp), produced a single output container in which each track is assigned either type `Velo` or `VeloBackward` as appropriate.
For the [`LHCb::Event::v3::Tracks`](https://gitlab.cern.ch/lhcb/LHCb/-/blob/a40311ae9b06dd1734e600beb098d155fa3b4e4a/Event/TrackEvent/include/Event/Track_v3.h) containers, the track type is a property of the container. Thus, a single output container with heterogenous track types no longer appears to be supported. In order to support the distinction between Velo and VeloBackward tracks, the new GaudiAllenVeloToV3Tracks has two output containers:
- `OutputTracksForward`, which has track type Velo and contains the forward Velo tracks, and
- `OutputTracksBackward`, which has track type VeloBackward and contains the backward Velo tracks.
## States
A fixed set of track states for each `LHCb::Event::v3::TrackType` is part of the definition of
[`LHCb::Event::v3::Tracks`](https://gitlab.cern.ch/lhcb/LHCb/-/blob/a40311ae9b06dd1734e600beb098d155fa3b4e4a/Event/TrackEvent/include/Event/Track_v3.h). This differs from the previous iterations of the Track definition that had variable sets of states. The track state information available to the GaudiAllen..ToV2Tracks converters is, in general, inconsistent with the that associated with the corresponding LHCb::Event::v3::TrackType. The following table indicates what is provided by the previous collection of converters and what is expected for the targeted `LHCb::Event::v3::TrackType`.
| v2 converter | States provided | LHCb::Event::v3::TrackType | States of v3::TrackType |
| -- | -- | -- | -- |
| GaudiAllenVeloToV2Tracks | `ClosestToBeam`[^1] | Velo, VeloBackward | `ClosestToBeam`, `FirstMeasurement`, `LastMeasurement` |
| GaudiAllenUTToV2Tracks | `ClosestToBeam`[^1], `EndVelo`[^1] | Upstream | `ClosestToBeam`, `FirstMeasurement`, `LastMeasurement`, `BegRich1`, `EndRich1` |
| GaudiAllenForwardToV2Tracks | `ClosestToBeam`[^2] | FittedForward | `ClosestToBeam` |
[^1]: Provided via input containers that are separate from the input tracks
[^2]: Provided as data members of input tracks
In the converters created by this MR, i have opted to fill *all* of the state information in the output `LHCb::Event::v3::TrackType` with approximations of valid data. In my testing, frequent run-time error messages were produced when i left empty the output states for which no directly analogous input states were available. Most of these errors happened when a user of a v1 track converted from the v3 tracks tried to determine the momentum at one of the empty states. The output states are filled with straight-line extrapolations from the state provided by Allen that is nearest to it in z.
## q/p and its variance
Each of the previous converters to v2 tracks had a different source of q/p.
- [`GaudiAllenForwardToV2Tracks`](https://gitlab.cern.ch/lhcb/Allen/-/blob/6a2d40ca61f3a404b942db7bf4e9c8f8368a0116/Rec/Allen/src/GaudiAllenForwardToV2Tracks.cpp#L103-104)
- q/p: accessed indirectly from the state returned by [`Allen::Views::Physics::BasicParticle::state()`](https://gitlab.cern.ch/lhcb/Allen/-/blob/a6fded372be12b4ff25635a60c424a968d069e39/device/event_model/common/include/ParticleTypes.cuh#L258)
- var(q/p): a fake value calculated from q/p and a property of `GaudiAllenForwardToV2Tracks`
- [`GaudiAllenUTToV2Tracks`](https://gitlab.cern.ch/lhcb/Allen/-/blob/6a2d40ca61f3a404b942db7bf4e9c8f8368a0116/Rec/Allen/src/GaudiAllenUTToV2Tracks.cpp#L104)
- q/p: accessed directly from the track: [`Allen::Views::UT::Consolidated::Track::qop()`](https://gitlab.cern.ch/lhcb/Allen/-/blob/6a2d40ca61f3a404b942db7bf4e9c8f8368a0116/device/event_model/UT/include/UTConsolidated.cuh#L152)
- No covariance information transferred
- [`GaudiAllenVeloToV2Tracks`](https://gitlab.cern.ch/lhcb/Allen/-/blob/master/Rec/Allen/src/GaudiAllenVeloToV2Tracks.cpp#L102-107)
- q/p: a fake value calculated from beamline state tx and ty and a property of `GaudiAllenVeloToV2Tracks`
- var(q/p): a fixed hard-coded fake value of 1.e-6.
The various methods for accessing and faking q/p have been carried into the v3 converters of this MR. The `GaudiAllenForwardToV2Tracks` method of faking var(q/p) has been uniformly adopted.
## Tests
The algorithms created in this MR are tested in the existing Moore tests
* RecoConf.allen_gaudi_forward_with_mcchecking
* RecoConf.allen_gaudi_seed_and_match_with_mcchecking
* RecoConf.allen_gaudi_velo_ut_with_mcchecking
* RecoConf.allen_gaudi_velo_with_mcchecking
* RecoConf.hlt1_hlt2_comparisonSebastien PonceSebastien Poncehttps://gitlab.cern.ch/lhcb/Allen/-/merge_requests/1141Fix clang-15 compiler warnings2023-03-08T12:34:11+01:00Roel AaijFix clang-15 compiler warningsLocally tested a build with Clang 15 and got extra warnings. Fixes are all very straightforward.Locally tested a build with Clang 15 and got extra warnings. Fixes are all very straightforward.Daniel Campora PerezDaniel Campora Perezhttps://gitlab.cern.ch/lhcb/Allen/-/merge_requests/977clean up LHCbID in Allen2022-09-04T12:58:44+02:00Christina Agapopoulouclean up LHCbID in AllenClean-up of LHCbID in Allen. Implemented changes:
- LHCbID model in `device/event_model/common/include/LHCbID.cuh` (replacing existing `host/event_model/MC/include/LHCbID.h`
- extended mapping of sub-detectors to LHCbIDType to include p...Clean-up of LHCbID in Allen. Implemented changes:
- LHCbID model in `device/event_model/common/include/LHCbID.cuh` (replacing existing `host/event_model/MC/include/LHCbID.h`
- extended mapping of sub-detectors to LHCbIDType to include placeholders for other sub-detectors (will be updated according to LHCb!3226 in a separate MR)
- single definition of LHCbID literals used throughout the code.Rosen MatevRosen Matevhttps://gitlab.cern.ch/lhcb/Allen/-/merge_requests/699Adapt to track enum changes2022-02-01T14:47:19+01:00Andre GuntherAdapt to track enum changesGoes with LHCb!3299Goes with LHCb!3299Alessandro ScarabottoAlessandro Scarabottohttps://gitlab.cern.ch/lhcb/Allen/-/merge_requests/688Remove IP requirements on dielectrons in FilterTracks2022-01-22T16:48:16+01:00Thomas BoettcherRemove IP requirements on dielectrons in FilterTracksTracks identified as electrons should be used to create secondary vertices with no PV-related requirements. To do this only in the hlt1_pp_ecal sequence, this MR does the following:
- Adds `is_electron` data member to `ParKalmanFilter::...Tracks identified as electrons should be used to create secondary vertices with no PV-related requirements. To do this only in the hlt1_pp_ecal sequence, this MR does the following:
- Adds `is_electron` data member to `ParKalmanFilter::FittedTrack`, which is set to `false` when the tracks are created in the kalman filter.
- Adds an algorithm that takes kalman tracks and calo ID results and creates new kalman tracks with `is_electron` set
- Instead of ignoring PV requirements in FilterTracks if a track `is_muon`, these requirements are ignored if `is_muon || is_lepton`
This is built off of https://gitlab.cern.ch/lhcb/Allen/-/merge_requests/639. This is a workaround and should be unnecessary after https://gitlab.cern.ch/lhcb/Allen/-/merge_requests/690 is done.
FYI @johndan @nnolteRosen MatevRosen Matevhttps://gitlab.cern.ch/lhcb/Allen/-/merge_requests/672Add views to the UT event model2021-11-17T18:27:49+01:00Thomas BoettcherAdd views to the UT event modelFirst attempt at adding views to the UT event model to start iterating with @dcampora. To-do list:
- [x] Create UT views
- [x] Add an algorithm to create Velo-UT LHCbIDContainers
- [x] Add checks for the LHCbIDs accessed through the vie...First attempt at adding views to the UT event model to start iterating with @dcampora. To-do list:
- [x] Create UT views
- [x] Add an algorithm to create Velo-UT LHCbIDContainers
- [x] Add checks for the LHCbIDs accessed through the views
- [x] Use views in algorithms downstream of the UT reco
The views introduced in this MR are used throughout the SciFi reconstruction and Kalman filter. All that's left is the SelReport writer, which will require additional event model work (SciFi tracks, SVs, etc.).Rosen MatevRosen Matevhttps://gitlab.cern.ch/lhcb/Allen/-/merge_requests/658Create LHCb ID containers2021-09-25T18:30:59+02:00Daniel Campora PerezCreate LHCb ID containersThis MR adds the LHCb ID containers to Allen drafted in https://gitlab.cern.ch/lhcb/Allen/-/merge_requests/651. This MR is intended to be merged, the other one is a proof-of-concept of what will be doable in the future once all EMs are u...This MR adds the LHCb ID containers to Allen drafted in https://gitlab.cern.ch/lhcb/Allen/-/merge_requests/651. This MR is intended to be merged, the other one is a proof-of-concept of what will be doable in the future once all EMs are updated to use LHCb ID containers.
Concretely:
* Add LHCb ID multi ev container / container / sequence interfaces.
* Make Velo EM an implementation of those.
* Add a postcondition test to VeloConsolidateTracks that checks the integrity of LHCb ID containers.https://gitlab.cern.ch/lhcb/Allen/-/merge_requests/510Improve Allen consolidated VELO event model and transform it to be event-based2021-08-27T17:03:15+02:00Daniel Campora PerezImprove Allen consolidated VELO event model and transform it to be event-basedThis MR provides a new Allen consolidated VELO event model:
* It lives under namespace `Allen::Views::Velo::Consolidated`.
* It provides the classes `Hit`, `Hits`, `State`, `States`, `Track` and `Tracks`.
* `Hits`, `States` and `Tracks`...This MR provides a new Allen consolidated VELO event model:
* It lives under namespace `Allen::Views::Velo::Consolidated`.
* It provides the classes `Hit`, `Hits`, `State`, `States`, `Track` and `Tracks`.
* `Hits`, `States` and `Tracks` are limited in scope to a single event.
* An object of type `Allen::Views::Velo::Consolidated::Tracks` is now produced by `velo_consolidate_tracks_t`, concretely `dev_velo_tracks_view_t`. It is also provided in the configuration in `make_velo_tracks` with key `dev_velo_tracks_view`.
* Two objects of type `Allen::Views::Velo::Consolidated::States` are produced in `velo_kalman_filter_t`, concretely `dev_velo_kalman_beamline_states_view_t` and `dev_velo_kalman_endvelo_states_view_t`.
These classes and more concretely these objects (`dev_velo_tracks_view_t`, `dev_velo_kalman_beamline_states_view_t` and `dev_velo_kalman_endvelo_states_view_t`) improve the usability and readability of the Allen consolidated Velo Event Model. It does not affect the backend, which remains unmodified.Christoph HasseChristoph Hassehttps://gitlab.cern.ch/lhcb/Allen/-/merge_requests/577adapt to LHCb!3069 and LHCb!30592021-07-07T21:41:07+02:00Gerhard Ravenadapt to LHCb!3069 and LHCb!3059take advantage of `LHCb::RawBank::types()` and the parsing of LHCb::RawBank::BankTypetake advantage of `LHCb::RawBank::types()` and the parsing of LHCb::RawBank::BankTypehttps://gitlab.cern.ch/lhcb/Allen/-/merge_requests/539Support views2021-06-15T14:56:24+02:00Daniel Campora PerezSupport viewsThis MR brings the ability to define views to Allen datatypes. A view is a datatype that is linked to the lifetime of other types, and it allows to define a type that relies on others (see https://gitlab.cern.ch/lhcb/Allen/-/issues/174 f...This MR brings the ability to define views to Allen datatypes. A view is a datatype that is linked to the lifetime of other types, and it allows to define a type that relies on others (see https://gitlab.cern.ch/lhcb/Allen/-/issues/174 for a more comprehensive example).
Here is a working example:
```c++
DEVICE_OUTPUT(
dev_velo_clusters_t,
Velo::Clusters, dev_velo_cluster_container_t, dev_module_cluster_num_t, dev_number_of_events_t)
dev_velo_clusters;
```
The type `dev_velo_clusters_t` is defined to be of type `Velo::Clusters`, with its lifetime linked to types `dev_velo_cluster_container_t, dev_module_cluster_num_t, dev_number_of_events_t`.
This type can be used just like any other type:
```c++
auto velo_cluster_container = Velo::Clusters {parameters.dev_velo_cluster_container, estimated_number_of_clusters};
parameters.dev_velo_clusters[event_number] = velo_cluster_container;
```
And subsequent algorithms can request it with no need to specify it as a view anymore:
```
DEVICE_INPUT(dev_velo_clusters_t, Velo::Clusters) dev_velo_clusters;
```
The reason these two types are compatible is because the `Allen underlying type` of both the view and non-view parameter is `Velo::Clusters`.
Behind the scenes
-----------------
Now every parameter has a `using deps` statement, where dependencies are set. `TupleContainsWithView` checks whether the tuple contains any parameter or view:
```c++
template<typename T, typename Tuple>
struct TupleContainsDecay;
template<typename T, typename... Ts>
struct TupleContainsDecay<T, std::tuple<Ts...>>
: std::bool_constant<((std::is_base_of_v<std::decay_t<Ts>, std::decay_t<T>> || ...))> {
};
template<typename T, typename Tuple>
struct TupleContainsWithViews;
template<typename T>
struct TupleContainsWithViews<T, std::tuple<>> : std::bool_constant<false> {
};
template<typename T, typename OtherT, typename... Ts>
struct TupleContainsWithViews<T, std::tuple<OtherT, Ts...>>
: std::bool_constant<
std::is_same_v<T, OtherT> || TupleContainsWithViews<T, std::tuple<Ts...>>::value ||
TupleContainsDecay<T, typename OtherT::deps>::value> {
};
```
It is also possible to check whether this worked by running `./Allen -p1` and looking at whether the parameter `velo_masked_clustering__dev_velo_cluster_container_t` is still populated in the device memory, in algorithm search by triplet.
Closes https://gitlab.cern.ch/lhcb/Allen/-/issues/174https://gitlab.cern.ch/lhcb/Allen/-/merge_requests/393Reworked selections2021-02-18T12:55:04+01:00Daniel Campora PerezReworked selectionsThis MR redesigns from the ground up selections.
* Selections are now algorithms. A new type of algorithm `SelectionAlgorithm` is available.
* Input aggregates are now supported. Parser detects these types and generates code accordingly...This MR redesigns from the ground up selections.
* Selections are now algorithms. A new type of algorithm `SelectionAlgorithm` is available.
* Input aggregates are now supported. Parser detects these types and generates code accordingly.
* `GatherSelections` is an algorithm that uses input aggregates.
* Three line types have been added (OneTrackLine, TwoTrackLine, ODINLine).
* The RateChecker has been adapted to work with the new selections.
* All algorithms (that require it) have been given a `dev_event_list_t` as input.
* Algorithms that require it have been given a `dev_number_of_events_t` as input.
* Added "verbosity" property to all algorithms.
* `selections.md` documentation updated accordingly.
* Created a new implementation of a `dec_reporter`.
* Selection algorithms now have the following properties: a pre-scaler factor and hash string, and a post-scaler factor and hash string. The scaler factor is in the range [0-1] and determines how many events will be accepted. The hash string must not be empty and contains a string from which an `unsigned` hash is calculated which serves as the seed for the deterministic scaler.
To do:
- [x] Implement pre-scalers
- [x] Implement post-scalers
- [x] Fix warning in Debug build
- [x] Fix compilation with Gaudi (see [this failing ci-test](https://lhcb-nightlies.web.cern.ch/logs/build/nightly/lhcb-master-mr/1330/x86_64-centos7-gcc9-opt/Allen/) )
Implement the following lines:
- [x] PassThrough
- [x] ODINNoBias
- [x] ODINLumi
- [x] GECPassthrough
- [x] SingleHighPtMuon
- [x] LowPtMuon
- [x] DiMuonHighMass
- [x] DiMuonLowMass
- [x] LowPtDiMuon
- [x] DisplacedDiMuon
- [x] DiMuonSoft
- [x] D2KPi
- [x] D2PiPi
- [x] D2KK
- [x] DiMuonTrackEff
- [x] TrackMuonMVA
Note: The previous "ErrorEvent" line does not make sense in the context of the new selection framework, where each selection is an algorithm. Error handling deserves its own issue, should be discussed in depth and implemented in a separate MR.
GPU throughput of the sequence is reduced by 4% with this branch:
Prior throughput:
```
Quadro RTX 6000 │█████████████████████████████████ 166.02 kHz
GeForce RTX 2080 Ti │███████████████████████████████ 155.88 kHz
Tesla V100-PCIE-32GB │██████████████████████████████ 151.72 kHz
AMD EPYC 7502 32-Core │████ 22.44 kHz
Intel Xeon E5-2630 v4 │▌ 4.66 kHz
┼─┴─┼─┴─┼─┴─┼─┴─┼─┴─┼─┴─┼─┴─┼─┴─┼─┴─┼
0 20 40 60 80 100 120 140 160 180
```
New throughput:
```
Quadro RTX 6000 │███████████████████████████████████████████████ 159.90 kHz
GeForce RTX 2080 Ti │████████████████████████████████████████████ 149.55 kHz
Tesla V100-PCIE-32GB │██████████████████████████████████████████ 140.60 kHz
AMD EPYC 7502 32-Core │██████ 22.35 kHz
Intel Xeon E5-2630 v4 │█ 4.73 kHz
┼──┴──┼──┴──┼──┴──┼──┴──┼──┴──┼──┴──┼──┴──┼──┴──┼
0 20 40 60 80 100 120 140 160
```
Built on top of https://gitlab.cern.ch/lhcb/Allen/-/merge_requests/388.
Closes https://gitlab.cern.ch/lhcb/Allen/-/issues/131
Should go together with: https://gitlab.cern.ch/lhcb/Moore/-/merge_requests/652https://gitlab.cern.ch/lhcb/Allen/-/merge_requests/281Allen TDR2020-08-03T18:30:23+02:00Daniel Campora PerezAllen TDR