58 <<
"Can not proceed, no CSC parts found with the filter. The current node is: " << fv.
logicalPart().
toString();
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);
71 edm::LogVerbatim(
"CSCGeometryParsFromDD") <<
"(0) CSCGeometryParsFromDD - DDD ";
89 LogTrace(
myName) <<
myName <<
": raw id for this detector is " <<
id <<
", octal " << std::oct <<
id <<
", hex " 93 int jendcap = detid.
endcap();
95 int jring = detid.
ring();
97 int jlayer = detid.
layer();
100 <<
"(1) detId: " <<
id <<
" jendcap: " << jendcap <<
" jstation: " << jstation <<
" jring: " << jring
101 <<
" jchamber: " << jchamber <<
" jlayer: " << jlayer;
113 bool chSpecsAlreadyExist =
false;
123 chSpecsAlreadyExist =
true;
125 for (; spit != spec.end(); spit++) {
126 DDsvalues_type::const_iterator
it = (**spit).begin();
127 for (;
it != (**spit).end();
it++) {
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);
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()) {
143 }
else if (
it->second.name() ==
"NumGroups") {
144 for (
double i :
it->second.doubles()) {
147 }
else if (
it->second.name() ==
"WireSpacing") {
150 }
else if (
it->second.name() ==
"AlignmentPinToFirstWire") {
153 }
else if (
it->second.name() ==
"TotNumWireGroups") {
155 }
else if (
it->second.name() ==
"LengthOfFirstWire") {
158 }
else if (
it->second.name() ==
"LengthOfLastWire") {
161 }
else if (
it->second.name() ==
"RadialExtentOfWirePlane") {
186 uparvals.emplace_back(*
it);
191 uparvals.emplace_back(*
it);
203 dpar =
third.parameters();
232 LogTrace(
myName) <<
myName <<
": gtran[0]=" << gtran[0] <<
", gtran[1]=" << gtran[1] <<
", gtran[2]=" << gtran[2];
235 <<
"(8) gtran[0]: " << gtran[0] <<
" gtran[1]: " << gtran[1] <<
" gtran[2]: " << gtran[2];
239 fv.
rotation().GetComponents(trm.begin(), trm.end());
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;
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.;
277 LogTrace(
myName) <<
myName <<
":_z_ frame=" << uparvals[31] / 10. <<
" gap=" << uparvals[32] / 10.
278 <<
" panel=" << uparvals[33] / 10. <<
" offset=" << uparvals[34] / 10.;
280 if (jstation == 1 && jring == 1) {
286 std::transform(gtran.begin(), gtran.end(), gtran.begin(), [](
double i) ->
double {
289 std::transform(grmat.begin(), grmat.end(), grmat.begin(), [](
double i) ->
double {
295 rig.
insert(
id, gtran, grmat, fpar);
296 if (!chSpecsAlreadyExist) {
301 std::copy(uparvals.begin(), uparvals.end(), std::back_inserter(rdp.
pfupars));
308 const int kNoOfAnonParams = 35;
309 if (noOfAnonParams == 0) {
310 noOfAnonParams = kNoOfAnonParams;
315 uparvals.begin() + noOfAnonParams + 1, uparvals.begin() + (2 * noOfAnonParams) + 2, uparvals.begin() + 1);
319 std::transform(gtran.begin(), gtran.end(), gtran.begin(), [](
double i) ->
double {
322 std::transform(grmat.begin(), grmat.end(), grmat.begin(), [](
double i) ->
double {
328 rig.
insert(detid1a.rawId(), gtran, grmat, fpar);
338 LogDebug(
myName) <<
"found chamber type " << chtypeA <<
" so don't put it in! ";
344 std::copy(uparvals.begin(), uparvals.end(), std::back_inserter(rdp.
pfupars));
348 std::transform(gtran.begin(), gtran.end(), gtran.begin(), [](
double i) ->
double {
351 std::transform(grmat.begin(), grmat.end(), grmat.begin(), [](
double i) ->
double {
356 rig.
insert(
id, gtran, grmat, fpar);
357 if (!chSpecsAlreadyExist) {
362 std::copy(uparvals.begin(), uparvals.end(), std::back_inserter(rdp.
pfupars));
368 doSubDets = fv.
next();
384 int noOfAnonParams = 0;
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);
393 edm::LogVerbatim(
"CSCGeometryParsFromDD") <<
"(0) CSCGeometryParsFromDD - DD4hep ";
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();
408 <<
"(1) detId: " <<
id <<
" jendcap: " << jendcap <<
" jstation: " << jstation <<
" jring: " << jring
409 <<
" jchamber: " << jchamber <<
" jlayer: " << jlayer;
419 bool chSpecsAlreadyExist =
false;
428 chSpecsAlreadyExist =
true;
430 std::string_view my_name_bis = fv.
name();
432 std::vector<std::string_view> namesInPath = mypar.names(
"//" + my_name_tris);
436 std::size_t
found = namesInPath[
i].find(my_string);
437 if (
found != std::string::npos)
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);
455 auto wirespacing = fv.
get<
double>(
"WireSpacing");
456 wg.
wireSpacing =
static_cast<double>(wirespacing / dd4hep::mm);
459 auto alignmentpintofirstwire = fv.
get<
double>(
"AlignmentPinToFirstWire");
463 auto totnumwiregroups = fv.
get<
double>(
"TotNumWireGroups");
466 auto lengthoffirstwire = fv.
get<
double>(
"LengthOfFirstWire");
470 auto lengthoflastwire = fv.
get<
double>(
"LengthOfLastWire");
474 auto radialextentofwireplane = fv.
get<
double>(
"RadialExtentOfWirePlane");
475 wg.
lengthOfWirePlane =
static_cast<double>(radialextentofwireplane / dd4hep::mm);
489 uparvals.emplace_back(*
it);
494 uparvals.emplace_back(*
it);
504 if (my_title ==
"Subtraction") {
506 auto solidA = mysolid.
solidA();
507 std::vector<double> dpar = solidA.dimensions();
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));
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;
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));
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;
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);
540 <<
"(8) gtran[0]: " << gtran[0] / dd4hep::cm <<
" gtran[1]: " << gtran[1] / dd4hep::cm
541 <<
" gtran[2]: " << gtran[2] / dd4hep::cm;
546 fv.
rotation().GetComponents(trm.begin(), trm.end());
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;
562 if (jstation == 1 && jring == 1) {
563 std::transform(gtran.begin(), gtran.end(), gtran.begin(), [](
double i) ->
double {
567 std::transform(grmat.begin(), grmat.end(), grmat.begin(), [](
double i) ->
double {
574 rig.
insert(
id, gtran, grmat, fpar);
575 if (!chSpecsAlreadyExist) {
579 std::copy(uparvals.begin(), uparvals.end(), std::back_inserter(rdp.
pfupars));
586 const int kNoOfAnonParams = 35;
587 if (noOfAnonParams == 0) {
588 noOfAnonParams = kNoOfAnonParams;
593 uparvals.begin() + noOfAnonParams + 1, uparvals.begin() + (2 * noOfAnonParams) + 2, uparvals.begin() + 1);
597 std::transform(gtran.begin(), gtran.end(), gtran.begin(), [](
double i) ->
double {
601 std::transform(grmat.begin(), grmat.end(), grmat.begin(), [](
double i) ->
double {
608 rig.
insert(detid1a.rawId(), gtran, grmat, fpar);
618 LogTrace(
myName) <<
myName <<
" ct < rdp.pChamberType.size() && rdp.pChamberType[ct] == chtypeA ";
623 std::copy(uparvals.begin(), uparvals.end(), std::back_inserter(rdp.
pfupars));
627 std::transform(gtran.begin(), gtran.end(), gtran.begin(), [](
double i) ->
double {
631 std::transform(grmat.begin(), grmat.end(), grmat.begin(), [](
double i) ->
double {
638 rig.
insert(
id, gtran, grmat, fpar);
639 if (!chSpecsAlreadyExist) {
643 std::copy(uparvals.begin(), uparvals.end(), std::back_inserter(rdp.
pfupars));
Log< level::Info, true > LogVerbatim
static int whatChamberType(int istation, int iring)
bool insert(DetId id, const std::vector< double > &trans, const std::vector< double > &rot, const std::vector< double > &pars)
double narrowWidthOfWirePlane
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Container wiresInEachGroup
virtual ~CSCGeometryParsFromDD()
Destructor.
DDSpecParRegistry const & specpars() const
Log< level::Error, false > LogError
dd4hep::Solid solidA() const
Compact representation of the geometrical detector hierarchy.
A DDSolid represents the shape of a part.
dd4hep::SpecParRegistry DDSpecParRegistry
std::vector< float > pfupars
U second(std::pair< T, U > const &p)
std::string_view name() const
bool next()
set current node to the next node in the filtered tree
const ExpandedNodes & history()
The numbering history of the current node.
std::vector< int > pChamberType
std::vector< int > pUserParOffset
double wideWidthOfWirePlane
std::string toString() const
constexpr valType roundIfNear0(valType value, double tolerance=1.e-7)
bool firstChild()
set the current node to the first child
DDSolidShape shape(void) const
The type of the solid.
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
T get(const std::string &)
extract attribute value
int baseNumberToUnitNumber(const MuonBaseNumber &) const override
std::vector< const DDsvalues_type * > specifics() const
constexpr NumType convertMmToCm(NumType millimeters)
std::vector< int > pUserParSize
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
dd4hep::Solid solid() const
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
bool build(const DDCompactView *cview, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rig, CSCRecoDigiParameters &rdp)
Build the geometry returning the RecoIdealGeometry and the CSCRecoDigiParameters objects.
const RotationMatrix rotation() const
bool firstChild()
set the current node to the first child ...
CSCGeometryParsFromDD()
Constructor.
Container consecutiveGroups
const DDTranslation & translation() const
The absolute translation of the current node.
const std::vector< double > parameters() const
extract shape parameters
MuonBaseNumber geoHistoryToBaseNumber(const DDGeoHistory &history) const
double alignmentPinToFirstWire
const Translation translation() const