  We address two important questions in gravitational-wave astronomy. What is
the astrophysical formation scenario leading to black-hole binary mergers? Did
some of the merging black holes form hierarchically through previous
generations of mergers? Leveraging fast-to-generate astrophysical simulations
from the rapster code and a random forest algorithm, we develop a pipeline to
accurately classify the most likely generation and formation scenario of
dynamically formed BHs on an event-by-event basis. We test our framework on
four merger events with features suggesting a dynamical origin: the large total
mass event GW190521, GW190412 (with large mass asymmetry), and two events with
effective spins antialigned with the orbital angular momentum (GW191109 and
GW200225). Within the models we consider, and assuming these events to be
formed dynamically, we find that one of the component black holes in GW190521
formed from a previous merger with high probability ($\gtrsim 85\%$). GW190521,
GW191109 and GW200225 are compatible with formation through three-body
interactions, while the most likely formation channel for GW190412 are two-body
captures. We also rule out that GW191109 contains only first-generation black
holes with a probability of 97$\%$. Our pipeline could be useful to identify
the evolutionary path of individual GW observations once it is trained on more
comprehensive sets of binary formation simulations.
