CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackingLayer.cc
Go to the documentation of this file.
2 
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,3)=="TEC" )
188  {
189  trackingLayer._subDet=TrackingLayer::Det::TEC;
190  trackingLayer._layerNumber = std::atoi(layerSpecification.substr(3,1).c_str());
191  if (layerSpecification.substr(layerSpecification.size()-3)=="pos")
192  {
193  trackingLayer._side = TrackingLayer::Side::POS_ENDCAP;
194  }
195  else if (layerSpecification.substr(layerSpecification.size()-3)=="neg")
196  {
197  trackingLayer._side = TrackingLayer::Side::NEG_ENDCAP;
198  }
199  else
200  {
201  throw cms::Exception("FastSimulation/Tracking/python")
202  <<"TEC seeding layer configuration '"<<layerSpecification.c_str()<<"' does not specify the side correctly!";
203  }
204 
205 
206  }
207  else if (layerSpecification.substr(0,4)=="MTEC" )
208  {
209  trackingLayer._subDet=TrackingLayer::Det::TEC;
210  trackingLayer._layerNumber = std::atoi(layerSpecification.substr(4,1).c_str());
211  if (layerSpecification.substr(layerSpecification.size()-3)=="pos")
212  {
213  trackingLayer._side = TrackingLayer::Side::POS_ENDCAP;
214  }
215  else if (layerSpecification.substr(layerSpecification.size()-3)=="neg")
216  {
217  trackingLayer._side = TrackingLayer::Side::NEG_ENDCAP;
218  }
219  else
220  {
221  throw cms::Exception("FastSimulation/Tracking/python")
222  <<"MTEC seeding layer configuration '"<<layerSpecification.c_str()<<"' does not specify the side correctly!";
223  }
224  }
225  else
226  {
227  throw cms::Exception("FastSimulation/Tracking/python")
228  << "Bad data naming in seeding layer configuration."
229  << "no case sensitive name of ['BPix','FPix','TIB','MTIB','TID','MTID','TOB','TEC','MTEC'] matches '"<<layerSpecification.c_str()<<"'";
230  }
231  //std::cout<<"LayerSpec::createFromString: "<<layerSpecification.c_str()<<", parsed="<<seedingLayer.print().c_str()<<std::endl;
232 
233  return trackingLayer;
234 }
235 
237 {
238  std::stringstream ss;
239  switch (_subDet)
240  {
242  ss<<"unknown";
243  break;
245  ss<<" BPix";
246  break;
248  ss<<" FPix";
249  break;
251  ss<<" TIB";
252  break;
254  ss<<" TID";
255  break;
257  ss<<" TOB";
258  break;
260  ss<<" TEC";
261  break;
262  }
263  ss << _layerNumber;
264  switch (_side)
265  {
267  break;
268  case Side:: NEG_ENDCAP:
269  ss<<"_neg";
270  break;
272  ss<< "_pos";
273  break;
274  }
275 
276  return std::move(ss.str());
277 }
278 
280 {
281  std::stringstream ss;
282  ss<<getSubDetNumber()<<":"<<getLayerNumber()<<":"<<getSideNumber();
283  return std::move(ss.str());
284 }
285 
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)
static const hashfct _hashfct
Definition: TrackingLayer.h:53
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
def move
Definition: eostools.py:508
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:37
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
unsigned int tobLayer(const DetId &id) const
unsigned int tecSide(const DetId &id) const