CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

SiPixelFedCablingTree Class Reference

#include <SiPixelFedCablingTree.h>

Inheritance diagram for SiPixelFedCablingTree:
SiPixelFedCabling

List of all members.

Public Types

typedef
sipixelobjects::PixelFEDCabling 
PixelFEDCabling

Public Member Functions

void addFed (const PixelFEDCabling &f)
 add cabling for one fed
void addItem (unsigned int fedId, unsigned int linkId, const sipixelobjects::PixelROC &roc)
int checkNumbering () const
const PixelFEDCablingfed (unsigned int idFed) const
 get fed identified by its id
std::vector< const
PixelFEDCabling * > 
fedList () const
virtual const
sipixelobjects::PixelROC
findItem (const sipixelobjects::CablingPathToDetUnit &path) const
virtual std::vector
< sipixelobjects::CablingPathToDetUnit
pathToDetUnit (uint32_t rawDetId) const
std::string print (int depth=0) const
 SiPixelFedCablingTree (const std::string &version="")
virtual std::string version () const
 map version
virtual ~SiPixelFedCablingTree ()

Private Attributes

std::map< int, PixelFEDCablingtheFedCablings
std::string theVersion

Detailed Description

Definition at line 11 of file SiPixelFedCablingTree.h.


Member Typedef Documentation

Definition at line 14 of file SiPixelFedCablingTree.h.


Constructor & Destructor Documentation

SiPixelFedCablingTree::SiPixelFedCablingTree ( const std::string &  version = "") [inline]

Definition at line 16 of file SiPixelFedCablingTree.h.

virtual SiPixelFedCablingTree::~SiPixelFedCablingTree ( ) [inline, virtual]

Definition at line 18 of file SiPixelFedCablingTree.h.

{}

Member Function Documentation

void SiPixelFedCablingTree::addFed ( const PixelFEDCabling f)

add cabling for one fed

Definition at line 33 of file SiPixelFedCablingTree.cc.

References f, and sipixelobjects::PixelFEDCabling::id().

Referenced by SiPixelFedCablingMapBuilder::produce().

{
  int id = f.id();
  theFedCablings[id] = f;
}
void SiPixelFedCablingTree::addItem ( unsigned int  fedId,
unsigned int  linkId,
const sipixelobjects::PixelROC roc 
)

Definition at line 68 of file SiPixelFedCablingTree.cc.

References sipixelobjects::PixelFEDCabling::addItem(), and sipixelobjects::PixelFEDCabling::id().

Referenced by SiPixelFedCablingMap::cablingTree(), and SiPixelFedCablingMapBuilder::produce().

{
  PixelFEDCabling & cabling = theFedCablings[fedId];
  if (cabling.id() != fedId) cabling=PixelFEDCabling(fedId);
  cabling.addItem(linkId,roc);
}
int SiPixelFedCablingTree::checkNumbering ( ) const

Definition at line 87 of file SiPixelFedCablingTree.cc.

References gather_cfg::cout, and ntuplemaker::status.

{
  int status = 0;
  for (std::map<int, PixelFEDCabling>::const_iterator im = theFedCablings.begin();
       im != theFedCablings.end(); ++im) {
    if (im->first != static_cast<int>( im->second.id())) {
      status = 1;
      std::cout <<  "PROBLEM WITH FED ID!!" << im->first <<" vs: "<< im->second.id() << std::endl; 
    }
    im->second.checkLinkNumbering();
  }
  return status;
}
const PixelFEDCabling * SiPixelFedCablingTree::fed ( unsigned int  idFed) const

get fed identified by its id

Definition at line 39 of file SiPixelFedCablingTree.cc.

{
  IMAP  it = theFedCablings.find(id);
  return ( it == theFedCablings.end() ) ? 0 : & (*it).second;
}
std::vector< const PixelFEDCabling * > SiPixelFedCablingTree::fedList ( ) const

Definition at line 58 of file SiPixelFedCablingTree.cc.

References query::result.

Referenced by SiPixelDigiToRaw::produce(), and SiPixelFedCablingMap::SiPixelFedCablingMap().

{
  std::vector<const PixelFEDCabling *> result;
  for (IMAP im = theFedCablings.begin(); im != theFedCablings.end(); im++) {
    result.push_back( &(im->second) );
  }
  return result;

}
const sipixelobjects::PixelROC * SiPixelFedCablingTree::findItem ( const sipixelobjects::CablingPathToDetUnit path) const [virtual]

Implements SiPixelFedCabling.

Definition at line 75 of file SiPixelFedCablingTree.cc.

References sipixelobjects::CablingPathToDetUnit::fed, sipixelobjects::CablingPathToDetUnit::link, sipixelobjects::PixelFEDCabling::link(), sipixelobjects::CablingPathToDetUnit::roc, and sipixelobjects::PixelFEDLink::roc().

{
  const PixelROC* roc = 0;
  const PixelFEDCabling * aFed = fed(path.fed);
  if (aFed) {
    const  PixelFEDLink * aLink = aFed->link(path.link);
    if (aLink) roc = aLink->roc(path.roc);
  }
  return roc;
}
std::vector< sipixelobjects::CablingPathToDetUnit > SiPixelFedCablingTree::pathToDetUnit ( uint32_t  rawDetId) const [virtual]

Implements SiPixelFedCabling.

Definition at line 10 of file SiPixelFedCablingTree.cc.

References sipixelobjects::PixelFEDLink::id(), sipixelobjects::PixelFEDCabling::id(), sipixelobjects::PixelROC::idInLink(), link(), sipixelobjects::PixelFEDCabling::link(), sipixelobjects::PixelFEDCabling::numberOfLinks(), sipixelobjects::PixelFEDLink::numberOfROCs(), path(), sipixelobjects::PixelROC::rawId(), query::result, and sipixelobjects::PixelFEDLink::roc().

{
  std::vector<sipixelobjects::CablingPathToDetUnit> result;
  typedef std::map<int, PixelFEDCabling>::const_iterator IM;
  for (IM im = theFedCablings.begin(); im != theFedCablings.end(); ++im) {
    const PixelFEDCabling & aFed = im->second;
    for (int idxLink = 1; idxLink <= aFed.numberOfLinks(); idxLink++) {
      const PixelFEDLink * link = aFed.link(idxLink);
      if (!link) continue;
      int numberOfRocs = link->numberOfROCs();
      for(int idxRoc = 1; idxRoc <= numberOfRocs; idxRoc++) {
        const PixelROC * roc = link->roc(idxRoc);
        if (rawDetId == roc->rawId() ) {
          CablingPathToDetUnit path = {aFed.id(), link->id(), roc->idInLink()};
          result.push_back(path);
        } 
      }
    }
  }
  return result;
}
string SiPixelFedCablingTree::print ( int  depth = 0) const

Definition at line 45 of file SiPixelFedCablingTree.cc.

References dbtoconf::out.

{
  ostringstream out;
  if ( depth-- >=0 ) {
    out << theVersion << endl;
    for(IMAP it=theFedCablings.begin(); it != theFedCablings.end(); it++) {
      out << (*it).second.print(depth);
    }
  }
  out << endl;
  return out.str();
}
virtual std::string SiPixelFedCablingTree::version ( ) const [inline, virtual]

map version

Implements SiPixelFedCabling.

Definition at line 29 of file SiPixelFedCablingTree.h.

References theVersion.

Referenced by SiPixelDigiToRaw::produce().

{ return theVersion; }

Member Data Documentation

Definition at line 44 of file SiPixelFedCablingTree.h.

std::string SiPixelFedCablingTree::theVersion [private]

Definition at line 43 of file SiPixelFedCablingTree.h.

Referenced by version().