CMS 3D CMS Logo

Public Member Functions | Private Attributes

SiPixelFrameReverter Class Reference

#include <SiPixelFrameReverter.h>

List of all members.

Public Member Functions

void buildStructure (edm::EventSetup const &)
int findFedId (uint32_t detId)
short findLinkInFed (uint32_t detId, sipixelobjects::GlobalPixel global)
sipixelobjects::LocalPixel findPixelInRoc (uint32_t detId, sipixelobjects::GlobalPixel global)
short findRocInDet (uint32_t detId, sipixelobjects::GlobalPixel global)
short findRocInLink (uint32_t detId, sipixelobjects::GlobalPixel global)
bool hasDetUnit (uint32_t detId) const
 SiPixelFrameReverter (const edm::EventSetup &, const SiPixelFedCabling *map)
int toCabling (sipixelobjects::ElectronicIndex &cabling, const sipixelobjects::DetectorIndex &detector) const

Private Attributes

std::map< uint32_t,
std::vector
< sipixelobjects::CablingPathToDetUnit > > 
DetToFedMap
const SiPixelFedCablingmap_

Detailed Description

Definition at line 18 of file SiPixelFrameReverter.h.


Constructor & Destructor Documentation

SiPixelFrameReverter::SiPixelFrameReverter ( const edm::EventSetup iSetup,
const SiPixelFedCabling map 
)

Definition at line 26 of file SiPixelFrameReverter.cc.

References buildStructure().

  : map_(map)
{ 
  // Build map
  buildStructure(iSetup);
}

Member Function Documentation

void SiPixelFrameReverter::buildStructure ( edm::EventSetup const &  iSetup)

Definition at line 34 of file SiPixelFrameReverter.cc.

References DetToFedMap, edm::EventSetup::get(), map_, EgammaValidation_cff::paths, and SiPixelFedCabling::pathToDetUnit().

Referenced by SiPixelFrameReverter().

{

  // Create map connecting each detId to appropriate SiPixelFrameConverter

  edm::ESHandle<TrackerGeometry> pDD;
  iSetup.get<TrackerDigiGeometryRecord>().get( pDD );

  for(TrackerGeometry::DetContainer::const_iterator it = pDD->dets().begin(); it != pDD->dets().end(); it++){
    
    if(dynamic_cast<PixelGeomDetUnit*>((*it))!=0){

      DetId detId = (*it)->geographicalId();
      uint32_t id = detId();
      std::vector<CablingPathToDetUnit> paths = map_->pathToDetUnit(id);
      DetToFedMap.insert(pair< uint32_t,std::vector<CablingPathToDetUnit> > (id,paths));

    }
  }  // for(TrackerGeometry::DetContainer::const_iterator
}  // end buildStructure
int SiPixelFrameReverter::findFedId ( uint32_t  detId)

Definition at line 79 of file SiPixelFrameReverter.cc.

References DetToFedMap, hasDetUnit(), and getHLTPrescaleColumns::path.

{
  if(!hasDetUnit(detId)) return -1;
  std::vector<CablingPathToDetUnit> path = DetToFedMap.find(detId)->second;
  int fedId = (int) path[0].fed;
  return fedId;
}
short SiPixelFrameReverter::findLinkInFed ( uint32_t  detId,
sipixelobjects::GlobalPixel  global 
)

Definition at line 88 of file SiPixelFrameReverter.cc.

References DetToFedMap, SiPixelFedCabling::findItem(), hasDetUnit(), link(), map_, getHLTPrescaleColumns::path, sipixelobjects::PixelROC::toLocal(), and sipixelobjects::LocalPixel::valid().

{
  if(!hasDetUnit(detId)) return -1;
  std::vector<CablingPathToDetUnit> path = DetToFedMap.find(detId)->second;
  typedef  std::vector<CablingPathToDetUnit>::const_iterator IT;
  for  (IT it = path.begin(); it != path.end(); ++it) {
    const PixelROC * roc = map_->findItem(*it);
    if (!roc) continue;

    LocalPixel local = roc->toLocal(global);

    if(!local.valid()) continue;
    short link = (short) it->link;
    return link;
  }
  return -1;
}
LocalPixel SiPixelFrameReverter::findPixelInRoc ( uint32_t  detId,
sipixelobjects::GlobalPixel  global 
)

Definition at line 145 of file SiPixelFrameReverter.cc.

References DetToFedMap, SiPixelFedCabling::findItem(), hasDetUnit(), map_, getHLTPrescaleColumns::path, sipixelobjects::PixelROC::toLocal(), and sipixelobjects::LocalPixel::valid().

{
  if(!hasDetUnit(detId)) {
    LocalPixel::RocRowCol pixel = {-1,-1};
    LocalPixel local(pixel);
    return local;
  }
  std::vector<CablingPathToDetUnit> path = DetToFedMap.find(detId)->second;
  typedef  std::vector<CablingPathToDetUnit>::const_iterator IT;
  for  (IT it = path.begin(); it != path.end(); ++it) {
    const PixelROC * roc = map_->findItem(*it);
    if (!roc) continue;

    LocalPixel local = roc->toLocal(global);

    if(!local.valid()) continue;
    return local;
  }
  LocalPixel::RocRowCol pixel = {-1,-1};
  LocalPixel local(pixel);
  return local;
}
short SiPixelFrameReverter::findRocInDet ( uint32_t  detId,
sipixelobjects::GlobalPixel  global 
)

Definition at line 126 of file SiPixelFrameReverter.cc.

References DetToFedMap, SiPixelFedCabling::findItem(), hasDetUnit(), sipixelobjects::PixelROC::idInDetUnit(), map_, getHLTPrescaleColumns::path, sipixelobjects::PixelROC::toLocal(), and sipixelobjects::LocalPixel::valid().

Referenced by SiPixelQuality::IsAreaBad().

{
  if(!hasDetUnit(detId)) return -1;
  std::vector<CablingPathToDetUnit> path = DetToFedMap.find(detId)->second;
  typedef  std::vector<CablingPathToDetUnit>::const_iterator IT;
  for  (IT it = path.begin(); it != path.end(); ++it) {
    const PixelROC * roc = map_->findItem(*it);
    if (!roc) continue;

    LocalPixel local = roc->toLocal(global);

    if(!local.valid()) continue;
    short rocInDet = (short) roc->idInDetUnit();
    return rocInDet;
  }
  return -1;
}
short SiPixelFrameReverter::findRocInLink ( uint32_t  detId,
sipixelobjects::GlobalPixel  global 
)

Definition at line 107 of file SiPixelFrameReverter.cc.

References DetToFedMap, SiPixelFedCabling::findItem(), hasDetUnit(), sipixelobjects::PixelROC::idInLink(), map_, getHLTPrescaleColumns::path, sipixelobjects::PixelROC::toLocal(), and sipixelobjects::LocalPixel::valid().

{
  if(!hasDetUnit(detId)) return -1;
  std::vector<CablingPathToDetUnit> path = DetToFedMap.find(detId)->second;
  typedef  std::vector<CablingPathToDetUnit>::const_iterator IT;
  for  (IT it = path.begin(); it != path.end(); ++it) {
    const PixelROC * roc = map_->findItem(*it);
    if (!roc) continue;

    LocalPixel local = roc->toLocal(global);

    if(!local.valid()) continue;
    short rocInLink = (short) roc->idInLink();
    return rocInLink;
  }
  return -1;
}
bool SiPixelFrameReverter::hasDetUnit ( uint32_t  detId) const [inline]

Definition at line 26 of file SiPixelFrameReverter.h.

References DetToFedMap.

Referenced by findFedId(), findLinkInFed(), findPixelInRoc(), findRocInDet(), findRocInLink(), and toCabling().

{ return (DetToFedMap.find(detId)!=DetToFedMap.end()); }
int SiPixelFrameReverter::toCabling ( sipixelobjects::ElectronicIndex cabling,
const sipixelobjects::DetectorIndex detector 
) const

Definition at line 56 of file SiPixelFrameReverter.cc.

References sipixelobjects::DetectorIndex::col, sipixelobjects::LocalPixel::dcol(), DetToFedMap, SiPixelFedCabling::findItem(), hasDetUnit(), map_, getHLTPrescaleColumns::path, sipixelobjects::LocalPixel::pxid(), sipixelobjects::PixelROC::rawId(), sipixelobjects::DetectorIndex::rawId, sipixelobjects::DetectorIndex::row, sipixelobjects::PixelROC::toLocal(), and sipixelobjects::LocalPixel::valid().

Referenced by PixelDataFormatter::digi2word().

{
  if(!hasDetUnit(detector.rawId)) return -1;
  std::vector<CablingPathToDetUnit> path = DetToFedMap.find(detector.rawId)->second;
  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
  for  (IT it = path.begin(); it != path.end(); ++it) {
    const PixelROC * roc = map_->findItem(*it);
    if (!roc) return -3;
    if (! roc->rawId() == detector.rawId) return -4;

    GlobalPixel global = {detector.row, detector.col};
    LocalPixel local = roc->toLocal(global);
    if(!local.valid()) continue;
    ElectronicIndex cabIdx = {static_cast<int>(it->link), static_cast<int>(it->roc), local.dcol(), local.pxid()};
    cabling = cabIdx;

    return it->fed;
  }
  return -2;
}

Member Data Documentation

std::map< uint32_t,std::vector<sipixelobjects::CablingPathToDetUnit> > SiPixelFrameReverter::DetToFedMap [private]