Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef SiPixelTools_SiPixelFrameReverter_H
0002 #define SiPixelTools_SiPixelFrameReverter_H
0003 
0004 #include "CondFormats/SiPixelObjects/interface/SiPixelFedCabling.h"
0005 #include "CondFormats/SiPixelObjects/interface/CablingPathToDetUnit.h"
0006 #include "CondFormats/SiPixelObjects/interface/GlobalPixel.h"
0007 #include "CondFormats/SiPixelObjects/interface/LocalPixel.h"
0008 #include "CondFormats/SiPixelObjects/interface/ElectronicIndex.h"
0009 #include "CondFormats/SiPixelObjects/interface/DetectorIndex.h"
0010 
0011 #include <cstdint>
0012 #include <map>
0013 #include <vector>
0014 
0015 class TrackerGeometry;
0016 
0017 class SiPixelFrameReverter {
0018 public:
0019   SiPixelFrameReverter(const SiPixelFedCabling* map);
0020 
0021   void buildStructure(const TrackerGeometry*);
0022 
0023   // Function to test if detId exists
0024   bool hasDetUnit(uint32_t detId) const { return (DetToFedMap.find(detId) != DetToFedMap.end()); }
0025 
0026   // Function to convert offline addressing to online
0027   int toCabling(sipixelobjects::ElectronicIndex& cabling, const sipixelobjects::DetectorIndex& detector) const;
0028 
0029   // Function to find FedId given detId
0030   int findFedId(uint32_t detId);
0031 
0032   // Function to find Fed link given detId and pixel row and col on plaquette
0033   // returns -1 if link can't be found
0034   short findLinkInFed(uint32_t detId, sipixelobjects::GlobalPixel global);
0035 
0036   // Function to find Roc number on a link given detId and pixel row and col on plaquette
0037   // returns -1 if Roc can't be found
0038   short findRocInLink(uint32_t detId, sipixelobjects::GlobalPixel global);
0039 
0040   // Function to find the Roc number within a plaquette given detId and pixel row and col on plaquette
0041   // returns -1 if Roc can't be found
0042   short findRocInDet(uint32_t detId, sipixelobjects::GlobalPixel global);
0043 
0044   // Function to find local pixel given detId and pixel row and col on plaquette
0045   sipixelobjects::LocalPixel findPixelInRoc(uint32_t detId, sipixelobjects::GlobalPixel global);
0046 
0047 private:
0048   const SiPixelFedCabling* map_;
0049 
0050   std::map<uint32_t, std::vector<sipixelobjects::CablingPathToDetUnit> > DetToFedMap;
0051 };
0052 #endif