27 #include "CLHEP/Units/GlobalSystemOfUnits.h"
65 <<
"Can not proceed, no CSC parts found with the filter. The current node is: " << fv.
logicalPart().
toString();
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);
93 LogTrace(
myName) <<
myName <<
": raw id for this detector is " <<
id <<
", octal " << std::oct <<
id <<
", hex "
97 int jendcap = detid.
endcap();
99 int jring = detid.
ring();
100 int jchamber = detid.
chamber();
101 int jlayer = detid.
layer();
113 bool chSpecsAlreadyExist =
false;
121 LogDebug(
myName) <<
"already found a " << chamberType <<
" at index " << ct;
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") {
149 }
else if (it->second.name() ==
"AlignmentPinToFirstWire") {
151 }
else if (it->second.name() ==
"TotNumWireGroups") {
153 }
else if (it->second.name() ==
"LengthOfFirstWire") {
155 }
else if (it->second.name() ==
"LengthOfLastWire") {
157 }
else if (it->second.name() ==
"RadialExtentOfWirePlane") {
178 for (CSCWireGroupPackage::Container::const_iterator it = wg.
wiresInEachGroup.begin();
181 uparvals.emplace_back(*it);
183 for (CSCWireGroupPackage::Container::const_iterator it = wg.
consecutiveGroups.begin();
186 uparvals.emplace_back(*it);
210 LogTrace(
myName) <<
myName <<
": dpars are... " << dpar[4] / cm <<
", " << dpar[8] / cm <<
", " << dpar[3] / cm
211 <<
", " << dpar[0] / cm;
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));
224 LogTrace(
myName) <<
myName <<
": gtran[0]=" << gtran[0] <<
", gtran[1]=" << gtran[1] <<
", gtran[2]=" << gtran[2];
228 fv.
rotation().GetComponents(trm.begin(), trm.end());
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;
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.;
266 LogTrace(
myName) <<
myName <<
":_z_ frame=" << uparvals[31] / 10. <<
" gap=" << uparvals[32] / 10.
267 <<
" panel=" << uparvals[33] / 10. <<
" offset=" << uparvals[34] / 10.;
269 if (jstation == 1 && jring == 1) {
275 std::transform(gtran.begin(), gtran.end(), gtran.begin(), [](
double i) ->
double {
278 std::transform(grmat.begin(), grmat.end(), grmat.begin(), [](
double i) ->
double {
284 rig.
insert(
id, gtran, grmat, fpar);
285 if (!chSpecsAlreadyExist) {
286 LogDebug(
myName) <<
" inserting chamber type " << chamberType << std::endl;
290 std::copy(uparvals.begin(), uparvals.end(), std::back_inserter(rdp.
pfupars));
297 const int kNoOfAnonParams = 35;
298 if (noOfAnonParams == 0) {
299 noOfAnonParams = kNoOfAnonParams;
304 uparvals.begin() + noOfAnonParams + 1, uparvals.begin() + (2 * noOfAnonParams) + 2, uparvals.begin() + 1);
308 std::transform(gtran.begin(), gtran.end(), gtran.begin(), [](
double i) ->
double {
311 std::transform(grmat.begin(), grmat.end(), grmat.begin(), [](
double i) ->
double {
317 rig.
insert(detid1a.rawId(), gtran, grmat, fpar);
327 LogDebug(
myName) <<
"found chamber type " << chtypeA <<
" so don't put it in! ";
333 std::copy(uparvals.begin(), uparvals.end(), std::back_inserter(rdp.
pfupars));
337 std::transform(gtran.begin(), gtran.end(), gtran.begin(), [](
double i) ->
double {
340 std::transform(grmat.begin(), grmat.end(), grmat.begin(), [](
double i) ->
double {
345 rig.
insert(
id, gtran, grmat, fpar);
346 if (!chSpecsAlreadyExist) {
351 std::copy(uparvals.begin(), uparvals.end(), std::back_inserter(rdp.
pfupars));
357 doSubDets = fv.
next();
373 fv.mergedSpecifics(refs);
375 int noOfAnonParams = 0;
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()) {
389 int id = cscnum.getDetId();
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();
406 bool chSpecsAlreadyExist =
false;
415 chSpecsAlreadyExist =
true;
417 std::string_view my_name_bis = fv.name();
419 std::vector<std::string_view> namesInPath = mypar.
names(
"//" + my_name_tris);
423 std::size_t
found = namesInPath[
i].find(my_string);
424 if (
found != std::string::npos)
427 uparvals = fv.get<std::vector<double>>(
std::string(namesInPath[
index]),
"upar");
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);
434 for (
auto i : fv.get<std::vector<double>>(
std::string(namesInPath[
index]),
"NumWiresPerGrp")) {
438 for (
auto i : fv.get<std::vector<double>>(
std::string(namesInPath[
index]),
"NumGroups")) {
442 auto wirespacing = fv.get<
double>(
"WireSpacing");
445 auto alignmentpintofirstwire = fv.get<
double>(
"AlignmentPinToFirstWire");
448 auto totnumwiregroups = fv.get<
double>(
"TotNumWireGroups");
451 auto lengthoffirstwire = fv.get<
double>(
"LengthOfFirstWire");
454 auto lengthoflastwire = fv.get<
double>(
"LengthOfLastWire");
457 auto radialextentofwireplane = fv.get<
double>(
"RadialExtentOfWirePlane");
468 for (CSCWireGroupPackage::Container::const_iterator it = wg.
wiresInEachGroup.begin();
471 uparvals.emplace_back(*it);
473 for (CSCWireGroupPackage::Container::const_iterator it = wg.
consecutiveGroups.begin();
476 uparvals.emplace_back(*it);
486 if (my_title ==
"Subtraction") {
488 auto solidA = mysolid.
solidA();
489 std::vector<double> dpar = solidA.dimensions();
494 fpar.emplace_back((dpar[1]));
495 fpar.emplace_back((dpar[2]));
496 fpar.emplace_back((dpar[3]));
497 fpar.emplace_back((dpar[4]));
499 dpar = fv.parameters();
504 fpar.emplace_back((dpar[0]));
505 fpar.emplace_back((dpar[1]));
506 fpar.emplace_back((dpar[2]));
507 fpar.emplace_back((dpar[3]));
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());
517 fv.rotation().GetComponents(trm.begin(), trm.end());
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;
536 if (jstation == 1 && jring == 1) {
537 std::transform(gtran.begin(), gtran.end(), gtran.begin(), [](
double i) ->
double {
541 std::transform(grmat.begin(), grmat.end(), grmat.begin(), [](
double i) ->
double {
548 rig.
insert(
id, gtran, grmat, fpar);
549 if (!chSpecsAlreadyExist) {
553 std::copy(uparvals.begin(), uparvals.end(), std::back_inserter(rdp.
pfupars));
560 const int kNoOfAnonParams = 35;
561 if (noOfAnonParams == 0) {
562 noOfAnonParams = kNoOfAnonParams;
567 uparvals.begin() + noOfAnonParams + 1, uparvals.begin() + (2 * noOfAnonParams) + 2, uparvals.begin() + 1);
571 std::transform(gtran.begin(), gtran.end(), gtran.begin(), [](
double i) ->
double {
575 std::transform(grmat.begin(), grmat.end(), grmat.begin(), [](
double i) ->
double {
582 rig.
insert(detid1a.rawId(), gtran, grmat, fpar);
592 LogTrace(
myName) <<
myName <<
" ct < rdp.pChamberType.size() && rdp.pChamberType[ct] == chtypeA ";
597 std::copy(uparvals.begin(), uparvals.end(), std::back_inserter(rdp.
pfupars));
601 std::transform(gtran.begin(), gtran.end(), gtran.begin(), [](
double i) ->
double {
605 std::transform(grmat.begin(), grmat.end(), grmat.begin(), [](
double i) ->
double {
612 rig.
insert(
id, gtran, grmat, fpar);
613 if (!chSpecsAlreadyExist) {
617 std::copy(uparvals.begin(), uparvals.end(), std::back_inserter(rdp.
pfupars));