CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CmsTrackerLayerBuilder.cc
Go to the documentation of this file.
11 #include <vector>
12 
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.push_back(component);
69  }else{
70  pos.push_back(component);
71  }
72  }
73 
74  for(GeometricDet::GeometricDetContainer::iterator i=neg.begin();i!=neg.end();i++){
75  double rPos = (*i)->translation().Rho();
76  if(rPos > layerRadius ){
77  extneg.push_back(*i);
78  }else{
79  intneg.push_back(*i);
80  }
81  }
82 
83  for(GeometricDet::GeometricDetContainer::iterator i=pos.begin();i!=pos.end();i++){
84  double rPos = (*i)->translation().Rho();
85  if(rPos > layerRadius ){
86  extpos.push_back(*i);
87  }else{
88  intpos.push_back(*i);
89  }
90  }
91 
92  TrackerStablePhiSort(extneg.begin(), extneg.end(), ExtractPhi());
93  TrackerStablePhiSort(extpos.begin(), extpos.end(), ExtractPhi());
94  TrackerStablePhiSort(intneg.begin(), intneg.end(), ExtractPhi());
95  TrackerStablePhiSort(intpos.begin(), intpos.end(), ExtractPhi());
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.push_back(component);
142  }else{
143  pos.push_back(component);
144  }
145  }
146 
147  TrackerStablePhiSort(neg.begin(), neg.end(), ExtractPhi());
148  TrackerStablePhiSort(pos.begin(), pos.end(), ExtractPhi());
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(), ExtractPhi());
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 *)
int i
Definition: DBlmapReader.cc:9
void addComponent(GeometricDet *)
virtual void buildComponent(DDFilteredView &, GeometricDet *, std::string)
void clearComponents()
Definition: GeometricDet.h:96
void setGeographicalID(DetId id)
Definition: GeometricDet.h:80
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:174
std::vector< double > const & params() const
Definition: GeometricDet.h:163
virtual void build(DDFilteredView &, GeometricDet *, std::string)
void TrackerStablePhiSort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr)
DDTranslation const & translation() const
Definition: GeometricDet.h:123
GeometricDet * component(size_t index)
Definition: GeometricDet.h:112
std::vector< GeometricDet const * > ConstGeometricDetContainer
Definition: GeometricDet.h:36
Definition: DetId.h:18
void addComponents(GeometricDetContainer const &cont)
virtual void sortNS(DDFilteredView &, GeometricDet *)
GeometricDet::GeometricEnumType type(std::string const &) const
CmsTrackerStringToEnum theCmsTrackerStringToEnum