Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:34

0001 #ifndef SiPixelObjects_SiPixelFrameConverter_H
0002 #define SiPixelObjects_SiPixelFrameConverter_H
0003 
0004 #include "CondFormats/SiPixelObjects/interface/ElectronicIndex.h"
0005 #include "CondFormats/SiPixelObjects/interface/DetectorIndex.h"
0006 #include "CondFormats/SiPixelObjects/interface/SiPixelFedCabling.h"
0007 #include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingTree.h"
0008 #include "CondFormats/SiPixelObjects/interface/PixelFEDCabling.h"
0009 #include "CondFormats/SiPixelObjects/interface/PixelROC.h"
0010 #include "CondFormats/SiPixelObjects/interface/LocalPixel.h"
0011 #include "CondFormats/SiPixelObjects/interface/GlobalPixel.h"
0012 
0013 #include <cstdint>
0014 
0015 class SiPixelFrameConverter {
0016 public:
0017   typedef sipixelobjects::PixelFEDCabling PixelFEDCabling;
0018 
0019   //  using PixelFEDCabling = sipixelobjects::PixelFEDCabling;
0020 
0021   SiPixelFrameConverter(const SiPixelFedCabling* map, int fedId);
0022 
0023   bool hasDetUnit(uint32_t radId) const;
0024 
0025   sipixelobjects::PixelROC const* toRoc(int link, int roc) const;
0026 
0027   int toDetector(const sipixelobjects::ElectronicIndex& cabling, sipixelobjects::DetectorIndex& detector) const {
0028     using namespace sipixelobjects;
0029     auto roc = toRoc(cabling.link, cabling.roc);
0030     if (!roc)
0031       return 2;
0032     LocalPixel::DcolPxid local = {cabling.dcol, cabling.pxid};
0033     if (!local.valid())
0034       return 3;
0035 
0036     GlobalPixel global = roc->toGlobal(LocalPixel(local));
0037     detector.rawId = roc->rawId();
0038     detector.row = global.row;
0039     detector.col = global.col;
0040 
0041     return 0;
0042   }
0043 
0044   int toCabling(sipixelobjects::ElectronicIndex& cabling, const sipixelobjects::DetectorIndex& detector) const;
0045 
0046 private:
0047   int theFedId;
0048   const SiPixelFedCabling* theMap;
0049   SiPixelFedCablingTree const* theTree;
0050   const PixelFEDCabling* theFed;
0051 };
0052 #endif