CMS 3D CMS Logo

CmsTrackerLayerBuilder.cc
Go to the documentation of this file.
11 
12 #include <vector>
13 #include <bitset>
14 
16 
17  CmsTrackerStringBuilder theCmsTrackerStringBuilder ;
18  CmsTrackerRodBuilder theCmsTrackerRodBuilder;
19  CmsTrackerLadderBuilder theCmsTrackerLadderBuilder;
20 
24  theCmsTrackerStringBuilder.build(fv,subdet,s);
25  break;
26  case GeometricDet::rod:
27  theCmsTrackerRodBuilder.build(fv,subdet,s);
28  break;
30  theCmsTrackerLadderBuilder.build(fv,subdet,s);
31  break;
32  default:
33  edm::LogError("CmsTrackerLayerBuilder")<<" ERROR - I was expecting a String, Rod or Ladder, I got a "<<ExtractStringFromDDD::getString(s,&fv);
34 
35  }
36  g->addComponent(subdet);
37 
38 }
39 
41 
43 
44  // TIB
45  // SubDetector Side: 2 bits [TIB-:1 TIB+:2]
46  // Layer Part : 2 bits [internal:1 external:0]
47  // String Number : 6 bits [1,...,56 (at most)]
48  //
49  if(comp.front()->type()== GeometricDet::strng){
50  float layerRadius = (det->params()[2]+det->params()[1])/2.;
51 
58  neg.clear();
59  pos.clear();
60  extneg.clear();
61  intneg.clear();
62  extpos.clear();
63  intpos.clear();
64 
65  for(size_t i = 0; i< comp.size(); ++i) {
66  auto component = det->component(i);
67  if(component->translation().z()<0.){
68  neg.emplace_back(component);
69  }else{
70  pos.emplace_back(component);
71  }
72  }
73 
74  for(auto & i : neg){
75  double rPos = i->translation().Rho();
76  if(rPos > layerRadius ){
77  extneg.emplace_back(i);
78  }else{
79  intneg.emplace_back(i);
80  }
81  }
82 
83  for(auto & po : pos){
84  double rPos = po->translation().Rho();
85  if(rPos > layerRadius ){
86  extpos.emplace_back(po);
87  }else{
88  intpos.emplace_back(po);
89  }
90  }
91 
92  trackerStablePhiSort(extneg.begin(), extneg.end(), getPhi);
93  trackerStablePhiSort(extpos.begin(), extpos.end(), getPhi);
94  trackerStablePhiSort(intneg.begin(), intneg.end(), getPhi);
95  trackerStablePhiSort(intpos.begin(), intpos.end(), getPhi);
96 
97  for(uint32_t i=0;i<intneg.size();i++){
98  uint32_t temp=i+1;
99  temp|=(1<<8); // 1 : SubDetector Side TIB-
100  temp|=(1<<6); // 1 : Layer Part int
101  intneg[i]->setGeographicalID(DetId(temp));
102  }
103 
104  for(uint32_t i=0;i<extneg.size();i++){
105  uint32_t temp=i+1;
106  temp|=(1<<8); // 1 : SubDetector Side TIB-
107  temp|=(2<<6); // 2 : Layer Part ext
108  extneg[i]->setGeographicalID(DetId(temp));
109  }
110 
111  for(uint32_t i=0;i<intpos.size();i++){
112  uint32_t temp=i+1;
113  temp|=(2<<8); // 2 : SubDetector Side TIB+
114  temp|=(1<<6); // 1 : Layer Part int
115  intpos[i]->setGeographicalID(DetId(temp));
116  }
117 
118  for(uint32_t i=0;i<extpos.size();i++){
119  uint32_t temp=i+1;
120  temp|=(2<<8); // 2 : SubDetector Side TIB+
121  temp|=(2<<6); // 2 : Layer Part ext
122  extpos[i]->setGeographicalID(DetId(temp));
123  }
124 
125 
126  det->clearComponents();
127  det->addComponents(intneg);
128  det->addComponents(extneg);
129  det->addComponents(intpos);
130  det->addComponents(extpos);
131 
132  }else if(comp.front()->type()== GeometricDet::rod){
135  neg.clear();
136  pos.clear();
137 
138  for(size_t i=0; i<comp.size(); ++i) {
139  auto component = det->component(i);
140  if(component->translation().z()<0.){
141  neg.emplace_back(component);
142  }else{
143  pos.emplace_back(component);
144  }
145  }
146 
147  trackerStablePhiSort(neg.begin(), neg.end(), getPhi);
148  trackerStablePhiSort(pos.begin(), pos.end(), getPhi);
149 
150  for(uint32_t i=0; i<neg.size();i++){
151  uint32_t temp = i+1;
152  temp|=(1<<7);
153  neg[i]->setGeographicalID(DetId(temp));
154  }
155 
156  for(uint32_t i=0; i<pos.size();i++){
157  uint32_t temp = i+1;
158  temp|=(2<<7);
159  pos[i]->setGeographicalID(DetId(temp));
160  }
161 
162  det->clearComponents();
163  det->addComponents(neg);
164  det->addComponents(pos);
165 
166  }else if(det->components().front()->type()== GeometricDet::ladder){
167 
168  trackerStablePhiSort(comp.begin(), comp.end(), getPhi);
169 
170  for(uint32_t i=0; i<comp.size();i++){
171  det->component(i)->setGeographicalID(DetId(i+1));
172  }
173 
174  }else{
175  edm::LogError("CmsTrackerLayerBuilder")<<"ERROR - wrong SubDet to sort..... "<<det->components().front()->type();
176  }
177 
178 }
179 
static std::string getString(std::string const &, DDFilteredView *)
void buildComponent(DDFilteredView &, GeometricDet *, std::string) override
void addComponent(GeometricDet *)
void build(DDFilteredView &, GeometricDet *, std::string) override
static double getPhi(const GeometricDet *a)
void clearComponents()
Definition: GeometricDet.h:98
void setGeographicalID(DetId id)
Definition: GeometricDet.h:82
std::vector< GeometricDet * > GeometricDetContainer
Definition: GeometricDet.h:37
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:176
std::vector< double > const & params() const
Definition: GeometricDet.h:165
void sortNS(DDFilteredView &, GeometricDet *) override
GeometricDet * component(size_t index)
Definition: GeometricDet.h:114
void trackerStablePhiSort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr)
std::vector< GeometricDet const * > ConstGeometricDetContainer
Definition: GeometricDet.h:36
Definition: DetId.h:18
void addComponents(GeometricDetContainer const &cont)
GeometricDet::GeometricEnumType type(std::string const &) const
CmsTrackerStringToEnum theCmsTrackerStringToEnum