CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
SiPixelFrameConverter Class Reference

#include <SiPixelFrameConverter.h>

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.

15  : theFedId(fedId), theMap(map)
16 { }
const SiPixelFedCabling * theMap

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.

20 {
21  std::vector<CablingPathToDetUnit> paths = theMap->pathToDetUnit(rawId);
22  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
23  for (IT it=paths.begin(); it!=paths.end();++it) {
24  if(it->fed==static_cast<unsigned int>(theFedId)) return true;
25  }
26  return false;
27 }
virtual std::vector< sipixelobjects::CablingPathToDetUnit > pathToDetUnit(uint32_t rawDetId) const =0
std::vector< LinkConnSpec >::const_iterator IT
const SiPixelFedCabling * theMap
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::DetectorIndex::rawId, sipixelobjects::PixelROC::rawId(), sipixelobjects::DetectorIndex::row, theMap, sipixelobjects::PixelROC::toLocal(), and sipixelobjects::LocalPixel::valid().

Referenced by SiPixelSCurveCalibrationAnalysis::makeThresholdSummary().

60 {
61  std::vector<CablingPathToDetUnit> path = theMap->pathToDetUnit(detector.rawId);
62  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
63  for (IT it = path.begin(); it != path.end(); ++it) {
64  const PixelROC * roc = theMap->findItem(*it);
65  if (!roc) return 2;
66  if (! roc->rawId() == detector.rawId) return 3;
67 
68  GlobalPixel global = {detector.row, detector.col};
69  //LogTrace("")<<"GLOBAL PIXEL: row=" << global.row <<" col="<< global.col;
70 
71  LocalPixel local = roc->toLocal(global);
72  // LogTrace("")<<"LOCAL PIXEL: dcol ="
73  //<< local.dcol()<<" pxid="<< local.pxid()<<" inside: " <<local.valid();
74 
75  if(!local.valid()) continue;
76  ElectronicIndex cabIdx = {static_cast<int>(it->link),
77  static_cast<int>(it->roc), local.dcol(), local.pxid()};
78  cabling = cabIdx;
79  return 0;
80  }
81  return 1;
82 }
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
virtual std::vector< sipixelobjects::CablingPathToDetUnit > pathToDetUnit(uint32_t rawDetId) const =0
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 &gp) const
Definition: PixelROC.cc:54
uint32_t rawId() const
return the DetUnit to which this ROC belongs to.
Definition: PixelROC.h:40
std::vector< LinkConnSpec >::const_iterator IT
const SiPixelFedCabling * theMap
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::DetectorIndex::rawId, sipixelobjects::PixelROC::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().

31 {
32  CablingPathToDetUnit path = {static_cast<unsigned int>(theFedId),
33  static_cast<unsigned int>(cabling.link),
34  static_cast<unsigned int>(cabling.roc)};
35  const PixelROC * roc = theMap->findItem(path);
36  if (!roc){
37  stringstream stm;
38  stm << "Map shows no fed="<<theFedId
39  <<", link="<<cabling.link
40  <<", roc="<<cabling.roc;
41  edm::LogWarning("SiPixelFrameConverter") << stm.str();
42  return 2;
43  }
44  LocalPixel::DcolPxid local = { cabling.dcol, cabling.pxid };
45  if (!local.valid()) return 3;
46 
47  GlobalPixel global = roc->toGlobal( LocalPixel(local) );
48  detector.rawId = roc->rawId();
49  detector.row = global.row;
50  detector.col = global.col;
51 
52  return 0;
53 
54 
55 }
GlobalPixel toGlobal(const LocalPixel &loc) const
Definition: PixelROC.cc:44
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
identify pixel inside single ROC
Definition: LocalPixel.h:7
global coordinates (row and column in DetUnit, as in PixelDigi)
Definition: GlobalPixel.h:6
uint32_t rawId() const
return the DetUnit to which this ROC belongs to.
Definition: PixelROC.h:40
double collumn and pixel ID in double collumn representation
Definition: LocalPixel.h:22
const SiPixelFedCabling * theMap

Member Data Documentation

int SiPixelFrameConverter::theFedId
private

Definition at line 27 of file SiPixelFrameConverter.h.

Referenced by hasDetUnit(), and toDetector().

const SiPixelFedCabling* SiPixelFrameConverter::theMap
private

Definition at line 28 of file SiPixelFrameConverter.h.

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