CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CSCGeometryParsFromDD Class Reference

#include <CSCGeometryParsFromDD.h>

Public Member Functions

bool build (const cms::DDCompactView *cview, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rig, CSCRecoDigiParameters &rdp)
 
bool build (const DDCompactView *cview, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rig, CSCRecoDigiParameters &rdp)
 Build the geometry returning the RecoIdealGeometry and the CSCRecoDigiParameters objects. More...
 
 CSCGeometryParsFromDD ()
 Constructor. More...
 
virtual ~CSCGeometryParsFromDD ()
 Destructor. More...
 

Private Attributes

std::string myName
 

Detailed Description

Definition at line 29 of file CSCGeometryParsFromDD.h.

Constructor & Destructor Documentation

◆ CSCGeometryParsFromDD()

CSCGeometryParsFromDD::CSCGeometryParsFromDD ( )

Constructor.

Definition at line 35 of file CSCGeometryParsFromDD.cc.

35 : myName("CSCGeometryParsFromDD") {}

◆ ~CSCGeometryParsFromDD()

CSCGeometryParsFromDD::~CSCGeometryParsFromDD ( )
virtual

Destructor.

Definition at line 37 of file CSCGeometryParsFromDD.cc.

37 {}

Member Function Documentation

◆ build() [1/2]

bool CSCGeometryParsFromDD::build ( const cms::DDCompactView cview,
const MuonGeometryConstants muonConstants,
RecoIdealGeometry rig,
CSCRecoDigiParameters rdp 
)

end stuff

Definition at line 374 of file CSCGeometryParsFromDD.cc.

377  {
378  const std::string attribute = "MuStructure";
379  const std::string value = "MuonEndcapCSC";
380  const cms::DDSpecParRegistry& mypar = cview->specpars();
381  const cms::DDFilter filter(attribute, value);
382  cms::DDFilteredView fv(*cview, filter);
383 
384  int noOfAnonParams = 0;
385 
386  std::vector<double> uparvals;
387  std::vector<double> fpar;
388  std::vector<double> dpar;
389  std::vector<double> gtran(3);
390  std::vector<double> grmat(9);
391  std::vector<double> trm(9);
392 
393  edm::LogVerbatim("CSCGeometryParsFromDD") << "(0) CSCGeometryParsFromDD - DD4HEP ";
394 
395  while (fv.firstChild()) {
396  MuonGeometryNumbering mbn(muonConstants);
397  CSCNumberingScheme cscnum(muonConstants);
398  int id = cscnum.baseNumberToUnitNumber(mbn.geoHistoryToBaseNumber(fv.history()));
399  CSCDetId detid = CSCDetId(id);
400 
401  int jendcap = detid.endcap();
402  int jstation = detid.station();
403  int jring = detid.ring();
404  int jchamber = detid.chamber();
405  int jlayer = detid.layer();
406 
407  edm::LogVerbatim("CSCGeometryParsFromDD")
408  << "(1) detId: " << id << " jendcap: " << jendcap << " jstation: " << jstation << " jring: " << jring
409  << " jchamber: " << jchamber << " jlayer: " << jlayer;
410 
411  // Package up the wire group info as it's decoded
413  uparvals.clear();
414 
415  // if the specs are made no need to get all this stuff!
416  int chamberType = CSCChamberSpecs::whatChamberType(jstation, jring);
417 
418  size_t ct = 0;
419  bool chSpecsAlreadyExist = false;
420 
421  for (; ct < rdp.pChamberType.size(); ++ct) {
422  if (chamberType == rdp.pChamberType[ct]) {
423  break;
424  }
425  }
426 
427  if (ct < rdp.pChamberType.size() && rdp.pChamberType[ct] == chamberType) {
428  chSpecsAlreadyExist = true;
429  } else {
430  std::string_view my_name_bis = fv.name();
431  std::string my_name_tris = std::string(my_name_bis);
432  std::vector<std::string_view> namesInPath = mypar.names("//" + my_name_tris);
433  std::string my_string = "ChamberSpecs_";
434  int index = -1;
435  for (vector<string_view>::size_type i = 0; i < namesInPath.size(); ++i) {
436  std::size_t found = namesInPath[i].find(my_string);
437  if (found != std::string::npos)
438  index = i;
439  }
440  uparvals = fv.get<std::vector<double>>(std::string(namesInPath[index]), "upar");
441 
442  auto it = uparvals.begin();
443  it = uparvals.insert(it, uparvals.size());
444  auto noofanonparams = fv.get<double>("NoOfAnonParams");
445  noOfAnonParams = static_cast<int>(noofanonparams);
446 
447  for (auto i : fv.get<std::vector<double>>(std::string(namesInPath[index]), "NumWiresPerGrp")) {
448  wg.wiresInEachGroup.emplace_back(int(i));
449  }
450 
451  for (auto i : fv.get<std::vector<double>>(std::string(namesInPath[index]), "NumGroups")) {
452  wg.consecutiveGroups.emplace_back(int(i));
453  }
454 
455  auto wirespacing = fv.get<double>("WireSpacing");
456  wg.wireSpacing = static_cast<double>(wirespacing / dd4hep::mm);
457  edm::LogVerbatim("CSCGeometryParsFromDD") << "(2) wireSpacing: " << wg.wireSpacing;
458 
459  auto alignmentpintofirstwire = fv.get<double>("AlignmentPinToFirstWire");
460  wg.alignmentPinToFirstWire = static_cast<double>(alignmentpintofirstwire / dd4hep::mm);
461  edm::LogVerbatim("CSCGeometryParsFromDD") << "(3) alignmentPinToFirstWire: " << wg.alignmentPinToFirstWire;
462 
463  auto totnumwiregroups = fv.get<double>("TotNumWireGroups");
464  wg.numberOfGroups = static_cast<int>(totnumwiregroups);
465 
466  auto lengthoffirstwire = fv.get<double>("LengthOfFirstWire");
467  wg.narrowWidthOfWirePlane = static_cast<double>(lengthoffirstwire / dd4hep::mm);
468  edm::LogVerbatim("CSCGeometryParsFromDD") << "(4) narrowWidthOfWirePlane: " << wg.narrowWidthOfWirePlane;
469 
470  auto lengthoflastwire = fv.get<double>("LengthOfLastWire");
471  wg.wideWidthOfWirePlane = static_cast<double>(lengthoflastwire / dd4hep::mm);
472  edm::LogVerbatim("CSCGeometryParsFromDD") << "(5) wideWidthOfWirePlane: " << wg.wideWidthOfWirePlane;
473 
474  auto radialextentofwireplane = fv.get<double>("RadialExtentOfWirePlane");
475  wg.lengthOfWirePlane = static_cast<double>(radialextentofwireplane / dd4hep::mm);
476  edm::LogVerbatim("CSCGeometryParsFromDD") << "(6) lengthOfWirePlane: " << wg.lengthOfWirePlane;
477 
478  uparvals.emplace_back(wg.wireSpacing);
479  uparvals.emplace_back(wg.alignmentPinToFirstWire);
480  uparvals.emplace_back(wg.numberOfGroups);
481  uparvals.emplace_back(wg.narrowWidthOfWirePlane);
482  uparvals.emplace_back(wg.wideWidthOfWirePlane);
483  uparvals.emplace_back(wg.lengthOfWirePlane);
484  uparvals.emplace_back(wg.wiresInEachGroup.size());
485 
486  for (CSCWireGroupPackage::Container::const_iterator it = wg.wiresInEachGroup.begin();
487  it != wg.wiresInEachGroup.end();
488  ++it) {
489  uparvals.emplace_back(*it);
490  }
491  for (CSCWireGroupPackage::Container::const_iterator it = wg.consecutiveGroups.begin();
492  it != wg.consecutiveGroups.end();
493  ++it) {
494  uparvals.emplace_back(*it);
495  }
496 
498  }
499 
500  fpar.clear();
501 
502  std::string my_title(fv.solid()->GetTitle());
503 
504  if (my_title == "Subtraction") {
505  cms::DDSolid mysolid(fv.solid());
506  auto solidA = mysolid.solidA();
507  std::vector<double> dpar = solidA.dimensions();
508 
510  dpar.begin(), dpar.end(), dpar.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); });
511 
512  fpar.emplace_back((dpar[1] / dd4hep::cm));
513  fpar.emplace_back((dpar[2] / dd4hep::cm));
514  fpar.emplace_back((dpar[3] / dd4hep::cm));
515  fpar.emplace_back((dpar[4] / dd4hep::cm));
516  edm::LogVerbatim("CSCGeometryParsFromDD")
517  << "(7) - Subtraction - dpar[1] (ddd dpar[4]): " << dpar[1] / dd4hep::cm
518  << " (ddd dpar[8]): " << dpar[2] / dd4hep::cm << " dpar[3] (as ddd): " << dpar[3] / dd4hep::cm
519  << " dpar[4] (ddd dpar[0]): " << dpar[4] / dd4hep::cm;
520  } else {
521  dpar = fv.parameters();
522 
524  dpar.begin(), dpar.end(), dpar.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); });
525 
526  fpar.emplace_back((dpar[0] / dd4hep::cm));
527  fpar.emplace_back((dpar[1] / dd4hep::cm));
528  fpar.emplace_back((dpar[2] / dd4hep::cm));
529  fpar.emplace_back((dpar[3] / dd4hep::cm));
530  edm::LogVerbatim("CSCGeometryParsFromDD")
531  << "(7)Bis - Else - dpar[0]: " << dpar[0] / dd4hep::cm << " dpar[1]: " << dpar[1] / dd4hep::cm
532  << " dpar[2]: " << dpar[2] / dd4hep::cm << " dpar[3]: " << dpar[3] / dd4hep::cm;
533  }
534 
535  gtran[0] = static_cast<float>(fv.translation().X() / dd4hep::cm);
536  gtran[1] = static_cast<float>(fv.translation().Y() / dd4hep::cm);
537  gtran[2] = static_cast<float>(fv.translation().Z() / dd4hep::cm);
538 
539  edm::LogVerbatim("CSCGeometryParsFromDD")
540  << "(8) gtran[0]: " << gtran[0] / dd4hep::cm << " gtran[1]: " << gtran[1] / dd4hep::cm
541  << " gtran[2]: " << gtran[2] / dd4hep::cm;
542 
544  gtran.begin(), gtran.end(), gtran.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); });
545 
546  fv.rotation().GetComponents(trm.begin(), trm.end());
547  size_t rotindex = 0;
548  for (size_t i = 0; i < 9; ++i) {
549  grmat[i] = static_cast<float>(trm[rotindex]);
550  rotindex = rotindex + 3;
551  if ((i + 1) % 3 == 0) {
552  rotindex = (i + 1) / 3;
553  }
554  }
555 
556  if (wg.numberOfGroups == 0) {
557  LogTrace(myName) << myName << " wg.numberOfGroups == 0 ";
558  }
559 
560  if (jlayer == 0) { // Can only build chambers if we're filtering them
561 
562  if (jstation == 1 && jring == 1) {
563  std::transform(gtran.begin(), gtran.end(), gtran.begin(), [](double i) -> double {
565  });
566 
567  std::transform(grmat.begin(), grmat.end(), grmat.begin(), [](double i) -> double {
569  });
570 
572  fpar.begin(), fpar.end(), fpar.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); });
573 
574  rig.insert(id, gtran, grmat, fpar);
575  if (!chSpecsAlreadyExist) {
576  rdp.pChamberType.emplace_back(chamberType);
577  rdp.pUserParOffset.emplace_back(rdp.pfupars.size());
578  rdp.pUserParSize.emplace_back(uparvals.size());
579  std::copy(uparvals.begin(), uparvals.end(), std::back_inserter(rdp.pfupars));
580  }
581 
582  // No. of anonymous parameters per chamber type should be read from cscSpecs file...
583  // Only required for ME11 splitting into ME1a and ME1b values,
584  // If it isn't seen may as well try to get further but this value will depend
585  // on structure of the file so may not even match!
586  const int kNoOfAnonParams = 35;
587  if (noOfAnonParams == 0) {
588  noOfAnonParams = kNoOfAnonParams;
589  } // in case it wasn't seen
590 
591  // copy ME1a params from back to the front
592  std::copy(
593  uparvals.begin() + noOfAnonParams + 1, uparvals.begin() + (2 * noOfAnonParams) + 2, uparvals.begin() + 1);
594 
595  CSCDetId detid1a = CSCDetId(jendcap, 1, 4, jchamber, 0); // reset to ME1A
596 
597  std::transform(gtran.begin(), gtran.end(), gtran.begin(), [](double i) -> double {
599  });
600 
601  std::transform(grmat.begin(), grmat.end(), grmat.begin(), [](double i) -> double {
603  });
604 
606  fpar.begin(), fpar.end(), fpar.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); });
607 
608  rig.insert(detid1a.rawId(), gtran, grmat, fpar);
609  int chtypeA = CSCChamberSpecs::whatChamberType(1, 4);
610  ct = 0;
611  for (; ct < rdp.pChamberType.size(); ++ct) {
612  if (chtypeA == rdp.pChamberType[ct]) {
613  break;
614  }
615  }
616  if (ct < rdp.pChamberType.size() && rdp.pChamberType[ct] == chtypeA) {
617  // then its in already, don't put it
618  LogTrace(myName) << myName << " ct < rdp.pChamberType.size() && rdp.pChamberType[ct] == chtypeA ";
619  } else {
620  rdp.pChamberType.emplace_back(chtypeA);
621  rdp.pUserParOffset.emplace_back(rdp.pfupars.size());
622  rdp.pUserParSize.emplace_back(uparvals.size());
623  std::copy(uparvals.begin(), uparvals.end(), std::back_inserter(rdp.pfupars));
624  }
625 
626  } else {
627  std::transform(gtran.begin(), gtran.end(), gtran.begin(), [](double i) -> double {
629  });
630 
631  std::transform(grmat.begin(), grmat.end(), grmat.begin(), [](double i) -> double {
633  });
634 
636  fpar.begin(), fpar.end(), fpar.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); });
637 
638  rig.insert(id, gtran, grmat, fpar);
639  if (!chSpecsAlreadyExist) {
640  rdp.pChamberType.emplace_back(chamberType);
641  rdp.pUserParOffset.emplace_back(rdp.pfupars.size());
642  rdp.pUserParSize.emplace_back(uparvals.size());
643  std::copy(uparvals.begin(), uparvals.end(), std::back_inserter(rdp.pfupars));
644  }
645  }
646 
647  } // filtering chambers.
648  }
649 
650  return true;
651 }

References CSCWireGroupPackage::alignmentPinToFirstWire, CSCNumberingScheme::baseNumberToUnitNumber(), CSCDetId::chamber(), CSCWireGroupPackage::consecutiveGroups, filterCSVwithJSON::copy, CSCDetId::endcap(), ALCARECOTkAlBeamHalo_cff::filter, cms::DDFilteredView::firstChild(), newFWLiteAna::found, MuonGeometryNumbering::geoHistoryToBaseNumber(), cms::DDFilteredView::get(), cms::DDFilteredView::history(), mps_fire::i, RecoIdealGeometry::insert(), CSCDetId::layer(), CSCWireGroupPackage::lengthOfWirePlane, LogTrace, myName, cms::DDFilteredView::name(), CSCWireGroupPackage::narrowWidthOfWirePlane, CSCWireGroupPackage::numberOfGroups, cms::DDFilteredView::parameters(), CSCRecoDigiParameters::pChamberType, CSCRecoDigiParameters::pfupars, CSCRecoDigiParameters::pUserParOffset, CSCRecoDigiParameters::pUserParSize, CSCDetId::ring(), cms::DDFilteredView::rotation(), cms_rounding::roundIfNear0(), cms::DDFilteredView::solid(), cms::DDSolid::solidA(), cms::DDCompactView::specpars(), CSCDetId::station(), AlCaHLTBitMon_QueryRunRegistry::string, HcalDetIdTransform::transform(), cms::DDFilteredView::translation(), CSCChamberSpecs::whatChamberType(), CSCWireGroupPackage::wideWidthOfWirePlane, CSCWireGroupPackage::wiresInEachGroup, and CSCWireGroupPackage::wireSpacing.

◆ build() [2/2]

bool CSCGeometryParsFromDD::build ( const DDCompactView cview,
const MuonGeometryConstants muonConstants,
RecoIdealGeometry rig,
CSCRecoDigiParameters rdp 
)

Build the geometry returning the RecoIdealGeometry and the CSCRecoDigiParameters objects.

stuff: using a constructed wg to deconstruct it and put it in db... alternative? use temporary (not wg!) storage.

format as inserted is best documented by the actualy emplace_back statements below.

fupar size now becomes origSize+6+wg.wiresInEachGroup.size()+wg.consecutiveGroups.size()

end stuff

Definition at line 41 of file CSCGeometryParsFromDD.cc.

44  {
45  std::string attribute = "MuStructure"; // could come from outside
46  std::string value = "MuonEndcapCSC"; // could come from outside
47 
48  // Asking for a specific section of the MuStructure
49 
51 
52  DDFilteredView fv(*cview, filter);
53 
54  bool doSubDets = fv.firstChild();
55 
56  if (!doSubDets) {
57  edm::LogError("CSCGeometryParsFromDD")
58  << "Can not proceed, no CSC parts found with the filter. The current node is: " << fv.logicalPart().toString();
59  return false;
60  }
61  int noOfAnonParams = 0;
62  std::vector<const DDsvalues_type*> spec = fv.specifics();
63  std::vector<const DDsvalues_type*>::const_iterator spit = spec.begin();
64  std::vector<double> uparvals;
65  std::vector<double> fpar;
66  std::vector<double> dpar;
67  std::vector<double> gtran(3);
68  std::vector<double> grmat(9);
69  std::vector<double> trm(9);
70 
71  edm::LogVerbatim("CSCGeometryParsFromDD") << "(0) CSCGeometryParsFromDD - DDD ";
72 
73  while (doSubDets) {
74  spec = fv.specifics();
75  spit = spec.begin();
76 
77  // get numbering information early for possible speed up of code.
78 
79  LogTrace(myName) << myName << ": create numbering scheme...";
80 
81  MuonGeometryNumbering mdn(muonConstants);
82  MuonBaseNumber mbn = mdn.geoHistoryToBaseNumber(fv.geoHistory());
83  CSCNumberingScheme mens(muonConstants);
84 
85  LogTrace(myName) << myName << ": find detid...";
86 
87  int id = mens.baseNumberToUnitNumber(mbn); //@@ FIXME perhaps should return CSCDetId itself?
88 
89  LogTrace(myName) << myName << ": raw id for this detector is " << id << ", octal " << std::oct << id << ", hex "
90  << std::hex << id << std::dec;
91 
92  CSCDetId detid = CSCDetId(id);
93  int jendcap = detid.endcap();
94  int jstation = detid.station();
95  int jring = detid.ring();
96  int jchamber = detid.chamber();
97  int jlayer = detid.layer();
98 
99  edm::LogVerbatim("CSCGeometryParsFromDD")
100  << "(1) detId: " << id << " jendcap: " << jendcap << " jstation: " << jstation << " jring: " << jring
101  << " jchamber: " << jchamber << " jlayer: " << jlayer;
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  edm::LogVerbatim("CSCGeometryParsFromDD") << "(2) wireSpacing: " << wg.wireSpacing;
150  } else if (it->second.name() == "AlignmentPinToFirstWire") {
151  wg.alignmentPinToFirstWire = it->second.doubles()[0];
152  edm::LogVerbatim("CSCGeometryParsFromDD") << "(3) alignmentPinToFirstWire: " << wg.alignmentPinToFirstWire;
153  } else if (it->second.name() == "TotNumWireGroups") {
154  wg.numberOfGroups = int(it->second.doubles()[0]);
155  } else if (it->second.name() == "LengthOfFirstWire") {
156  wg.narrowWidthOfWirePlane = it->second.doubles()[0];
157  edm::LogVerbatim("CSCGeometryParsFromDD") << "(4) narrowWidthOfWirePlane: " << wg.narrowWidthOfWirePlane;
158  } else if (it->second.name() == "LengthOfLastWire") {
159  wg.wideWidthOfWirePlane = it->second.doubles()[0];
160  edm::LogVerbatim("CSCGeometryParsFromDD") << "(5) wideWidthOfWirePlane: " << wg.wideWidthOfWirePlane;
161  } else if (it->second.name() == "RadialExtentOfWirePlane") {
162  wg.lengthOfWirePlane = it->second.doubles()[0];
163  edm::LogVerbatim("CSCGeometryParsFromDD") << "(6) lengthOfWirePlane: " << wg.lengthOfWirePlane;
164  }
165  }
166  }
167 
175  uparvals.emplace_back(wg.wireSpacing);
176 
177  uparvals.emplace_back(wg.alignmentPinToFirstWire);
178  uparvals.emplace_back(wg.numberOfGroups);
179  uparvals.emplace_back(wg.narrowWidthOfWirePlane);
180  uparvals.emplace_back(wg.wideWidthOfWirePlane);
181  uparvals.emplace_back(wg.lengthOfWirePlane);
182  uparvals.emplace_back(wg.wiresInEachGroup.size());
183  for (CSCWireGroupPackage::Container::const_iterator it = wg.wiresInEachGroup.begin();
184  it != wg.wiresInEachGroup.end();
185  ++it) {
186  uparvals.emplace_back(*it);
187  }
188  for (CSCWireGroupPackage::Container::const_iterator it = wg.consecutiveGroups.begin();
189  it != wg.consecutiveGroups.end();
190  ++it) {
191  uparvals.emplace_back(*it);
192  }
193 
195  }
196 
197  fpar.clear();
198 
199  if (fv.logicalPart().solid().shape() == DDSolidShape::ddsubtraction) {
200  const DDSubtraction& first = fv.logicalPart().solid();
201  const DDSubtraction& second = first.solidA();
202  const DDSolid& third = second.solidA();
203  dpar = third.parameters();
205  dpar.begin(), dpar.end(), dpar.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); });
206 
207  } else {
208  dpar = fv.logicalPart().solid().parameters();
210  dpar.begin(), dpar.end(), dpar.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); });
211  }
212 
213  LogTrace(myName) << myName << ": noOfAnonParams=" << noOfAnonParams;
214  LogTrace(myName) << myName << ": fill fpar...";
215  LogTrace(myName) << myName << ": dpars are... " << convertMmToCm(dpar[4]) << ", " << convertMmToCm(dpar[8]) << ", "
216  << convertMmToCm(dpar[3]) << ", " << convertMmToCm(dpar[0]);
217  edm::LogVerbatim("CSCGeometryParsFromDD")
218  << "(7) dpar[4]: " << convertMmToCm(dpar[4]) << " dpar[8]: " << convertMmToCm(dpar[8])
219  << " dpar[3]: " << convertMmToCm(dpar[3]) << " dpar[0]: " << convertMmToCm(dpar[0]);
220 
221  fpar.emplace_back(convertMmToCm(dpar[4]));
222  fpar.emplace_back(convertMmToCm(dpar[8]));
223  fpar.emplace_back(convertMmToCm(dpar[3]));
224  fpar.emplace_back(convertMmToCm(dpar[0]));
225 
226  LogTrace(myName) << myName << ": fill gtran...";
227 
228  gtran[0] = (float)1.0 * (convertMmToCm(fv.translation().X()));
229  gtran[1] = (float)1.0 * (convertMmToCm(fv.translation().Y()));
230  gtran[2] = (float)1.0 * (convertMmToCm(fv.translation().Z()));
231 
232  LogTrace(myName) << myName << ": gtran[0]=" << gtran[0] << ", gtran[1]=" << gtran[1] << ", gtran[2]=" << gtran[2];
233 
234  edm::LogVerbatim("CSCGeometryParsFromDD")
235  << "(8) gtran[0]: " << gtran[0] << " gtran[1]: " << gtran[1] << " gtran[2]: " << gtran[2];
236 
237  LogTrace(myName) << myName << ": fill grmat...";
238 
239  fv.rotation().GetComponents(trm.begin(), trm.end());
240  size_t rotindex = 0;
241  for (size_t i = 0; i < 9; ++i) {
242  grmat[i] = (float)1.0 * trm[rotindex];
243  rotindex = rotindex + 3;
244  if ((i + 1) % 3 == 0) {
245  rotindex = (i + 1) / 3;
246  }
247  }
248  LogTrace(myName) << myName << ": looking for wire group info for layer "
249  << "E" << CSCDetId::endcap(id) << " S" << CSCDetId::station(id) << " R" << CSCDetId::ring(id)
250  << " C" << CSCDetId::chamber(id) << " L" << CSCDetId::layer(id);
251 
252  if (wg.numberOfGroups != 0) {
253  LogTrace(myName) << myName << ": fv.geoHistory: = " << fv.geoHistory();
254  LogTrace(myName) << myName << ": TotNumWireGroups = " << wg.numberOfGroups;
255  LogTrace(myName) << myName << ": WireSpacing = " << wg.wireSpacing;
256  LogTrace(myName) << myName << ": AlignmentPinToFirstWire = " << wg.alignmentPinToFirstWire;
257  LogTrace(myName) << myName << ": Narrow width of wire plane = " << wg.narrowWidthOfWirePlane;
258  LogTrace(myName) << myName << ": Wide width of wire plane = " << wg.wideWidthOfWirePlane;
259  LogTrace(myName) << myName << ": Length in y of wire plane = " << wg.lengthOfWirePlane;
260  LogTrace(myName) << myName << ": wg.consecutiveGroups.size() = " << wg.consecutiveGroups.size();
261  LogTrace(myName) << myName << ": wg.wiresInEachGroup.size() = " << wg.wiresInEachGroup.size();
262  LogTrace(myName) << myName << ": \tNumGroups\tWiresInGroup";
263  for (size_t i = 0; i < wg.consecutiveGroups.size(); i++) {
264  LogTrace(myName) << myName << " \t" << wg.consecutiveGroups[i] << "\t\t" << wg.wiresInEachGroup[i];
265  }
266  } else {
267  LogTrace(myName) << myName << ": DDD is MISSING SpecPars for wire groups";
268  }
269  LogTrace(myName) << myName << ": end of wire group info. ";
270 
271  LogTrace(myName) << myName << ":_z_ E" << jendcap << " S" << jstation << " R" << jring << " C" << jchamber << " L"
272  << jlayer << " gx=" << gtran[0] << ", gy=" << gtran[1] << ", gz=" << gtran[2]
273  << " thickness=" << fpar[2] * 2.;
274 
275  if (jlayer == 0) { // Can only build chambers if we're filtering them
276 
277  LogTrace(myName) << myName << ":_z_ frame=" << uparvals[31] / 10. << " gap=" << uparvals[32] / 10.
278  << " panel=" << uparvals[33] / 10. << " offset=" << uparvals[34] / 10.;
279 
280  if (jstation == 1 && jring == 1) {
281  // set up params for ME1a and ME1b and call buildChamber *for each*
282  // Both get the full ME11 dimensions
283 
284  // detid is for ME11 and that's what we're using for ME1b in the software
285 
286  std::transform(gtran.begin(), gtran.end(), gtran.begin(), [](double i) -> double {
288  });
289  std::transform(grmat.begin(), grmat.end(), grmat.begin(), [](double i) -> double {
291  });
293  fpar.begin(), fpar.end(), fpar.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); });
294 
295  rig.insert(id, gtran, grmat, fpar);
296  if (!chSpecsAlreadyExist) {
297  LogDebug(myName) << " inserting chamber type " << chamberType << std::endl;
298  rdp.pChamberType.emplace_back(chamberType);
299  rdp.pUserParOffset.emplace_back(rdp.pfupars.size());
300  rdp.pUserParSize.emplace_back(uparvals.size());
301  std::copy(uparvals.begin(), uparvals.end(), std::back_inserter(rdp.pfupars));
302  }
303 
304  // No. of anonymous parameters per chamber type should be read from cscSpecs file...
305  // Only required for ME11 splitting into ME1a and ME1b values,
306  // If it isn't seen may as well try to get further but this value will depend
307  // on structure of the file so may not even match!
308  const int kNoOfAnonParams = 35;
309  if (noOfAnonParams == 0) {
310  noOfAnonParams = kNoOfAnonParams;
311  } // in case it wasn't seen
312 
313  // copy ME1a params from back to the front
314  std::copy(
315  uparvals.begin() + noOfAnonParams + 1, uparvals.begin() + (2 * noOfAnonParams) + 2, uparvals.begin() + 1);
316 
317  CSCDetId detid1a = CSCDetId(jendcap, 1, 4, jchamber, 0); // reset to ME1A
318 
319  std::transform(gtran.begin(), gtran.end(), gtran.begin(), [](double i) -> double {
321  });
322  std::transform(grmat.begin(), grmat.end(), grmat.begin(), [](double i) -> double {
324  });
326  fpar.begin(), fpar.end(), fpar.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); });
327 
328  rig.insert(detid1a.rawId(), gtran, grmat, fpar);
329  int chtypeA = CSCChamberSpecs::whatChamberType(1, 4);
330  ct = 0;
331  for (; ct < rdp.pChamberType.size(); ++ct) {
332  if (chtypeA == rdp.pChamberType[ct]) {
333  break;
334  }
335  }
336  if (ct < rdp.pChamberType.size() && rdp.pChamberType[ct] == chtypeA) {
337  // then its in already, don't put it
338  LogDebug(myName) << "found chamber type " << chtypeA << " so don't put it in! ";
339  } else {
340  LogDebug(myName) << " inserting chamber type " << chtypeA;
341  rdp.pChamberType.emplace_back(chtypeA);
342  rdp.pUserParOffset.emplace_back(rdp.pfupars.size());
343  rdp.pUserParSize.emplace_back(uparvals.size());
344  std::copy(uparvals.begin(), uparvals.end(), std::back_inserter(rdp.pfupars));
345  }
346 
347  } else {
348  std::transform(gtran.begin(), gtran.end(), gtran.begin(), [](double i) -> double {
350  });
351  std::transform(grmat.begin(), grmat.end(), grmat.begin(), [](double i) -> double {
353  });
355  fpar.begin(), fpar.end(), fpar.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); });
356  rig.insert(id, gtran, grmat, fpar);
357  if (!chSpecsAlreadyExist) {
358  LogDebug(myName) << " inserting chamber type " << chamberType;
359  rdp.pChamberType.emplace_back(chamberType);
360  rdp.pUserParOffset.emplace_back(rdp.pfupars.size());
361  rdp.pUserParSize.emplace_back(uparvals.size());
362  std::copy(uparvals.begin(), uparvals.end(), std::back_inserter(rdp.pfupars));
363  }
364  }
365 
366  } // filtering chambers.
367 
368  doSubDets = fv.next();
369  }
370  return true;
371 }

References CSCWireGroupPackage::alignmentPinToFirstWire, CSCNumberingScheme::baseNumberToUnitNumber(), CSCDetId::chamber(), CSCWireGroupPackage::consecutiveGroups, geant_units::operators::convertMmToCm(), filterCSVwithJSON::copy, ddsubtraction, TauDecayModes::dec, CSCDetId::endcap(), ALCARECOTkAlBeamHalo_cff::filter, first, DDFilteredView::firstChild(), dqmMemoryStats::float, DDFilteredView::geoHistory(), MuonGeometryNumbering::geoHistoryToBaseNumber(), mps_fire::i, RecoIdealGeometry::insert(), createfilelist::int, CSCDetId::layer(), CSCWireGroupPackage::lengthOfWirePlane, LogDebug, DDFilteredView::logicalPart(), LogTrace, myName, CSCWireGroupPackage::narrowWidthOfWirePlane, DDFilteredView::next(), CSCWireGroupPackage::numberOfGroups, DDSolid::parameters(), CSCRecoDigiParameters::pChamberType, CSCRecoDigiParameters::pfupars, CSCRecoDigiParameters::pUserParOffset, CSCRecoDigiParameters::pUserParSize, CSCDetId::ring(), DDFilteredView::rotation(), cms_rounding::roundIfNear0(), edm::second(), DDSolid::shape(), DDLogicalPart::solid(), DDFilteredView::specifics(), CSCDetId::station(), AlCaHLTBitMon_QueryRunRegistry::string, trklet::third, DDBase< N, C >::toString(), HcalDetIdTransform::transform(), DDFilteredView::translation(), CSCChamberSpecs::whatChamberType(), CSCWireGroupPackage::wideWidthOfWirePlane, CSCWireGroupPackage::wiresInEachGroup, and CSCWireGroupPackage::wireSpacing.

Referenced by CSCRecoIdealDBLoader::beginRun(), and CSCGeometryBuilderFromDDD::build().

Member Data Documentation

◆ myName

std::string CSCGeometryParsFromDD::myName
private

Definition at line 50 of file CSCGeometryParsFromDD.h.

Referenced by build().

cms::DDSolid
Definition: DDFilteredView.h:33
mps_fire.i
i
Definition: mps_fire.py:428
CSCWireGroupPackage::lengthOfWirePlane
double lengthOfWirePlane
Definition: CSCWireGroupPackage.h:37
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
CSCWireGroupPackage::consecutiveGroups
Container consecutiveGroups
Definition: CSCWireGroupPackage.h:28
CSCDetId::ring
int ring() const
Definition: CSCDetId.h:68
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
cms::DDFilteredView
Definition: DDFilteredView.h:70
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
cms::DDSolid::solidA
dd4hep::Solid solidA() const
Definition: DDFilteredView.cc:17
CSCRecoDigiParameters::pfupars
std::vector< float > pfupars
Definition: CSCRecoDigiParameters.h:26
cms::DDSpecParRegistry
dd4hep::SpecParRegistry DDSpecParRegistry
Definition: DDCompactView.h:28
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
cms::DDFilter
Definition: DDFilteredView.h:59
CSCDetId::layer
int layer() const
Definition: CSCDetId.h:56
CSCWireGroupPackage::narrowWidthOfWirePlane
double narrowWidthOfWirePlane
Definition: CSCWireGroupPackage.h:35
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
CSCWireGroupPackage::wideWidthOfWirePlane
double wideWidthOfWirePlane
Definition: CSCWireGroupPackage.h:36
ALCARECOTkAlBeamHalo_cff.filter
filter
Definition: ALCARECOTkAlBeamHalo_cff.py:27
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:125
CSCRecoDigiParameters::pUserParSize
std::vector< int > pUserParSize
Definition: CSCRecoDigiParameters.h:24
CSCRecoDigiParameters::pUserParOffset
std::vector< int > pUserParOffset
Definition: CSCRecoDigiParameters.h:23
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
CSCWireGroupPackage::wireSpacing
double wireSpacing
Definition: CSCWireGroupPackage.h:33
CSCWireGroupPackage::wiresInEachGroup
Container wiresInEachGroup
Definition: CSCWireGroupPackage.h:31
CSCDetId
Definition: CSCDetId.h:26
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
CSCRecoDigiParameters::pChamberType
std::vector< int > pChamberType
Definition: CSCRecoDigiParameters.h:25
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
CSCWireGroupPackage
Definition: CSCWireGroupPackage.h:18
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::DDCompactView::specpars
DDSpecParRegistry const & specpars() const
Definition: DDCompactView.h:35
CSCChamberSpecs::whatChamberType
static int whatChamberType(int istation, int iring)
Definition: CSCChamberSpecs.cc:164
MuonBaseNumber
Definition: MuonBaseNumber.h:21
CSCWireGroupPackage::numberOfGroups
int numberOfGroups
Definition: CSCWireGroupPackage.h:32
DDValue
Definition: DDValue.h:22
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
CSCDetId::endcap
int endcap() const
Definition: CSCDetId.h:85
CSCWireGroupPackage::alignmentPinToFirstWire
double alignmentPinToFirstWire
Definition: CSCWireGroupPackage.h:34
DDSolid
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
DDSpecificsMatchesValueFilter
Definition: DDFilter.h:70
MuonGeometryNumbering
Definition: MuonGeometryNumbering.h:24
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
DDFilteredView
Definition: DDFilteredView.h:20
geant_units::operators::convertMmToCm
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:63
CSCNumberingScheme
Definition: CSCNumberingScheme.h:18
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
trklet::third
constexpr double third
Definition: Settings.h:42
CSCDetId::station
int station() const
Definition: CSCDetId.h:79
DDSubtraction
Definition: DDSolid.h:336
DDSolidShape::ddsubtraction
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
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
CSCGeometryParsFromDD::myName
std::string myName
Definition: CSCGeometryParsFromDD.h:50