#ifndef PM_HDU_UTILS_H
#define PM_HDU_UTILS_H

#include "pmFPA.h"
#include "pmHDU.h"

// Get the lowest HDU in the hierarchy, as supplied
pmHDU *pmHDUGetLowest(pmFPA *fpa, // The FPA
                      pmChip *chip, // The chip, or NULL
                      pmCell *cell // The cell, or NULL
                     );

// Find the HDU in the FPA hierarchy
pmHDU *pmHDUFromFPA(pmFPA *fpa          // FPA for which to find HDU
                   );
pmHDU *pmHDUFromChip(pmChip *chip       // Chip for which to find HDU
                    );
pmHDU *pmHDUFromCell(pmCell *cell       // Cell for which to find HDU
                    );

pmHDU *pmHDUFromReadout (pmReadout *readout  // Readout for which to find HDU
                        );

#endif
