In many areas of the brain, both spontaneous and stimulus-evoked activity can manifest as synchronous activation of neuronal assemblies. The characterization of assembly structure and dynamics provides important insights into how brain computations are distributed across neural networks. The proliferation of experimental techniques for recording the activity of neuronal assemblies calls for a comprehensive statistical method to describe, analyze and characterize these high dimensional datasets. The performance of existing methods for defining assemblies is sensitive to noise and stochasticity in neuronal firing patterns and assembly heterogeneity. To address these problems, we introduce a generative hierarchical model of synchronous activity to describe the organization of neurons into assemblies. Unlike existing methods, our analysis provides a simultaneous estimation of assembly composition, dynamics and within-assembly statistical features, such as the levels of activity, noise and assembly synchrony. We have used our method to characterize population activity throughout the tectum of larval zebrafish, allowing us to make statistical inference on the spatiotemporal organization of tectal assemblies, their composition and the logic of their interactions. We have also applied our method to functional imaging and neuropixels recordings from the mouse, allowing us to relate the activity of identified assemblies to specific behaviours such as running or changes in pupil diameter.