819{
820
822
823
824
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
845
846 if (pickedPath->getNodeFromTail(0)->getTypeId()==SoCylinder::getClassTypeId())
847 pickedPath->pop();
848
849 if (pickedPath->getLength()<5) {
851 return;
852 }
853
854 SoSeparator * nodesep(0);
855
856 if (pickedPath->getNodeFromTail(1)->getTypeId()==SoSeparator::getClassTypeId()
857 && pickedPath->getNodeFromTail(2)->getTypeId()==SoSwitch::getClassTypeId()
858 && pickedPath->getNodeFromTail(3)->getTypeId()==SoSeparator::getClassTypeId())
859 {
860
861 nodesep = static_cast<SoSeparator*>(pickedPath->getNodeFromTail(3));
862 pickedPath->pop();
863 }
864 else if (pickedPath->getNodeFromTail(1)->getTypeId()==SoSwitch::getClassTypeId()
865 && pickedPath->getNodeFromTail(2)->getTypeId()==SoSeparator::getClassTypeId())
866 {
867
868 nodesep = static_cast<SoSeparator*>(pickedPath->getNodeFromTail(2));
869 }
870 else if (pickedPath->getNodeFromTail(1)->getTypeId()==SoSeparator::getClassTypeId()) {
871
872 nodesep = static_cast<SoSeparator*>(pickedPath->getNodeFromTail(1));
873 }
874 if (!nodesep) {
875 message(
"Unexpected picked path");
876 return;
877 }
878 if ( (!(nodesep)) || (
m_d->sonodesep2volhandle.find(nodesep) ==
m_d->sonodesep2volhandle.end()) ) {
879 message(
"Problems finding volume handle");
880 return;
881 }
882 VolumeHandle * volhandle =
m_d->sonodesep2volhandle[nodesep];
883 if (!volhandle) {
884 message(
"Found NULL volume handle");
885 return;
886 }
887
889
890
891
893
894
895
896
897
898 bool shift_isdown = (Qt::ShiftModifier & QApplication::keyboardModifiers());
899
900
901
902 if (shift_isdown) {
903
907 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
908 return;
909 }
910
911 bool ctrl_isdown = (Qt::ControlModifier & QApplication::keyboardModifiers());
912
913
914
915 if (ctrl_isdown) {
916
920 }
921 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
922 return;
923 }
924
925 bool z_isdown =
m_d->kbEvent && SO_KEY_PRESS_EVENT(
m_d->kbEvent,SoKeyboardEvent::Z);
926 if (z_isdown) {
927
931
932 return;
933 }
934
936
937
939
940 bool orientedView(false);
941 if (
m_d->controller->orientViewToMuonChambersOnClick() && volhandle->
isInMuonChamber()) {
942
944 orientedView = true;
945
946
947
948
950 message(
"Warning: Failed to relocate picked node.");
952 }
953 }
954
956
958
959
960 if (!orientedView&&
m_d->controller->zoomToVolumeOnClick()) {
963 std::set<SoCamera*>::iterator
it,itE = cameras.end();
964 for (it=cameras.begin();it!=itE;++it) {
966 }
967 }
968 }
969
970
972
974
975 m_d->controller->setLastSelectedVolume(volhandle);
976
978
980
982
983 if (
m_d->controller->printInfoOnClick_Shape()) {
986 }
987
988 if (
m_d->controller->printInfoOnClick_Material()) {
992 }
993
994 if (
m_d->controller->printInfoOnClick_CopyNumber() ) {
996 message(
"===> CopyNo : "+(cn>=0?QString::number(cn):QString(cn==-1?
"Invalid":
"Error reconstructing copynumber")));
997 }
998
999 if (
m_d->controller->printInfoOnClick_Transform() ) {
1000
1001 float translation_x, translation_y, translation_z, rotaxis_x, rotaxis_y, rotaxis_z, rotangle_radians;
1003 translation_x, translation_y, translation_z,
1004 rotaxis_x, rotaxis_y, rotaxis_z, rotangle_radians );
1005 message(
"===> Local Translation:");
1006 message(
" x = "+QString::number(translation_x/CLHEP::mm)+
" mm");
1007 message(
" y = "+QString::number(translation_y/CLHEP::mm)+
" mm");
1008 message(
" z = "+QString::number(translation_z/CLHEP::mm)+
" mm");
1009 message(
"===> Local Rotation:");
1010 message(
" axis x = "+QString::number(rotaxis_x));
1011 message(
" axis y = "+QString::number(rotaxis_y));
1012 message(
" axis z = "+QString::number(rotaxis_z));
1013 message(
" angle = "+QString::number(rotangle_radians*180.0/
M_PI)+
" deg");
1015 translation_x, translation_y, translation_z,
1016 rotaxis_x, rotaxis_y, rotaxis_z, rotangle_radians );
1017 message(
"===> Global Translation:");
1018 message(
" x = "+QString::number(translation_x/CLHEP::mm)+
" mm");
1019 message(
" y = "+QString::number(translation_y/CLHEP::mm)+
" mm");
1020 message(
" z = "+QString::number(translation_z/CLHEP::mm)+
" mm");
1021 message(
"===> Global Rotation:");
1022 message(
" axis x = "+QString::number(rotaxis_x));
1023 message(
" axis y = "+QString::number(rotaxis_y));
1024 message(
" axis z = "+QString::number(rotaxis_z));
1025 message(
" angle = "+QString::number(rotangle_radians*180.0/
M_PI)+
" deg");
1026 }
1027
1028 if (
m_d->controller->printInfoOnClick_Tree()) {
1029 std::ostringstream
str;
1030 GeoPrintGraphAction
pg(
str);
1033 for (
const QString& line : QString(
str.str().c_str()).split(
"\n"))
1035 }
1036
1037 if (
m_d->controller->printInfoOnClick_Mass()) {
1038
1039
1040
1041 message(
"===> Total Mass <===");
1044 }
1045
1046 if (
m_d->controller->printInfoOnClick_MuonStationInfo()&&volhandle->
isInMuonChamber()) {
1048 std::map<PVConstLink,VolumeHandle*>::const_iterator itChamber =
m_d->muonchambers_pv2handles.find(pvlink);
1049 #ifndef BUILDVP1LIGHT
1050 if (itChamber!=
m_d->muonchambers_pv2handles.end()) {
1051 m_d->ensureInitPV2MuonStationMap();
1052 std::map<GeoPVConstLink,const MuonGM::MuonStation*>::const_iterator itStation(
m_d->pv2MuonStation.find(pvlink));
1053 if (itStation!=
m_d->pv2MuonStation.end()) {
1054 message(
"===> Muon station <===");
1055 message(
" ",
m_d->stationInfo(itStation->second));
1056 }
1057 }
1058 #endif
1059 }
1060
1062
1064 QStack<QString> partspectPath, extras;
1065 QString detFactoryName;
1066
1067 VolumeHandle *parentVH(volhandle), *childVH(volhandle);
1068 m_d->createPathExtras(volhandle,detFactoryName,extras);
1069
1070 do {
1071 parentVH = parentVH->parent();
1072 PVConstLink parentPVLink = parentVH ? parentVH->geoPVConstLink() : childVH->geoPVConstLink()->getParent();
1073 if (parentPVLink) {
1074 int indexOfChild = parentVH ? childVH->childNumber() : parentPVLink->indexOf(childVH->geoPVConstLink()).value();
1075
1076 std::string childPVName = parentPVLink->getNameOfChildVol(indexOfChild);
1077 QString pathEntry = childPVName=="ANON" ? detFactoryName+childVH->getName() : QString(childPVName.c_str());
1078
1079 std::optional<int> childCopyNo = parentPVLink->getIdOfChildVol(indexOfChild);
1080 if(childCopyNo) {
1081 QString strCopyNo;
1082 strCopyNo.setNum(*childCopyNo);
1083 pathEntry += ("::"+strCopyNo);
1084 }
1085 partspectPath.push(pathEntry);
1086 childVH = parentVH;
1087 }
1088 }while(parentVH);
1089
1090 while(!extras.isEmpty())
1091 partspectPath.push(extras.pop());
1092
1093 partspectPath.push("Atlas::Atlas");
1094
1095
1096
1097
1100}
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