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