CMS 3D CMS Logo

CmsTrackerOTLayerBuilder.cc
Go to the documentation of this file.
11 
12 #include <vector>
13 #include <bitset>
14 
15 template <class FilteredView>
17  LogTrace("DetConstruction") << " CmsTrackerOTLayerBuilder::buildComponent ";
18  CmsTrackerLadderBuilder<FilteredView> theCmsTrackerLadderBuilder;
19  CmsTrackerOTRingBuilder<FilteredView> theCmsTrackerOTRingBuilder;
20 
21  GeometricDet* subdet = new GeometricDet(&fv,
27  theCmsTrackerLadderBuilder.build(fv, subdet, s);
28  break;
30  theCmsTrackerOTRingBuilder.build(fv, subdet, s);
31  break;
32  default:
33  edm::LogError("CmsTrackerOTLayerBuilder") << " ERROR - I was expecting a ladder or a panel, I got a "
35  }
36  g->addComponent(subdet);
37 }
38 
39 template <class FilteredView>
42 
43  //order ladder and rings together
47  rods.clear();
48  ringsNeg.clear();
49  ringsPos.clear();
50 
51  for (uint32_t i = 0; i < comp.size(); i++) {
52  auto component = det->component(i);
53  if (component->type() == GeometricDet::ladder) {
54  rods.emplace_back(component);
55  } else if (component->type() == GeometricDet::panel) {
56  if (component->translation().z() < 0.) {
57  ringsNeg.emplace_back(component);
58  } else if (component->translation().z() > 0.) {
59  ringsPos.emplace_back(component);
60  }
61  } else {
62  edm::LogError("CmsTrackerOTLayerBuilder")
63  << "ERROR - wrong SubDet to sort..... " << det->components().front()->type();
64  }
65  }
66 
67  // negative rings
68  if (!ringsNeg.empty()) {
69  std::sort(ringsNeg.begin(), ringsNeg.end(), CmsTrackerLevelBuilderHelper::isLessZ);
70  uint32_t totalringsNeg = ringsNeg.size();
71 
72  LogTrace("DetConstruction") << " Neg rings ordered by z: ";
73  for (uint32_t ring = 0; ring < totalringsNeg; ring++) {
74  uint32_t temp = ring + 1;
75  temp |= (1 << 8);
76  ringsNeg[ring]->setGeographicalID(temp);
77  LogTrace("BuildingTrackerDetId") << "\t\t\t DetId >> " << temp
78  << "(r: " << sqrt(ringsNeg[ring]->translation().Perp2())
79  << ", phi: " << ringsNeg[ring]->phi()
80  << ", z: " << ringsNeg[ring]->translation().z() << ")";
81  }
82  }
83 
84  // rods
85  if (!rods.empty()) {
87  uint32_t totalrods = rods.size();
88 
89  LogTrace("DetConstruction") << " Rods ordered by phi: ";
90  for (uint32_t rod = 0; rod < totalrods; rod++) {
91  uint32_t temp = rod + 1;
92  temp |= (3 << 8);
93  rods[rod]->setGeographicalID(DetId(temp));
94  LogTrace("BuildingTrackerDetId") << "\t\t\t DetId >> " << temp << "(r: " << sqrt(rods[rod]->translation().Perp2())
95  << ", phi: " << rods[rod]->phi() << ", z: " << rods[rod]->translation().z()
96  << ")";
97  }
98  }
99 
100  // positive rings
101  if (!ringsPos.empty()) {
102  std::sort(ringsPos.begin(), ringsPos.end(), CmsTrackerLevelBuilderHelper::isLessZ);
103  uint32_t totalringsPos = ringsPos.size();
104 
105  LogTrace("DetConstruction") << " Pos rings ordered by z: ";
106  for (uint32_t ring = 0; ring < totalringsPos; ring++) {
107  uint32_t temp = ring + 1;
108  temp |= (2 << 8);
109  ringsPos[ring]->setGeographicalID(temp);
110  LogTrace("BuildingTrackerDetId") << "\t\t\t DetId >> " << temp
111  << "(r: " << sqrt(ringsPos[ring]->translation().Perp2())
112  << ", phi: " << ringsPos[ring]->phi()
113  << ", z: " << ringsPos[ring]->translation().z() << ")";
114  }
115  }
116 
117  det->clearComponents();
118  det->addComponents(ringsNeg);
119  det->addComponents(rods);
120  det->addComponents(ringsPos);
121 }
122 
std::vector< GeometricDet * > GeometricDetContainer
Definition: GeometricDet.h:35
static bool isLessZ(const GeometricDet *a, const GeometricDet *b)
static std::string getString(const std::string &, FilteredView *)
void clearComponents()
Definition: GeometricDet.h:162
Log< level::Error, false > LogError
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
#define LogTrace(id)
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:151
T sqrt(T t)
Definition: SSEVec.h:19
GeometricDet * component(size_t index)
Definition: GeometricDet.h:147
std::vector< GeometricDet const * > ConstGeometricDetContainer
Definition: GeometricDet.h:34
void trackerStablePhiSort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr)
Definition: DetId.h:17
void addComponents(GeometricDetContainer const &cont)
void buildComponent(FilteredView &, GeometricDet *, const std::string &) override
static double getPhi(const GeometricDet *a)
void sortNS(FilteredView &, GeometricDet *) override