CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes
TrackingLayer Class Reference

#include <TrackingLayer.h>

Classes

struct  eqfct
 
struct  hashfct
 

Public Types

enum  Det {
  Det::UNKNOWN, Det::PXB, Det::PXD, Det::TIB,
  Det::TID, Det::TOB, Det::TEC
}
 
enum  Side { Side::BARREL, Side::NEG_ENDCAP, Side::POS_ENDCAP }
 

Public Member Functions

unsigned int getLayerNumber () const
 
TrackingLayer::Side getSide () const
 
unsigned int getSideNumber () const
 
TrackingLayer::Det getSubDet () const
 
unsigned int getSubDetNumber () const
 
bool operator< (const TrackingLayer &layer) const
 
bool operator== (const TrackingLayer &layer) const
 
std::string toIdString () const
 
std::string toString () const
 
 TrackingLayer ()
 

Static Public Member Functions

static TrackingLayer createFromDetId (const DetId &detId, const TrackerTopology &trackerTopology)
 
static TrackingLayer createFromString (std::string layerSpecification)
 

Public Attributes

unsigned int _layerNumber
 
Side _side
 
Det _subDet
 

Static Public Attributes

static const eqfct _eqfct
 
static const hashfct _hashfct
 

Detailed Description

Definition at line 9 of file TrackingLayer.h.

Member Enumeration Documentation

enum TrackingLayer::Det
strong
Enumerator
UNKNOWN 
PXB 
PXD 
TIB 
TID 
TOB 
TEC 

Definition at line 36 of file TrackingLayer.h.

36  {
37  UNKNOWN,
38  PXB, //pixel barrel
39  PXD, //pixel disk
40  TIB, //tracker inner barrel
41  TID, //tracker inner disk
42  TOB, //tracker outer barrel
43  TEC //tracker endcap
44  };
0: Unidentified isolated particle
Definition: ParticleCode.h:19
enum TrackingLayer::Side
strong
Enumerator
BARREL 
NEG_ENDCAP 
POS_ENDCAP 

Definition at line 45 of file TrackingLayer.h.

45  {
46  BARREL, NEG_ENDCAP, POS_ENDCAP
47  };

Constructor & Destructor Documentation

TrackingLayer::TrackingLayer ( )

Member Function Documentation

TrackingLayer TrackingLayer::createFromDetId ( const DetId detId,
const TrackerTopology trackerTopology 
)
static

Definition at line 14 of file TrackingLayer.cc.

References _layerNumber, _side, _subDet, BARREL, Exception, NEG_ENDCAP, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, POS_ENDCAP, TrackerTopology::print(), PXB, TrackerTopology::pxbLayer(), PXD, TrackerTopology::pxfDisk(), TrackerTopology::pxfSide(), DetId::subdetId(), StripSubdetector::TEC, TEC, TrackerTopology::tecSide(), TrackerTopology::tecWheel(), StripSubdetector::TIB, TIB, TrackerTopology::tibLayer(), StripSubdetector::TID, TID, TrackerTopology::tidSide(), TrackerTopology::tidWheel(), StripSubdetector::TOB, TOB, and TrackerTopology::tobLayer().

Referenced by TrajectorySeedHitCandidate::init().

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 }
unsigned int tibLayer(const DetId &id) const
unsigned int pxfDisk(const DetId &id) const
unsigned int tidWheel(const DetId &id) const
std::string print(DetId detid) const
unsigned int tidSide(const DetId &id) const
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
unsigned int pxbLayer(const DetId &id) const
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
TrackingLayer TrackingLayer::createFromString ( std::string  layerSpecification)
static

Definition at line 104 of file TrackingLayer.cc.

References _layerNumber, _side, _subDet, BARREL, Exception, NEG_ENDCAP, POS_ENDCAP, PXB, PXD, TEC, TIB, TID, and TOB.

Referenced by TrajectorySeedProducer::TrajectorySeedProducer().

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 }
unsigned int _layerNumber
Definition: TrackingLayer.h:54
unsigned int TrackingLayer::getLayerNumber ( ) const
inline
TrackingLayer::Side TrackingLayer::getSide ( ) const
inline

Definition at line 70 of file TrackingLayer.h.

References _side.

71  {
72  return _side;
73  }
unsigned int TrackingLayer::getSideNumber ( ) const
inline

Definition at line 80 of file TrackingLayer.h.

References _side.

Referenced by TrackingLayer::hashfct::operator()(), TrackingLayer::eqfct::operator()(), and toIdString().

81  {
82  return static_cast<unsigned int>(_side);
83  }
TrackingLayer::Det TrackingLayer::getSubDet ( ) const
inline

Definition at line 65 of file TrackingLayer.h.

References _subDet.

66  {
67  return _subDet;
68  }
unsigned int TrackingLayer::getSubDetNumber ( ) const
inline

Definition at line 75 of file TrackingLayer.h.

References _subDet.

Referenced by TrackingLayer::hashfct::operator()(), TrackingLayer::eqfct::operator()(), TrajectorySeedHitCandidate::subDetId(), and toIdString().

76  {
77  return static_cast<unsigned int>(_subDet);
78  }
bool TrackingLayer::operator< ( const TrackingLayer layer) const
inline

Definition at line 95 of file TrackingLayer.h.

References _hashfct.

96  {
97  return _hashfct(*this)<_hashfct(layer);
98  }
static const hashfct _hashfct
Definition: TrackingLayer.h:53
bool TrackingLayer::operator== ( const TrackingLayer layer) const
inline

Definition at line 90 of file TrackingLayer.h.

References _eqfct.

91  {
92  return _eqfct(*this, layer);
93  }
static const eqfct _eqfct
Definition: TrackingLayer.h:52
std::string TrackingLayer::toIdString ( ) const

Definition at line 279 of file TrackingLayer.cc.

References getLayerNumber(), getSideNumber(), getSubDetNumber(), eostools::move(), and contentValuesCheck::ss.

280 {
281  std::stringstream ss;
282  ss<<getSubDetNumber()<<":"<<getLayerNumber()<<":"<<getSideNumber();
283  return std::move(ss.str());
284 }
unsigned int getSubDetNumber() const
Definition: TrackingLayer.h:75
unsigned int getLayerNumber() const
Definition: TrackingLayer.h:85
def move
Definition: eostools.py:508
unsigned int getSideNumber() const
Definition: TrackingLayer.h:80
std::string TrackingLayer::toString ( ) const

Definition at line 236 of file TrackingLayer.cc.

References _layerNumber, _side, _subDet, BARREL, eostools::move(), NEG_ENDCAP, POS_ENDCAP, PXB, PXD, contentValuesCheck::ss, TEC, TIB, TID, TOB, and UNKNOWN.

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 }
def move
Definition: eostools.py:508
unsigned int _layerNumber
Definition: TrackingLayer.h:54

Member Data Documentation

const TrackingLayer::eqfct TrackingLayer::_eqfct
static

Definition at line 52 of file TrackingLayer.h.

Referenced by operator==().

const TrackingLayer::hashfct TrackingLayer::_hashfct
static

Definition at line 53 of file TrackingLayer.h.

Referenced by operator<().

unsigned int TrackingLayer::_layerNumber

Definition at line 54 of file TrackingLayer.h.

Referenced by createFromDetId(), createFromString(), getLayerNumber(), and toString().

Side TrackingLayer::_side

Definition at line 51 of file TrackingLayer.h.

Referenced by createFromDetId(), createFromString(), getSide(), getSideNumber(), and toString().

Det TrackingLayer::_subDet