CMS 3D CMS Logo

Public Member Functions | Private Attributes

SiPixelFrameConverter Class Reference

#include <SiPixelFrameConverter.h>

List of all members.

Public Member Functions

bool hasDetUnit (uint32_t radId) const
 SiPixelFrameConverter (const SiPixelFedCabling *map, int fedId)
int toCabling (sipixelobjects::ElectronicIndex &cabling, const sipixelobjects::DetectorIndex &detector) const
int toDetector (const sipixelobjects::ElectronicIndex &cabling, sipixelobjects::DetectorIndex &detector) const

Private Attributes

int theFedId
const SiPixelFedCablingtheMap

Detailed Description

Definition at line 12 of file SiPixelFrameConverter.h.


Constructor & Destructor Documentation

SiPixelFrameConverter::SiPixelFrameConverter ( const SiPixelFedCabling map,
int  fedId 
)

Definition at line 14 of file SiPixelFrameConverter.cc.

  : theFedId(fedId), theMap(map)
{ }

Member Function Documentation

bool SiPixelFrameConverter::hasDetUnit ( uint32_t  radId) const

Definition at line 19 of file SiPixelFrameConverter.cc.

References EgammaValidation_cff::paths, SiPixelFedCabling::pathToDetUnit(), theFedId, and theMap.

{
  std::vector<CablingPathToDetUnit> paths = theMap->pathToDetUnit(rawId);
  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
  for (IT it=paths.begin(); it!=paths.end();++it) {
    if(it->fed==static_cast<unsigned int>(theFedId)) return true;
  }
  return false;
}
int SiPixelFrameConverter::toCabling ( sipixelobjects::ElectronicIndex cabling,
const sipixelobjects::DetectorIndex detector 
) const

Definition at line 58 of file SiPixelFrameConverter.cc.

References sipixelobjects::DetectorIndex::col, sipixelobjects::LocalPixel::dcol(), SiPixelFedCabling::findItem(), SiPixelFedCabling::pathToDetUnit(), sipixelobjects::LocalPixel::pxid(), sipixelobjects::PixelROC::rawId(), sipixelobjects::DetectorIndex::rawId, sipixelobjects::DetectorIndex::row, theMap, sipixelobjects::PixelROC::toLocal(), and sipixelobjects::LocalPixel::valid().

Referenced by SiPixelSCurveCalibrationAnalysis::makeThresholdSummary().

{
  std::vector<CablingPathToDetUnit> path = theMap->pathToDetUnit(detector.rawId);
  typedef  std::vector<CablingPathToDetUnit>::const_iterator IT;
  for  (IT it = path.begin(); it != path.end(); ++it) {
    const PixelROC * roc = theMap->findItem(*it); 
    if (!roc) return 2;
    if (! roc->rawId() == detector.rawId) return 3;

    GlobalPixel global = {detector.row, detector.col};
    //LogTrace("")<<"GLOBAL PIXEL: row=" << global.row <<" col="<< global.col;

    LocalPixel local = roc->toLocal(global);
    // LogTrace("")<<"LOCAL PIXEL: dcol =" 
    //<<  local.dcol()<<" pxid="<<  local.pxid()<<" inside: " <<local.valid();

    if(!local.valid()) continue;
    ElectronicIndex cabIdx = {static_cast<int>(it->link), 
                              static_cast<int>(it->roc), local.dcol(), local.pxid()}; 
    cabling = cabIdx;
    return 0;
  }  
  return 1;
}
int SiPixelFrameConverter::toDetector ( const sipixelobjects::ElectronicIndex cabling,
sipixelobjects::DetectorIndex detector 
) const

Definition at line 30 of file SiPixelFrameConverter.cc.

References sipixelobjects::GlobalPixel::col, sipixelobjects::DetectorIndex::col, sipixelobjects::ElectronicIndex::dcol, SiPixelFedCabling::findItem(), sipixelobjects::ElectronicIndex::link, getHLTPrescaleColumns::path, sipixelobjects::ElectronicIndex::pxid, sipixelobjects::PixelROC::rawId(), sipixelobjects::DetectorIndex::rawId, sipixelobjects::ElectronicIndex::roc, sipixelobjects::GlobalPixel::row, sipixelobjects::DetectorIndex::row, theFedId, theMap, sipixelobjects::PixelROC::toGlobal(), and sipixelobjects::LocalPixel::DcolPxid::valid().

Referenced by ErrorChecker::errorDetId(), and PixelDataFormatter::word2digi().

{
  CablingPathToDetUnit path = {static_cast<unsigned int>(theFedId),
                               static_cast<unsigned int>(cabling.link),
                               static_cast<unsigned int>(cabling.roc)}; 
  const PixelROC * roc = theMap->findItem(path);
  if (!roc){
    stringstream stm;
    stm << "Map shows no fed="<<theFedId
        <<", link="<<cabling.link
        <<", roc="<<cabling.roc;
    edm::LogWarning("SiPixelFrameConverter") << stm.str();
    return 2;
  }
  LocalPixel::DcolPxid local = { cabling.dcol, cabling.pxid };
  if (!local.valid()) return 3;

  GlobalPixel global = roc->toGlobal( LocalPixel(local) );
  detector.rawId = roc->rawId();
  detector.row   = global.row;
  detector.col   = global.col;

  return 0;


}

Member Data Documentation

Definition at line 27 of file SiPixelFrameConverter.h.

Referenced by hasDetUnit(), and toDetector().

Definition at line 28 of file SiPixelFrameConverter.h.

Referenced by hasDetUnit(), toCabling(), and toDetector().