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(det->components().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 
66  for(GeometricDet::GeometricDetContainer::iterator i=comp.begin();i!=comp.end();i++){
67  if((*i)->translation().z()<0.){
68  neg.push_back(*i);
69  }else{
70  pos.push_back(*i);
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(det->components().front()->type()== GeometricDet::rod){
135  neg.clear();
136  pos.clear();
137 
138  for(GeometricDet::GeometricDetContainer::iterator i=comp.begin();i!=comp.end();i++){
139  if((*i)->translation().z()<0.){
140  neg.push_back(*i);
141  }else{
142  pos.push_back(*i);
143  }
144  }
145 
146  TrackerStablePhiSort(neg.begin(), neg.end(), ExtractPhi());
147  TrackerStablePhiSort(pos.begin(), pos.end(), ExtractPhi());
148 
149  for(uint32_t i=0; i<neg.size();i++){
150  uint32_t temp = i+1;
151  temp|=(1<<7);
152  neg[i]->setGeographicalID(DetId(temp));
153  }
154 
155  for(uint32_t i=0; i<pos.size();i++){
156  uint32_t temp = i+1;
157  temp|=(2<<7);
158  pos[i]->setGeographicalID(DetId(temp));
159  }
160 
161  det->clearComponents();
162  det->addComponents(neg);
163  det->addComponents(pos);
164 
165  }else if(det->components().front()->type()== GeometricDet::ladder){
166 
167  TrackerStablePhiSort(comp.begin(), comp.end(), ExtractPhi());
168 
169  for(uint32_t i=0; i<comp.size();i++){
170  comp[i]->setGeographicalID(DetId(i+1));
171  }
172 
173  det->clearComponents();
174  det->addComponents(comp);
175  }else{
176  edm::LogError("CmsTrackerLayerBuilder")<<"ERROR - wrong SubDet to sort..... "<<det->components().front()->type();
177  }
178 
179 }
180 
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:89
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
std::vector< GeometricDet const * > GeometricDetContainer
Definition: GeometricDet.h:36
std::vector< double > const & params() const
Definition: GeometricDet.h:152
virtual void build(DDFilteredView &, GeometricDet *, std::string)
void TrackerStablePhiSort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr)
Definition: DetId.h:20
GeometricDetContainer & components()
Definition: GeometricDet.h:163
void addComponents(GeometricDetContainer const &cont)
virtual void sortNS(DDFilteredView &, GeometricDet *)
GeometricDet::GeometricEnumType type(std::string const &) const
CmsTrackerStringToEnum theCmsTrackerStringToEnum