code: private function mapByGeneration($mapByDepthDesc, $mapById)
      {
          $result = []; // [ $custId=>[$genId => $totalPv, ...], ... ]
          foreach ($mapByDepthDesc as $depth => $ids) {
              foreach ($ids as $custId) {
                  /** @var EBonDwnl $entry */
                  $entry = $mapById[$custId];
                  $path = $entry->getPath();
                  $parents = $this->hlpTree->getParentsFromPathReversed($path);
                  $level = 0;
                  foreach ($parents as $parentId) {
                      $level += 1;
                      if (!isset($result[$parentId])) {
                          $result[$parentId] = [];
                      }
                      if (!isset($result[$parentId][$level])) {
                          $result[$parentId][$level] = [];
                      }
                      $result[$parentId][$level][] = $custId;
                  }
              }
          }
          return $result;
      }
docs: Generate map of the customer generations.
  
  @param $mapByDepthDesc
  @param $mapById
  @param $mapById
  
  @return array [$custId=>[$genNum=>[$childId, ...], ...], ...]