CMS 3D CMS Logo

TrackingLayer.cc
Go to the documentation of this file.
3 
5 
7  _subDet(Det::UNKNOWN),
8  _side(Side::BARREL),
9  _layerNumber(0)
10 {
11 }
12 
13 
15  const DetId& detId,
16  const TrackerTopology& trackerTopology
17 )
18 {
19  TrackingLayer trackingLayer;
20  uint32_t subdet=detId.subdetId();
21  //BPix
22  if ( subdet == PixelSubdetector::PixelBarrel )
23  {
24  trackingLayer._subDet=TrackingLayer::Det::PXB;
25  trackingLayer._side=TrackingLayer::Side::BARREL;
26  trackingLayer._layerNumber = trackerTopology.pxbLayer(detId);
27  }
28  //FPix
29  else if ( subdet == PixelSubdetector::PixelEndcap )
30  {
31  trackingLayer._subDet=TrackingLayer::Det::PXD;
32  if(trackerTopology.pxfSide(detId)==1)
33  {
35  }
36  else if(trackerTopology.pxfSide(detId)==2)
37  {
39  }
40  else
41  {
42  throw cms::Exception("FastSimulation/Tracking") <<"Tracker hit for seeding in FPix seems neither on positive nor on negative disk side: "<<trackerTopology.print(detId).c_str();
43  }
44  trackingLayer._layerNumber = trackerTopology.pxfDisk(detId);
45  }
46  //TIB
47  else if ( subdet == StripSubdetector::TIB )
48  {
49  trackingLayer._subDet=TrackingLayer::Det::TIB;
50  trackingLayer._side=TrackingLayer::Side::BARREL;
51  trackingLayer._layerNumber = trackerTopology.tibLayer(detId);
52  }
53  //TID
54  else if ( subdet == StripSubdetector::TID )
55  {
56  trackingLayer._subDet=TrackingLayer::Det::TID;
57  if(trackerTopology.tidSide(detId)==1)
58  {
60  }
61  else if(trackerTopology.tidSide(detId)==2)
62  {
64  }
65  else
66  {
67  throw cms::Exception("FastSimulation/Tracking") <<"Tracker hit for seeding in TID seems neither on positive nor on negative disk side: "<<trackerTopology.print(detId).c_str();
68  }
69  trackingLayer._layerNumber = trackerTopology.tidWheel(detId);
70  }
71  //TOB
72  else if ( subdet == StripSubdetector::TOB )
73  {
74  trackingLayer._subDet=TrackingLayer::Det::TOB;
75  trackingLayer._side=TrackingLayer::Side::BARREL;
76  trackingLayer._layerNumber = trackerTopology.tobLayer(detId);
77  }
78  //TEC
79  else if ( subdet == StripSubdetector::TEC )
80  {
81  trackingLayer._subDet=TrackingLayer::Det::TEC;
82  if(trackerTopology.tecSide(detId)==1)
83  {
85  }
86  else if(trackerTopology.tecSide(detId)==2)
87  {
89  }
90  else
91  {
92  throw cms::Exception("FastSimulation/Tracking") <<"Tracker hit for seeding in TEC seems neither on positive nor on negative disk side: "<<trackerTopology.print(detId).c_str();
93  }
94  trackingLayer._layerNumber = trackerTopology.tecWheel(detId);
95  }
96  else
97  {
98  throw cms::Exception("FastSimulation/Tracking") << "Cannot determine seeding layer from DetId:"<<trackerTopology.print(detId).c_str()<<std::endl;
99  }
100  //std::cout<<"LayerSpec::createFromDetId: "<<trackerTopology.print(detId).c_str()<<", parsed="<<seedingLayer.print().c_str()<<std::endl;
101  return trackingLayer;
102 }
103 
105 {
106  TrackingLayer trackingLayer;
107  if (layerSpecification.substr(0,4)=="BPix" )
108  {
109  trackingLayer._subDet=TrackingLayer::Det::PXB;
110  trackingLayer._side=TrackingLayer::Side::BARREL;
111  trackingLayer._layerNumber = std::atoi(layerSpecification.substr(4,1).c_str());
112  }
113  else if (layerSpecification.substr(0,4)=="FPix" )
114  {
115  trackingLayer._subDet=TrackingLayer::Det::PXD;
116  trackingLayer._layerNumber = std::atoi(layerSpecification.substr(4,1).c_str());
117  if(layerSpecification.substr(layerSpecification.size()-3)=="pos")
118  {
119  trackingLayer._side = TrackingLayer::Side::POS_ENDCAP;
120  }
121  else if (layerSpecification.substr(layerSpecification.size()-3)=="neg")
122  {
123  trackingLayer._side = TrackingLayer::Side::NEG_ENDCAP;
124  }
125  else
126  {
127  throw cms::Exception("FastSimulation/Tracking/python")
128  <<"FPix seeding layer configuration '"<<layerSpecification.c_str()<<"' does not specify the side correctly!";
129  }
130 
131  }
132  else if (layerSpecification.substr(0,3)=="TIB")
133  {
134  trackingLayer._subDet=TrackingLayer::Det::TIB;
135  trackingLayer._side=TrackingLayer::Side::BARREL;
136  trackingLayer._layerNumber = std::atoi(layerSpecification.substr(3,1).c_str());
137  }
138  else if (layerSpecification.substr(0,4)=="MTIB")
139  {
140  trackingLayer._subDet=TrackingLayer::Det::TIB;
141  trackingLayer._side=TrackingLayer::Side::BARREL;
142  trackingLayer._layerNumber = std::atoi(layerSpecification.substr(4,1).c_str());
143  }
144 
145  else if (layerSpecification.substr(0,3)=="TID")
146  {
147  trackingLayer._subDet=TrackingLayer::Det::TID;
148  trackingLayer._layerNumber = std::atoi(layerSpecification.substr(3,1).c_str());
149  if (layerSpecification.substr(layerSpecification.size()-3)=="pos")
150  {
151  trackingLayer._side = TrackingLayer::Side::POS_ENDCAP;
152  }
153  else if (layerSpecification.substr(layerSpecification.size()-3)=="neg")
154  {
155  trackingLayer._side = TrackingLayer::Side::NEG_ENDCAP;
156  }
157  else
158  {
159  throw cms::Exception("FastSimulation/Tracking/python")
160  <<"TID seeding layer configuration '"<<layerSpecification.c_str()<<"' does not specify the side correctly!";
161  }
162  }
163  else if (layerSpecification.substr(0,4)=="MTID")
164  {
165  trackingLayer._subDet=TrackingLayer::Det::TID;
166  trackingLayer._layerNumber = std::atoi(layerSpecification.substr(4,1).c_str());
167  if (layerSpecification.substr(layerSpecification.size()-3)=="pos")
168  {
169  trackingLayer._side = TrackingLayer::Side::POS_ENDCAP;
170  }
171  else if (layerSpecification.substr(layerSpecification.size()-3)=="neg")
172  {
173  trackingLayer._side = TrackingLayer::Side::NEG_ENDCAP;
174  }
175  else
176  {
177  throw cms::Exception("FastSimulation/Tracking/python")
178  <<"MTID seeding layer configuration '"<<layerSpecification.c_str()<<"' does not specify the side correctly!";
179  }
180  }
181  else if (layerSpecification.substr(0,3)=="TOB" )
182  {
183  trackingLayer._subDet=TrackingLayer::Det::TOB;
184  trackingLayer._side=TrackingLayer::Side::BARREL;
185  trackingLayer._layerNumber = std::atoi(layerSpecification.substr(3,1).c_str());
186  }
187  else if (layerSpecification.substr(0,4)=="MTOB" )
188  {
189  trackingLayer._subDet=TrackingLayer::Det::TOB;
190  trackingLayer._side=TrackingLayer::Side::BARREL;
191  trackingLayer._layerNumber = std::atoi(layerSpecification.substr(4,1).c_str());
192  }
193  else if (layerSpecification.substr(0,3)=="TEC" )
194  {
195  trackingLayer._subDet=TrackingLayer::Det::TEC;
196  trackingLayer._layerNumber = std::atoi(layerSpecification.substr(3,1).c_str());
197  if (layerSpecification.substr(layerSpecification.size()-3)=="pos")
198  {
199  trackingLayer._side = TrackingLayer::Side::POS_ENDCAP;
200  }
201  else if (layerSpecification.substr(layerSpecification.size()-3)=="neg")
202  {
203  trackingLayer._side = TrackingLayer::Side::NEG_ENDCAP;
204  }
205  else
206  {
207  throw cms::Exception("FastSimulation/Tracking/python")
208  <<"TEC seeding layer configuration '"<<layerSpecification.c_str()<<"' does not specify the side correctly!";
209  }
210 
211 
212  }
213  else if (layerSpecification.substr(0,4)=="MTEC" )
214  {
215  trackingLayer._subDet=TrackingLayer::Det::TEC;
216  trackingLayer._layerNumber = std::atoi(layerSpecification.substr(4,1).c_str());
217  if (layerSpecification.substr(layerSpecification.size()-3)=="pos")
218  {
219  trackingLayer._side = TrackingLayer::Side::POS_ENDCAP;
220  }
221  else if (layerSpecification.substr(layerSpecification.size()-3)=="neg")
222  {
223  trackingLayer._side = TrackingLayer::Side::NEG_ENDCAP;
224  }
225  else
226  {
227  throw cms::Exception("FastSimulation/Tracking/python")
228  <<"MTEC seeding layer configuration '"<<layerSpecification.c_str()<<"' does not specify the side correctly!";
229  }
230  }
231  else
232  {
233  throw cms::Exception("FastSimulation/Tracking/python")
234  << "Bad data naming in seeding layer configuration."
235  << "no case sensitive name of ['BPix','FPix','TIB','MTIB','TID','MTID','TOB','TEC','MTEC'] matches '"<<layerSpecification.c_str()<<"'";
236  }
237  //std::cout<<"LayerSpec::createFromString: "<<layerSpecification.c_str()<<", parsed="<<seedingLayer.print().c_str()<<std::endl;
238 
239  return trackingLayer;
240 }
241 
243 {
244  std::stringstream ss;
245  switch (_subDet)
246  {
248  ss<<"unknown";
249  break;
251  ss<<" BPix";
252  break;
254  ss<<" FPix";
255  break;
257  ss<<" TIB";
258  break;
260  ss<<" TID";
261  break;
263  ss<<" TOB";
264  break;
266  ss<<" TEC";
267  break;
268  }
269  ss << _layerNumber;
270  switch (_side)
271  {
273  break;
274  case Side:: NEG_ENDCAP:
275  ss<<"_neg";
276  break;
278  ss<< "_pos";
279  break;
280  }
281 
282  return std::move(ss.str());
283 }
284 
286 {
287  std::stringstream ss;
288  ss<<getSubDetNumber()<<":"<<getLayerNumber()<<":"<<getSideNumber();
289  return std::move(ss.str());
290 }
291 
unsigned int getSubDetNumber() const
Definition: TrackingLayer.h:75
unsigned int tibLayer(const DetId &id) const
unsigned int getLayerNumber() const
Definition: TrackingLayer.h:85
unsigned int pxfDisk(const DetId &id) const
0: Unidentified isolated particle
Definition: ParticleCode.h:19
static TrackingLayer createFromDetId(const DetId &detId, const TrackerTopology &trackerTopology)
std::string toIdString() const
unsigned int tidWheel(const DetId &id) const
std::string print(DetId detid) const
static const eqfct _eqfct
Definition: TrackingLayer.h:52
unsigned int tidSide(const DetId &id) const
unsigned int getSideNumber() const
Definition: TrackingLayer.h:80
static TrackingLayer createFromString(std::string layerSpecification)
unsigned int _layerNumber
Definition: TrackingLayer.h:54
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:38
std::string toString() const
unsigned int pxbLayer(const DetId &id) const
Definition: DetId.h:18
unsigned int pxfSide(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
def move(src, dest)
Definition: eostools.py:510
unsigned int tobLayer(const DetId &id) const
unsigned int tecSide(const DetId &id) const