612 {
614
616 std::string the_arg{
argv[
arg]};
617 if (the_arg == "--refFile" && arg +1 < argc) {
620 } else if (the_arg == "--testFile" && arg + 1 < argc) {
623 }
624 }
626 std::cerr<<"Please parse the path of the reference file via --refFile "<<std::endl;
627 return EXIT_FAILURE;
628 }
630 std::cerr<<"Please parse the path of the test file via --testFile "<<std::endl;
631 return EXIT_FAILURE;
632 }
637 std::set<sTgcChamber> refChambers =
readTreeDump(refFile);
638 if (refChambers.empty()) {
639 std::cerr<<
"The file "<<
refFile<<
" should contain at least one chamber "<<std::endl;
640 return EXIT_FAILURE;
641 }
642 std::set<sTgcChamber> testChambers =
readTreeDump(testFile);
643 if (testChambers.empty()) {
644 std::cerr<<
"The file "<<
testFile<<
" should contain at least one chamber "<<std::endl;
645 return EXIT_FAILURE;
646 }
647 int return_code = EXIT_SUCCESS;
650 std::set<sTgcChamber>::const_iterator test_itr = testChambers.find(
reference);
651
652 if (test_itr == testChambers.end()) {
653 std::cerr<<
"The chamber "<<
reference<<
" is not part of the testing "<<std::endl;
654 return_code = EXIT_FAILURE;
655 continue;
656 }
657 bool chamberOkay = true;
659
662 std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": The alignable nodes are at differnt places for "
664 chamberOkay = false;
665 }
666
670
672 TEST_BASICPROP(sChamberLength,
"Chamber length on the short side");
673 TEST_BASICPROP(lChamberLength,
"Chamber length on the long side");
678
681 TEST_BASICPROP(wireGroupWidth,
"number of wires in a normal wiregroup");
682
686 TEST_BASICPROP(sPadLength,
"gasGap length on the short side for pads and wires");
687 TEST_BASICPROP(lPadLength,
"gasGap length on the long side for pads and wires");
688 TEST_BASICPROP(anglePadPhi,
"angular width of a pad in phi direction");
689 TEST_BASICPROP(beamlineRadius,
"distance from the gapCenter to beamline");
690
693 for (
const sTgcLayer& refLayer :
reference.layers) {
694 std::set<sTgcLayer>::const_iterator lay_itr =
test.layers.find(refLayer);
695 if (lay_itr ==
test.layers.end()) {
696 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "
697 <<refLayer<<" is not found. "<<std::endl;
698 chamberOkay = false;
699 continue;
700 }
701 const sTgcLayer& testLayer{*lay_itr};
703 testLayer.transform;
705 if (false)
706 std::cout <<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "
707 <<
"The test layer transform for layer "<<
c <<
" is: " <<
Amg::toString(testLayer.transform)
708 <<
" and the reference layer transform is: " <<
Amg::toString(refLayer.transform)
710
712 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "
713 <<"the layer "<<testLayer<<" is misaligned w.r.t. reference by "
715 chamberOkay = false;
716 continue;
717 }
719 TEST_BASICPROP(numWires[c],
"number of wires in the layer "<< c + 1 <<
" are ");
720 TEST_BASICPROP(firstWireGroupWidth[c],
"number of wires in first wire group in the layer "<< c + 1 <<
" are ");
722 TEST_BASICPROP(numPads[c],
"number of pads in the layer "<< c + 1 <<
" are ");
723 TEST_BASICPROP(numPadEta[c],
"number of pads in the eta direction in the layer "<< c + 1 <<
" are ");
724 TEST_BASICPROP(numPadPhi[c],
"number of in the phi direction in the layer "<< c + 1 <<
" are ");
725 TEST_BASICPROP(firstPadHeight[c],
"height of the first pad row in the layer "<< c + 1 <<
" are ");
726 TEST_BASICPROP(padHeight[c],
"height of pads in the rest of the rows in the layer "<< c + 1 <<
" are ");
727 TEST_BASICPROP(padPhiShift[c],
"shift of inner pad edges in phi direction in the layer "<< c + 1 <<
" are ");
728 TEST_BASICPROP(firstPadPhiDiv[c],
"angular position of the outer edge of the first pad in the layer "<< c + 1 <<
" are ");
730 }
731
733 for (
const sTgcChannel& refChannel :
reference.channels) {
734 std::set<sTgcChannel>::const_iterator channel_itr =
test.channels.find(refChannel);
735 if (channel_itr ==
test.channels.end()) {
736 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "
737 <<refChannel<<" is not found. "<<std::endl;
738 chamberOkay = false;
739 continue;
740 }
741 const sTgcChannel& testChannel{*channel_itr};
742
743 const Amg::Vector3D diffGlobalPos{testChannel.globalPosition - refChannel.globalPosition};
744 const Amg::Vector2D diffLocalPos{testChannel.localPosition - refChannel.localPosition};
746 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"channel (gasGap/number): "
747 <<testChannel.gasGap<<"/"<<testChannel.channelNumber<<", chType: "<<testChannel.channelType<<", "<< " global position: "
749 <<
" displacement: "<<
Amg::toString(diffGlobalPos,2)<<std::endl;
750 chamberOkay = false;
751 }
753 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"channel (gasGap/number): "
754 <<testChannel.gasGap<<"/"<<testChannel.channelNumber<<", chType: "<<testChannel.channelType<<", "<< " local position: "
756 <<
" displacement: "<<
Amg::toString(diffLocalPos,2)<<std::endl;
757 chamberOkay = false;
758 }
759 const double diffChannelLen{testChannel.channelLen - refChannel.channelLen};
760 if (std::abs(diffChannelLen) >
tolerance) {
761 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"channel (gasGap/number): "
762 <<testChannel.gasGap<<"/"<<testChannel.channelNumber<<", chType: "<<testChannel.channelType<<", "<< " Run 4 strip Length: "
763 <<testChannel.channelLen<<" Run 3 strip Length "<<refChannel.channelLen
764 <<" displacement: "<<diffChannelLen<<std::endl;
765 chamberOkay = false;
766 }
767 }
768
770 for (
const sTgcPad& refPad :
reference.pads) {
771 std::set<sTgcPad>::const_iterator pad_itr =
test.pads.find(refPad);
772 if (pad_itr ==
test.pads.end()) {
773 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "
774 <<refPad<<" is not found. "<<std::endl;
775 chamberOkay = false;
776 continue;
777 }
778 const sTgcPad& testPad{*pad_itr};
780 const Amg::Vector2D diffLocalPadPos{testPad.localPosition - refPad.localPosition};
782 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"pad (gasGap/(padEta, padPhi)): "
783 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " local position: "
785 <<
" displacement: "<<
Amg::toString(diffLocalPadPos,2)<<std::endl;
786 chamberOkay = false;
787 }
789 const Amg::Vector2D diffLocalPadCornerBL{testPad.localPadCornerBL - refPad.localPadCornerBL};
790 if (diffLocalPadCornerBL.mag() >
tolerance) {
791 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"pad (gasGap/(padEta, padPhi)): "
792 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " bottom-left corner: "
794 <<
" displacement: "<<
Amg::toString(diffLocalPadCornerBL,2)<<std::endl;
795 chamberOkay = false;
796 }
798 const Amg::Vector2D diffLocalPadCornerBR{testPad.localPadCornerBR - refPad.localPadCornerBR};
799 if (diffLocalPadCornerBR.mag() >
tolerance) {
800 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"pad (gasGap/(padEta, padPhi)): "
801 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " bottom-right corner: "
803 <<
" displacement: "<<
Amg::toString(diffLocalPadCornerBR,2)<<std::endl;
804 chamberOkay = false;
805 }
807 const Amg::Vector2D diffLocalPadCornerTL{testPad.localPadCornerTL - refPad.localPadCornerTL};
808 if (diffLocalPadCornerTL.mag() >
tolerance) {
809 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"pad (gasGap/(padEta, padPhi)): "
810 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " top-left corner: "
812 <<
" displacement: "<<
Amg::toString(diffLocalPadCornerTL,2)<<std::endl;
813 chamberOkay = false;
814 }
816 const Amg::Vector2D diffLocalPadCornerTR{testPad.localPadCornerTR - refPad.localPadCornerTR};
817 if (diffLocalPadCornerTR.mag() >
tolerance) {
818 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"pad (gasGap/(padEta, padPhi)): "
819 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " top-right corner: "
821 <<
" displacement: "<<
Amg::toString(diffLocalPadCornerTR,2)<<std::endl;
822 chamberOkay = false;
823 }
824
826 const Amg::Vector3D diffGlobalPadPos{testPad.globalPosition - refPad.globalPosition};
827 if (diffGlobalPadPos.mag() >
tolerance) {
828 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"pad (gasGap/(padEta, padPhi)): "
829 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " global position: "
831 <<
" displacement: "<<
Amg::toString(diffGlobalPadPos,2)<<std::endl;
832 chamberOkay = false;
833 }
835 const Amg::Vector3D diffGlobalPadCornerBL{testPad.globalPadCornerBL - refPad.globalPadCornerBL};
836 if (diffGlobalPadCornerBL.mag() >
tolerance) {
837 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"pad (gasGap/(padEta, padPhi)): "
838 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " bottom-left corner: "
840 <<
" displacement: "<<
Amg::toString(diffGlobalPadCornerBL,2)<<std::endl;
841 chamberOkay = false;
842 }
843
845 const Amg::Vector3D diffGlobalPadCornerBR{testPad.globalPadCornerBR - refPad.globalPadCornerBR};
846 if (diffGlobalPadCornerBR.mag() >
tolerance) {
847 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"pad (gasGap/(padEta, padPhi)): "
848 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " bottom-right corner: "
850 <<
" displacement: "<<
Amg::toString(diffGlobalPadCornerBR,2)<<std::endl;
851 chamberOkay = false;
852 }
854 const Amg::Vector3D diffGlobalPadCornerTL{testPad.globalPadCornerTL - refPad.globalPadCornerTL};
855 if (diffGlobalPadCornerTL.mag() >
tolerance) {
856 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"pad (gasGap/(padEta, padPhi)): "
857 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " top-left corner: "
859 <<
" displacement: "<<
Amg::toString(diffGlobalPadCornerTL,2)<<std::endl;
860 chamberOkay = false;
861 }
863 const Amg::Vector3D diffGlobalPadCornerTR{testPad.globalPadCornerTR - refPad.globalPadCornerTR};
864 if (diffGlobalPadCornerTR.mag() >
tolerance) {
865 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"pad (gasGap/(padEta, padPhi)): "
866 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " top-right corner: "
868 <<
" displacement: "<<
Amg::toString(diffGlobalPadCornerTR,2)<<std::endl;
869 chamberOkay = false;
870 }
872 const Amg::Vector2D diffHitPosition{testPad.hitPosition - refPad.hitPosition};
874 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"pad (gasGap/(padEta, padPhi)): "
875 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " Hit Position: "
877 chamberOkay = false;
878 }
880 const int diffPadNumber{testPad.padNumber - refPad.padNumber};
881 if (std::abs(diffPadNumber) > 0 || testPad.padNumber < 0 || refPad.padNumber < 0) {
882 std::cerr<<
"runsTgcGeoComparison() "<<__LINE__<<
": in chamber "<<
test<<
" "<<
"pad (gasGap/(padEta, padPhi)): "
883 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " padNumber: "
884 <<testPad.padNumber <<" should be "<<refPad.padNumber <<" displacement: "<< diffPadNumber
885 <<
" Hit Position: "<<
Amg::toString(testPad.hitPosition, 2) <<
" BL Corner: "
887 chamberOkay = false;
888 }
889
890 if (!chamberOkay) {
891 return_code = EXIT_FAILURE;
892 }
893 }
894 }
895 return return_code;
896}
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.