55 #include <TEveGeoNode.h>
56 #include <TGeoVolume.h>
136 : infileName_(iConfig.getUntrackedParameter<
std::
string>(
"infileName")),
137 outfileName_(iConfig.getUntrackedParameter<
std::
string>(
"outfileName")) {
154 std::cout <<
"Validating RPC -z endcap geometry" << std::endl;
157 std::cout <<
"Validating RPC +z endcap geometry" << std::endl;
160 std::cout <<
"Validating RPC barrel geometry" << std::endl;
168 std::cout <<
"Validating DT chamber geometry" << std::endl;
171 std::cout <<
"Validating DT layer geometry" << std::endl;
179 std::cout <<
"Validating CSC -z geometry" << std::endl;
182 std::cout <<
"Validating CSC +z geometry" << std::endl;
185 std::cout <<
"Validating CSC layer -z geometry" << std::endl;
188 std::cout <<
"Validating CSC layer +z geometry" << std::endl;
198 std::cout <<
"Validating TIB geometry and topology" << std::endl;
202 std::cout <<
"Validating TOB geometry and topology" << std::endl;
206 std::cout <<
"Validating TEC geometry and topology" << std::endl;
210 std::cout <<
"Validating TID geometry and topology" << std::endl;
214 std::cout <<
"Validating PXB geometry and topology" << std::endl;
218 std::cout <<
"Validating PXF geometry and topology" << std::endl;
229 std::cout <<
"Validating EB geometry" << std::endl;
232 std::cout <<
"Validating EE geometry" << std::endl;
235 std::cout <<
"Validating ES geometry" << std::endl;
238 std::cout <<
"Validating HB geometry" << std::endl;
241 std::cout <<
"Validating HE geometry" << std::endl;
244 std::cout <<
"Validating HO geometry" << std::endl;
247 std::cout <<
"Validating HF geometry" << std::endl;
250 std::cout <<
"Validating Castor geometry" << std::endl;
253 std::cout <<
"Validating ZDC geometry" << std::endl;
263 std::vector<double> centers;
267 for (
auto it = rolls.begin(), itEnd = rolls.end(); it != itEnd; ++it) {
273 if (rpcDetId.
region() == regionNumber) {
280 std::cout <<
"Failed to get matrix of RPC with detid: " << rpcDetId.
rawId() << std::endl;
289 std::cout <<
"Failed to get shape of RPC with detid: " << rpcDetId.
rawId() << std::endl;
298 std::cout <<
"Parameters empty for RPC with detid: " << rpcDetId.
rawId() << std::endl;
320 centers.push_back(centreOfStrip1.
x() - centreOfStrip2.
x());
337 for (
auto it =
chambers.begin(), itEnd =
chambers.end(); it != itEnd; ++it) {
347 std::cout <<
"Failed to get matrix of DT chamber with detid: " << chId.
rawId() << std::endl;
356 std::cout <<
"Failed to get shape of DT chamber with detid: " << chId.
rawId() << std::endl;
370 std::vector<double> wire_positions;
374 for (
auto it =
layers.begin(), itEnd =
layers.end(); it != itEnd; ++it) {
384 std::cout <<
"Failed to get matrix of DT layer with detid: " << layerId.
rawId() << std::endl;
393 std::cout <<
"Failed to get shape of DT layer with detid: " << layerId.
rawId() << std::endl;
402 std::cout <<
"Parameters empty for DT layer with detid: " << layerId.
rawId() << std::endl;
406 float width =
layer->surface().bounds().width();
412 float length =
layer->surface().bounds().length();
415 int firstChannel =
layer->specificTopology().firstChannel();
418 int lastChannel =
layer->specificTopology().lastChannel();
422 for (
int wireN = firstChannel; wireN - lastChannel <= 0; ++wireN) {
423 double localX1 =
layer->specificTopology().wirePosition(wireN);
426 wire_positions.push_back(localX1 - localX2);
443 for (
auto it =
chambers.begin(), itEnd =
chambers.end(); it != itEnd; ++it) {
453 std::cout <<
"Failed to get matrix of CSC chamber with detid: " << detId.
rawId() << std::endl;
462 std::cout <<
"Failed to get shape of CSC chamber with detid: " << detId.
rawId() << std::endl;
475 std::vector<double> strip_positions;
476 std::vector<double> wire_positions;
478 std::vector<double> me11_wiresLocal;
479 std::vector<double> me12_wiresLocal;
480 std::vector<double> me13_wiresLocal;
481 std::vector<double> me14_wiresLocal;
482 std::vector<double> me21_wiresLocal;
483 std::vector<double> me22_wiresLocal;
484 std::vector<double> me31_wiresLocal;
485 std::vector<double> me32_wiresLocal;
486 std::vector<double> me41_wiresLocal;
487 std::vector<double> me42_wiresLocal;
491 for (
auto it =
layers.begin(), itEnd =
layers.end(); it != itEnd; ++it) {
501 std::cout <<
"Failed to get matrix of CSC layer with detid: " << detId.
rawId() << std::endl;
510 std::cout <<
"Failed to get shape of CSC layer with detid: " << detId.
rawId() << std::endl;
523 std::cout <<
"Failed to get trapezoid from shape for CSC layer with detid: " << detId.
rawId() << std::endl;
530 std::cout <<
"Parameters empty for CSC layer with detid: " << detId.
rawId() << std::endl;
534 int yAxisOrientation =
layer->geometry()->topology()->yAxisOrientation();
537 float centreToIntersection =
layer->geometry()->topology()->centreToIntersection();
540 float yCentre =
layer->geometry()->topology()->yCentreOfStripPlane();
543 float phiOfOneEdge =
layer->geometry()->topology()->phiOfOneEdge();
546 float stripOffset =
layer->geometry()->topology()->stripOffset();
549 float angularWidth =
layer->geometry()->topology()->angularWidth();
552 for (
int nStrip = 1; nStrip <=
layer->geometry()->numberOfStrips(); ++nStrip) {
553 float xOfStrip1 =
layer->geometry()->xOfStrip(nStrip);
555 double stripAngle = phiOfOneEdge + yAxisOrientation * (nStrip - (0.5 - stripOffset)) * angularWidth;
556 double xOfStrip2 = yAxisOrientation * (centreToIntersection - yCentre) *
tan(stripAngle);
558 strip_positions.push_back(xOfStrip1 - xOfStrip2);
564 double wireSpacingInGroup =
layer->geometry()->wireTopology()->wireSpacing();
567 double wireSpacing = 0.0;
571 double extentOfWirePlane = 0.0;
575 extentOfWirePlane = 174.81;
577 extentOfWirePlane = 323.38;
579 extentOfWirePlane = 150.5;
581 extentOfWirePlane = 164.47;
583 extentOfWirePlane = 189.97;
585 extentOfWirePlane = 170.01;
587 extentOfWirePlane = 149.73;
589 float wireAngle =
layer->geometry()->wireTopology()->wireAngle();
600 double alignmentPinToFirstWire;
601 double yAlignmentFrame = 3.49;
605 alignmentPinToFirstWire = 1.065;
606 yAlignmentFrame = 0.0;
610 alignmentPinToFirstWire = 2.85;
614 alignmentPinToFirstWire = 3.04;
617 alignmentPinToFirstWire = 2.84;
620 alignmentPinToFirstWire = 2.87;
622 double yOfFirstWire = (yAlignmentFrame - length) + alignmentPinToFirstWire;
624 int nWireGroups =
layer->geometry()->numberOfWireGroups();
625 double E = extentOfWirePlane / nWireGroups;
627 for (
int nWireGroup = 1; nWireGroup <= nWireGroups; ++nWireGroup) {
628 LocalPoint centerOfWireGroup =
layer->geometry()->localCenterOfWireGroup(nWireGroup);
629 double yOfWire1 = centerOfWireGroup.
y();
633 double yOfWire2 = yOfFirstWire + ((nWireGroup - 1) * E);
634 yOfWire2 += wireSpacing * 0.5;
636 double ydiff_local = yOfWire1 - yOfWire2;
637 wire_positions.push_back(ydiff_local);
654 me11_wiresLocal.push_back(ydiff_local);
655 }
else if (
ring == 2) {
656 me12_wiresLocal.push_back(ydiff_local);
657 }
else if (
ring == 3) {
658 me13_wiresLocal.push_back(ydiff_local);
659 }
else if (
ring == 4) {
660 me14_wiresLocal.push_back(ydiff_local);
664 me21_wiresLocal.push_back(ydiff_local);
665 }
else if (
ring == 2) {
666 me22_wiresLocal.push_back(ydiff_local);
670 me31_wiresLocal.push_back(ydiff_local);
671 }
else if (
ring == 2) {
672 me32_wiresLocal.push_back(ydiff_local);
676 me41_wiresLocal.push_back(ydiff_local);
677 }
else if (
ring == 2) {
678 me42_wiresLocal.push_back(ydiff_local);
711 for (
auto it = ids.begin(), iEnd = ids.end(); it != iEnd; ++it) {
712 unsigned int rawId = (*it).rawId();
717 std::cout <<
"Failed to get points of " << detname <<
" element with detid: " << rawId << std::endl;
721 auto cellGeometry =
geometry->getGeometry(*it);
726 for (
unsigned int i = 0,
offset = 0;
i < 8; ++
i) {
742 for (TrackerGeometry::DetContainer::const_iterator it = dets.begin(), itEnd = dets.end(); it != itEnd; ++it) {
745 unsigned int rawId = (*it)->geographicalId().rawId();
750 std::cout <<
"Failed to get matrix of " << detname <<
" element with detid: " << rawId << std::endl;
759 std::cout <<
"Failed to get shape of " << detname <<
" element with detid: " << rawId << std::endl;
770 std::vector<double> pixelLocalXs;
771 std::vector<double> pixelLocalYs;
773 for (TrackerGeometry::DetContainer::const_iterator it = dets.begin(), itEnd = dets.end(); it != itEnd; ++it) {
774 unsigned int rawId = (*it)->geographicalId().rawId();
779 std::cout <<
"Parameters empty for " << detname <<
" element with detid: " << rawId << std::endl;
786 int nrows = rpt->nrows();
787 int ncolumns = rpt->ncolumns();
789 for (
int row = 1; row <= nrows; ++row) {
790 for (
int column = 1; column <= ncolumns; ++column) {
800 std::cout <<
"No topology for " << detname <<
" " << rawId << std::endl;
804 std::cout <<
"No geomDetUnit for " << detname <<
" " << rawId << std::endl;
813 std::vector<double> radialStripLocalXs;
814 std::vector<double> rectangularStripLocalXs;
816 for (TrackerGeometry::DetContainer::const_iterator it = dets.begin(), itEnd = dets.end(); it != itEnd; ++it) {
817 unsigned int rawId = (*it)->geographicalId().rawId();
822 std::cout <<
"Parameters empty for " << detname <<
" element with detid: " << rawId << std::endl;
831 const StripTopology* st = dynamic_cast<const StripTopology*>(&det->specificTopology());
840 dynamic_cast<const RadialStripTopology*>(&(det->specificType().specificTopology()))) {
848 float stripAngle1 = rst->stripAngle(
strip);
851 assert((stripAngle1 - stripAngle2) == 0);
856 radialStripLocalXs.push_back(stripPosition.
x() - stripX);
860 else if (dynamic_cast<const RectangularStripTopology*>(&(det->specificType().specificTopology()))) {
868 rectangularStripLocalXs.push_back(stripPosition.
x() - stripX);
872 else if (dynamic_cast<const TrapezoidalStripTopology*>(&(det->specificType().specificTopology()))) {
878 std::cout <<
"Failed to get pitch for " << detname <<
" " << rawId << std::endl;
882 std::cout <<
"Failed cast to StripTopology for " << detname <<
" " << rawId << std::endl;
890 makeHistogram(hn +
" radial strip localX", radialStripLocalXs);
891 makeHistogram(hn +
" rectangular strip localX", rectangularStripLocalXs);
895 double local[3] = {0.0, 0.0, 0.0};
906 double shape_topWidth;
907 double shape_bottomWidth;
909 double shape_thickness;
912 shape_topWidth = shape[2];
913 shape_bottomWidth = shape[1];
914 shape_length = shape[4];
915 shape_thickness = shape[3];
918 else if (shape[0] == 2) {
919 shape_topWidth = shape[1];
920 shape_bottomWidth = shape[1];
921 shape_length = shape[2];
922 shape_thickness = shape[3];
926 std::cout <<
"Failed to get box or trapezoid from shape" << std::endl;
930 double topWidth, bottomWidth;
936 std::array<const float, 4>
const& ps = tpbs->parameters();
946 else if ((dynamic_cast<const RectangularPlaneBounds*>(bounds))) {
949 bottomWidth = topWidth;
954 std::cout <<
"Failed to get bounds" << std::endl;
967 topWidths_.push_back(fabs(shape_topWidth - topWidth));
968 bottomWidths_.push_back(fabs(shape_bottomWidth - bottomWidth));
969 lengths_.push_back(fabs(shape_length - length));
983 (
p1.z() -
p2.z()) * (
p1.z() -
p2.z()));
991 std::string gdn =
d +
": distance between points in global coordinates";
994 std::string twn =
d +
": absolute difference between top widths (along X)";
997 std::string bwn =
d +
": absolute difference between bottom widths (along X)";
1000 std::string ln =
d +
": absolute difference between lengths (along Y)";
1003 std::string tn =
d +
": absolute difference between thicknesses (along Z)";
1013 std::vector<double>::iterator it;
1015 it = std::min_element(
data.begin(),
data.end());
1018 it = std::max_element(
data.begin(),
data.end());
1021 std::vector<double>::iterator itEnd =
data.end();
1023 TH1D
hist(
name.c_str(),
name.c_str(), 100, minE * (1 + 0.10),
maxE * (1 + 0.10));
1025 for (it =
data.begin(); it != itEnd; ++it)
1028 hist.GetXaxis()->SetTitle(
"[cm]");