CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Private Attributes

PixelEndcapLinkMaker Class Reference

#include <PixelEndcapLinkMaker.h>

List of all members.

Classes

struct  Item
struct  Order

Public Types

typedef std::vector< uint32_t > DetUnits
typedef PixelFEDCabling::Links Links
typedef std::vector
< PixelModuleName * > 
Names
typedef
sipixelobjects::PixelFEDCabling 
PixelFEDCabling
typedef
sipixelobjects::PixelFEDLink 
PixelFEDLink
typedef sipixelobjects::PixelROC PixelROC
typedef TRange< int > Range

Public Member Functions

Links links (const Names &n, const DetUnits &u) const
 PixelEndcapLinkMaker (const PixelFEDCabling *o)
 ctor from owner

Private Attributes

const PixelFEDCablingtheOwner

Detailed Description

Definition at line 14 of file PixelEndcapLinkMaker.h.


Member Typedef Documentation

typedef std::vector<uint32_t> PixelEndcapLinkMaker::DetUnits

Definition at line 22 of file PixelEndcapLinkMaker.h.

Definition at line 23 of file PixelEndcapLinkMaker.h.

Definition at line 21 of file PixelEndcapLinkMaker.h.

Definition at line 17 of file PixelEndcapLinkMaker.h.

Definition at line 18 of file PixelEndcapLinkMaker.h.

Definition at line 19 of file PixelEndcapLinkMaker.h.

Definition at line 24 of file PixelEndcapLinkMaker.h.


Constructor & Destructor Documentation

PixelEndcapLinkMaker::PixelEndcapLinkMaker ( const PixelFEDCabling o) [inline]

ctor from owner

Definition at line 27 of file PixelEndcapLinkMaker.h.

: theOwner(o) { }

Member Function Documentation

PixelEndcapLinkMaker::Links PixelEndcapLinkMaker::links ( const Names n,
const DetUnits u 
) const

construct links Each Endcap module triggers one or two link Items. They are sorted according to Order(). The ROCs corresponding to items are created. The link is form from link items and ROCS.

Definition at line 32 of file PixelEndcapLinkMaker.cc.

References sipixelobjects::PixelFEDLink::add(), link(), LogDebug, PixelEndcapName::moduleType(), PixelEndcapName::name(), PixelEndcapLinkMaker::Item::name, query::result, PixelEndcapLinkMaker::Item::rocIds, python::multivaluedict::sort(), PixelEndcapLinkMaker::Item::unit, PixelModuleName::v1x2, PixelModuleName::v1x5, PixelModuleName::v2x3, PixelModuleName::v2x4, and PixelModuleName::v2x5.

Referenced by SiPixelFedCablingMapBuilder::produce().

{
    
  Links result; 
  typedef Names::const_iterator CIN;

  //
  // split names to links
  //
  vector<Item> linkItems;
  typedef vector<Item>::const_iterator CIU;


  for(unsigned int idx = 0; idx < n.size(); idx++) {
    Item item;
    PixelEndcapName * e = dynamic_cast<PixelEndcapName * >(n[idx]);
    uint32_t d = u[idx];
    item.name = e;
    item.unit = d;
    Range rocIds(-1,-1);
    PixelModuleName::ModuleType type = e->moduleType(); 
    switch (type) {
      case(PixelModuleName::v1x2) : { rocIds = Range(0,1); break; }
      case(PixelModuleName::v1x5) : { rocIds = Range(0,4); break; }
      case(PixelModuleName::v2x3) : { rocIds = Range(0,5); break; }
      case(PixelModuleName::v2x4) : { rocIds = Range(0,7); break; }
      case(PixelModuleName::v2x5) : { rocIds = Range(0,9); break; }
      default:
        edm::LogError("PixelEndcapLinkMaker")<< " *** UNEXPECTED roc: " << e->name() ;
    };
    item.rocIds = rocIds;
    linkItems.push_back(item);
  }
  //
  // sort names to get the order as in links
  //

  sort( linkItems.begin(), linkItems.end(), Order() );

  //
  // DEBUG
  //
  ostringstream str;
  for (CIU it = linkItems.begin(); it != linkItems.end(); it++) {
    str << (*it).name->name() <<" r="<< (*it).rocIds << endl;
  }
  LogDebug(" sorted ENDCAP links: ") << str.str();

  result.reserve(36);
  int lastPannelId = -1;
  int idLink = 0;
  int idRoc = 0;
  PixelFEDLink link(idLink); // dummy object, id=0

  for (CIU it = linkItems.begin(); it != linkItems.end(); it++) {
    PixelFEDLink::ROCs rocs;
    int pannelId = it->name->pannelName();

    if ( pannelId != lastPannelId ) {
      lastPannelId = pannelId;
      if (idLink > 0) result.push_back(link);
      idRoc = 0;
      link = PixelFEDLink(++idLink); // real link, to be filled
    }

    for (int id = (*it).rocIds.min(); id <= (*it).rocIds.max(); id++) { 
     ++idRoc;
     rocs.push_back( PixelROC( it->unit, id, idRoc ) );
    }

    link.add( rocs);
  }

  if (idLink > 0) result.push_back(link);
  return result;
}

Member Data Documentation

Definition at line 37 of file PixelEndcapLinkMaker.h.