SiPixelFrameConverter

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
#ifndef SiPixelObjects_SiPixelFrameConverter_H
#define SiPixelObjects_SiPixelFrameConverter_H

#include "CondFormats/SiPixelObjects/interface/ElectronicIndex.h"
#include "CondFormats/SiPixelObjects/interface/DetectorIndex.h"
#include "CondFormats/SiPixelObjects/interface/SiPixelFedCabling.h"
#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingTree.h"
#include "CondFormats/SiPixelObjects/interface/PixelFEDCabling.h"
#include "CondFormats/SiPixelObjects/interface/PixelROC.h"
#include "CondFormats/SiPixelObjects/interface/LocalPixel.h"
#include "CondFormats/SiPixelObjects/interface/GlobalPixel.h"

#include <cstdint>

class SiPixelFrameConverter {
public:
  typedef sipixelobjects::PixelFEDCabling PixelFEDCabling;

  //  using PixelFEDCabling = sipixelobjects::PixelFEDCabling;

  SiPixelFrameConverter(const SiPixelFedCabling* map, int fedId);

  bool hasDetUnit(uint32_t radId) const;

  sipixelobjects::PixelROC const* toRoc(int link, int roc) const;

  int toDetector(const sipixelobjects::ElectronicIndex& cabling, sipixelobjects::DetectorIndex& detector) const {
    using namespace sipixelobjects;
    auto roc = toRoc(cabling.link, cabling.roc);
    if (!roc)
      return 2;
    LocalPixel::DcolPxid local = {cabling.dcol, cabling.pxid};
    if (!local.valid())
      return 3;

    GlobalPixel global = roc->toGlobal(LocalPixel(local));
    detector.rawId = roc->rawId();
    detector.row = global.row;
    detector.col = global.col;

    return 0;
  }

  int toCabling(sipixelobjects::ElectronicIndex& cabling, const sipixelobjects::DetectorIndex& detector) const;

private:
  int theFedId;
  const SiPixelFedCabling* theMap;
  SiPixelFedCablingTree const* theTree;
  const PixelFEDCabling* theFed;
};
#endif