606 {
608
610 std::string the_arg{
argv[
arg]};
611 if (the_arg == "--refFile" && arg +1 < argc) {
614 } else if (the_arg == "--testFile" && arg + 1 < argc) {
617 }
618 }
620 std::cerr<<"Please parse the path of the reference file via --refFile "<<std::endl;
621 return EXIT_FAILURE;
622 }
624 std::cerr<<"Please parse the path of the test file via --testFile "<<std::endl;
625 return EXIT_FAILURE;
626 }
631 std::set<sTgcChamber> refChambers =
readTreeDump(refFile);
632 if (refChambers.empty()) {
633 std::cerr<<
"The file "<<
refFile<<
" should contain at least one chamber "<<std::endl;
634 return EXIT_FAILURE;
635 }
636 std::set<sTgcChamber> testChambers =
readTreeDump(testFile);
637 if (testChambers.empty()) {
638 std::cerr<<
"The file "<<
testFile<<
" should contain at least one chamber "<<std::endl;
639 return EXIT_FAILURE;
640 }
641 int return_code = EXIT_SUCCESS;
644 std::set<sTgcChamber>::const_iterator test_itr = testChambers.find(
reference);
645
646 if (test_itr == testChambers.end()) {
647 std::cerr<<
"The chamber "<<
reference<<
" is not part of the testing "<<std::endl;
648 return_code = EXIT_FAILURE;
649 continue;
650 }
651 bool chamberOkay = true;
653
656 std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": The alignable nodes are at differnt places for "
658 chamberOkay = false;
659 }
660
664
666 TEST_BASICPROP(sChamberLength,
"Chamber length on the short side");
667 TEST_BASICPROP(lChamberLength,
"Chamber length on the long side");
672
675 TEST_BASICPROP(wireGroupWidth,
"number of wires in a normal wiregroup");
676
680 TEST_BASICPROP(sPadLength,
"gasGap length on the short side for pads and wires");
681 TEST_BASICPROP(lPadLength,
"gasGap length on the long side for pads and wires");
682 TEST_BASICPROP(anglePadPhi,
"angular width of a pad in phi direction");
683 TEST_BASICPROP(beamlineRadius,
"distance from the gapCenter to beamline");
684
687 for (
const sTgcLayer& refLayer :
reference.layers) {
688 std::set<sTgcLayer>::const_iterator lay_itr =
test.layers.find(refLayer);
689 if (lay_itr ==
test.layers.end()) {
690 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "
691 <<refLayer<<" is not found. "<<std::endl;
692 chamberOkay = false;
693 continue;
694 }
695 const sTgcLayer& testLayer{*lay_itr};
697 testLayer.transform;
699 if (false)
700 std::cout <<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "
701 <<
"The test layer transform for layer "<<
c <<
" is: " <<
Amg::toString(testLayer.transform)
702 <<
" and the reference layer transform is: " <<
Amg::toString(refLayer.transform)
704
706 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "
707 <<"the layer "<<testLayer<<" is misaligned w.r.t. reference by "
709 chamberOkay = false;
710 continue;
711 }
713 TEST_BASICPROP(numWires[c],
"number of wires in the layer "<< c + 1 <<
" are ");
714 TEST_BASICPROP(firstWireGroupWidth[c],
"number of wires in first wire group in the layer "<< c + 1 <<
" are ");
716 TEST_BASICPROP(numPads[c],
"number of pads in the layer "<< c + 1 <<
" are ");
717 TEST_BASICPROP(numPadEta[c],
"number of pads in the eta direction in the layer "<< c + 1 <<
" are ");
718 TEST_BASICPROP(numPadPhi[c],
"number of in the phi direction in the layer "<< c + 1 <<
" are ");
719 TEST_BASICPROP(firstPadHeight[c],
"height of the first pad row in the layer "<< c + 1 <<
" are ");
720 TEST_BASICPROP(padHeight[c],
"height of pads in the rest of the rows in the layer "<< c + 1 <<
" are ");
721 TEST_BASICPROP(padPhiShift[c],
"shift of inner pad edges in phi direction in the layer "<< c + 1 <<
" are ");
722 TEST_BASICPROP(firstPadPhiDiv[c],
"angular position of the outer edge of the first pad in the layer "<< c + 1 <<
" are ");
724 }
725
727 for (
const sTgcChannel& refChannel :
reference.channels) {
728 std::set<sTgcChannel>::const_iterator channel_itr =
test.channels.find(refChannel);
729 if (channel_itr ==
test.channels.end()) {
730 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "
731 <<refChannel<<" is not found. "<<std::endl;
732 chamberOkay = false;
733 continue;
734 }
735 const sTgcChannel& testChannel{*channel_itr};
736
737 const Amg::Vector3D diffGlobalPos{testChannel.globalPosition - refChannel.globalPosition};
738 const Amg::Vector2D diffLocalPos{testChannel.localPosition - refChannel.localPosition};
740 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"channel (gasGap/number): "
741 <<testChannel.gasGap<<"/"<<testChannel.channelNumber<<", chType: "<<testChannel.channelType<<", "<< " global position: "
743 <<
" displacement: "<<
Amg::toString(diffGlobalPos,2)<<std::endl;
744 chamberOkay = false;
745 }
747 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"channel (gasGap/number): "
748 <<testChannel.gasGap<<"/"<<testChannel.channelNumber<<", chType: "<<testChannel.channelType<<", "<< " local position: "
750 <<
" displacement: "<<
Amg::toString(diffLocalPos,2)<<std::endl;
751 chamberOkay = false;
752 }
753 const double diffChannelLen{testChannel.channelLen - refChannel.channelLen};
754 if (std::abs(diffChannelLen) >
tolerance) {
755 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"channel (gasGap/number): "
756 <<testChannel.gasGap<<"/"<<testChannel.channelNumber<<", chType: "<<testChannel.channelType<<", "<< " Run 4 strip Length: "
757 <<testChannel.channelLen<<" Run 3 strip Length "<<refChannel.channelLen
758 <<" displacement: "<<diffChannelLen<<std::endl;
759 chamberOkay = false;
760 }
761 }
762
764 for (
const sTgcPad& refPad :
reference.pads) {
765 std::set<sTgcPad>::const_iterator pad_itr =
test.pads.find(refPad);
766 if (pad_itr ==
test.pads.end()) {
767 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "
768 <<refPad<<" is not found. "<<std::endl;
769 chamberOkay = false;
770 continue;
771 }
772 const sTgcPad& testPad{*pad_itr};
774 const Amg::Vector2D diffLocalPadPos{testPad.localPosition - refPad.localPosition};
776 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"pad (gasGap/(padEta, padPhi)): "
777 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " local position: "
779 <<
" displacement: "<<
Amg::toString(diffLocalPadPos,2)<<std::endl;
780 chamberOkay = false;
781 }
783 const Amg::Vector2D diffLocalPadCornerBL{testPad.localPadCornerBL - refPad.localPadCornerBL};
784 if (diffLocalPadCornerBL.mag() >
tolerance) {
785 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"pad (gasGap/(padEta, padPhi)): "
786 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " bottom-left corner: "
788 <<
" displacement: "<<
Amg::toString(diffLocalPadCornerBL,2)<<std::endl;
789 chamberOkay = false;
790 }
792 const Amg::Vector2D diffLocalPadCornerBR{testPad.localPadCornerBR - refPad.localPadCornerBR};
793 if (diffLocalPadCornerBR.mag() >
tolerance) {
794 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"pad (gasGap/(padEta, padPhi)): "
795 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " bottom-right corner: "
797 <<
" displacement: "<<
Amg::toString(diffLocalPadCornerBR,2)<<std::endl;
798 chamberOkay = false;
799 }
801 const Amg::Vector2D diffLocalPadCornerTL{testPad.localPadCornerTL - refPad.localPadCornerTL};
802 if (diffLocalPadCornerTL.mag() >
tolerance) {
803 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"pad (gasGap/(padEta, padPhi)): "
804 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " top-left corner: "
806 <<
" displacement: "<<
Amg::toString(diffLocalPadCornerTL,2)<<std::endl;
807 chamberOkay = false;
808 }
810 const Amg::Vector2D diffLocalPadCornerTR{testPad.localPadCornerTR - refPad.localPadCornerTR};
811 if (diffLocalPadCornerTR.mag() >
tolerance) {
812 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"pad (gasGap/(padEta, padPhi)): "
813 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " top-right corner: "
815 <<
" displacement: "<<
Amg::toString(diffLocalPadCornerTR,2)<<std::endl;
816 chamberOkay = false;
817 }
818
820 const Amg::Vector3D diffGlobalPadPos{testPad.globalPosition - refPad.globalPosition};
821 if (diffGlobalPadPos.mag() >
tolerance) {
822 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"pad (gasGap/(padEta, padPhi)): "
823 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " global position: "
825 <<
" displacement: "<<
Amg::toString(diffGlobalPadPos,2)<<std::endl;
826 chamberOkay = false;
827 }
829 const Amg::Vector3D diffGlobalPadCornerBL{testPad.globalPadCornerBL - refPad.globalPadCornerBL};
830 if (diffGlobalPadCornerBL.mag() >
tolerance) {
831 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"pad (gasGap/(padEta, padPhi)): "
832 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " bottom-left corner: "
834 <<
" displacement: "<<
Amg::toString(diffGlobalPadCornerBL,2)<<std::endl;
835 chamberOkay = false;
836 }
837
839 const Amg::Vector3D diffGlobalPadCornerBR{testPad.globalPadCornerBR - refPad.globalPadCornerBR};
840 if (diffGlobalPadCornerBR.mag() >
tolerance) {
841 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"pad (gasGap/(padEta, padPhi)): "
842 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " bottom-right corner: "
844 <<
" displacement: "<<
Amg::toString(diffGlobalPadCornerBR,2)<<std::endl;
845 chamberOkay = false;
846 }
848 const Amg::Vector3D diffGlobalPadCornerTL{testPad.globalPadCornerTL - refPad.globalPadCornerTL};
849 if (diffGlobalPadCornerTL.mag() >
tolerance) {
850 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"pad (gasGap/(padEta, padPhi)): "
851 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " top-left corner: "
853 <<
" displacement: "<<
Amg::toString(diffGlobalPadCornerTL,2)<<std::endl;
854 chamberOkay = false;
855 }
857 const Amg::Vector3D diffGlobalPadCornerTR{testPad.globalPadCornerTR - refPad.globalPadCornerTR};
858 if (diffGlobalPadCornerTR.mag() >
tolerance) {
859 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"pad (gasGap/(padEta, padPhi)): "
860 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " top-right corner: "
862 <<
" displacement: "<<
Amg::toString(diffGlobalPadCornerTR,2)<<std::endl;
863 chamberOkay = false;
864 }
866 const Amg::Vector2D diffHitPosition{testPad.hitPosition - refPad.hitPosition};
868 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"pad (gasGap/(padEta, padPhi)): "
869 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " Hit Position: "
871 chamberOkay = false;
872 }
874 const int diffPadNumber{testPad.padNumber - refPad.padNumber};
875 if (std::abs(diffPadNumber) > 0 || testPad.padNumber < 0 || refPad.padNumber < 0) {
876 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"pad (gasGap/(padEta, padPhi)): "
877 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " padNumber: "
878 <<testPad.padNumber <<" should be "<<refPad.padNumber <<" displacement: "<< diffPadNumber
879 <<
" Hit Position: "<<
Amg::toString(testPad.hitPosition, 2) <<
" BL Corner: "
881 chamberOkay = false;
882 }
883
884 if (!chamberOkay) {
885 return_code = EXIT_FAILURE;
886 }
887 }
888 }
889 return return_code;
890}
static std::string FindCalibFile(const std::string &logical_file_name)
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
bool isIdentity(const Amg::Transform3D &trans)
Checks whether the transformation is the Identity transformation.
bool doesNotDeform(const Amg::Transform3D &trans)
Checks whether the linear part of the transformation rotates or stetches any of the basis vectors.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
#define TEST_BASICPROP(attribute, propName)
std::set< sTgcChamber > readTreeDump(const std::string &inputFile)
Helper struct to assess that the layers are properly oriented.
Helper struct to represent a full sTgc chamber.