CMS 3D CMS Logo

CSCGeometryParsFromDD.cc
Go to the documentation of this file.
1 /*
2 // \class CSCGeometryParsFromDDD
3 //
4 // Description: CSC Geometry Pars for DD4hep
5 //
6 //
7 // \author Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4HEP migration)
8 // Created: Thu, 05 March 2020
9 //
10 // Original author: Tim Cox
11 */
12 #include "CSCGeometryParsFromDD.h"
13 
16 
22 
26 
27 #include "CLHEP/Units/GlobalSystemOfUnits.h"
28 
30 
35 
38 
40 
41 using namespace std;
42 using namespace cms_units::operators;
43 
44 CSCGeometryParsFromDD::CSCGeometryParsFromDD() : myName("CSCGeometryParsFromDD") {}
45 
47 
49  const MuonGeometryConstants& muonConstants,
50  RecoIdealGeometry& rig,
51  CSCRecoDigiParameters& rdp) {
52  std::string attribute = "MuStructure"; // could come from outside
53  std::string value = "MuonEndcapCSC"; // could come from outside
54 
55  // Asking for a specific section of the MuStructure
56 
58 
59  DDFilteredView fv(*cview, filter);
60 
61  bool doSubDets = fv.firstChild();
62 
63  if (!doSubDets) {
64  edm::LogError("CSCGeometryParsFromDD")
65  << "Can not proceed, no CSC parts found with the filter. The current node is: " << fv.logicalPart().toString();
66  return false;
67  }
68  int noOfAnonParams = 0;
69  std::vector<const DDsvalues_type*> spec = fv.specifics();
70  std::vector<const DDsvalues_type*>::const_iterator spit = spec.begin();
71  std::vector<double> uparvals;
72  std::vector<double> fpar;
73  std::vector<double> dpar;
74  std::vector<double> gtran(3);
75  std::vector<double> grmat(9);
76  std::vector<double> trm(9);
77  while (doSubDets) {
78  spec = fv.specifics();
79  spit = spec.begin();
80 
81  // get numbering information early for possible speed up of code.
82 
83  LogTrace(myName) << myName << ": create numbering scheme...";
84 
85  MuonDDDNumbering mdn(muonConstants);
87  CSCNumberingScheme mens(muonConstants);
88 
89  LogTrace(myName) << myName << ": find detid...";
90 
91  int id = mens.baseNumberToUnitNumber(mbn); //@@ FIXME perhaps should return CSCDetId itself?
92 
93  LogTrace(myName) << myName << ": raw id for this detector is " << id << ", octal " << std::oct << id << ", hex "
94  << std::hex << id << std::dec;
95 
96  CSCDetId detid = CSCDetId(id);
97  int jendcap = detid.endcap();
98  int jstation = detid.station();
99  int jring = detid.ring();
100  int jchamber = detid.chamber();
101  int jlayer = detid.layer();
102 
103  // Package up the wire group info as it's decoded
105  uparvals.clear();
106  LogDebug(myName) << "size of spec=" << spec.size();
107 
108  // if the specs are made no need to get all this stuff!
109  int chamberType = CSCChamberSpecs::whatChamberType(jstation, jring);
110 
111  LogDebug(myName) << "Chamber Type: " << chamberType;
112  size_t ct = 0;
113  bool chSpecsAlreadyExist = false;
114  for (; ct < rdp.pChamberType.size(); ++ct) {
115  if (chamberType == rdp.pChamberType[ct]) {
116  break;
117  }
118  }
119  if (ct < rdp.pChamberType.size() && rdp.pChamberType[ct] == chamberType) {
120  // it was found, therefore no need to load all the intermediate stuff from DD.
121  LogDebug(myName) << "already found a " << chamberType << " at index " << ct;
122 
123  chSpecsAlreadyExist = true;
124  } else {
125  for (; spit != spec.end(); spit++) {
126  DDsvalues_type::const_iterator it = (**spit).begin();
127  for (; it != (**spit).end(); it++) {
128  LogDebug(myName) << "it->second.name()=" << it->second.name();
129  if (it->second.name() == "upar") {
130  uparvals.emplace_back(it->second.doubles().size());
131  for (double i : it->second.doubles()) {
132  uparvals.emplace_back(i);
133  }
134 
135  LogDebug(myName) << "found upars ";
136  } else if (it->second.name() == "NoOfAnonParams") {
137  noOfAnonParams = static_cast<int>(it->second.doubles()[0]);
138  } else if (it->second.name() == "NumWiresPerGrp") {
139  for (double i : it->second.doubles()) {
140  wg.wiresInEachGroup.emplace_back(int(i));
141  }
142  LogDebug(myName) << "found upars " << std::endl;
143  } else if (it->second.name() == "NumGroups") {
144  for (double i : it->second.doubles()) {
145  wg.consecutiveGroups.emplace_back(int(i));
146  }
147  } else if (it->second.name() == "WireSpacing") {
148  wg.wireSpacing = it->second.doubles()[0];
149  } else if (it->second.name() == "AlignmentPinToFirstWire") {
150  wg.alignmentPinToFirstWire = it->second.doubles()[0];
151  } else if (it->second.name() == "TotNumWireGroups") {
152  wg.numberOfGroups = int(it->second.doubles()[0]);
153  } else if (it->second.name() == "LengthOfFirstWire") {
154  wg.narrowWidthOfWirePlane = it->second.doubles()[0];
155  } else if (it->second.name() == "LengthOfLastWire") {
156  wg.wideWidthOfWirePlane = it->second.doubles()[0];
157  } else if (it->second.name() == "RadialExtentOfWirePlane") {
158  wg.lengthOfWirePlane = it->second.doubles()[0];
159  }
160  }
161  }
162 
170  uparvals.emplace_back(wg.wireSpacing);
171 
172  uparvals.emplace_back(wg.alignmentPinToFirstWire);
173  uparvals.emplace_back(wg.numberOfGroups);
174  uparvals.emplace_back(wg.narrowWidthOfWirePlane);
175  uparvals.emplace_back(wg.wideWidthOfWirePlane);
176  uparvals.emplace_back(wg.lengthOfWirePlane);
177  uparvals.emplace_back(wg.wiresInEachGroup.size());
178  for (CSCWireGroupPackage::Container::const_iterator it = wg.wiresInEachGroup.begin();
179  it != wg.wiresInEachGroup.end();
180  ++it) {
181  uparvals.emplace_back(*it);
182  }
183  for (CSCWireGroupPackage::Container::const_iterator it = wg.consecutiveGroups.begin();
184  it != wg.consecutiveGroups.end();
185  ++it) {
186  uparvals.emplace_back(*it);
187  }
188 
190  }
191 
192  fpar.clear();
193 
195  const DDSubtraction& first = fv.logicalPart().solid();
196  const DDSubtraction& second = first.solidA();
197  const DDSolid& third = second.solidA();
198  dpar = third.parameters();
200  dpar.begin(), dpar.end(), dpar.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); });
201 
202  } else {
203  dpar = fv.logicalPart().solid().parameters();
205  dpar.begin(), dpar.end(), dpar.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); });
206  }
207 
208  LogTrace(myName) << myName << ": noOfAnonParams=" << noOfAnonParams;
209  LogTrace(myName) << myName << ": fill fpar...";
210  LogTrace(myName) << myName << ": dpars are... " << dpar[4] / cm << ", " << dpar[8] / cm << ", " << dpar[3] / cm
211  << ", " << dpar[0] / cm;
212 
213  fpar.emplace_back((dpar[4] / cm));
214  fpar.emplace_back((dpar[8] / cm));
215  fpar.emplace_back((dpar[3] / cm));
216  fpar.emplace_back((dpar[0] / cm));
217 
218  LogTrace(myName) << myName << ": fill gtran...";
219 
220  gtran[0] = (float)1.0 * (fv.translation().X() / cm);
221  gtran[1] = (float)1.0 * (fv.translation().Y() / cm);
222  gtran[2] = (float)1.0 * (fv.translation().Z() / cm);
223 
224  LogTrace(myName) << myName << ": gtran[0]=" << gtran[0] << ", gtran[1]=" << gtran[1] << ", gtran[2]=" << gtran[2];
225 
226  LogTrace(myName) << myName << ": fill grmat...";
227 
228  fv.rotation().GetComponents(trm.begin(), trm.end());
229  size_t rotindex = 0;
230  for (size_t i = 0; i < 9; ++i) {
231  grmat[i] = (float)1.0 * trm[rotindex];
232  rotindex = rotindex + 3;
233  if ((i + 1) % 3 == 0) {
234  rotindex = (i + 1) / 3;
235  }
236  }
237  LogTrace(myName) << myName << ": looking for wire group info for layer "
238  << "E" << CSCDetId::endcap(id) << " S" << CSCDetId::station(id) << " R" << CSCDetId::ring(id)
239  << " C" << CSCDetId::chamber(id) << " L" << CSCDetId::layer(id);
240 
241  if (wg.numberOfGroups != 0) {
242  LogTrace(myName) << myName << ": fv.geoHistory: = " << fv.geoHistory();
243  LogTrace(myName) << myName << ": TotNumWireGroups = " << wg.numberOfGroups;
244  LogTrace(myName) << myName << ": WireSpacing = " << wg.wireSpacing;
245  LogTrace(myName) << myName << ": AlignmentPinToFirstWire = " << wg.alignmentPinToFirstWire;
246  LogTrace(myName) << myName << ": Narrow width of wire plane = " << wg.narrowWidthOfWirePlane;
247  LogTrace(myName) << myName << ": Wide width of wire plane = " << wg.wideWidthOfWirePlane;
248  LogTrace(myName) << myName << ": Length in y of wire plane = " << wg.lengthOfWirePlane;
249  LogTrace(myName) << myName << ": wg.consecutiveGroups.size() = " << wg.consecutiveGroups.size();
250  LogTrace(myName) << myName << ": wg.wiresInEachGroup.size() = " << wg.wiresInEachGroup.size();
251  LogTrace(myName) << myName << ": \tNumGroups\tWiresInGroup";
252  for (size_t i = 0; i < wg.consecutiveGroups.size(); i++) {
253  LogTrace(myName) << myName << " \t" << wg.consecutiveGroups[i] << "\t\t" << wg.wiresInEachGroup[i];
254  }
255  } else {
256  LogTrace(myName) << myName << ": DDD is MISSING SpecPars for wire groups";
257  }
258  LogTrace(myName) << myName << ": end of wire group info. ";
259 
260  LogTrace(myName) << myName << ":_z_ E" << jendcap << " S" << jstation << " R" << jring << " C" << jchamber << " L"
261  << jlayer << " gx=" << gtran[0] << ", gy=" << gtran[1] << ", gz=" << gtran[2]
262  << " thickness=" << fpar[2] * 2.;
263 
264  if (jlayer == 0) { // Can only build chambers if we're filtering them
265 
266  LogTrace(myName) << myName << ":_z_ frame=" << uparvals[31] / 10. << " gap=" << uparvals[32] / 10.
267  << " panel=" << uparvals[33] / 10. << " offset=" << uparvals[34] / 10.;
268 
269  if (jstation == 1 && jring == 1) {
270  // set up params for ME1a and ME1b and call buildChamber *for each*
271  // Both get the full ME11 dimensions
272 
273  // detid is for ME11 and that's what we're using for ME1b in the software
274 
275  std::transform(gtran.begin(), gtran.end(), gtran.begin(), [](double i) -> double {
277  });
278  std::transform(grmat.begin(), grmat.end(), grmat.begin(), [](double i) -> double {
280  });
282  fpar.begin(), fpar.end(), fpar.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); });
283 
284  rig.insert(id, gtran, grmat, fpar);
285  if (!chSpecsAlreadyExist) {
286  LogDebug(myName) << " inserting chamber type " << chamberType << std::endl;
287  rdp.pChamberType.emplace_back(chamberType);
288  rdp.pUserParOffset.emplace_back(rdp.pfupars.size());
289  rdp.pUserParSize.emplace_back(uparvals.size());
290  std::copy(uparvals.begin(), uparvals.end(), std::back_inserter(rdp.pfupars));
291  }
292 
293  // No. of anonymous parameters per chamber type should be read from cscSpecs file...
294  // Only required for ME11 splitting into ME1a and ME1b values,
295  // If it isn't seen may as well try to get further but this value will depend
296  // on structure of the file so may not even match!
297  const int kNoOfAnonParams = 35;
298  if (noOfAnonParams == 0) {
299  noOfAnonParams = kNoOfAnonParams;
300  } // in case it wasn't seen
301 
302  // copy ME1a params from back to the front
303  std::copy(
304  uparvals.begin() + noOfAnonParams + 1, uparvals.begin() + (2 * noOfAnonParams) + 2, uparvals.begin() + 1);
305 
306  CSCDetId detid1a = CSCDetId(jendcap, 1, 4, jchamber, 0); // reset to ME1A
307 
308  std::transform(gtran.begin(), gtran.end(), gtran.begin(), [](double i) -> double {
310  });
311  std::transform(grmat.begin(), grmat.end(), grmat.begin(), [](double i) -> double {
313  });
315  fpar.begin(), fpar.end(), fpar.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); });
316 
317  rig.insert(detid1a.rawId(), gtran, grmat, fpar);
318  int chtypeA = CSCChamberSpecs::whatChamberType(1, 4);
319  ct = 0;
320  for (; ct < rdp.pChamberType.size(); ++ct) {
321  if (chtypeA == rdp.pChamberType[ct]) {
322  break;
323  }
324  }
325  if (ct < rdp.pChamberType.size() && rdp.pChamberType[ct] == chtypeA) {
326  // then its in already, don't put it
327  LogDebug(myName) << "found chamber type " << chtypeA << " so don't put it in! ";
328  } else {
329  LogDebug(myName) << " inserting chamber type " << chtypeA;
330  rdp.pChamberType.emplace_back(chtypeA);
331  rdp.pUserParOffset.emplace_back(rdp.pfupars.size());
332  rdp.pUserParSize.emplace_back(uparvals.size());
333  std::copy(uparvals.begin(), uparvals.end(), std::back_inserter(rdp.pfupars));
334  }
335 
336  } else {
337  std::transform(gtran.begin(), gtran.end(), gtran.begin(), [](double i) -> double {
339  });
340  std::transform(grmat.begin(), grmat.end(), grmat.begin(), [](double i) -> double {
342  });
344  fpar.begin(), fpar.end(), fpar.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); });
345  rig.insert(id, gtran, grmat, fpar);
346  if (!chSpecsAlreadyExist) {
347  LogDebug(myName) << " inserting chamber type " << chamberType;
348  rdp.pChamberType.emplace_back(chamberType);
349  rdp.pUserParOffset.emplace_back(rdp.pfupars.size());
350  rdp.pUserParSize.emplace_back(uparvals.size());
351  std::copy(uparvals.begin(), uparvals.end(), std::back_inserter(rdp.pfupars));
352  }
353  }
354 
355  } // filtering chambers.
356 
357  doSubDets = fv.next();
358  }
359  return true;
360 }
361 
362 // dd4hep
364  const cms::MuonNumbering& muonConstants,
365  RecoIdealGeometry& rig,
366  CSCRecoDigiParameters& rdp) {
367  const std::string attribute = "MuStructure";
368  const std::string value = "MuonEndcapCSC";
369  cms::DDFilteredView fv(cview->detector(), cview->detector()->worldVolume());
370  cms::DDSpecParRefs refs;
371  const cms::DDSpecParRegistry& mypar = cview->specpars();
372  mypar.filter(refs, attribute, value);
373  fv.mergedSpecifics(refs);
374 
375  int noOfAnonParams = 0;
376 
377  std::vector<double> uparvals;
378  std::vector<double> fpar;
379  std::vector<double> dpar;
380  std::vector<double> gtran(3);
381  std::vector<double> grmat(9);
382  std::vector<double> trm(9);
383  while (fv.firstChild()) {
384  MuonBaseNumber mbn = muonConstants.geoHistoryToBaseNumber(fv.history());
385 
386  cms::CSCNumberingScheme cscnum(muonConstants.values());
387 
388  cscnum.baseNumberToUnitNumber(mbn);
389  int id = cscnum.getDetId();
390 
391  CSCDetId detid = CSCDetId(id);
392  int jendcap = detid.endcap();
393  int jstation = detid.station();
394  int jring = detid.ring();
395  int jchamber = detid.chamber();
396  int jlayer = detid.layer();
397 
398  // Package up the wire group info as it's decoded
400  uparvals.clear();
401 
402  // if the specs are made no need to get all this stuff!
403  int chamberType = CSCChamberSpecs::whatChamberType(jstation, jring);
404 
405  size_t ct = 0;
406  bool chSpecsAlreadyExist = false;
407 
408  for (; ct < rdp.pChamberType.size(); ++ct) {
409  if (chamberType == rdp.pChamberType[ct]) {
410  break;
411  }
412  }
413 
414  if (ct < rdp.pChamberType.size() && rdp.pChamberType[ct] == chamberType) {
415  chSpecsAlreadyExist = true;
416  } else {
417  std::string_view my_name_bis = fv.name();
418  std::string my_name_tris = std::string(my_name_bis);
419  std::vector<std::string_view> namesInPath = mypar.names("//" + my_name_tris);
420  std::string my_string = "ChamberSpecs_";
421  int index = -1;
422  for (vector<string_view>::size_type i = 0; i < namesInPath.size(); ++i) {
423  std::size_t found = namesInPath[i].find(my_string);
424  if (found != std::string::npos)
425  index = i;
426  }
427  uparvals = fv.get<std::vector<double>>(std::string(namesInPath[index]), "upar");
428 
429  auto it = uparvals.begin();
430  it = uparvals.insert(it, uparvals.size());
431  auto noofanonparams = fv.get<double>("NoOfAnonParams");
432  noOfAnonParams = static_cast<int>(noofanonparams);
433 
434  for (auto i : fv.get<std::vector<double>>(std::string(namesInPath[index]), "NumWiresPerGrp")) {
435  wg.wiresInEachGroup.emplace_back(int(i));
436  }
437 
438  for (auto i : fv.get<std::vector<double>>(std::string(namesInPath[index]), "NumGroups")) {
439  wg.consecutiveGroups.emplace_back(int(i));
440  }
441 
442  auto wirespacing = fv.get<double>("WireSpacing");
443  wg.wireSpacing = static_cast<double>(wirespacing);
444 
445  auto alignmentpintofirstwire = fv.get<double>("AlignmentPinToFirstWire");
446  wg.alignmentPinToFirstWire = static_cast<double>(alignmentpintofirstwire);
447 
448  auto totnumwiregroups = fv.get<double>("TotNumWireGroups");
449  wg.numberOfGroups = static_cast<int>(totnumwiregroups);
450 
451  auto lengthoffirstwire = fv.get<double>("LengthOfFirstWire");
452  wg.narrowWidthOfWirePlane = static_cast<double>(lengthoffirstwire);
453 
454  auto lengthoflastwire = fv.get<double>("LengthOfLastWire");
455  wg.wideWidthOfWirePlane = static_cast<double>(lengthoflastwire);
456 
457  auto radialextentofwireplane = fv.get<double>("RadialExtentOfWirePlane");
458  wg.lengthOfWirePlane = static_cast<double>(radialextentofwireplane);
459 
460  uparvals.emplace_back((wg.wireSpacing) * 10.0);
461  uparvals.emplace_back(wg.alignmentPinToFirstWire);
462  uparvals.emplace_back(wg.numberOfGroups);
463  uparvals.emplace_back(wg.narrowWidthOfWirePlane);
464  uparvals.emplace_back(wg.wideWidthOfWirePlane);
465  uparvals.emplace_back(wg.lengthOfWirePlane);
466  uparvals.emplace_back(wg.wiresInEachGroup.size());
467 
468  for (CSCWireGroupPackage::Container::const_iterator it = wg.wiresInEachGroup.begin();
469  it != wg.wiresInEachGroup.end();
470  ++it) {
471  uparvals.emplace_back(*it);
472  }
473  for (CSCWireGroupPackage::Container::const_iterator it = wg.consecutiveGroups.begin();
474  it != wg.consecutiveGroups.end();
475  ++it) {
476  uparvals.emplace_back(*it);
477  }
478 
480  }
481 
482  fpar.clear();
483 
484  std::string my_title(fv.solid()->GetTitle());
485 
486  if (my_title == "Subtraction") {
487  cms::DDSolid mysolid(fv.solid());
488  auto solidA = mysolid.solidA();
489  std::vector<double> dpar = solidA.dimensions();
490 
492  dpar.begin(), dpar.end(), dpar.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); });
493 
494  fpar.emplace_back((dpar[1]));
495  fpar.emplace_back((dpar[2]));
496  fpar.emplace_back((dpar[3]));
497  fpar.emplace_back((dpar[4]));
498  } else {
499  dpar = fv.parameters();
500 
502  dpar.begin(), dpar.end(), dpar.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); });
503 
504  fpar.emplace_back((dpar[0]));
505  fpar.emplace_back((dpar[1]));
506  fpar.emplace_back((dpar[2]));
507  fpar.emplace_back((dpar[3]));
508  }
509 
510  gtran[0] = static_cast<float>(fv.translation().X());
511  gtran[1] = static_cast<float>(fv.translation().Y());
512  gtran[2] = static_cast<float>(fv.translation().Z());
513 
515  gtran.begin(), gtran.end(), gtran.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); });
516 
517  fv.rotation().GetComponents(trm.begin(), trm.end());
518  size_t rotindex = 0;
519  for (size_t i = 0; i < 9; ++i) {
520  grmat[i] = static_cast<float>(trm[rotindex]);
521  rotindex = rotindex + 3;
522  if ((i + 1) % 3 == 0) {
523  rotindex = (i + 1) / 3;
524  }
525  }
526 
527  if (wg.numberOfGroups != 0) {
528  for (size_t i = 0; i < wg.consecutiveGroups.size(); i++) {
529  }
530  } else {
531  LogTrace(myName) << myName << " wg.numberOfGroups == 0 ";
532  }
533 
534  if (jlayer == 0) { // Can only build chambers if we're filtering them
535 
536  if (jstation == 1 && jring == 1) {
537  std::transform(gtran.begin(), gtran.end(), gtran.begin(), [](double i) -> double {
539  });
540 
541  std::transform(grmat.begin(), grmat.end(), grmat.begin(), [](double i) -> double {
543  });
544 
546  fpar.begin(), fpar.end(), fpar.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); });
547 
548  rig.insert(id, gtran, grmat, fpar);
549  if (!chSpecsAlreadyExist) {
550  rdp.pChamberType.emplace_back(chamberType);
551  rdp.pUserParOffset.emplace_back(rdp.pfupars.size());
552  rdp.pUserParSize.emplace_back(uparvals.size());
553  std::copy(uparvals.begin(), uparvals.end(), std::back_inserter(rdp.pfupars));
554  }
555 
556  // No. of anonymous parameters per chamber type should be read from cscSpecs file...
557  // Only required for ME11 splitting into ME1a and ME1b values,
558  // If it isn't seen may as well try to get further but this value will depend
559  // on structure of the file so may not even match!
560  const int kNoOfAnonParams = 35;
561  if (noOfAnonParams == 0) {
562  noOfAnonParams = kNoOfAnonParams;
563  } // in case it wasn't seen
564 
565  // copy ME1a params from back to the front
566  std::copy(
567  uparvals.begin() + noOfAnonParams + 1, uparvals.begin() + (2 * noOfAnonParams) + 2, uparvals.begin() + 1);
568 
569  CSCDetId detid1a = CSCDetId(jendcap, 1, 4, jchamber, 0); // reset to ME1A
570 
571  std::transform(gtran.begin(), gtran.end(), gtran.begin(), [](double i) -> double {
573  });
574 
575  std::transform(grmat.begin(), grmat.end(), grmat.begin(), [](double i) -> double {
577  });
578 
580  fpar.begin(), fpar.end(), fpar.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); });
581 
582  rig.insert(detid1a.rawId(), gtran, grmat, fpar);
583  int chtypeA = CSCChamberSpecs::whatChamberType(1, 4);
584  ct = 0;
585  for (; ct < rdp.pChamberType.size(); ++ct) {
586  if (chtypeA == rdp.pChamberType[ct]) {
587  break;
588  }
589  }
590  if (ct < rdp.pChamberType.size() && rdp.pChamberType[ct] == chtypeA) {
591  // then its in already, don't put it
592  LogTrace(myName) << myName << " ct < rdp.pChamberType.size() && rdp.pChamberType[ct] == chtypeA ";
593  } else {
594  rdp.pChamberType.emplace_back(chtypeA);
595  rdp.pUserParOffset.emplace_back(rdp.pfupars.size());
596  rdp.pUserParSize.emplace_back(uparvals.size());
597  std::copy(uparvals.begin(), uparvals.end(), std::back_inserter(rdp.pfupars));
598  }
599 
600  } else {
601  std::transform(gtran.begin(), gtran.end(), gtran.begin(), [](double i) -> double {
603  });
604 
605  std::transform(grmat.begin(), grmat.end(), grmat.begin(), [](double i) -> double {
607  });
608 
610  fpar.begin(), fpar.end(), fpar.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); });
611 
612  rig.insert(id, gtran, grmat, fpar);
613  if (!chSpecsAlreadyExist) {
614  rdp.pChamberType.emplace_back(chamberType);
615  rdp.pUserParOffset.emplace_back(rdp.pfupars.size());
616  rdp.pUserParSize.emplace_back(uparvals.size());
617  std::copy(uparvals.begin(), uparvals.end(), std::back_inserter(rdp.pfupars));
618  }
619  }
620 
621  } // filtering chambers.
622  }
623 
624  return true;
625 }
cms::DDSolid
Definition: DDFilteredView.h:31
MuonDDDNumbering
Definition: MuonDDDNumbering.h:24
MuonGeometryConstants
Definition: MuonGeometryConstants.h:20
cms::MuonNumbering::geoHistoryToBaseNumber
const MuonBaseNumber geoHistoryToBaseNumber(const cms::ExpandedNodes &) const
Definition: DD4hep_MuonNumbering.cc:8
CSCGeometryParsFromDD::build
bool build(const DDCompactView *cview, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rig, CSCRecoDigiParameters &rdp)
Build the geometry returning the RecoIdealGeometry and the CSCRecoDigiParameters objects.
Definition: CSCGeometryParsFromDD.cc:48
mps_fire.i
i
Definition: mps_fire.py:355
cms_units::operators
Definition: CMSUnits.h:13
CSCWireGroupPackage::lengthOfWirePlane
double lengthOfWirePlane
Definition: CSCWireGroupPackage.h:37
MessageLogger.h
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
cms::CSCNumberingScheme::baseNumberToUnitNumber
void baseNumberToUnitNumber(const MuonBaseNumber &)
Definition: DD4hep_CSCNumberingScheme.cc:34
CSCRecoDigiParameters
Definition: CSCRecoDigiParameters.h:18
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
MuonDDDNumbering::geoHistoryToBaseNumber
MuonBaseNumber geoHistoryToBaseNumber(const DDGeoHistory &history) const
Definition: MuonDDDNumbering.cc:37
CSCWireGroupPackage::consecutiveGroups
Container consecutiveGroups
Definition: CSCWireGroupPackage.h:28
CSCDetId::ring
int ring() const
Definition: CSCDetId.h:68
DDFilteredView::logicalPart
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
Definition: DDFilteredView.cc:16
MuonGeometryConstants.h
Rounding.h
cms::CSCNumberingScheme
Definition: DD4hep_CSCNumberingScheme.h:20
cms::DDSpecParRegistry
Definition: DDSpecParRegistry.h:32
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
cms::DDFilteredView
Definition: DDFilteredView.h:65
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
dqmdumpme.first
first
Definition: dqmdumpme.py:55
cms::DDSolid::solidA
dd4hep::Solid solidA() const
Definition: DDFilteredView.cc:17
DD4hep_CSCNumberingScheme.h
CSCRecoDigiParameters::pfupars
std::vector< float > pfupars
Definition: CSCRecoDigiParameters.h:26
DDSolid::shape
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:119
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
DDFilteredView::firstChild
bool firstChild()
set the current node to the first child ...
Definition: DDFilteredView.cc:86
DDFilteredView.h
cms::MuonNumbering::values
const MuonConstants & values() const
Definition: DD4hep_MuonNumbering.h:42
CSCWireGroupPackage.h
DDBase::toString
std::string toString() const
Definition: DDBase.h:63
DDFilteredView::next
bool next()
set current node to the next node in the filtered tree
Definition: DDFilteredView.cc:67
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
CSCDetId::layer
int layer() const
Definition: CSCDetId.h:56
CSCWireGroupPackage::narrowWidthOfWirePlane
double narrowWidthOfWirePlane
Definition: CSCWireGroupPackage.h:35
DDSolid.h
DDFilteredView.h
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
DDCompactView.h
CSCWireGroupPackage::wideWidthOfWirePlane
double wideWidthOfWirePlane
Definition: CSCWireGroupPackage.h:36
ALCARECOTkAlBeamHalo_cff.filter
filter
Definition: ALCARECOTkAlBeamHalo_cff.py:27
cms::DDSpecParRefs
std::vector< const DDSpecPar * > DDSpecParRefs
Definition: DDSpecParRegistry.h:30
RecoIdealGeometry.h
CSCRecoDigiParameters::pUserParSize
std::vector< int > pUserParSize
Definition: CSCRecoDigiParameters.h:24
CSCRecoDigiParameters::pUserParOffset
std::vector< int > pUserParOffset
Definition: CSCRecoDigiParameters.h:23
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CSCRecoDigiParameters.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
CSCWireGroupPackage::wireSpacing
double wireSpacing
Definition: CSCWireGroupPackage.h:33
edm::LogError
Definition: MessageLogger.h:183
GeantUnits.h
CSCWireGroupPackage::wiresInEachGroup
Container wiresInEachGroup
Definition: CSCWireGroupPackage.h:31
MuonBaseNumber.h
CSCDetId
Definition: CSCDetId.h:26
cms::MuonNumbering
Definition: DD4hep_MuonNumbering.h:37
createfilelist.int
int
Definition: createfilelist.py:10
value
Definition: value.py:1
cms_rounding::roundIfNear0
constexpr valType roundIfNear0(valType value, double tolerance=1.e-7)
Definition: Rounding.h:11
CSCDetId::chamber
int chamber() const
Definition: CSCDetId.h:62
DDFilteredView::geoHistory
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
Definition: DDFilteredView.cc:30
CSCRecoDigiParameters::pChamberType
std::vector< int > pChamberType
Definition: CSCRecoDigiParameters.h:25
CSCWireGroupPackage
Definition: CSCWireGroupPackage.h:18
CSCNumberingScheme.h
DD4hep_MuonNumbering.h
cms::DDCompactView::specpars
DDSpecParRegistry const & specpars() const
Definition: DDCompactView.h:33
DDFilteredView::specifics
std::vector< const DDsvalues_type * > specifics() const
Definition: DDFilteredView.cc:32
CSCChamberSpecs::whatChamberType
static int whatChamberType(int istation, int iring)
Definition: CSCChamberSpecs.cc:164
MuonBaseNumber
Definition: MuonBaseNumber.h:21
std
Definition: JetResolutionObject.h:76
CSCGeometryParsFromDD.h
CSCWireGroupPackage::numberOfGroups
int numberOfGroups
Definition: CSCWireGroupPackage.h:32
DDValue
Definition: DDValue.h:21
CSCDetId::endcap
int endcap() const
Definition: CSCDetId.h:85
DDFilteredView::translation
const DDTranslation & translation() const
The absolute translation of the current node.
Definition: DDFilteredView.cc:26
cms::DDSpecParRegistry::filter
void filter(DDSpecParRefs &, const std::string &, const std::string &="") const
Definition: DDSpecparRegistry.cc:98
CSCWireGroupPackage::alignmentPinToFirstWire
double alignmentPinToFirstWire
Definition: CSCWireGroupPackage.h:34
cms::DDCompactView
Definition: DDCompactView.h:29
DDSolid::parameters
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:121
DDSolid
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
DDSpecificsMatchesValueFilter
Definition: DDFilter.h:70
CMSUnits.h
DDFilteredView::rotation
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
Definition: DDFilteredView.cc:28
CSCGeometryParsFromDD::~CSCGeometryParsFromDD
virtual ~CSCGeometryParsFromDD()
Destructor.
Definition: CSCGeometryParsFromDD.cc:46
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
DDFilteredView
Definition: DDFilteredView.h:20
CSCNumberingScheme
Definition: CSCNumberingScheme.h:18
CSCChamberSpecs.h
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
CSCDetId::station
int station() const
Definition: CSCDetId.h:79
cms::DDSpecParRegistry::names
std::vector< std::string_view > names() const
Definition: DDSpecparRegistry.cc:130
DDSubtraction
Definition: DDSolid.h:325
MuonDDDNumbering.h
DDSolidShape::ddsubtraction
CSCNumberingScheme::baseNumberToUnitNumber
int baseNumberToUnitNumber(const MuonBaseNumber &) override
Definition: CSCNumberingScheme.cc:27
RecoIdealGeometry::insert
bool insert(DetId id, const std::vector< double > &trans, const std::vector< double > &rot, const std::vector< double > &pars)
Definition: RecoIdealGeometry.h:33
DDLogicalPart::solid
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
Definition: DDLogicalPart.cc:120
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
cms::DDDetector::worldVolume
Volume worldVolume() const
Handle to the world volume containing everything.
Definition: DDDetector.cc:41
cms::DDCompactView::detector
const cms::DDDetector * detector() const
Definition: DDCompactView.h:32
RecoIdealGeometry
Definition: RecoIdealGeometry.h:28
CSCGeometryParsFromDD::CSCGeometryParsFromDD
CSCGeometryParsFromDD()
Constructor.
Definition: CSCGeometryParsFromDD.cc:44
CSCGeometryParsFromDD::myName
std::string myName
Definition: CSCGeometryParsFromDD.h:53