CMS 3D CMS Logo

TrackingLayer.cc
Go to the documentation of this file.
4 
6 
7 TrackingLayer::TrackingLayer() : _subDet(Det::UNKNOWN), _side(Side::BARREL), _layerNumber(0) {}
8 
9 TrackingLayer TrackingLayer::createFromDetId(const DetId& detId, const TrackerTopology& trackerTopology) {
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 }
78 
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 }
175 
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 }
215 
217  std::stringstream ss;
218  ss << getSubDetNumber() << ":" << getLayerNumber() << ":" << getSideNumber();
219  return ss.str();
220 }
TrackingLayer::toIdString
std::string toIdString() const
Definition: TrackingLayer.cc:216
TrackingLayer::toString
std::string toString() const
Definition: TrackingLayer.cc:176
PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
TrackingLayer::Det
Det
Definition: TrackingLayer.h:28
TrackerTopology::pxfSide
unsigned int pxfSide(const DetId &id) const
Definition: TrackerTopology.h:192
TrackingLayer::createFromDetId
static TrackingLayer createFromDetId(const DetId &detId, const TrackerTopology &trackerTopology)
Definition: TrackingLayer.cc:9
TrackerTopology
Definition: TrackerTopology.h:16
TrackingLayer::Det::PXB
TrackingLayer::Side::POS_ENDCAP
TrackingLayer::Det::TEC
BARREL
Definition: ElectronIdentifier.h:39
TrackingLayer::_layerNumber
unsigned int _layerNumber
Definition: TrackingLayer.h:43
TrackingLayer::_eqfct
static const eqfct _eqfct
Definition: TrackingLayer.h:41
TrackerTopology::tidWheel
unsigned int tidWheel(const DetId &id) const
Definition: TrackerTopology.h:201
TrackingLayer::Side::BARREL
TrackerTopology::pxbLayer
unsigned int pxbLayer(const DetId &id) const
Definition: TrackerTopology.h:144
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
DetId
Definition: DetId.h:17
TrackingLayer::Det::TOB
TrackingLayer::getSideNumber
unsigned int getSideNumber() const
Definition: TrackingLayer.h:57
TrackingLayer::Side::NEG_ENDCAP
TrackerTopology::print
std::string print(DetId detid) const
Definition: TrackerTopology.cc:252
StripSubdetector::TIB
static constexpr auto TIB
Definition: StripSubdetector.h:16
TrackingLayer::getSubDetNumber
unsigned int getSubDetNumber() const
Definition: TrackingLayer.h:55
TrackingLayer::Det::TID
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
TrackingLayer::Det::UNKNOWN
TrackingLayer.h
TrackingLayer::_side
Side _side
Definition: TrackingLayer.h:40
TrackerTopology::tidSide
unsigned int tidSide(const DetId &id) const
Definition: TrackerTopology.h:190
TrackerTopology::pxfDisk
unsigned int pxfDisk(const DetId &id) const
Definition: TrackerTopology.h:446
TrackingLayer::_subDet
Det _subDet
Definition: TrackingLayer.h:39
TrackingLayer::Side
Side
Definition: TrackingLayer.h:37
TrackingLayer::Det::PXD
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TrackingLayer::eqfct
Definition: TrackingLayer.h:19
SiStripSubdetector::UNKNOWN
Definition: SiStripEnums.h:5
TrackerTopology::tobLayer
unsigned int tobLayer(const DetId &id) const
Definition: TrackerTopology.h:147
StripSubdetector::TEC
static constexpr auto TEC
Definition: StripSubdetector.h:19
TrackingLayer
Definition: TrackingLayer.h:9
Exception
Definition: hltDiff.cc:245
TrackingLayer::TrackingLayer
TrackingLayer()
Definition: TrackingLayer.cc:7
StripSubdetector::TOB
static constexpr auto TOB
Definition: StripSubdetector.h:18
TrackingLayer::createFromString
static TrackingLayer createFromString(std::string layerSpecification)
Definition: TrackingLayer.cc:79
Exception.h
TrackingLayer::getLayerNumber
unsigned int getLayerNumber() const
Definition: TrackingLayer.h:59
TrackerTopology::tecWheel
unsigned int tecWheel(const DetId &id) const
Definition: TrackerTopology.h:198
StripSubdetector.h
StripSubdetector::TID
static constexpr auto TID
Definition: StripSubdetector.h:17
TrackerTopology::tibLayer
unsigned int tibLayer(const DetId &id) const
Definition: TrackerTopology.h:150
TrackingLayer::Det::TIB
TrackerTopology::tecSide
unsigned int tecSide(const DetId &id) const
Definition: TrackerTopology.h:184