CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Private Attributes

PixelBarrelLinkMaker Class Reference

#include <PixelBarrelLinkMaker.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
 PixelBarrelLinkMaker (const PixelFEDCabling *o)
 ctor from owner

Private Attributes

const PixelFEDCablingtheOwner

Detailed Description

Assign barrel pixel modules (defined by name and unit) to links

Definition at line 19 of file PixelBarrelLinkMaker.h.


Member Typedef Documentation

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

Definition at line 26 of file PixelBarrelLinkMaker.h.

Definition at line 27 of file PixelBarrelLinkMaker.h.

Definition at line 25 of file PixelBarrelLinkMaker.h.

Definition at line 21 of file PixelBarrelLinkMaker.h.

Definition at line 22 of file PixelBarrelLinkMaker.h.

Definition at line 23 of file PixelBarrelLinkMaker.h.

Definition at line 28 of file PixelBarrelLinkMaker.h.


Constructor & Destructor Documentation

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

ctor from owner

Definition at line 31 of file PixelBarrelLinkMaker.h.

: theOwner(o) { }

Member Function Documentation

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

construct links Each barrel 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 PixelBarrelLinkMaker.cc.

References sipixelobjects::PixelFEDLink::add(), b, PixelBarrelName::isHalfModule(), PixelBarrelName::layerName(), link(), LogDebug, PixelBarrelLinkMaker::Item::name, query::result, PixelBarrelLinkMaker::Item::rocIds, python::multivaluedict::sort(), and PixelBarrelLinkMaker::Item::unit.

Referenced by SiPixelFedCablingMapBuilder::produce().

{

  Links result;
  typedef Names::const_iterator CIN;

  //
  // construct link items from names. 
  // the item is equivalent to name for layer=3.
  // for layer=1,2 each module has 2 links
  //
  vector<Item> linkItems;
  typedef vector<Item>::const_iterator CIU;

  for(unsigned int idx = 0; idx < n.size(); idx++) {
    Item item;
    PixelBarrelName * b = dynamic_cast<PixelBarrelName * >(n[idx]);
    uint32_t d = u[idx];
    item.name = b;
    item.unit = d;

    if ( b->isHalfModule()) {
      item.rocIds = Range(0,7);      // half modules 
      linkItems.push_back(item);
    } else if(b->layerName() <= 2) {
      item.rocIds = Range(0,7);      // first link for modules in Layer=1,2
      linkItems.push_back(item);
      item.rocIds = Range(8,15);     // second link for modules in Layer=1,2
      linkItems.push_back(item);
    } else {
      item.rocIds = Range(0,15);    // one module per link 
      linkItems.push_back(item);     
    }
  }



  //
  // sort link items to get the order as in links
  //
  
  Order myLess;
  sort( linkItems.begin(), linkItems.end(), myLess );

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


  //
  // create corresponding PixelROC and link
  //
  int idLink = 0;
  result.reserve(linkItems.size());
  for (CIU it = linkItems.begin(); it != linkItems.end(); it++) {
    PixelFEDLink::ROCs rocs; 
    PixelFEDLink link(++idLink);
    int idRoc = 0;
    for (int id = (*it).rocIds.min(); id <= (*it).rocIds.max(); id++) {
      idRoc++;
      rocs.push_back( PixelROC( it->unit, id, idRoc) ); 
    }
    link.add(rocs);
    result.push_back(link); 
  }

  return result;
}

Member Data Documentation

Definition at line 41 of file PixelBarrelLinkMaker.h.