SiPixelFrameReverter

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 SiPixelTools_SiPixelFrameReverter_H
#define SiPixelTools_SiPixelFrameReverter_H

#include "CondFormats/SiPixelObjects/interface/SiPixelFedCabling.h"
#include "CondFormats/SiPixelObjects/interface/CablingPathToDetUnit.h"
#include "CondFormats/SiPixelObjects/interface/GlobalPixel.h"
#include "CondFormats/SiPixelObjects/interface/LocalPixel.h"
#include "CondFormats/SiPixelObjects/interface/ElectronicIndex.h"
#include "CondFormats/SiPixelObjects/interface/DetectorIndex.h"

#include <cstdint>
#include <map>
#include <vector>

class TrackerGeometry;

class SiPixelFrameReverter {
public:
  SiPixelFrameReverter(const SiPixelFedCabling* map);

  void buildStructure(const TrackerGeometry*);

  // Function to test if detId exists
  bool hasDetUnit(uint32_t detId) const { return (DetToFedMap.find(detId) != DetToFedMap.end()); }

  // Function to convert offline addressing to online
  int toCabling(sipixelobjects::ElectronicIndex& cabling, const sipixelobjects::DetectorIndex& detector) const;

  // Function to find FedId given detId
  int findFedId(uint32_t detId);

  // Function to find Fed link given detId and pixel row and col on plaquette
  // returns -1 if link can't be found
  short findLinkInFed(uint32_t detId, sipixelobjects::GlobalPixel global);

  // Function to find Roc number on a link given detId and pixel row and col on plaquette
  // returns -1 if Roc can't be found
  short findRocInLink(uint32_t detId, sipixelobjects::GlobalPixel global);

  // Function to find the Roc number within a plaquette given detId and pixel row and col on plaquette
  // returns -1 if Roc can't be found
  short findRocInDet(uint32_t detId, sipixelobjects::GlobalPixel global);

  // Function to find local pixel given detId and pixel row and col on plaquette
  sipixelobjects::LocalPixel findPixelInRoc(uint32_t detId, sipixelobjects::GlobalPixel global);

private:
  const SiPixelFedCabling* map_;

  std::map<uint32_t, std::vector<sipixelobjects::CablingPathToDetUnit> > DetToFedMap;
};
#endif