CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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
 
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 28 of file TrackingLayer.h.

28  {
29  UNKNOWN,
30  PXB, //pixel barrel
31  PXD, //pixel disk
32  TIB, //tracker inner barrel
33  TID, //tracker inner disk
34  TOB, //tracker outer barrel
35  TEC //tracker endcap
36  };
enum TrackingLayer::Side
strong
Enumerator
BARREL 
NEG_ENDCAP 
POS_ENDCAP 

Definition at line 37 of file TrackingLayer.h.

37 { BARREL, NEG_ENDCAP, POS_ENDCAP };

Constructor & Destructor Documentation

TrackingLayer::TrackingLayer ( )

Member Function Documentation

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

Definition at line 9 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 TrackCandidateProducer::produce().

9  {
10  TrackingLayer trackingLayer;
11  uint32_t subdet = detId.subdetId();
12  //BPix
13  if (subdet == PixelSubdetector::PixelBarrel) {
14  trackingLayer._subDet = TrackingLayer::Det::PXB;
15  trackingLayer._side = TrackingLayer::Side::BARREL;
16  trackingLayer._layerNumber = trackerTopology.pxbLayer(detId);
17  }
18  //FPix
19  else if (subdet == PixelSubdetector::PixelEndcap) {
20  trackingLayer._subDet = TrackingLayer::Det::PXD;
21  if (trackerTopology.pxfSide(detId) == 1) {
22  trackingLayer._side = TrackingLayer::Side::NEG_ENDCAP;
23  } else if (trackerTopology.pxfSide(detId) == 2) {
24  trackingLayer._side = TrackingLayer::Side::POS_ENDCAP;
25  } else {
26  throw cms::Exception("FastSimulation/Tracking")
27  << "Tracker hit for seeding in FPix seems neither on positive nor on negative disk side: "
28  << trackerTopology.print(detId).c_str();
29  }
30  trackingLayer._layerNumber = trackerTopology.pxfDisk(detId);
31  }
32  //TIB
33  else if (subdet == StripSubdetector::TIB) {
34  trackingLayer._subDet = TrackingLayer::Det::TIB;
35  trackingLayer._side = TrackingLayer::Side::BARREL;
36  trackingLayer._layerNumber = trackerTopology.tibLayer(detId);
37  }
38  //TID
39  else if (subdet == StripSubdetector::TID) {
40  trackingLayer._subDet = TrackingLayer::Det::TID;
41  if (trackerTopology.tidSide(detId) == 1) {
42  trackingLayer._side = TrackingLayer::Side::NEG_ENDCAP;
43  } else if (trackerTopology.tidSide(detId) == 2) {
44  trackingLayer._side = TrackingLayer::Side::POS_ENDCAP;
45  } else {
46  throw cms::Exception("FastSimulation/Tracking")
47  << "Tracker hit for seeding in TID seems neither on positive nor on negative disk side: "
48  << trackerTopology.print(detId).c_str();
49  }
50  trackingLayer._layerNumber = trackerTopology.tidWheel(detId);
51  }
52  //TOB
53  else if (subdet == StripSubdetector::TOB) {
54  trackingLayer._subDet = TrackingLayer::Det::TOB;
55  trackingLayer._side = TrackingLayer::Side::BARREL;
56  trackingLayer._layerNumber = trackerTopology.tobLayer(detId);
57  }
58  //TEC
59  else if (subdet == StripSubdetector::TEC) {
60  trackingLayer._subDet = TrackingLayer::Det::TEC;
61  if (trackerTopology.tecSide(detId) == 1) {
62  trackingLayer._side = TrackingLayer::Side::NEG_ENDCAP;
63  } else if (trackerTopology.tecSide(detId) == 2) {
64  trackingLayer._side = TrackingLayer::Side::POS_ENDCAP;
65  } else {
66  throw cms::Exception("FastSimulation/Tracking")
67  << "Tracker hit for seeding in TEC seems neither on positive nor on negative disk side: "
68  << trackerTopology.print(detId).c_str();
69  }
70  trackingLayer._layerNumber = trackerTopology.tecWheel(detId);
71  } else {
72  throw cms::Exception("FastSimulation/Tracking")
73  << "Cannot determine seeding layer from DetId:" << trackerTopology.print(detId).c_str() << std::endl;
74  }
75  //std::cout<<"LayerSpec::createFromDetId: "<<trackerTopology.print(detId).c_str()<<", parsed="<<seedingLayer.print().c_str()<<std::endl;
76  return trackingLayer;
77 }
static constexpr auto TEC
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
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
unsigned int _layerNumber
Definition: TrackingLayer.h:43
static constexpr auto TOB
unsigned int pxbLayer(const DetId &id) const
static constexpr auto TIB
unsigned int pxfSide(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
static constexpr auto TID
unsigned int tobLayer(const DetId &id) const
unsigned int tecSide(const DetId &id) const
TrackingLayer TrackingLayer::createFromString ( std::string  layerSpecification)
static

Definition at line 79 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().

79  {
80  TrackingLayer trackingLayer;
81  if (layerSpecification.substr(0, 4) == "BPix") {
82  trackingLayer._subDet = TrackingLayer::Det::PXB;
83  trackingLayer._side = TrackingLayer::Side::BARREL;
84  trackingLayer._layerNumber = std::atoi(layerSpecification.substr(4, 1).c_str());
85  } else if (layerSpecification.substr(0, 4) == "FPix") {
86  trackingLayer._subDet = TrackingLayer::Det::PXD;
87  trackingLayer._layerNumber = std::atoi(layerSpecification.substr(4, 1).c_str());
88  if (layerSpecification.substr(layerSpecification.size() - 3) == "pos") {
89  trackingLayer._side = TrackingLayer::Side::POS_ENDCAP;
90  } else if (layerSpecification.substr(layerSpecification.size() - 3) == "neg") {
91  trackingLayer._side = TrackingLayer::Side::NEG_ENDCAP;
92  } else {
93  throw cms::Exception("FastSimulation/Tracking/python")
94  << "FPix seeding layer configuration '" << layerSpecification.c_str()
95  << "' does not specify the side correctly!";
96  }
97 
98  } else if (layerSpecification.substr(0, 3) == "TIB") {
99  trackingLayer._subDet = TrackingLayer::Det::TIB;
100  trackingLayer._side = TrackingLayer::Side::BARREL;
101  trackingLayer._layerNumber = std::atoi(layerSpecification.substr(3, 1).c_str());
102  } else if (layerSpecification.substr(0, 4) == "MTIB") {
103  trackingLayer._subDet = TrackingLayer::Det::TIB;
104  trackingLayer._side = TrackingLayer::Side::BARREL;
105  trackingLayer._layerNumber = std::atoi(layerSpecification.substr(4, 1).c_str());
106  }
107 
108  else if (layerSpecification.substr(0, 3) == "TID") {
109  trackingLayer._subDet = TrackingLayer::Det::TID;
110  trackingLayer._layerNumber = std::atoi(layerSpecification.substr(3, 1).c_str());
111  if (layerSpecification.substr(layerSpecification.size() - 3) == "pos") {
112  trackingLayer._side = TrackingLayer::Side::POS_ENDCAP;
113  } else if (layerSpecification.substr(layerSpecification.size() - 3) == "neg") {
114  trackingLayer._side = TrackingLayer::Side::NEG_ENDCAP;
115  } else {
116  throw cms::Exception("FastSimulation/Tracking/python")
117  << "TID seeding layer configuration '" << layerSpecification.c_str()
118  << "' does not specify the side correctly!";
119  }
120  } else if (layerSpecification.substr(0, 4) == "MTID") {
121  trackingLayer._subDet = TrackingLayer::Det::TID;
122  trackingLayer._layerNumber = std::atoi(layerSpecification.substr(4, 1).c_str());
123  if (layerSpecification.substr(layerSpecification.size() - 3) == "pos") {
124  trackingLayer._side = TrackingLayer::Side::POS_ENDCAP;
125  } else if (layerSpecification.substr(layerSpecification.size() - 3) == "neg") {
126  trackingLayer._side = TrackingLayer::Side::NEG_ENDCAP;
127  } else {
128  throw cms::Exception("FastSimulation/Tracking/python")
129  << "MTID seeding layer configuration '" << layerSpecification.c_str()
130  << "' does not specify the side correctly!";
131  }
132  } else if (layerSpecification.substr(0, 3) == "TOB") {
133  trackingLayer._subDet = TrackingLayer::Det::TOB;
134  trackingLayer._side = TrackingLayer::Side::BARREL;
135  trackingLayer._layerNumber = std::atoi(layerSpecification.substr(3, 1).c_str());
136  } else if (layerSpecification.substr(0, 4) == "MTOB") {
137  trackingLayer._subDet = TrackingLayer::Det::TOB;
138  trackingLayer._side = TrackingLayer::Side::BARREL;
139  trackingLayer._layerNumber = std::atoi(layerSpecification.substr(4, 1).c_str());
140  } else if (layerSpecification.substr(0, 3) == "TEC") {
141  trackingLayer._subDet = TrackingLayer::Det::TEC;
142  trackingLayer._layerNumber = std::atoi(layerSpecification.substr(3, 1).c_str());
143  if (layerSpecification.substr(layerSpecification.size() - 3) == "pos") {
144  trackingLayer._side = TrackingLayer::Side::POS_ENDCAP;
145  } else if (layerSpecification.substr(layerSpecification.size() - 3) == "neg") {
146  trackingLayer._side = TrackingLayer::Side::NEG_ENDCAP;
147  } else {
148  throw cms::Exception("FastSimulation/Tracking/python")
149  << "TEC seeding layer configuration '" << layerSpecification.c_str()
150  << "' does not specify the side correctly!";
151  }
152 
153  } else if (layerSpecification.substr(0, 4) == "MTEC") {
154  trackingLayer._subDet = TrackingLayer::Det::TEC;
155  trackingLayer._layerNumber = std::atoi(layerSpecification.substr(4, 1).c_str());
156  if (layerSpecification.substr(layerSpecification.size() - 3) == "pos") {
157  trackingLayer._side = TrackingLayer::Side::POS_ENDCAP;
158  } else if (layerSpecification.substr(layerSpecification.size() - 3) == "neg") {
159  trackingLayer._side = TrackingLayer::Side::NEG_ENDCAP;
160  } else {
161  throw cms::Exception("FastSimulation/Tracking/python")
162  << "MTEC seeding layer configuration '" << layerSpecification.c_str()
163  << "' does not specify the side correctly!";
164  }
165  } else {
166  throw cms::Exception("FastSimulation/Tracking/python")
167  << "Bad data naming in seeding layer configuration."
168  << "no case sensitive name of ['BPix','FPix','TIB','MTIB','TID','MTID','TOB','TEC','MTEC'] matches '"
169  << layerSpecification.c_str() << "'";
170  }
171  //std::cout<<"LayerSpec::createFromString: "<<layerSpecification.c_str()<<", parsed="<<seedingLayer.print().c_str()<<std::endl;
172 
173  return trackingLayer;
174 }
unsigned int _layerNumber
Definition: TrackingLayer.h:43
unsigned int TrackingLayer::getLayerNumber ( ) const
inline
TrackingLayer::Side TrackingLayer::getSide ( ) const
inline

Definition at line 53 of file TrackingLayer.h.

References _side.

53 { return _side; }
unsigned int TrackingLayer::getSideNumber ( ) const
inline

Definition at line 57 of file TrackingLayer.h.

References _side.

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

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

Definition at line 51 of file TrackingLayer.h.

References _subDet.

51 { return _subDet; }
unsigned int TrackingLayer::getSubDetNumber ( ) const
inline

Definition at line 55 of file TrackingLayer.h.

References _subDet.

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

55 { return static_cast<unsigned int>(_subDet); }
bool TrackingLayer::operator!= ( const TrackingLayer layer) const
inline

Definition at line 63 of file TrackingLayer.h.

References _eqfct.

63 { return not _eqfct(*this, layer); }
static const eqfct _eqfct
Definition: TrackingLayer.h:41
bool TrackingLayer::operator< ( const TrackingLayer layer) const
inline

Definition at line 65 of file TrackingLayer.h.

References _hashfct.

65 { return _hashfct(*this) < _hashfct(layer); }
static const hashfct _hashfct
Definition: TrackingLayer.h:42
bool TrackingLayer::operator== ( const TrackingLayer layer) const
inline

Definition at line 61 of file TrackingLayer.h.

References _eqfct.

61 { return _eqfct(*this, layer); }
static const eqfct _eqfct
Definition: TrackingLayer.h:41
std::string TrackingLayer::toIdString ( ) const

Definition at line 216 of file TrackingLayer.cc.

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

216  {
217  std::stringstream ss;
218  ss << getSubDetNumber() << ":" << getLayerNumber() << ":" << getSideNumber();
219  return ss.str();
220 }
unsigned int getSubDetNumber() const
Definition: TrackingLayer.h:55
unsigned int getLayerNumber() const
Definition: TrackingLayer.h:59
unsigned int getSideNumber() const
Definition: TrackingLayer.h:57
std::string TrackingLayer::toString ( ) const

Definition at line 176 of file TrackingLayer.cc.

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

176  {
177  std::stringstream ss;
178  switch (_subDet) {
180  ss << "unknown";
181  break;
183  ss << " BPix";
184  break;
186  ss << " FPix";
187  break;
189  ss << " TIB";
190  break;
192  ss << " TID";
193  break;
195  ss << " TOB";
196  break;
198  ss << " TEC";
199  break;
200  }
201  ss << _layerNumber;
202  switch (_side) {
204  break;
205  case Side::NEG_ENDCAP:
206  ss << "_neg";
207  break;
209  ss << "_pos";
210  break;
211  }
212 
213  return ss.str();
214 }
unsigned int _layerNumber
Definition: TrackingLayer.h:43

Member Data Documentation

const TrackingLayer::eqfct TrackingLayer::_eqfct
static

Definition at line 41 of file TrackingLayer.h.

Referenced by operator!=(), and operator==().

const hashfct TrackingLayer::_hashfct
static

Definition at line 42 of file TrackingLayer.h.

Referenced by operator<().

unsigned int TrackingLayer::_layerNumber

Definition at line 43 of file TrackingLayer.h.

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

Side TrackingLayer::_side

Definition at line 40 of file TrackingLayer.h.

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

Det TrackingLayer::_subDet