CMS 3D CMS Logo

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

#include <PixelEndcapLinkMaker.h>

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 More...
 

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.

27 : theOwner(o) { }
const PixelFEDCabling * theOwner

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(), alignCSCRings::e, 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().

34 {
35 
36  Links result;
37  typedef Names::const_iterator CIN;
38 
39  //
40  // split names to links
41  //
42  vector<Item> linkItems;
43  typedef vector<Item>::const_iterator CIU;
44 
45 
46  for(unsigned int idx = 0; idx < n.size(); idx++) {
47  Item item;
48  PixelEndcapName * e = dynamic_cast<PixelEndcapName * >(n[idx]);
49  uint32_t d = u[idx];
50  item.name = e;
51  item.unit = d;
52  Range rocIds(-1,-1);
54  switch (type) {
55  case(PixelModuleName::v1x2) : { rocIds = Range(0,1); break; }
56  case(PixelModuleName::v1x5) : { rocIds = Range(0,4); break; }
57  case(PixelModuleName::v2x3) : { rocIds = Range(0,5); break; }
58  case(PixelModuleName::v2x4) : { rocIds = Range(0,7); break; }
59  case(PixelModuleName::v2x5) : { rocIds = Range(0,9); break; }
60  default:
61  edm::LogError("PixelEndcapLinkMaker")<< " *** UNEXPECTED roc: " << e->name() ;
62  };
63  item.rocIds = rocIds;
64  linkItems.push_back(item);
65  }
66  //
67  // sort names to get the order as in links
68  //
69 
70  sort( linkItems.begin(), linkItems.end(), Order() );
71 
72  //
73  // DEBUG
74  //
75  ostringstream str;
76  for (CIU it = linkItems.begin(); it != linkItems.end(); it++) {
77  str << (*it).name->name() <<" r="<< (*it).rocIds << endl;
78  }
79  LogDebug(" sorted ENDCAP links: ") << str.str();
80 
81  result.reserve(36);
82  int lastPannelId = -1;
83  int idLink = 0;
84  int idRoc = 0;
85  PixelFEDLink link(idLink); // dummy object, id=0
86 
87  for (CIU it = linkItems.begin(); it != linkItems.end(); it++) {
88  PixelFEDLink::ROCs rocs;
89  int pannelId = it->name->pannelName();
90 
91  if ( pannelId != lastPannelId ) {
92  lastPannelId = pannelId;
93  if (idLink > 0) result.push_back(link);
94  idRoc = 0;
95  link = PixelFEDLink(++idLink); // real link, to be filled
96  }
97 
98  for (int id = (*it).rocIds.min(); id <= (*it).rocIds.max(); id++) {
99  ++idRoc;
100  rocs.push_back( PixelROC( it->unit, id, idRoc ) );
101  }
102 
103  link.add( rocs);
104  }
105 
106  if (idLink > 0) result.push_back(link);
107  return result;
108 }
#define LogDebug(id)
type
Definition: HCALResponse.h:22
PixelFEDCabling::Links Links
sipixelobjects::PixelROC PixelROC
std::string link(std::string &nm, std::string &ns)
Definition: hierarchy.cc:47
tuple result
Definition: query.py:137
sipixelobjects::PixelFEDLink PixelFEDLink
virtual PixelModuleName::ModuleType moduleType() const
module Type
virtual std::string name() const
from base class

Member Data Documentation

const PixelFEDCabling* PixelEndcapLinkMaker::theOwner
private

Definition at line 37 of file PixelEndcapLinkMaker.h.