CMS 3D CMS Logo

TkDetMapESProducer.cc
Go to the documentation of this file.
6 
8 
10 class TrackerTopology;
11 
13 
15 {
16 public:
18  ~TkDetMapESProducer() override {}
19 
20  std::unique_ptr<TkDetMap> produce(const TrackerTopologyRcd&);
21 };
22 
24 {
25  setWhatProduced(this);
26 }
27 
28 namespace {
29  TkLayerMap makeTkLayerMap(int layer, const TrackerTopology* tTopo, const std::vector<uint32_t> tkDetIdList)
30  {
31  LogTrace("TkLayerMap") <<" TkLayerMap::constructor for layer " << layer;
32  uint32_t nStringExt, nRod;
33  std::vector<uint32_t> SingleExtString;
34  switch (layer) {
35  case TkLayerMap::TIB_L1: //TIBL1
36  nStringExt = 30;
37  SingleExtString.insert(SingleExtString.begin(),8,0);
38  SingleExtString.insert(SingleExtString.begin()+8,7,1);
39  SingleExtString.insert(SingleExtString.begin()+15,8,2);
40  SingleExtString.insert(SingleExtString.begin()+23,7,3);
41  return TkLayerMap(layer, 12, -6., 6., 2*(nStringExt+1), -1.*(nStringExt+1.), (nStringExt+1), tTopo, tkDetIdList,
42  SingleExtString, {}, {}, {}, nStringExt);
43  break;
44  case TkLayerMap::TIB_L2:
45  nStringExt = 38;
46  SingleExtString.insert(SingleExtString.begin(),10,0);
47  SingleExtString.insert(SingleExtString.begin()+10,9,1);
48  SingleExtString.insert(SingleExtString.begin()+19,10,2);
49  SingleExtString.insert(SingleExtString.begin()+29,9,3);
50  return TkLayerMap(layer, 12, -6., 6., 2*(nStringExt+1), -1.*(nStringExt+1.), (nStringExt+1), tTopo, tkDetIdList,
51  SingleExtString, {}, {}, {}, nStringExt);
52  break;
53  case TkLayerMap::TIB_L3:
54  nStringExt = 46;
55  SingleExtString.insert(SingleExtString.begin(),23,0);
56  SingleExtString.insert(SingleExtString.begin()+23,23,1);
57  return TkLayerMap(layer, 12, -6., 6., nStringExt, 0, nStringExt, tTopo, tkDetIdList,
58  SingleExtString, {}, {}, {}, nStringExt);
59  break;
60  case TkLayerMap::TIB_L4:
61  nStringExt = 56;
62  SingleExtString.insert(SingleExtString.begin(),14,0);
63  SingleExtString.insert(SingleExtString.begin()+14,14,1);
64  SingleExtString.insert(SingleExtString.begin()+28,14,2);
65  SingleExtString.insert(SingleExtString.begin()+42,14,3);
66  return TkLayerMap(layer, 12, -6., 6., nStringExt, 0, nStringExt, tTopo, tkDetIdList,
67  SingleExtString, {}, {}, {}, nStringExt);
68  break;
69  case TkLayerMap::TIDM_D1: //TID
70  case TkLayerMap::TIDM_D2: //TID
71  case TkLayerMap::TIDM_D3: //TID
72  return TkLayerMap(layer, 7, -7., 0., 40, 0., 40., tTopo, tkDetIdList, {});
73  break;
74  case TkLayerMap::TIDP_D1: //TID
75  case TkLayerMap::TIDP_D2: //TID
76  case TkLayerMap::TIDP_D3: //TID
77  return TkLayerMap(layer, 7, 0., 7., 40, 0., 40., tTopo, tkDetIdList, {});
78  break;
79  case TkLayerMap::TOB_L1: //TOBL1
80  nRod = 42;
81  return TkLayerMap(layer, 12, -6., 6., 2*(nRod+1), -1.*(nRod+1.), (nRod+1.), tTopo, tkDetIdList,
82  {}, {}, {}, {}, 0, nRod);
83  break;
84  case TkLayerMap::TOB_L2:
85  nRod = 48;
86  return TkLayerMap(layer, 12, -6., 6., 2*(nRod+1), -1.*(nRod+1.), (nRod+1.), tTopo, tkDetIdList,
87  {}, {}, {}, {}, 0, nRod);
88  break;
89  case TkLayerMap::TOB_L3: //TOBL3
90  nRod = 54;
91  return TkLayerMap(layer, 12, -6., 6., nRod, 0., 1.*nRod, tTopo, tkDetIdList,
92  {}, {}, {}, {}, 0, nRod);
93  break;
94  case TkLayerMap::TOB_L4:
95  nRod = 60;
96  return TkLayerMap(layer, 12, -6., 6., nRod, 0., 1.*nRod, tTopo, tkDetIdList,
97  {}, {}, {}, {}, 0, nRod);
98  break;
99  case TkLayerMap::TOB_L5:
100  nRod = 66;
101  return TkLayerMap(layer, 12, -6., 6., nRod, 0., 1.*nRod, tTopo, tkDetIdList,
102  {}, {}, {}, {}, 0, nRod);
103  break;
104  case TkLayerMap::TOB_L6:
105  nRod = 74;
106  return TkLayerMap(layer, 12, -6., 6., nRod, 0., 1.*nRod, tTopo, tkDetIdList,
107  {}, {}, {}, {}, 0, nRod);
108  break;
109  default: //TEC
110  std::vector<uint32_t> modulesInRingFront = { 0, 2, 2, 3, 4, 2, 4, 5 };
111  std::vector<uint32_t> modulesInRingBack = { 0, 1, 1, 2, 3, 3, 3, 5 };
112  switch (layer) {
113  case TkLayerMap::TECM_W1:
114  case TkLayerMap::TECM_W2:
115  case TkLayerMap::TECM_W3:
116  return TkLayerMap(layer, 16, -16., 0., 80, 0., 80., tTopo, tkDetIdList,
117  {}, modulesInRingFront, modulesInRingBack, { 0, 1, 4, 7, 9, 11, 14, 16 });
118  break;
119  case TkLayerMap::TECM_W4:
120  case TkLayerMap::TECM_W5:
121  case TkLayerMap::TECM_W6:
122  return TkLayerMap(layer, 13, -16., -3., 80, 0., 80., tTopo, tkDetIdList,
123  {}, modulesInRingFront, modulesInRingBack, { 0, 0, 1, 4, 6, 8, 11, 13 });
124  break;
125  case TkLayerMap::TECM_W7:
126  case TkLayerMap::TECM_W8:
127  return TkLayerMap(layer, 10, -16., -6., 80, 0., 80., tTopo, tkDetIdList,
128  {}, modulesInRingFront, modulesInRingBack, { 0, 0, 0, 1, 3, 5, 8, 10 });
129  break;
130  case TkLayerMap::TECM_W9:
131  return TkLayerMap(layer, 8, -16., -8., 80, 0., 80., tTopo, tkDetIdList,
132  {}, modulesInRingFront, modulesInRingBack, { 0, 0, 0, 0, 1, 3, 6, 8 });
133  break;
134  case TkLayerMap::TECP_W1:
135  case TkLayerMap::TECP_W2:
136  case TkLayerMap::TECP_W3:
137  return TkLayerMap(layer, 16, 0., 16., 80, 0., 80., tTopo, tkDetIdList,
138  {}, modulesInRingFront, modulesInRingBack, { 0, 1, 4, 7, 9, 11, 14, 16 });
139  break;
140  case TkLayerMap::TECP_W4:
141  case TkLayerMap::TECP_W5:
142  case TkLayerMap::TECP_W6:
143  return TkLayerMap(layer, 13, 3., 16., 80, 0., 80., tTopo, tkDetIdList,
144  {}, modulesInRingFront, modulesInRingBack, { 0, 0, 1, 4, 6, 8, 11, 13 });
145  break;
146  case TkLayerMap::TECP_W7:
147  case TkLayerMap::TECP_W8:
148  return TkLayerMap(layer, 10, 6., 16., 80, 0., 80., tTopo, tkDetIdList,
149  {}, modulesInRingFront, modulesInRingBack, { 0, 0, 0, 1, 3, 5, 8, 10 });
150  break;
151  case TkLayerMap::TECP_W9:
152  return TkLayerMap(layer, 8, 8., 16., 80, 0., 80., tTopo, tkDetIdList,
153  {}, modulesInRingFront, modulesInRingBack, { 0, 0, 0, 0, 1, 3, 6, 8 });
154  }
155  }
156  return TkLayerMap{};
157  }
158 }
159 
160 std::unique_ptr<TkDetMap> TkDetMapESProducer::produce(const TrackerTopologyRcd& tTopoRcd)
161 {
162  if ( ! edm::Service<SiStripDetInfoFileReader>().isAvailable() ) {
163  edm::LogError("TkLayerMap") <<
164  "\n------------------------------------------"
165  "\nUnAvailable Service SiStripDetInfoFileReader: please insert in the configuration file an instance like"
166  "\n\tprocess.SiStripDetInfoFileReader = cms.Service(\"SiStripDetInfoFileReader\")"
167  "\n------------------------------------------";
168  }
170  const std::vector<uint32_t>& TkDetIdList = fr->getAllDetIds();
171 
172  edm::ESHandle<TrackerTopology> tTopoHandle;
173  tTopoRcd.get(tTopoHandle);
174  const TrackerTopology* tTopo = tTopoHandle.product();
175 
176  auto tkDetMap = std::make_unique<TkDetMap>(tTopo);
177 
178  LogTrace("TkDetMap") <<"TkDetMap::constructor ";
179  //Create TkLayerMap for each layer declared in the TkLayerEnum
180  for ( int layer=1 ; layer < TkLayerMap::NUMLAYERS; ++layer ) {
181  tkDetMap->setLayerMap(layer, makeTkLayerMap(layer, tTopo, TkDetIdList));
182  }
183 
184  return tkDetMap;
185 }
186 
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:124
TkDetMapESProducer(const edm::ParameterSet &)
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
const std::vector< uint32_t > & getAllDetIds() const
#define LogTrace(id)
std::unique_ptr< TkDetMap > produce(const TrackerTopologyRcd &)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
T const * product() const
Definition: ESHandle.h:86
~TkDetMapESProducer() override