CMS 3D CMS Logo

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

◆ Det

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  };

◆ Side

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::TrackingLayer ( )

Member Function Documentation

◆ createFromDetId()

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

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

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

◆ createFromString()

TrackingLayer TrackingLayer::createFromString ( std::string  layerSpecification)
static

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

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

◆ getLayerNumber()

unsigned int TrackingLayer::getLayerNumber ( ) const
inline

◆ getSide()

TrackingLayer::Side TrackingLayer::getSide ( ) const
inline

Definition at line 53 of file TrackingLayer.h.

References _side.

53 { return _side; }

◆ getSideNumber()

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); }

◆ getSubDet()

TrackingLayer::Det TrackingLayer::getSubDet ( ) const
inline

Definition at line 51 of file TrackingLayer.h.

References _subDet.

51 { return _subDet; }

◆ getSubDetNumber()

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); }

◆ operator!=()

bool TrackingLayer::operator!= ( const TrackingLayer layer) const
inline

Definition at line 63 of file TrackingLayer.h.

References _eqfct, and pixelTopology::layer.

63 { return not _eqfct(*this, layer); }
static const eqfct _eqfct
Definition: TrackingLayer.h:41
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer

◆ operator<()

bool TrackingLayer::operator< ( const TrackingLayer layer) const
inline

Definition at line 65 of file TrackingLayer.h.

References _hashfct, and pixelTopology::layer.

65 { return _hashfct(*this) < _hashfct(layer); }
static const hashfct _hashfct
Definition: TrackingLayer.h:42
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer

◆ operator==()

bool TrackingLayer::operator== ( const TrackingLayer layer) const
inline

Definition at line 61 of file TrackingLayer.h.

References _eqfct, and pixelTopology::layer.

61 { return _eqfct(*this, layer); }
static const eqfct _eqfct
Definition: TrackingLayer.h:41
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer

◆ toIdString()

std::string TrackingLayer::toIdString ( ) const

Definition at line 219 of file TrackingLayer.cc.

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

219  {
220  std::stringstream ss;
221  ss << getSubDetNumber() << ":" << getLayerNumber() << ":" << getSideNumber();
222  return ss.str();
223 }
unsigned int getLayerNumber() const
Definition: TrackingLayer.h:59
unsigned int getSubDetNumber() const
Definition: TrackingLayer.h:55
unsigned int getSideNumber() const
Definition: TrackingLayer.h:57

◆ toString()

std::string TrackingLayer::toString ( ) const

Definition at line 179 of file TrackingLayer.cc.

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

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

Member Data Documentation

◆ _eqfct

const TrackingLayer::eqfct TrackingLayer::_eqfct
static

Definition at line 41 of file TrackingLayer.h.

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

◆ _hashfct

const hashfct TrackingLayer::_hashfct
static

Definition at line 42 of file TrackingLayer.h.

Referenced by operator<().

◆ _layerNumber

unsigned int TrackingLayer::_layerNumber

Definition at line 43 of file TrackingLayer.h.

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

◆ _side

Side TrackingLayer::_side

Definition at line 40 of file TrackingLayer.h.

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

◆ _subDet

Det TrackingLayer::_subDet