CMS 3D CMS Logo

SiPixelFrameConverter.cc
Go to the documentation of this file.
3 
6 
8 
9 #include <sstream>
10 
11 using namespace std;
12 using namespace sipixelobjects;
13 
15  : theFedId(fedId),
16  theMap(map),
17  theTree(dynamic_cast<SiPixelFedCablingTree const*>(map)),
18  theFed(theTree ? theTree->fed(fedId) : nullptr) {}
19 
20 bool SiPixelFrameConverter::hasDetUnit(uint32_t rawId) const {
21  return theMap->pathToDetUnitHasDetUnit(rawId, static_cast<unsigned int>(theFedId));
22 }
23 
26  static_cast<unsigned int>(theFedId), static_cast<unsigned int>(link), static_cast<unsigned int>(roc)};
27  const PixelROC* rocp = (theFed) ? theTree->findItemInFed(path, theFed) : theMap->findItem(path);
28  if
29  UNLIKELY(!rocp) {
30  stringstream stm;
31  stm << "Map shows no fed=" << theFedId << ", link=" << link << ", roc=" << roc;
32  edm::LogWarning("SiPixelFrameConverter") << stm.str();
33  }
34  return rocp;
35 }
36 
38  std::vector<CablingPathToDetUnit> path = theMap->pathToDetUnit(detector.rawId);
39  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
40  for (IT it = path.begin(); it != path.end(); ++it) {
41  const PixelROC* roc = theMap->findItem(*it);
42  if (!roc)
43  return 2;
44  if (roc->rawId() != detector.rawId)
45  return 3;
46 
47  GlobalPixel global = {detector.row, detector.col};
48  //LogTrace("")<<"GLOBAL PIXEL: row=" << global.row <<" col="<< global.col;
49 
50  LocalPixel local = roc->toLocal(global);
51  // LogTrace("")<<"LOCAL PIXEL: dcol ="
52  //<< local.dcol()<<" pxid="<< local.pxid()<<" inside: " <<local.valid();
53 
54  if (!local.valid())
55  continue;
56  ElectronicIndex cabIdx = {static_cast<int>(it->link), static_cast<int>(it->roc), local.dcol(), local.pxid()};
57  cabling = cabIdx;
58  return 0;
59  }
60  return 1;
61 }
virtual std::vector< sipixelobjects::CablingPathToDetUnit > pathToDetUnit(uint32_t rawDetId) const =0
#define nullptr
SiPixelFrameConverter(const SiPixelFedCabling *map, int fedId)
identify pixel inside single ROC
Definition: LocalPixel.h:7
global coordinates (row and column in DetUnit, as in PixelDigi)
Definition: GlobalPixel.h:6
LocalPixel toLocal(const GlobalPixel &glo) const
Definition: PixelROC.h:45
SiPixelFedCablingTree const * theTree
uint32_t rawId() const
return the DetUnit to which this ROC belongs to.
Definition: PixelROC.h:34
std::vector< LinkConnSpec >::const_iterator IT
virtual bool pathToDetUnitHasDetUnit(uint32_t rawDetId, unsigned int fedId) const =0
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
int toCabling(sipixelobjects::ElectronicIndex &cabling, const sipixelobjects::DetectorIndex &detector) const
const SiPixelFedCabling * theMap
sipixelobjects::PixelROC const * toRoc(int link, int roc) const
bool hasDetUnit(uint32_t radId) const
const sipixelobjects::PixelROC * findItemInFed(const sipixelobjects::CablingPathToDetUnit &path, const PixelFEDCabling *aFed) const
#define UNLIKELY(x)
Definition: Likely.h:21
const PixelFEDCabling * theFed