CMS 3D CMS Logo

TrackingLayer.cc
Go to the documentation of this file.
5 
7 
8 TrackingLayer::TrackingLayer() : _subDet(Det::UNKNOWN), _side(Side::BARREL), _layerNumber(0) {}
9 
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 }
80 
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 }
178 
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 }
218 
220  std::stringstream ss;
221  ss << getSubDetNumber() << ":" << getLayerNumber() << ":" << getSideNumber();
222  return ss.str();
223 }
unsigned int getLayerNumber() const
Definition: TrackingLayer.h:59
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
static TrackingLayer createFromDetId(const DetId &detId, const TrackerTopology &trackerTopology)
std::string toString() const
std::string toIdString() const
static const eqfct _eqfct
Definition: TrackingLayer.h:41
unsigned int tecSide(const DetId &id) const
unsigned int getSubDetNumber() const
Definition: TrackingLayer.h:55
unsigned int pxfDisk(const DetId &id) const
static TrackingLayer createFromString(std::string layerSpecification)
unsigned int _layerNumber
Definition: TrackingLayer.h:43
static constexpr auto TOB
Definition: DetId.h:17
unsigned int pxfSide(const DetId &id) const
static constexpr auto TIB
unsigned int tibLayer(const DetId &id) const
static constexpr auto TID
unsigned int getSideNumber() const
Definition: TrackingLayer.h:57