814{
815
817
818
819
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
840
841 if (pickedPath->getNodeFromTail(0)->getTypeId()==SoCylinder::getClassTypeId())
842 pickedPath->pop();
843
844 if (pickedPath->getLength()<5) {
846 return;
847 }
848
849 SoSeparator * nodesep(0);
850
851 if (pickedPath->getNodeFromTail(1)->getTypeId()==SoSeparator::getClassTypeId()
852 && pickedPath->getNodeFromTail(2)->getTypeId()==SoSwitch::getClassTypeId()
853 && pickedPath->getNodeFromTail(3)->getTypeId()==SoSeparator::getClassTypeId())
854 {
855
856 nodesep = static_cast<SoSeparator*>(pickedPath->getNodeFromTail(3));
857 pickedPath->pop();
858 }
859 else if (pickedPath->getNodeFromTail(1)->getTypeId()==SoSwitch::getClassTypeId()
860 && pickedPath->getNodeFromTail(2)->getTypeId()==SoSeparator::getClassTypeId())
861 {
862
863 nodesep = static_cast<SoSeparator*>(pickedPath->getNodeFromTail(2));
864 }
865 else if (pickedPath->getNodeFromTail(1)->getTypeId()==SoSeparator::getClassTypeId()) {
866
867 nodesep = static_cast<SoSeparator*>(pickedPath->getNodeFromTail(1));
868 }
869 if (!nodesep) {
870 message(
"Unexpected picked path");
871 return;
872 }
873 if ( (!(nodesep)) || (
m_d->sonodesep2volhandle.find(nodesep) ==
m_d->sonodesep2volhandle.end()) ) {
874 message(
"Problems finding volume handle");
875 return;
876 }
877 VolumeHandle * volhandle =
m_d->sonodesep2volhandle[nodesep];
878 if (!volhandle) {
879 message(
"Found NULL volume handle");
880 return;
881 }
882
884
885
886
888
889
890
891
892
893 bool shift_isdown = (Qt::ShiftModifier & QApplication::keyboardModifiers());
894
895
896
897 if (shift_isdown) {
898
902 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
903 return;
904 }
905
906 bool ctrl_isdown = (Qt::ControlModifier & QApplication::keyboardModifiers());
907
908
909
910 if (ctrl_isdown) {
911
915 }
916 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
917 return;
918 }
919
920 bool z_isdown =
m_d->kbEvent && SO_KEY_PRESS_EVENT(
m_d->kbEvent,SoKeyboardEvent::Z);
921 if (z_isdown) {
922
926
927 return;
928 }
929
931
932
934
935 bool orientedView(false);
936 if (
m_d->controller->orientViewToMuonChambersOnClick() && volhandle->
isInMuonChamber()) {
937
939 orientedView = true;
940
941
942
943
945 message(
"Warning: Failed to relocate picked node.");
947 }
948 }
949
951
953
954
955 if (!orientedView&&
m_d->controller->zoomToVolumeOnClick()) {
958 std::set<SoCamera*>::iterator
it,itE = cameras.end();
959 for (it=cameras.begin();it!=itE;++it) {
961 }
962 }
963 }
964
965
967
969
970 m_d->controller->setLastSelectedVolume(volhandle);
971
973
975
977
978 if (
m_d->controller->printInfoOnClick_Shape()) {
981 }
982
983 if (
m_d->controller->printInfoOnClick_Material()) {
987 }
988
989 if (
m_d->controller->printInfoOnClick_CopyNumber() ) {
991 message(
"===> CopyNo : "+(cn>=0?QString::number(cn):QString(cn==-1?
"Invalid":
"Error reconstructing copynumber")));
992 }
993
994 if (
m_d->controller->printInfoOnClick_Transform() ) {
995
996 float translation_x, translation_y, translation_z, rotaxis_x, rotaxis_y, rotaxis_z, rotangle_radians;
998 translation_x, translation_y, translation_z,
999 rotaxis_x, rotaxis_y, rotaxis_z, rotangle_radians );
1000 message(
"===> Local Translation:");
1001 message(
" x = "+QString::number(translation_x/CLHEP::mm)+
" mm");
1002 message(
" y = "+QString::number(translation_y/CLHEP::mm)+
" mm");
1003 message(
" z = "+QString::number(translation_z/CLHEP::mm)+
" mm");
1004 message(
"===> Local Rotation:");
1005 message(
" axis x = "+QString::number(rotaxis_x));
1006 message(
" axis y = "+QString::number(rotaxis_y));
1007 message(
" axis z = "+QString::number(rotaxis_z));
1008 message(
" angle = "+QString::number(rotangle_radians*180.0/
M_PI)+
" deg");
1010 translation_x, translation_y, translation_z,
1011 rotaxis_x, rotaxis_y, rotaxis_z, rotangle_radians );
1012 message(
"===> Global Translation:");
1013 message(
" x = "+QString::number(translation_x/CLHEP::mm)+
" mm");
1014 message(
" y = "+QString::number(translation_y/CLHEP::mm)+
" mm");
1015 message(
" z = "+QString::number(translation_z/CLHEP::mm)+
" mm");
1016 message(
"===> Global Rotation:");
1017 message(
" axis x = "+QString::number(rotaxis_x));
1018 message(
" axis y = "+QString::number(rotaxis_y));
1019 message(
" axis z = "+QString::number(rotaxis_z));
1020 message(
" angle = "+QString::number(rotangle_radians*180.0/
M_PI)+
" deg");
1021 }
1022
1023 if (
m_d->controller->printInfoOnClick_Tree()) {
1024 std::ostringstream
str;
1025 GeoPrintGraphAction
pg(
str);
1028 for (
const QString& line : QString(
str.str().c_str()).split(
"\n"))
1030 }
1031
1032 if (
m_d->controller->printInfoOnClick_Mass()) {
1033
1034
1035
1036 message(
"===> Total Mass <===");
1039 }
1040
1041 if (
m_d->controller->printInfoOnClick_MuonStationInfo()&&volhandle->
isInMuonChamber()) {
1043 std::map<PVConstLink,VolumeHandle*>::const_iterator itChamber =
m_d->muonchambers_pv2handles.find(pvlink);
1044 #ifndef BUILDVP1LIGHT
1045 if (itChamber!=
m_d->muonchambers_pv2handles.end()) {
1046 m_d->ensureInitPV2MuonStationMap();
1047 std::map<GeoPVConstLink,const MuonGM::MuonStation*>::const_iterator itStation(
m_d->pv2MuonStation.find(pvlink));
1048 if (itStation!=
m_d->pv2MuonStation.end()) {
1049 message(
"===> Muon station <===");
1050 message(
" ",
m_d->stationInfo(itStation->second));
1051 }
1052 }
1053 #endif
1054 }
1055
1057
1059 QStack<QString> partspectPath, extras;
1060 QString detFactoryName;
1061
1062 VolumeHandle *parentVH(volhandle), *childVH(volhandle);
1063 m_d->createPathExtras(volhandle,detFactoryName,extras);
1064
1065 do {
1066 parentVH = parentVH->parent();
1067 PVConstLink parentPVLink = parentVH ? parentVH->geoPVConstLink() : childVH->geoPVConstLink()->getParent();
1068 if (parentPVLink) {
1069 int indexOfChild = parentVH ? childVH->childNumber() : parentPVLink->indexOf(childVH->geoPVConstLink()).value();
1070
1071 std::string childPVName = parentPVLink->getNameOfChildVol(indexOfChild);
1072 QString pathEntry = childPVName=="ANON" ? detFactoryName+childVH->getName() : QString(childPVName.c_str());
1073
1074 std::optional<int> childCopyNo = parentPVLink->getIdOfChildVol(indexOfChild);
1075 if(childCopyNo) {
1076 QString strCopyNo;
1077 strCopyNo.setNum(*childCopyNo);
1078 pathEntry += ("::"+strCopyNo);
1079 }
1080 partspectPath.push(pathEntry);
1081 childVH = parentVH;
1082 }
1083 }while(parentVH);
1084
1085 while(!extras.isEmpty())
1086 partspectPath.push(extras.pop());
1087
1088 partspectPath.push("Atlas::Atlas");
1089
1090
1091
1092
1095}
static QStringList shapeToStringList(const GeoShape *shape)
static QStringList geoMaterialToStringList(const GeoMaterial *)
static double inclusiveMass(const PVConstLink &pv)
static double exclusiveMass(const PVConstLink &pv)
void orientViewToMuonChamber(const GeoPVConstLink &chamberPV)
void plotSpectrum(QStack< QString > &, int copyNumber=-1)
static void decodeTransformation(const SbMatrix &, float &translation_x, float &translation_y, float &translation_z, float &rotaxis_x, float &rotaxis_y, float &rotaxis_z, float &rotangle_radians)
static bool changePathTail(SoPath *path, SoNode *commonBranchPoint, SoNode *newtail)
const SbMatrix & getGlobalTransformToVolume() const
const GeoMaterial * geoMaterial() const
SbMatrix getLocalTransformToVolume() const
VolumeHandle * topLevelParent()
GeoPVConstLink geoPVConstLink() const
bool isInMuonChamber() const
unsigned nChildren() const