CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

sipixelobjects::PixelFEDLink Class Reference

#include <PixelFEDLink.h>

List of all members.

Public Types

typedef std::vector< PixelROCROCs
 ROCs served be this link.

Public Member Functions

void add (const ROCs &rocs)
 add connection (defined by connection spec and ROCs)
void addItem (const PixelROC &roc)
bool checkRocNumbering () const
unsigned int id () const
 link id
unsigned int numberOfROCs () const
 number of ROCs in fed
 PixelFEDLink (unsigned int id=0)
 ctor with id of link and parent FED
std::string print (int depth=0) const
const PixelROCroc (unsigned int id) const
 return ROC identified by id. ROC ids are ranged [1,numberOfROCs]

Private Member Functions

std::string printForMap () const

Private Attributes

unsigned int theId
ROCs theROCs

Detailed Description

Definition at line 18 of file PixelFEDLink.h.


Member Typedef Documentation

ROCs served be this link.

Definition at line 22 of file PixelFEDLink.h.


Constructor & Destructor Documentation

sipixelobjects::PixelFEDLink::PixelFEDLink ( unsigned int  id = 0) [inline]

ctor with id of link and parent FED

Definition at line 25 of file PixelFEDLink.h.

: theId(id) { } 

Member Function Documentation

void PixelFEDLink::add ( const ROCs rocs)

add connection (defined by connection spec and ROCs)

Definition at line 35 of file PixelFEDLink.cc.

Referenced by PixelEndcapLinkMaker::links(), and PixelBarrelLinkMaker::links().

{
  theROCs.insert( theROCs.end(), rocs.begin(), rocs.end() );
}
void PixelFEDLink::addItem ( const PixelROC roc)

Definition at line 12 of file PixelFEDLink.cc.

References sipixelobjects::PixelROC::idInLink().

{
  // INFO roc numbering vs vector has offset=1
  if(roc.idInLink() > theROCs.size() ) theROCs.resize(roc.idInLink());
  theROCs[roc.idInLink()-1] = roc;
}
bool PixelFEDLink::checkRocNumbering ( ) const

check ROC in link numbering consistency, ie. that ROC position in vector is the same as its id. To be called by owner

Definition at line 19 of file PixelFEDLink.cc.

References gather_cfg::cout, and query::result.

{
  bool result = true;
  unsigned int idx_expected = 0;
  typedef ROCs::const_iterator CIR;
  for (CIR it = theROCs.begin(); it != theROCs.end(); it++) {
    idx_expected++;
    if (idx_expected != (*it).idInLink() ) {
      result = false;
      cout << "** PixelFEDLink, idInLink in ROC, expected: "
           << idx_expected <<" has: "<<(*it).idInLink() << endl;
    }
  }
  return result;
}
unsigned int sipixelobjects::PixelFEDLink::id ( void  ) const [inline]
unsigned int sipixelobjects::PixelFEDLink::numberOfROCs ( ) const [inline]

number of ROCs in fed

Definition at line 34 of file PixelFEDLink.h.

References theROCs.

Referenced by SiPixelFedCablingTree::pathToDetUnit(), and SiPixelFedCablingMap::SiPixelFedCablingMap().

{ return theROCs.size(); }
string PixelFEDLink::print ( int  depth = 0) const

Definition at line 40 of file PixelFEDLink.cc.

References dbtoconf::out.

{
  ostringstream out;
  // if (id() < 0) return  out.str(); // id() >= 0, since it returns an unsigned

  if (depth-- >=0 ) {
    if(id()<10) out <<"  LNK:  "<<id(); else  out <<"  LNK: "<<id();
    if (depth==0) out << printForMap();
    else { 
      out << endl;
      typedef ROCs::const_iterator CIR;
      for (CIR ir = theROCs.begin(); ir != theROCs.end(); ir++) out<< (ir)->print(depth); 
      out <<"#  total number of ROCs: "<< numberOfROCs() << endl;
    }
  }
  return out.str();

}
string PixelFEDLink::printForMap ( ) const [private]

Definition at line 59 of file PixelFEDLink.cc.

References Reference_intrackfit_cff::barrel, PixelEndcapName::bladeName(), cond::rpcobgas::detid, PixelEndcapName::diskName(), first, PixelEndcapName::halfCylinder(), PixelModuleName::isBarrel(), max(), min, PixelEndcapName::name(), PixelBarrelName::name(), dbtoconf::out, PixelEndcapName::pannelName(), DetId::rawId(), and tmp.

{
  typedef ROCs::const_iterator CIR;
  ostringstream out;

// barrel
{
  int minroc = 9999;
  int maxroc = -1;
  bool first = true;
  PixelBarrelName prev;
  for (CIR ir = theROCs.begin(); ir < theROCs.end(); ir++) {
    DetId detid = DetId(ir->rawId());
    bool barrel = PixelModuleName::isBarrel(detid.rawId()); if (!barrel) continue;
    PixelBarrelName curr( detid);
    if (first) prev = curr; 

    int idRoc = ir->idInDetUnit();
    if (curr==prev) {
      minroc = min(idRoc, minroc);
      maxroc = max(idRoc, maxroc);
    }

    if ( !(curr==prev) ) {
    out <<"    MOD: "<< prev.name() <<" ROC: "<< minroc<<", "<<maxroc<< std::endl;
      prev = curr;
      maxroc = minroc = idRoc;
 //     minroc = idRoc;
 //     maxroc = idRoc;
    }

    if ( ir==theROCs.end()-1) {
    out <<"    MOD: "<< curr.name() <<" ROC: "<< minroc<<", "<<maxroc<< std::endl;
    }
  }
}

// same for endcpap
{
  bool first = true;
  PixelEndcapName prev;
  for (CIR ir = theROCs.begin(); ir < theROCs.end(); ir++) {
    DetId detid = DetId(ir->rawId());
    bool barrel = PixelModuleName::isBarrel(detid.rawId()); if (barrel) continue;
    PixelEndcapName tmp( detid);
    PixelEndcapName curr( tmp.halfCylinder(), tmp.diskName(), tmp.bladeName(), tmp.pannelName() );
    if (first) prev = curr;
    if ( !(curr==prev) ) out <<"    MOD: "<< prev.name() << std::endl;
    if ( ir==theROCs.end()-1) out <<"    MOD: "<< curr.name() << std::endl;
  }
}
  return out.str();
}
const PixelROC* sipixelobjects::PixelFEDLink::roc ( unsigned int  id) const [inline]

return ROC identified by id. ROC ids are ranged [1,numberOfROCs]

Definition at line 37 of file PixelFEDLink.h.

References theROCs.

Referenced by SiPixelFedCablingTree::findItem(), SiPixelFedCablingTree::pathToDetUnit(), and SiPixelFedCablingMap::SiPixelFedCablingMap().

    { return (id > 0 && id <= theROCs.size() ) ?  &theROCs[id-1] : 0; }

Member Data Documentation

unsigned int sipixelobjects::PixelFEDLink::theId [private]

Definition at line 49 of file PixelFEDLink.h.

Referenced by id().

Definition at line 50 of file PixelFEDLink.h.

Referenced by numberOfROCs(), and roc().