CMS 3D CMS Logo

CmsTrackerLayerBuilder.cc
Go to the documentation of this file.
12 
13 #include <vector>
14 #include <bitset>
15 
16 template <class FilteredView>
18  CmsTrackerStringBuilder<FilteredView> theCmsTrackerStringBuilder;
19  CmsTrackerRodBuilder<FilteredView> theCmsTrackerRodBuilder;
20  CmsTrackerLadderBuilder<FilteredView> theCmsTrackerLadderBuilder;
21 
22  GeometricDet* subdet = new GeometricDet(&fv,
28  theCmsTrackerStringBuilder.build(fv, subdet, s);
29  break;
30  case GeometricDet::rod:
31  theCmsTrackerRodBuilder.build(fv, subdet, s);
32  break;
34  theCmsTrackerLadderBuilder.build(fv, subdet, s);
35  break;
36  default:
37  edm::LogError("CmsTrackerLayerBuilder") << " ERROR - I was expecting a String, Rod or Ladder, I got a "
39  }
40  g->addComponent(subdet);
41 }
42 
43 template <class FilteredView>
46 
47  // TIB
48  // SubDetector Side: 2 bits [TIB-:1 TIB+:2]
49  // Layer Part : 2 bits [internal:1 external:0]
50  // String Number : 6 bits [1,...,56 (at most)]
51  //
52  if (comp.front()->type() == GeometricDet::strng) {
53  float layerRadius = (det->params()[2] + det->params()[1]) / 2.;
54 
61  neg.clear();
62  pos.clear();
63  extneg.clear();
64  intneg.clear();
65  extpos.clear();
66  intpos.clear();
67 
68  for (size_t i = 0; i < comp.size(); ++i) {
69  auto component = det->component(i);
70  if (component->translation().z() < 0.) {
71  neg.emplace_back(component);
72  } else {
73  pos.emplace_back(component);
74  }
75  }
76 
77  for (auto& i : neg) {
78  double rPos = i->translation().Rho();
79  if (rPos > layerRadius) {
80  extneg.emplace_back(i);
81  } else {
82  intneg.emplace_back(i);
83  }
84  }
85 
86  for (auto& po : pos) {
87  double rPos = po->translation().Rho();
88  if (rPos > layerRadius) {
89  extpos.emplace_back(po);
90  } else {
91  intpos.emplace_back(po);
92  }
93  }
94 
95  trackerStablePhiSort(extneg.begin(), extneg.end(), CmsTrackerLevelBuilderHelper::getPhi);
96  trackerStablePhiSort(extpos.begin(), extpos.end(), CmsTrackerLevelBuilderHelper::getPhi);
97  trackerStablePhiSort(intneg.begin(), intneg.end(), CmsTrackerLevelBuilderHelper::getPhi);
98  trackerStablePhiSort(intpos.begin(), intpos.end(), CmsTrackerLevelBuilderHelper::getPhi);
99 
100  for (uint32_t i = 0; i < intneg.size(); i++) {
101  uint32_t temp = i + 1;
102  temp |= (1 << 8); // 1 : SubDetector Side TIB-
103  temp |= (1 << 6); // 1 : Layer Part int
104  intneg[i]->setGeographicalID(DetId(temp));
105  }
106 
107  for (uint32_t i = 0; i < extneg.size(); i++) {
108  uint32_t temp = i + 1;
109  temp |= (1 << 8); // 1 : SubDetector Side TIB-
110  temp |= (2 << 6); // 2 : Layer Part ext
111  extneg[i]->setGeographicalID(DetId(temp));
112  }
113 
114  for (uint32_t i = 0; i < intpos.size(); i++) {
115  uint32_t temp = i + 1;
116  temp |= (2 << 8); // 2 : SubDetector Side TIB+
117  temp |= (1 << 6); // 1 : Layer Part int
118  intpos[i]->setGeographicalID(DetId(temp));
119  }
120 
121  for (uint32_t i = 0; i < extpos.size(); i++) {
122  uint32_t temp = i + 1;
123  temp |= (2 << 8); // 2 : SubDetector Side TIB+
124  temp |= (2 << 6); // 2 : Layer Part ext
125  extpos[i]->setGeographicalID(DetId(temp));
126  }
127 
128  det->clearComponents();
129  det->addComponents(intneg);
130  det->addComponents(extneg);
131  det->addComponents(intpos);
132  det->addComponents(extpos);
133 
134  } else if (comp.front()->type() == GeometricDet::rod) {
137  neg.clear();
138  pos.clear();
139 
140  for (size_t i = 0; i < comp.size(); ++i) {
141  auto component = det->component(i);
142  if (component->translation().z() < 0.) {
143  neg.emplace_back(component);
144  } else {
145  pos.emplace_back(component);
146  }
147  }
148 
151 
152  for (uint32_t i = 0; i < neg.size(); i++) {
153  uint32_t temp = i + 1;
154  temp |= (1 << 7);
155  neg[i]->setGeographicalID(DetId(temp));
156  }
157 
158  for (uint32_t i = 0; i < pos.size(); i++) {
159  uint32_t temp = i + 1;
160  temp |= (2 << 7);
161  pos[i]->setGeographicalID(DetId(temp));
162  }
163 
164  det->clearComponents();
165  det->addComponents(neg);
166  det->addComponents(pos);
167 
168  } else if (det->components().front()->type() == GeometricDet::ladder) {
170 
171  for (uint32_t i = 0; i < comp.size(); i++) {
172  det->component(i)->setGeographicalID(DetId(i + 1));
173  }
174 
175  } else {
176  edm::LogError("CmsTrackerLayerBuilder")
177  << "ERROR - wrong SubDet to sort..... " << det->components().front()->type();
178  }
179 }
180 
std::vector< GeometricDet * > GeometricDetContainer
Definition: GeometricDet.h:34
type
Definition: HCALResponse.h:21
void sortNS(FilteredView &, GeometricDet *) override
void addComponent(GeometricDet *)
void clearComponents()
Definition: GeometricDet.h:104
void setGeographicalID(DetId id)
Definition: GeometricDet.h:97
void build(FilteredView &, GeometricDet *, const std::string &) override
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:139
std::vector< double > const & params() const
Definition: GeometricDet.h:131
GeometricDet * component(size_t index)
Definition: GeometricDet.h:114
std::vector< GeometricDet const * > ConstGeometricDetContainer
Definition: GeometricDet.h:33
void trackerStablePhiSort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr)
Definition: DetId.h:17
static std::string getString(std::string const &, DDFilteredView *)
void buildComponent(FilteredView &, GeometricDet *, const std::string &) override
void addComponents(GeometricDetContainer const &cont)
static double getPhi(const GeometricDet *a)