CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/CondFormats/SiPixelObjects/interface/SiPixelFrameReverter.h

Go to the documentation of this file.
00001 #ifndef SiPixelTools_SiPixelFrameReverter_H
00002 #define SiPixelTools_SiPixelFrameReverter_H
00003 
00004 #include "CondFormats/SiPixelObjects/interface/SiPixelFedCabling.h"
00005 #include "CondFormats/SiPixelObjects/interface/CablingPathToDetUnit.h"
00006 #include "CondFormats/SiPixelObjects/interface/SiPixelFrameConverter.h"
00007 #include "CondFormats/SiPixelObjects/interface/GlobalPixel.h"
00008 #include "CondFormats/SiPixelObjects/interface/LocalPixel.h"
00009 #include "CondFormats/SiPixelObjects/interface/ElectronicIndex.h"
00010 #include "CondFormats/SiPixelObjects/interface/DetectorIndex.h"
00011 #include "FWCore/Framework/interface/Event.h"
00012 #include "FWCore/Framework/interface/ESHandle.h"
00013 
00014 #include <boost/cstdint.hpp>
00015 
00016 class SiPixelFedCablingMap;
00017 
00018 class SiPixelFrameReverter {
00019 public:
00020 
00021   SiPixelFrameReverter(const edm::EventSetup&, const SiPixelFedCabling* map);
00022 
00023   void buildStructure(edm::EventSetup const&);
00024 
00025   // Function to test if detId exists
00026   bool hasDetUnit(uint32_t detId) const { return (DetToFedMap.find(detId)!=DetToFedMap.end()); }
00027 
00028   // Function to convert offline addressing to online
00029   int toCabling( sipixelobjects::ElectronicIndex & cabling, 
00030                  const sipixelobjects::DetectorIndex & detector) const;
00031 
00032   // Function to find FedId given detId
00033   int findFedId(uint32_t detId);
00034 
00035   // Function to find Fed link given detId and pixel row and col on plaquette
00036   // returns -1 if link can't be found
00037   short findLinkInFed(uint32_t detId, sipixelobjects::GlobalPixel global);
00038 
00039   // Function to find Roc number on a link given detId and pixel row and col on plaquette
00040   // returns -1 if Roc can't be found
00041   short findRocInLink(uint32_t detId, sipixelobjects::GlobalPixel global);
00042 
00043   // Function to find the Roc number within a plaquette given detId and pixel row and col on plaquette
00044   // returns -1 if Roc can't be found
00045   short findRocInDet(uint32_t detId, sipixelobjects::GlobalPixel global);
00046 
00047   // Function to find local pixel given detId and pixel row and col on plaquette
00048   sipixelobjects::LocalPixel findPixelInRoc(uint32_t detId, sipixelobjects::GlobalPixel global);
00049 
00050 private:
00051 
00052   const SiPixelFedCabling * map_;
00053 
00054   std::map< uint32_t,std::vector<sipixelobjects::CablingPathToDetUnit> > DetToFedMap;
00055 
00056 };
00057 #endif
00058 
00059