CMS 3D CMS Logo

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 21 of file PixelEndcapLinkMaker.h.

Definition at line 22 of file PixelEndcapLinkMaker.h.

Definition at line 20 of file PixelEndcapLinkMaker.h.

Definition at line 16 of file PixelEndcapLinkMaker.h.

Definition at line 17 of file PixelEndcapLinkMaker.h.

Definition at line 18 of file PixelEndcapLinkMaker.h.

Definition at line 23 of file PixelEndcapLinkMaker.h.

Constructor & Destructor Documentation

PixelEndcapLinkMaker::PixelEndcapLinkMaker ( const PixelFEDCabling o)
inline

ctor from owner

Definition at line 26 of file PixelEndcapLinkMaker.h.

References links(), and gen::n.

26 : 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 40 of file PixelEndcapLinkMaker.cc.

References sipixelobjects::PixelFEDLink::add(), edmIntegrityCheck::d, MillePedeFileConverter_cfg::e, training_settings::idx, LogDebug, PixelEndcapName::moduleType(), PixelEndcapName::name(), PixelEndcapLinkMaker::Item::name, mps_fire::result, PixelEndcapLinkMaker::Item::rocIds, str, PixelEndcapLinkMaker::Item::unit, PixelModuleName::v1x2, PixelModuleName::v1x5, PixelModuleName::v2x3, PixelModuleName::v2x4, and PixelModuleName::v2x5.

Referenced by PixelEndcapLinkMaker().

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

Member Data Documentation

const PixelFEDCabling* PixelEndcapLinkMaker::theOwner
private

Definition at line 36 of file PixelEndcapLinkMaker.h.