39#include <Inventor/nodes/SoSeparator.h>
40#include <Inventor/nodes/SoSwitch.h>
41#include <Inventor/events/SoKeyboardEvent.h>
42#include <Inventor/nodes/SoPickStyle.h>
43#include <Inventor/nodes/SoEventCallback.h>
44#include <Inventor/nodes/SoCamera.h>
45#include <Inventor/nodes/SoCylinder.h>
46#include <Inventor/nodes/SoFont.h>
48#include "GeoModelKernel/GeoVolumeCursor.h"
49#include "GeoModelKernel/GeoPrintGraphAction.h"
67#include "GeoModelKernel/GeoBox.h"
68#include "GeoModelKernel/GeoCountVolAction.h"
69#include "GeoModelKernel/GeoAccessVolumeAction.h"
70#include "GeoModelDBManager/GMDBManager.h"
71#include "GeoRead/GReadIn.h"
87#include <QApplication>
103 #ifndef BUILDVP1LIGHT
107 const unsigned n_chamber_t0_sources=2;
108 for (
unsigned i=0;i<n_chamber_t0_sources;++i)
130 SubSystemInfo( QCheckBox* cb,
const QRegExp& the_geomodeltreetopregexp,
bool the_negatetreetopregexp,
132 const std::string& the_matname,
133 const QRegExp& the_geomodelgrandchildrenregexp,
bool the_negategrandchildrenregexp=
false)
148 muonchambers = ( matname==
"CSC"||matname==
"TGC"||matname==
"EndcapMdt"||matname==
"MM"||matname==
"sTGC"
149 ||matname==
"BarrelInner"||matname==
"BarrelMiddle"||matname==
"BarrelOuter" );
184 HepGeom::Transform3D
xf;
211 std::cout<<
" SubSystemInfo @ "<<
this<<
"\n"
212 <<(
isbuilt?
"Is built.\n":
"Is not built.\n")
213 <<(
muonchambers?
"Has muon chambers.\n":
"No muon chambers.\n");
214 std::cout<<
"Contains following volhandles: [";
215 for (
auto vol :
vollist) std::cout<<&vol<<
",";
216 std::cout<<
"]"<<std::endl;
217 std::cout<<
"Matname = "<<
matname<<std::endl;
218 std::cout<<
"Contains following TreetopInfo: [";
219 for (
const auto& tt :
treetopinfo) std::cout<<tt.volname<<
",";
220 std::cout<<
"]"<<std::endl;
228 const QString& treetopregexp,
const QString& childrenregexp=
"",
229 const std::string& matname=
"",
bool negatetreetopregexp =
false,
bool negatechildrenregexp =
false,
230 const QString& grandchildrenregexp=
"",
bool negategrandchildrenregexp =
false);
252 static double volume(
const PVConstLink& pv);
255 static void catchKbdState(
void *userData, SoEventCallback *CB);
277 #ifndef BUILDVP1LIGHT
293 void applyTopVolStates(
const QMap<quint32,QByteArray>&,
bool disablenotif =
false);
306 "This system displays the geometry as defined in the GeoModel tree.",
307 "Riccardo.Maria.Bianchi@cern.ch"),
308 m_d(new
Imp(this,SubSystemsTurnedOn))
317 m_d->volumetreemodel->cleanup();
318 delete m_d->matVisAttributes;
m_d->matVisAttributes = 0;
319 delete m_d->detVisAttributes;
m_d->detVisAttributes = 0;
320 delete m_d->volVisAttributes;
m_d->volVisAttributes = 0;
324 m_d->subsysInfoList.clear();
338 m_d->controller->setGeometrySelectable(b);
344 m_d->controller->setZoomToVolumeOnClick(b);
351 m_d->controller->setOrientViewToMuonChambersOnClick(b);
358 if (
m_d->controller->autoAdaptMuonChambersToEventData()!=b) {
359 m_d->controller->setAutoAdaptMuonChambersToEventData(b);
367 const QString& treetopregexp,
const QString& childrenregexp,
368 const std::string& matname,
bool negatetreetopregexp,
bool negatechildrenregexp,
369 const QString& grandchildrenregexp,
bool negategrandchildrenregexp)
371 theclass->messageDebug(
"VP1GeometrySystem::Imp::addSubSystem - flag: '" + QString(f) +
"' - matName: '" +
str(matname.c_str()) +
"'." );
373 QCheckBox * cb =
controller->subSystemCheckBox(f);
375 theclass->message(
"Error: Problems retrieving checkbox for subsystem "+
str(f));
379 QRegExp(childrenregexp),negatechildrenregexp,f,matname,
380 QRegExp(grandchildrenregexp), negategrandchildrenregexp);
387 message(
"VP1GeometrySystem::buildController");
405 connect(
m_d->controller,SIGNAL(muonChamberAdaptionStyleChanged(VP1GeoFlags::MuonChamberAdaptionStyleFlags)),
410 connect(
m_d->controller,SIGNAL(
autoAdaptPixelsOrSCT(
bool,
bool,
bool,
bool,
bool,
bool)),
this,SLOT(
autoAdaptPixelsOrSCT(
bool,
bool,
bool,
bool,
bool,
bool)));
411 connect(
m_d->controller,SIGNAL(
autoAdaptMuonNSW(
bool,
bool,
bool,
bool,
bool,
bool)),
this,SLOT(
autoAdaptMuonNSW(
bool,
bool,
bool,
bool,
bool,
bool)));
412 connect(
m_d->controller,SIGNAL(
autoAdaptHGTD(
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool)),
this,SLOT(
autoAdaptHGTD(
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool)));
415 connect(
m_d->controller,SIGNAL(labelsChanged(
int)),
this,SLOT(
setLabels(
int)));
416 connect(
m_d->controller,SIGNAL(labelPosOffsetChanged(QList<int>)),
this,SLOT(
setLabelPosOffsets(QList<int>)));
485 m_d->addSubSystem(
VP1GeoFlags::MuonToroidsEtc,
"Muon",
".*(CS|T1|T2|T3|T4|EI|EM|EO|EE|BI|BEE|BM|BO).*",
"MuonEtc",
false,
true,
"(ECT_Toroids|BAR_Toroid|Feet|NewSmallWheel|JDSH|JTSH|JFSH).*",
true);
495 m_d->controller->volumeTreeBrowser()->header()->hide();
496 m_d->controller->volumeTreeBrowser()->uniformRowHeights();
497 m_d->controller->volumeTreeBrowser()->setModel(
m_d->volumetreemodel);
499 return m_d->controller;
506 m_d->ensureInitVisAttributes();
513 This->
kbEvent =
static_cast<const SoKeyboardEvent *
>(CB->getEvent());
519 m_d->sceneroot = root;
521 #ifndef BUILDVP1LIGHT
523 message(
"Error: GeoModel not configured properly in job.");
530 message(
"Error: Could not retrieve the ATLAS GeoModelExperiment from detector store");
540 if (!
m_d->m_textSep) {
543 m_d->m_textSep =
new SoSeparator;
544 m_d->m_textSep->setName(
"TextSep");
545 m_d->m_textSep->ref();
547 m_d->sceneroot->addChild(
m_d->m_textSep);
550 SoFont *myFont =
new SoFont;
551 myFont->name.setValue(
"Arial");
552 myFont->size.setValue(12.0);
553 m_d->m_textSep->addChild(myFont);
555 bool save = root->enableNotify(
false);
558 SoEventCallback *catchEvents =
new SoEventCallback();
560 root->addChild(catchEvents);
562 root->addChild(
m_d->controller->drawOptions());
563 root->addChild(
m_d->controller->pickStyle());
566 qDebug() <<
"Configuring the default systems... - subsysInfoList len:" << (
m_d->subsysInfoList).
length();
572 bool on(
m_d->initialSubSystemsTurnedOn & subsys->
flag);
574 subsys->
checkbox->setEnabled(
false);
575 subsys->
checkbox->setToolTip(
"This sub-system is not available");
584 qDebug() <<
"Looping on volumes from the input GeoModel...";
586 GeoVolumeCursor av(world);
587 while (!av.atEnd()) {
589 std::string
name = av.getName();
591 qDebug() <<
"volume name:" << QString::fromStdString(
name);
602 if (subsys->
checkbox==checkBoxOther&&found) {
618 SoSwitch * sw =
new SoSwitch();
621 if (sw->whichChild.getValue() != SO_SWITCH_NONE)
622 sw->whichChild = SO_SWITCH_NONE;
623 SoSeparator * sep =
new SoSeparator;
628 subsys->
checkbox->setToolTip(
"Toggle the display of the "+subsys->
checkbox->text()+
" sub system");
634 message(
"Warning: Found unexpected GeoModel treetop: "+QString(
name.c_str()));
641 if (!checkBoxOther->isEnabled())
642 checkBoxOther->setVisible(
false);
648 m_d->buildSystem(subsys);
650 if (subsys->
soswitch->whichChild.getValue() != SO_SWITCH_ALL)
651 subsys->
soswitch->whichChild = SO_SWITCH_ALL;
653 m_d->volumetreemodel->enableSubSystem(subsys->
flag);
656 if (!
m_d->restoredTopvolstates.isEmpty()) {
657 m_d->applyTopVolStates(
m_d->restoredTopvolstates,
false);
658 m_d->restoredTopvolstates.clear();
660 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
661 root->enableNotify(save);
666 if (
m_d->controller->autoAdaptMuonChambersToEventData())
678 return getGeometryFromLocalDB();
684GeoModelExperiment* VP1GeometrySystem::Imp::createTheExperiment(GeoPhysVol* world)
686 if (world ==
nullptr)
689 double densityOfAir=0.1;
690 const GeoMaterial* worldMat =
new GeoMaterial(
"std::Air", densityOfAir);
691 const GeoBox* worldBox =
new GeoBox(1000*CLHEP::cm, 1000*CLHEP::cm, 1000*CLHEP::cm);
692 const GeoLogVol* worldLog =
new GeoLogVol(
"WorldLog", worldBox, worldMat);
694 world =
new GeoPhysVol(worldLog);
697 GeoModelExperiment* theExperiment =
new GeoModelExperiment(world);
698 return theExperiment;
703GeoModelExperiment* VP1GeometrySystem::Imp::getDummyGeometry()
706 GeoModelExperiment* theExperiment = createTheExperiment();
714 VP1Msg::messageDebug(
"Method VP1GeometrySystem::Imp::getDummyGeometry() has to be ported to the new standalone GeoModel.");
716 return theExperiment;
721GeoModelExperiment* VP1GeometrySystem::Imp::getGeometryFromLocalDB()
727 QSettings settings(
"ATLAS",
"VP1Light");
728 QString
path = settings.value(
"db/path").toString();
730 qDebug() <<
"Using this DB file:" <<
path;
735 if (! QFileInfo(path).
exists() ) {
736 qWarning() <<
"ERROR!! DB '" <<
path <<
"' does not exist!!";
737 qWarning() <<
"Returning..." <<
"\n";
742 GMDBManager*
db =
new GMDBManager(path);
746 qDebug() <<
"OK! Database is open!";
751 qDebug() <<
"Database is not open!";
758 GeoModelPers::GReadIn readInGeo = GeoModelPers::GReadIn(db);
760 qDebug() <<
"GReadIn set.";
764 GeoPhysVol* dbPhys = readInGeo.buildGeoModel();
767 qDebug() <<
"GReadIn::buildGeoModel() done.";
770 GeoModelExperiment* theExperiment = createTheExperiment(dbPhys);
773 return theExperiment;
781 QCheckBox * cb =
static_cast<QCheckBox*
>(sender());
784 if (cb==
ss->checkbox) {
790 message(
"ERROR: Unknown checkbox");
796 if (cb->isChecked()) {
797 SbBool save = sw->enableNotify(
false);
798 if (sw->getNumChildren()==0) {
799 m_d->buildSystem(subsys);
800 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
802 if (sw->whichChild.getValue() != SO_SWITCH_ALL)
803 sw->whichChild = SO_SWITCH_ALL;
804 sw->enableNotify(save);
806 m_d->volumetreemodel->enableSubSystem(subsys->
flag);
811 if (sw->whichChild.getValue() != SO_SWITCH_NONE)
812 sw->whichChild = SO_SWITCH_NONE;
813 m_d->volumetreemodel->disableSubSystem(subsys->
flag);
846 if (pickedPath->getNodeFromTail(0)->getTypeId()==SoCylinder::getClassTypeId())
849 if (pickedPath->getLength()<5) {
854 SoSeparator * nodesep(0);
856 if (pickedPath->getNodeFromTail(1)->getTypeId()==SoSeparator::getClassTypeId()
857 && pickedPath->getNodeFromTail(2)->getTypeId()==SoSwitch::getClassTypeId()
858 && pickedPath->getNodeFromTail(3)->getTypeId()==SoSeparator::getClassTypeId())
861 nodesep =
static_cast<SoSeparator*
>(pickedPath->getNodeFromTail(3));
864 else if (pickedPath->getNodeFromTail(1)->getTypeId()==SoSwitch::getClassTypeId()
865 && pickedPath->getNodeFromTail(2)->getTypeId()==SoSeparator::getClassTypeId())
868 nodesep =
static_cast<SoSeparator*
>(pickedPath->getNodeFromTail(2));
870 else if (pickedPath->getNodeFromTail(1)->getTypeId()==SoSeparator::getClassTypeId()) {
872 nodesep =
static_cast<SoSeparator*
>(pickedPath->getNodeFromTail(1));
875 message(
"Unexpected picked path");
878 if ( (!(nodesep)) || (
m_d->sonodesep2volhandle.find(nodesep) ==
m_d->sonodesep2volhandle.end()) ) {
879 message(
"Problems finding volume handle");
884 message(
"Found NULL volume handle");
898 bool shift_isdown = (Qt::ShiftModifier & QApplication::keyboardModifiers());
907 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
911 bool ctrl_isdown = (Qt::ControlModifier & QApplication::keyboardModifiers());
921 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
925 bool z_isdown =
m_d->kbEvent && SO_KEY_PRESS_EVENT(
m_d->kbEvent,SoKeyboardEvent::Z);
940 bool orientedView(
false);
941 if (
m_d->controller->orientViewToMuonChambersOnClick() && volhandle->
isInMuonChamber()) {
950 message(
"Warning: Failed to relocate picked node.");
960 if (!orientedView&&
m_d->controller->zoomToVolumeOnClick()) {
963 std::set<SoCamera*>::iterator it,itE = cameras.end();
964 for (it=cameras.begin();it!=itE;++it) {
975 m_d->controller->setLastSelectedVolume(volhandle);
983 if (
m_d->controller->printInfoOnClick_Shape()) {
988 if (
m_d->controller->printInfoOnClick_Material()) {
994 if (
m_d->controller->printInfoOnClick_CopyNumber() ) {
996 message(
"===> CopyNo : "+(cn>=0?QString::number(cn):QString(cn==-1?
"Invalid":
"Error reconstructing copynumber")));
999 if (
m_d->controller->printInfoOnClick_Transform() ) {
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");
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"))
1037 if (
m_d->controller->printInfoOnClick_Mass()) {
1041 message(
"===> Total Mass <===");
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));
1064 QStack<QString> partspectPath, extras;
1065 QString detFactoryName;
1067 VolumeHandle *parentVH(volhandle), *childVH(volhandle);
1068 m_d->createPathExtras(volhandle,detFactoryName,extras);
1071 parentVH = parentVH->parent();
1072 PVConstLink parentPVLink = parentVH ? parentVH->geoPVConstLink() : childVH->
geoPVConstLink()->getParent();
1076 std::string childPVName = parentPVLink->getNameOfChildVol(indexOfChild);
1077 QString pathEntry = childPVName==
"ANON" ? detFactoryName+childVH->
getName() : QString(childPVName.c_str());
1079 std::optional<int> childCopyNo = parentPVLink->getIdOfChildVol(indexOfChild);
1082 strCopyNo.setNum(*childCopyNo);
1083 pathEntry += (
"::"+strCopyNo);
1085 partspectPath.push(pathEntry);
1090 while(!extras.isEmpty())
1091 partspectPath.push(extras.pop());
1093 partspectPath.push(
"Atlas::Atlas");
1113 #ifndef BUILDVP1LIGHT
1123 SoSeparator * subsystemsep =
new SoSeparator;
1127 SbBool save = si->
soswitch->enableNotify(
false);
1131 std::vector<SubSystemInfo::TreetopInfo>::const_iterator it, itE = si->
treetopinfo.end();
1139 theclass->message(
"Warning: Did not find a predefined material for volume: "+QString(it->volname.c_str()));
1152 std::vector<SubSystemInfo::TreetopInfo>::const_iterator it, itE = si->
treetopinfo.end();
1160 SoMaterial*mat_top(0);
1167 volhandle_subsysdata->
ref();
1171 GeoVolumeCursor av(it->pV);
1173 while (!av.atEnd()) {
1180 PVConstLink pVD = av.getVolume();
1187 if (hasMuonChambers){
1188 #ifndef BUILDVP1LIGHT
1191 #ifdef BUILDVP1LIGHT
1196 std::cout<<
"Has muon chamber VH="<<vh<<std::endl;
1201 vh =
new VolumeHandle(volhandle_subsysdata,0,pVD,ichild++,
1230 volhandle_subsysdata->
unref();
1245 VP1Msg::messageDebug(
"Perform auto expansion of all ether volumes (needed for muon dead material)");
1248 for (it = si->
vollist.begin(); it!=itE; ++it){
1250 (*it)->expandMothersRecursivelyToNonEther();
1258 si->
soswitch->addChild(subsystemsep);
1267 const GeoLogVol* lv = pv->getLogVol();
1268 const GeoMaterial *material = lv->getMaterial();
1269 double density = material->getDensity();
1270 return density*
volume(pv);
1276 const GeoLogVol * lv = pv->getLogVol();
1277 const GeoShape *shape = lv->getShape();
1278 return shape->volume();
1285 const GeoLogVol* lv = pv->getLogVol();
1286 const GeoMaterial *material = lv->getMaterial();
1287 double density = material->getDensity();
1291 GeoVolumeCursor av(pv);
1292 while (!av.atEnd()) {
1294 mass -=
volume(av.getVolume())*density;
1310 serialise.save(
m_d->controller->saveSettings());
1313 QMap<QString,bool> subsysstate;
1315 serialise.widgetHandled(subsys->
checkbox);
1316 subsysstate.insert(subsys->
checkbox->text(),subsys->
checkbox->isChecked());
1318 serialise.save(subsysstate);
1321 QMap<quint32,QByteArray> topvolstates;
1327 topvolstates.insert((*it)->hashID(),(*it)->getPersistifiableState());
1329 serialise.save(topvolstates);
1331 m_d->ensureInitVisAttributes();
1332 serialise.save(
m_d->detVisAttributes->getState());
1333 serialise.save(
m_d->matVisAttributes->getState());
1334 serialise.save(
m_d->volVisAttributes->getState());
1336 serialise.disableUnsavedChecks();
1337 return serialise.result();
1344 message(
"Warning: State data in .vp1 file is in wrong format - ignoring!");
1347 if (
state.version()<=5) {
1348 message(
"Warning: State data in .vp1 file is in obsolete format - ignoring!");
1356 m_d->controller->restoreSettings(
state.restoreByteArray());
1359 VP1GeoFlags::SubSystemFlags flags;
1360 QMap<QString,bool> subsysstate =
state.restore<QMap<QString,bool> >();
1363 if (subsysstate.contains(subsys->
checkbox->text())&&subsysstate[subsys->
checkbox->text()])
1364 flags |= subsys->
flag;
1366 m_d->initialSubSystemsTurnedOn = flags;
1369 QMap<quint32,QByteArray> topvolstates;
1370 topvolstates =
state.restore<QMap<quint32,QByteArray> >();
1372 m_d->applyTopVolStates(topvolstates,
true);
1374 m_d->restoredTopvolstates = topvolstates;
1376 if (
state.version()>=7) {
1377 m_d->ensureInitVisAttributes();
1378 m_d->detVisAttributes->applyState(
state.restoreByteArray());
1379 m_d->matVisAttributes->applyState(
state.restoreByteArray());
1380 m_d->volVisAttributes->applyState(
state.restoreByteArray());
1383 state.disableUnrestoredChecks();
1386 if (
m_d->controller->autoAdaptMuonChambersToEventData())
1395 QMap<quint32,QByteArray>::const_iterator topvolstatesItr;
1398 for (;it!=itE;++it) {
1399 topvolstatesItr = topvolstates.find((*it)->hashID());
1400 if (topvolstatesItr!=topvolstates.end())
1401 (*it)->applyPersistifiableState(topvolstatesItr.value());
1415 prefix = QString(
"Pixel::");
1418 entries.push(
"ITkPixel::ITkPixel");
1424 prefix = QString(
"SCT::");
1427 entries.push(
"ITkStrip::ITkStrip");
1433 prefix = QString(
"HGTD::");
1439 prefix = QString(
"TRT::");
1445 prefix = QString(
"InDetServMat::");
1450 prefix = QString(
"LArMgr::");
1452 entries.push(
"LArMgr::LArMgr");
1456 prefix = QString(
"Tile::");
1474 prefix = QString(
"Muon::");
1475 entries.push(
"MUONQ02::MUONQ02");
1476 entries.push(
"Muon::MuonSys");
1480 prefix = QString(
"BeamPipe::");
1481 entries.push(
"BeamPipe::BeamPipe");
1502 if (val<0||val>100) {
1503 message(
"setCurvedSurfaceRealism Error: Value "+
str(val)+
"out of range!");
1506 m_d->controller->setComplexity(val==100?1.0:(val==0?0.0:val/100.0));
1516 float transparency =
m_d->controller->transparency();
1519 m_d->controller->setLastSelectedVolume(0);
1520 m_d->ensureInitVisAttributes();
1521 m_d->detVisAttributes->overrideTransparencies(transparency);
1522 m_d->matVisAttributes->overrideTransparencies(transparency);
1523 m_d->volVisAttributes->overrideTransparencies(transparency);
1524 m_d->controller->setLastSelectedVolume(lastSelVol);
1541 for (;it!=itE;++it) {
1542 messageDebug(
"resetting volume --> " + (*it)->getName() );
1552 if (
m_d->muonchambers_pv2handles.empty())
1555 std::set<GeoPVConstLink> allchambers;
1556 if (!
m_d->sender2ChamberList.empty()) {
1557 allchambers = (
m_d->sender2ChamberList.begin())->second;
1558 std::map<QObject*,std::set<GeoPVConstLink> >
::iterator itLists,itListsE(
m_d->sender2ChamberList.end());
1559 for (itLists =
m_d->sender2ChamberList.begin(),++itLists;itLists != itListsE;++itLists) {
1560 allchambers.insert(itLists->second.begin(),itLists->second.end());
1565 bool save =
m_d->sceneroot->enableNotify(
false);
1566 m_d->phisectormanager->largeChangesBegin();
1569 std::map<PVConstLink,VolumeHandle*>::iterator it, itE=
m_d->muonchambers_pv2handles.end();
1570 std::set<GeoPVConstLink>::iterator itchambersE = allchambers.end();
1571 for (it=
m_d->muonchambers_pv2handles.begin();it!=itE;++it) {
1572 if (allchambers.find(it->first)==itchambersE)
1575 if (it->second->muonChamberDirty())
1576 m_d->updateTouchedMuonChamber(it->second);
1579 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
1580 m_d->phisectormanager->largeChangesEnd();
1582 m_d->sceneroot->enableNotify(
true);
1583 m_d->sceneroot->touch();
1591 std::map<PVConstLink,VolumeHandle*>::iterator it, itE=
m_d->muonchambers_pv2handles.end();
1592 for (it=
m_d->muonchambers_pv2handles.begin();it!=itE;++it)
1593 it->second->setMuonChamberDirty(
true);
1596 if (
m_d->controller->autoAdaptMuonChambersToEventData())
1604 if (!
m_d->controller) {
1605 message(
"emit_appropriateMDTProjectionsChanged called before controller built.");
1608 VP1GeoFlags::MuonChamberAdaptionStyleFlags f(
m_d->controller->muonChamberAdaptionStyle());
1611 int i (option_openmdtchambers?(option_hidetubes?0:1):2);
1612 if (
m_d->last_appropriatemdtprojections != i ) {
1613 m_d->last_appropriatemdtprojections = i;
1622 bool listChanged(
m_d->sender2ChamberList.find(sender())!=
m_d->sender2ChamberList.end()?
1623 (chambers !=
m_d->sender2ChamberList[sender()]):
true);
1624 m_d->sender2ChamberList[sender()] = chambers;
1627 if ( listChanged &&
m_d->controller->autoAdaptMuonChambersToEventData() )
1635 if (stationname.empty()) {
1636 theclass->message(
"Warning: Asked to handle muon chamber (station) with empty name!");
1644 VP1GeoFlags::MuonChamberAdaptionStyleFlags f(
controller->muonChamberAdaptionStyle());
1651 char firstletter = stationname[0];
1652 std::string name1,name2;
1653 if (firstletter==
'E' || firstletter ==
'B') {
1657 if (option_openmdtchambers) {
1662 for (;itch!=itchE;++itch) {
1666 name1 = (*itch)->getNameStdString();
1667 if (name1.size()>2&&name1[0]==
'D'&&name1[1]==
'e'&&name1[2]==
'd')
1670 (*itch)->initialiseChildren();
1672 for (;itch2!=itch2E;++itch2) {
1676 name2 = (*itch2)->getNameStdString();
1678 if (option_hidetubes&&name2==
"MDTDriftWall") {
1680 }
else if (name2.size()>2&&name2[0]==
'R'&&((name2[1]==
'p'&&name2[2]==
'c')||(name2[1]==
'P'&&name2[2]==
'C'))) {
1681 zap = (option_hiderpcvolumes||name2!=
"Rpclayer");
1682 }
else if (name2.size()>2&&name2[0]==
'D'&&name2[1]==
'e'&&name2[2]==
'd') {
1691 chamberhandle->
reset();
1694 if (firstletter==
'C') {
1698 if (option_opencscchambers) {
1702 for (;itch!=itchE;++itch) {
1703 if ((*itch)->hasName(
"CSCspacer")) {
1707 if ((*itch)->nChildren()<1)
1709 (*itch)->initialiseChildren();
1711 for (;itch2!=itch2E;++itch2) {
1712 if ((*itch2)->nChildren()<1)
1714 (*itch2)->initialiseChildren();
1716 for (;itch3!=itch3E;++itch3) {
1717 if ((*itch3)->getNameStdString()==
"CscArCO2")
1732 if (option_opentgcchambers) {
1736 for (;itch!=itchE;++itch) {
1737 if ((*itch)->nChildren()<1)
1739 (*itch)->initialiseChildren();
1741 for (;itch2!=itch2E;++itch2) {
1742 if ((*itch2)->getNameStdString()==
"muo::TGCGas")
1761 std::string
name = chamberPV->getLogVol()->getName();
1766 if (!subsys->hasMuonChambers())
1768 if (subsys->childrenRegExpNameCompatible(
name)) {
1780 if (!
m_d->sceneroot)
1786 message(
"Error: Asked to orient view to chamber volume '"
1787 +QString(chamberPV->getLogVol()->getName().c_str())
1788 +
"', which doesn't fit the known format of any chamber!");
1794 message(
"Warning: Asked to orient view to muon chamber volume which is not available. Perhaps muon geometry was not built?");
1799 std::map<PVConstLink,VolumeHandle*>::iterator itChamber =
m_d->muonchambers_pv2handles.find(chamberPV);
1800 if (itChamber==
m_d->muonchambers_pv2handles.end()) {
1802 m_d->buildSystem(subsys);
1803 itChamber =
m_d->muonchambers_pv2handles.find(chamberPV);
1804 if (itChamber==
m_d->muonchambers_pv2handles.end()) {
1805 message(
"Error: Asked to orient view to chamber volume '"
1806 +QString(chamberPV->getLogVol()->getName().c_str())
1807 +
"', but could not find chamber handle!");
1817 bool isCSCOrTGC =
name.size()>=2 && ( (
name[0]==
'C' &&
name[1]==
'S') || (
name[0]==
'T') );
1818 if (!isCSCOrTGC&&!(
name.size()>=1&&(
name[0]==
'E'||
name[0]==
'B'))) {
1820 message(
"orientViewToMuonChamber Warning: Not CSC, TGC or MDT station!");
1824 bool save = subsys->
soswitch->enableNotify(
false);
1827 int32_t soswitch_val = subsys->
soswitch->whichChild.getValue();
1828 if (soswitch_val!=SO_SWITCH_ALL)
1829 subsys->
soswitch->whichChild = SO_SWITCH_ALL;
1837 std::set<SoCamera*>::iterator it,itE = cameras.end();
1838 for (it=cameras.begin();it!=itE;++it) {
1844 SbRotation camrot = (*it)->orientation.getValue();
1845 SbVec3f cameraDir(0, 0, -1);
1846 camrot.multVec(cameraDir, cameraDir);
1847 SbVec3f cameraUpVec(0, 1, 0);
1848 camrot.multVec(cameraUpVec, cameraUpVec);
1850 std::pair<SbVec3f,SbVec3f> chamberdirections;
1853 chamberdirections =
m_d->getClosestCSCOrTGCEdgeDirections(cameraDir,chamberHandle);
1856 chamberdirections =
m_d->getClosestMuonDriftTubeDirections(cameraDir,cameraUpVec,chamberHandle);
1858 SbVec3f newdirection = - chamberdirections.first;
1859 SbVec3f newup(cameraUpVec);
1860 const float epsilon(0.00001f);
1861 if (
m_d->previousAlignedChamberHandle==chamberHandle&&cameraDir.equals(newdirection,epsilon)) {
1865 SbRotation rot(cameraDir,0.5*
M_PI);
1866 SbVec3f chambdir1 = chamberdirections.second;
1867 SbVec3f chambdir2,chambdir3,chambdir4;
1868 rot.multVec(chambdir1,chambdir2);
1869 rot.multVec(chambdir2,chambdir3);
1870 rot.multVec(chambdir3,chambdir4);
1871 if (cameraUpVec.equals(chambdir1,epsilon)) {
1873 }
else if (cameraUpVec.equals(chambdir2,epsilon)) {
1875 }
else if (cameraUpVec.equals(chambdir3,epsilon)) {
1877 }
else if (cameraUpVec.equals(chambdir4,epsilon)) {
1881 float cos1 = chambdir1.dot(cameraUpVec);
1882 float cos2 = chambdir2.dot(cameraUpVec);
1883 float cos3 = chambdir3.dot(cameraUpVec);
1884 float cos4 = chambdir4.dot(cameraUpVec);
1885 float maxcos = std::max(std::max(cos1,cos2),std::max(cos3,cos4));
1888 else if (cos2==maxcos)
1890 else if (cos3==maxcos)
1904 chamberHandle->
setState(oldChamberState);
1905 if (soswitch_val!=SO_SWITCH_ALL)
1906 subsys->
soswitch->whichChild.setValue(soswitch_val);
1908 subsys->
soswitch->enableNotify(
true);
1911 m_d->previousAlignedChamberHandle=chamberHandle;
1918 const SbVec3f& cameraUpDirection,
1922 SbVec3f closesttubedir(cameraDirection);
1923 SbVec3f closesttubeupvec(cameraUpDirection);
1924 float smallestcosangle(1.1);
1929 for (;itch!=itchE;++itch) {
1931 std::string name1 = (*itch)->getNameStdString();
1932 if (name1.size()>2&&name1[0]==
'D'&&name1[1]==
'e'&&name1[2]==
'd')
1935 (*itch)->initialiseChildren();
1938 const SbVec3f unitz(0.0f,0.0f,1.0f);
1939 const SbVec3f unity(0.0f,1.0f,0.0f);
1941 SbVec3f translation, scale;
1942 SbRotation rotation, scalerotation;
1944 for (;itch2!=itch2E;++itch2) {
1945 if ((*itch2)->getNameStdString()==
"MDTDriftWall") {
1949 (*itch2)->getGlobalTransformToVolume().getTransform(translation,rotation,scale,scalerotation);
1950 rotation.multVec (unitz, tubeglob);
1951 if (tubeglob.dot(cameraDirection)<smallestcosangle) {
1952 smallestcosangle = tubeglob.dot(cameraDirection);
1953 closesttubedir = tubeglob;
1954 rotation.multVec(unity, closesttubeupvec);
1956 if (tubeglob.dot(-cameraDirection)<smallestcosangle) {
1957 smallestcosangle = tubeglob.dot(-cameraDirection);
1958 closesttubedir = -tubeglob;
1959 rotation.multVec(unity, closesttubeupvec);
1964 return std::pair<SbVec3f,SbVec3f>(closesttubedir,closesttubeupvec);
1972 std::vector<SbVec3f> directions;
1973 directions.push_back(SbVec3f(0.0f,1.0f,0.0f));
1974 directions.push_back(SbVec3f(0.0f,-1.0f,0.0f));
1975 directions.push_back(SbVec3f(0.0f,0.0f,1.0f));
1976 directions.push_back(SbVec3f(0.0f,0.0f,-1.0f));
1978 directions.push_back(SbVec3f(1.0f,0.0f,0.0f));
1979 directions.push_back(SbVec3f(-1.0f,0.0f,0.0f));
1982 SbVec3f translation, scale;
1983 SbRotation rotation, scalerotation;
1987 for (
unsigned i = 0; i<directions.size();++i)
1988 rotation.multVec(directions[i],directions[i]);
1991 SbVec3f chamberDir(-cameraDirection);
1992 float smallestcosangle(1.1);
1993 for (
unsigned i = 0; i<directions.size();++i) {
1994 if (directions.at(i).dot(cameraDirection)<smallestcosangle) {
1995 smallestcosangle = directions.at(i).dot(cameraDirection);
1996 chamberDir = directions.at(i);
2004 chamberDir.getValue(
x,
y,
z);
2006 rotation.multVec(SbVec3f(0.0f,1.0f,0.0f),chamberUp);
2008 rotation.multVec(SbVec3f(1.0f,0.0f,0.0f),chamberUp);
2012 return std::pair<SbVec3f,SbVec3f>(chamberDir,chamberUp);
2019 if (handle->isAttached()) {
2021 if (handle->isInitialisedAndHasNonStandardShape()) {
2023 handle->setState(target);
2029 if (handle->nChildren()==0||!handle->childrenAreInitialised())
2043 std::vector<std::pair<VolumeHandle::VolumeHandleListItr,VolumeHandle::VolumeHandleListItr> > roothandles;
2044 m_d->volumetreemodel->getRootHandles(roothandles);
2047 bool save =
m_d->sceneroot->enableNotify(
false);
2048 m_d->phisectormanager->largeChangesBegin();
2052 for (
unsigned i = 0; i<roothandles.size();++i) {
2053 it = roothandles.at(i).first;
2054 itE = roothandles.at(i).second;
2055 for(;it!=itE;++it) {
2056 m_d->changeStateOfVisibleNonStandardVolumesRecursively(*it,target);
2060 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
2061 m_d->phisectormanager->largeChangesEnd();
2063 m_d->sceneroot->enableNotify(
true);
2064 m_d->sceneroot->touch();
2071 if (targetname.isEmpty()) {
2076 messageVerbose(
"Auto expansions of visible volumes requested. Target all volumes with "
2077 +
str(bymatname?
"material name":
"name")+
" matching "+targetname);
2079 QRegExp selregexp(targetname,Qt::CaseSensitive,QRegExp::Wildcard);
2081 std::vector<std::pair<VolumeHandle::VolumeHandleListItr,VolumeHandle::VolumeHandleListItr> > roothandles;
2082 m_d->volumetreemodel->getRootHandles(roothandles);
2085 bool save =
m_d->sceneroot->enableNotify(
false);
2086 m_d->phisectormanager->largeChangesBegin();
2090 for (
unsigned i = 0; i<roothandles.size();++i) {
2091 it = roothandles.at(i).first;
2092 itE = roothandles.at(i).second;
2094 m_d->expandVisibleVolumesRecursively(*it,selregexp,bymatname);
2097 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
2098 m_d->phisectormanager->largeChangesEnd();
2100 m_d->sceneroot->enableNotify(
true);
2101 m_d->sceneroot->touch();
2112 if (handle->nChildren()>0
2113 && selregexp.exactMatch(bymatname?QString(handle->geoMaterial()->getName().c_str()):handle->getName())) {
2119 if (handle->nChildren()==0||!handle->childrenAreInitialised())
2134 if( selregexp.exactMatch(bymatname?QString(handle->geoMaterial()->getName().c_str()):handle->getName())) {
2140 if (handle->nChildren()==0||!handle->childrenAreInitialised())
2151 if (targetname.isEmpty()) {
2156 messageVerbose(
"Auto iconification/zapping of visible volumes requested. Target all volumes with "
2157 +
str(bymatname?
"material name":
"name")+
" matching "+targetname);
2159 QRegExp selregexp(targetname,Qt::CaseSensitive,QRegExp::Wildcard);
2161 std::vector<std::pair<VolumeHandle::VolumeHandleListItr,VolumeHandle::VolumeHandleListItr> > roothandles;
2162 m_d->volumetreemodel->getRootHandles(roothandles);
2165 bool save =
m_d->sceneroot->enableNotify(
false);
2166 m_d->phisectormanager->largeChangesBegin();
2170 for (
unsigned i = 0; i<roothandles.size();++i) {
2171 it = roothandles.at(i).first;
2172 itE = roothandles.at(i).second;
2174 m_d->iconifyVisibleVolumesRecursively(*it,selregexp,bymatname);
2177 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
2178 m_d->phisectormanager->largeChangesEnd();
2180 m_d->sceneroot->enableNotify(
true);
2181 m_d->sceneroot->touch();
2184#ifndef BUILDVP1LIGHT
2190 GeoPVConstLink pvlink = elem->getMaterialGeom()->getParent();
2193 theclass->message(
"WARNING: Ignored null station pointer");
2207 theclass->messageVerbose(
"Initializing physical volume link -> MuonStation map.");
2211 VP1Msg::message(
"WARNING: Could not get muon detector manager to construct volume -> muon station map!");
2214 if (mgr->nMdtRE()) {
2215 for (
auto det_el = mgr->mdtIdHelper()->detectorElement_begin();
2216 det_el != mgr->mdtIdHelper()->detectorElement_end(); ++det_el) {
2220 if (mgr->nRpcRE()) {
2221 for (
auto det_el = mgr->rpcIdHelper()->detectorElement_begin();
2222 det_el != mgr->rpcIdHelper()->detectorElement_end(); ++det_el) {
2226 if (mgr->nCscRE()) {
2227 for (
auto det_el = mgr->cscIdHelper()->detectorElement_begin();
2228 det_el != mgr->cscIdHelper()->detectorElement_end(); ++det_el) {
2232 if (mgr->nTgcRE()) {
2233 for (
auto det_el = mgr->tgcIdHelper()->detectorElement_begin();
2234 det_el != mgr->tgcIdHelper()->detectorElement_end(); ++det_el) {
2260 #ifndef BUILDVP1LIGHT
2267 bool bcm(bcmA||bcmC);
2274 if (si->
flag == subSysFlag) {
2280 message(
"AutoAdaptPixelsOrSCT Error: Could not find subsystem");
2291 bool save =
m_d->sceneroot->enableNotify(
false);
2292 m_d->phisectormanager->largeChangesBegin();
2297 for (;it!=itE;++it) {
2298 (*it)->initialiseChildren();
2301 for (;itChl!=itChlE;++itChl) {
2305 if (brl&&(*itChl)->hasName(
"barrelLog")) {
2307 m_d->showPixelModules(*itChl);
2308 }
else if ((ec)&&(*itChl)->hasName(
"EndCapLog")) {
2309 if (((*itChl)->isPositiveZ()?ecA:ecC)) {
2310 m_d->showPixelModules(*itChl);
2313 }
else if (bcm&&(*itChl)->hasName(
"bcmModLog")) {
2314 if (((*itChl)->isPositiveZ()?bcmA:bcmC)) {
2320 if ((*itChl)->hasName(
"ITkPixelDetector")) {
2321 m_d->showITkPixelModules(*itChl, brl, ecA, ecC);
2332 for (;it!=itE;++it) {
2333 (*it)->initialiseChildren();
2338 if (brl&&(*it)->hasName(
"SCT_Barrel")) {
2340 m_d->showSCTBarrelModules(*it);
2341 }
else if (ecA&&(*it)->hasName(
"SCT_ForwardA")) {
2343 m_d->showSCTEndcapModules(*it);
2344 }
else if (ecC&&(*it)->hasName(
"SCT_ForwardC")) {
2346 m_d->showSCTEndcapModules(*it);
2349 m_d->showITkStripModules(*it, brl, ecA, ecC);
2356 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
2357 m_d->phisectormanager->largeChangesEnd();
2359 m_d->sceneroot->enableNotify(
true);
2360 m_d->sceneroot->touch();
2370 #ifndef BUILDVP1LIGHT
2385 if (si->
flag == subSysFlag) {
2391 message(
"autoAdaptMuonNSW Error: Could not find subsystem");
2402 bool save =
m_d->sceneroot->enableNotify(
false);
2403 m_d->phisectormanager->largeChangesBegin();
2408 for (;it!=itE;++it) {
2410 (*it)->initialiseChildren();
2415 for (;itChl!=itChlE;++itChl) {
2417 bool unzap( reset?
true :
false );
2421 if ( (stgc) && (*itChl)->hasName(
"NSW_sTGC") ) {
2424 }
else if ( (mm) && (*itChl)->hasName(
"NSW_MM") ) {
2427 }
else if ( (passiveSpacer) && (*itChl)->hasName(
"NSW_Spacer") ) {
2429 }
else if ( (passiveStructure) && (*itChl)->hasName(
"NSW_Aluminum_Structure_and_HUB") ) {
2431 }
else if ( (passiveAPlate) && (*itChl)->hasName(
"A_Plate") ) {
2442 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
2443 m_d->phisectormanager->largeChangesEnd();
2446 m_d->sceneroot->enableNotify(
true);
2447 m_d->sceneroot->touch();
2453void VP1GeometrySystem::autoAdaptHGTD(
bool reset,
bool flex,
bool hybrid,
bool glue,
bool sensors,
bool inactive,
bool asic,
bool supportPlate,
bool frontCover,
bool backCover,
bool moderatorIn,
bool moderatorOut,
bool outerRCover,
bool coolingLines)
2457 #ifndef BUILDVP1LIGHT
2471 if (si->
flag == subSysFlag) {
2477 message(
"autoAdaptHGTD Error: Could not find subsystem");
2488 bool save =
m_d->sceneroot->enableNotify(
false);
2489 m_d->phisectormanager->largeChangesBegin();
2497 handles.push_back(volume);
2499 for (
unsigned i = 0; i < handles.size(); ++i) {
2500 handles.at(i)->initialiseChildren();
2502 handles.at(i)->childrenBegin(), handles.at(i)->childrenEnd()))
2503 handles.push_back(child);
2511 const QString
name = handle->getName();
2512 bool selected(
false);
2513 if (flex && (
name==
"HGTDFlexPackage" ||
name.startsWith(
"HGTDFlexTube"))) {
2515 }
else if (hybrid &&
name==
"HGTDHybrid") {
2517 }
else if (glue && (
name==
"HGTDGlueSensor" ||
name==
"HGTDGlueAsic")) {
2519 }
else if (sensors &&
name.startsWith(
"HGTDSiSensor")) {
2521 }
else if (inactive &&
name==
"HGTDLGADInactive") {
2523 }
else if (asic &&
name==
"HGTDASIC") {
2525 }
else if (supportPlate &&
name==
"HGTDSupportPlate") {
2527 }
else if (frontCover &&
name==
"HGTDFrontCover") {
2529 }
else if (backCover &&
name==
"HGTDBackCover") {
2531 }
else if (moderatorIn &&
name==
"HGTDModeratorIn") {
2533 }
else if (moderatorOut &&
name==
"HGTDModeratorOut") {
2535 }
else if (outerRCover &&
name==
"HGTDOuterRCover") {
2537 }
else if (coolingLines &&
name==
"HGTDPeripheralCoolingLines") {
2547 parent = parent->parent();
2556 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
2557 m_d->phisectormanager->largeChangesEnd();
2560 m_d->sceneroot->enableNotify(
true);
2561 m_d->sceneroot->touch();
2572 h->initialiseChildren();
2574 for (;it!=itE;++it) {
2575 if ((*it)->hasName(
"moduleLog")) {
2577 (*it)->contractDaughtersRecursively();
2578 (*it)->initialiseChildren();
2580 for (;itMod!=itModE;++itMod) {
2581 if ((*itMod)->getName().startsWith(
"si"))
2589 if ((*it)->hasName(
"pigtailLog")||(*it)->hasName(
"omegaLog")) {
2591 (*it)->contractDaughtersRecursively();
2594 if ((*it)->nChildren()<1) {
2606 if (
h->nChildren()==0) {
2607 if (isPixel and (ecA or ecC)) {
2608 float translation_x, translation_y, translation_z, rotaxis_x, rotaxis_y, rotaxis_z, rotangle_radians;
2610 translation_x, translation_y, translation_z,
2611 rotaxis_x, rotaxis_y, rotaxis_z, rotangle_radians );
2612 if ((!ecA || !ecC) && ((ecA and (translation_z<0.)) or (ecC and (translation_z>0.) ))) {
2619 std::vector< std::string > selected_volumes = {};
2622 selected_volumes.push_back(
"InnerBarrelSingleMod_Sensor");
2623 selected_volumes.push_back(
"InnerBarrelQuadMod_Sensor");
2624 selected_volumes.push_back(
"OuterBarrelQuadMod_Sensor");
2625 selected_volumes.push_back(
"LongeronCoolingTube");
2626 selected_volumes.push_back(
"InnerPixBarrelSupport_Stave");
2627 selected_volumes.push_back(
"InnerPixBarrelSupport_Stave1");
2628 selected_volumes.push_back(
"LongeronCornerBase");
2629 selected_volumes.push_back(
"LongeronCornerEnd");
2630 selected_volumes.push_back(
"LongeronTrussWall");
2631 selected_volumes.push_back(
"LongeronCapBase");
2632 selected_volumes.push_back(
"LongeronTopCap");
2635 selected_volumes.push_back(
"BRLSensorSS");
2636 selected_volumes.push_back(
"BRLSensorMS");
2637 selected_volumes.push_back(
"B_HybridPCB");
2638 selected_volumes.push_back(
"DCDC_PCB");
2639 selected_volumes.push_back(
"DCDC_Box");
2640 selected_volumes.push_back(
"Bex_HybridPCB_near");
2641 selected_volumes.push_back(
"Bex_HybridPCB_far");
2646 selected_volumes.push_back(
"InclinedQuadMod_Sensor");
2647 selected_volumes.push_back(
"InnerRingSingleMod_Sensor");
2648 selected_volumes.push_back(
"InnerEndcapQuadMod_Sensor");
2649 selected_volumes.push_back(
"OuterEndcapQuadMod_Sensor");
2650 selected_volumes.push_back(
"L2HalfRingCoolingPipe");
2651 selected_volumes.push_back(
"L3HalfRingCoolingPipe");
2652 selected_volumes.push_back(
"L4endcapcoolingpipe");
2653 selected_volumes.push_back(
"InclL2HalfShell");
2654 selected_volumes.push_back(
"InclL2Support");
2655 selected_volumes.push_back(
"InclL3HalfShell");
2656 selected_volumes.push_back(
"InclL3Support");
2657 selected_volumes.push_back(
"InclL4HalfShell");
2658 selected_volumes.push_back(
"InclL4Support");
2659 selected_volumes.push_back(
"InnerPixEndcap_CoupledRingSupport");
2660 selected_volumes.push_back(
"InnerPixEndcap_IntermediateRingSupport");
2661 selected_volumes.push_back(
"InnerPixEndcap_L1RingSupport");
2662 selected_volumes.push_back(
"L2HalfRingCarbonFoamInner");
2663 selected_volumes.push_back(
"L2HalfRingCarbonFoamOuter");
2664 selected_volumes.push_back(
"L2HalfRingFaceSheet");
2665 selected_volumes.push_back(
"L3HalfRingCarbonFoamInner");
2666 selected_volumes.push_back(
"L3HalfRingCarbonFoamOuter");
2667 selected_volumes.push_back(
"L3HalfRingFaceSheet");
2668 selected_volumes.push_back(
"L4endcapinnerCarbonFoam");
2669 selected_volumes.push_back(
"L4endcapouterCarbonFoam");
2670 selected_volumes.push_back(
"L4endcapFaceSheet");
2671 selected_volumes.push_back(
"L2HalfShell");
2672 selected_volumes.push_back(
"L3HalfShell");
2673 selected_volumes.push_back(
"L4HalfShell");
2675 selected_volumes.push_back(
"ECSensor0");
2676 selected_volumes.push_back(
"ECSensor1");
2677 selected_volumes.push_back(
"ECSensor2");
2678 selected_volumes.push_back(
"ECSensor3");
2679 selected_volumes.push_back(
"ECSensor4");
2680 selected_volumes.push_back(
"ECSensor5");
2681 selected_volumes.push_back(
"ECSensorBack0");
2682 selected_volumes.push_back(
"ECSensorBack1");
2683 selected_volumes.push_back(
"ECSensorBack2");
2684 selected_volumes.push_back(
"ECSensorBack3");
2685 selected_volumes.push_back(
"ECSensorBack4");
2686 selected_volumes.push_back(
"ECSensorBack5");
2690 std::string
name =
h->getName().toStdString();
2692 if (not isPixel and (ecA or ecC)) {
2694 if (
name.starts_with(
"ECHybrid") or
name.starts_with(
"DCDC_EC"))
2698 if (std::find(selected_volumes.begin(), selected_volumes.end(),
name) == selected_volumes.end()) {
2703 }
else if (not isPixel and (
h->getName().toStdString()==
"PetalCore" or
2704 h->getName().toStdString()==
"StaveCoreSS" or
2705 h->getName().toStdString() ==
"StaveCoreMS")) {
2708 h->initialiseChildren();
2712 for (;it!=itE;++it) {
2720 h->initialiseChildren();
2723 for (;it!=itE;++it) {
2732 h->initialiseChildren();
2735 for (;it!=itE;++it) {
2736 if (brl and (*it)->hasName(
"ITkStrip_Barrel")) {
2739 else if (ecA and (*it)->hasName(
"ITkStrip_ForwardPlus")) {
2742 else if (ecC and (*it)->hasName(
"ITkStrip_ForwardMinus")) {
2753 h->initialiseChildren();
2755 for (;it!=itE;++it) {
2756 if ((*it)->getName().startsWith(
"Layer")) {
2758 (*it)->initialiseChildren();
2760 for (;itLay!=itLayE;++itLay) {
2761 if ((*itLay)->getName().endsWith(
"Active")&&(*itLay)->getName().startsWith(
"Layer")) {
2763 (*itLay)->initialiseChildren();
2765 for (;itActLay!=itActLayE;++itActLay) {
2766 if ((*itActLay)->getName().startsWith(
"Ski")) {
2768 (*itActLay)->initialiseChildren();
2770 for (;itSki!=itSkiE;++itSki) {
2772 if ((*itSki)->hasName(
"Module")) {
2775 (*itSki)->initialiseChildren();
2777 for (;itMod!=itModE;++itMod) {
2778 if ((*itMod)->getName().contains(
"Envelope")) {
2780 (*itMod)->initialiseChildren();
2782 for(;itEnv!=itEnvE;++itEnv) {
2783 if ((*itEnv)->getName().contains(
"Sensor"))
2806 (*itLay)->contractDaughtersRecursively();
2812 (*it)->contractDaughtersRecursively();
2821 h->initialiseChildren();
2823 for (;it!=itE;++it) {
2824 if ((*it)->getName().startsWith(
"Wheel")) {
2826 (*it)->initialiseChildren();
2828 for (;itWhl!=itWhlE;++itWhl) {
2829 if ((*itWhl)->getName().startsWith(
"Ring")) {
2831 (*itWhl)->initialiseChildren();
2833 for (;itRng!=itRngE;++itRng) {
2834 if ((*itRng)->getName().startsWith(
"FwdModule")) {
2836 (*itRng)->initialiseChildren();
2838 for(;itMod!=itModE;++itMod) {
2839 if ((*itMod)->getName().startsWith(
"ECSensor")) {
2853 (*itWhl)->contractDaughtersRecursively();
2859 (*it)->contractDaughtersRecursively();
2872 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
2882 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
2888 std::map<SoSeparator*,VolumeHandle*>::iterator it,itE(
m_d->sonodesep2volhandle.end());
2889 for (it =
m_d->sonodesep2volhandle.begin();it!=itE;++it)
2897 if (filename.isEmpty())
2901 QFileInfo fi(filename);
2903 if (!fi.isWritable()) {
2904 QMessageBox::critical(0,
"Error - could not save to file "+filename,
2905 "Could not save to file: <i>"+filename+
"</i>"
2906 +
"<br/><br/>Reason: File exists already and is write protected",QMessageBox::Ok,QMessageBox::Ok);
2911 QFile
file(filename);
2912 if (!
file.open(QIODevice::WriteOnly)) {
2913 QMessageBox::critical(0,
"Error - problems writing to file "+filename,
2914 "Problems writing to file: <i>"+filename+
"</i>",QMessageBox::Ok,QMessageBox::Ok);
2918 m_d->ensureInitVisAttributes();
2921 s.save(QString(
"VP1GeoMaterialsBegin"));
2922 s.save(
m_d->detVisAttributes->getState(onlyChangedMaterials));
2923 s.save(
m_d->matVisAttributes->getState(onlyChangedMaterials));
2924 s.save(
m_d->volVisAttributes->getState(onlyChangedMaterials));
2925 s.save(QString(
"VP1GeoMaterialsEnd"));
2926 s.disableUnsavedChecks();
2928 QDataStream outfile(&
file);
2929 outfile<<qCompress(s.result()).toBase64();
2936 if (filename.isEmpty())
2938 QFileInfo fi(filename);
2940 QMessageBox::critical(0,
"Error - file does not exists: "+filename,
2941 "File does not exists: <i>"+filename+
"</i>",QMessageBox::Ok,QMessageBox::Ok);
2944 if (!fi.isReadable()) {
2945 QMessageBox::critical(0,
"Error - file is not readable: "+filename,
2946 "File is not readable: <i>"+filename+
"</i>",QMessageBox::Ok,QMessageBox::Ok);
2950 QFile
file(filename);
2951 if (!
file.open(QIODevice::ReadOnly)) {
2952 QMessageBox::critical(0,
"Error - problems opening file "+filename,
2953 "Problems opening file: <i>"+filename+
"</i>",QMessageBox::Ok,QMessageBox::Ok);
2956 QByteArray byteArray64;
2957 QDataStream infile(&
file);
2958 infile >> byteArray64;
2959 QByteArray byteArray = qUncompress(QByteArray::fromBase64(byteArray64));
2962 if (s.version()!=0) {
2963 QMessageBox::critical(0,
"Error - File in wrong format "+filename,
2964 "File in wrong format: <i>"+filename+
"</i>",QMessageBox::Ok,QMessageBox::Ok);
2967 QString txtbegin, txtend;
2968 QByteArray baDet, baMat, baVol;
2969 txtbegin = s.restoreString();
2970 baDet = s.restoreByteArray();
2971 baMat = s.restoreByteArray();
2972 baVol = s.restoreByteArray();
2973 txtend = s.restoreString();
2974 s.disableUnrestoredChecks();
2975 if (txtbegin!=
"VP1GeoMaterialsBegin"||txtend!=
"VP1GeoMaterialsEnd") {
2976 QMessageBox::critical(0,
"Error - File in wrong format "+filename,
2977 "File in wrong format: <i>"+filename+
"</i>",QMessageBox::Ok,QMessageBox::Ok);
2981 m_d->ensureInitVisAttributes();
2982 m_d->detVisAttributes->applyState(baDet);
2983 m_d->matVisAttributes->applyState(baMat);
2984 m_d->volVisAttributes->applyState(baVol);
2987 m_d->controller->setLastSelectedVolume(0);
2988 m_d->controller->setLastSelectedVolume(lastsel);
3002 std::map<PVConstLink,VolumeHandle*>::const_iterator it =
m_d->muonchambers_pv2handles.begin(), itEnd =
m_d->muonchambers_pv2handles.end();
3003 for (; it!=itEnd ; ++it){
3004 if (it->second->isInMuonChamber()) it->second->updateLabels();
3009 m_d->controller->setLabelsEnabled(t0s,hits);
3013 messageVerbose(
"muonChamberT0sChanged for this many chambers:"+
str(t0s.size()));
3015 message(
"ERROR: chamber t0 index out of bounds!");
Header file for AthHistogramAlgorithm.
static QStringList shapeToStringList(const GeoShape *shape)
GeoPhysVol * getPhysVol()
Destructor.
IVP13DSystemSimple(const QString &name, const QString &information, const QString &contact_info)
void ensureBuildController()
virtual void deselectAll(SoCooperativeSelection *exception_sel=0)
void messageVerbose(const QString &) const
virtual void restoreFromState(QByteArray)
void messageDebug(const QString &) const
const QString & name() const
void message(const QString &) const
virtual QByteArray saveState()
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Base class for the XxxReadoutElement, with Xxx = Mdt, Rpc, Tgc, Csc.
int getEtaIndex() const
a la AMDB
int getPhiIndex() const
a la AMDB
const std::string & getStationName() const
like BMS5, T1F1, CSL1
The Athena Transient Store API.
static VP1CameraHelper * animatedZoomToSubTree(SoCamera *camera, SoGroup *sceneroot, SoNode *subtreeroot, double duration_in_secs=1.0, double clipVolPercent=100.0, double lastClipVolPercent=100.0, double slack=1.0, const SbVec3f &lookat=SbVec3f(999, 999, 999), const SbVec3f &upvec=SbVec3f(999, 999, 999), bool varySpeed=true, bool forceCircular=false)
static const MuonGM::MuonDetectorManager * muonDetMgr()
@ MuonBarrelStationMiddle
static QString toString(const VOLSTATE &)
static QStringList geoMaterialToStringList(const GeoMaterial *)
bool negatechildrenregexp
std::vector< TreetopInfo > treetopinfo
bool hasMuonChambers() const
SubSystemInfo(QCheckBox *cb, const QRegExp &the_geomodeltreetopregexp, bool the_negatetreetopregexp, const QRegExp &the_geomodelchildrenregexp, bool the_negatechildrenregexp, VP1GeoFlags::SubSystemFlag the_flag, const std::string &the_matname, const QRegExp &the_geomodelgrandchildrenregexp, bool the_negategrandchildrenregexp=false)
bool grandchildrenRegExpNameCompatible(const std::string &volname) const
bool negategrandchildrenregexp
QRegExp geomodeltreetopregexp
bool childrenRegExpNameCompatible(const std::string &volname) const
VolumeHandle::VolumeHandleList vollist
VP1GeoFlags::SubSystemFlag flag
QRegExp geomodelgrandchildrenregexp
QRegExp geomodelchildrenregexp
void createPathExtras(const VolumeHandle *, QString &, QStack< QString > &)
void expandAllChildren(VolumeHandle *, bool isPixel, bool brl, bool ecA, bool ecC)
VP1GeometrySystem * theclass
void showSCTEndcapModules(VolumeHandle *)
void expandVisibleVolumesRecursively(VolumeHandle *, const QRegExp &, bool bymatname)
void showITkStripModules(VolumeHandle *, bool brl, bool ecA, bool ecC)
QStringList stationInfo(const MuonGM::MuonStation *)
SubSystemInfo * chamberPVToMuonSubSystemInfo(const GeoPVConstLink &chamberPV)
void addSubSystem(const VP1GeoFlags::SubSystemFlag &, const QString &treetopregexp, const QString &childrenregexp="", const std::string &matname="", bool negatetreetopregexp=false, bool negatechildrenregexp=false, const QString &grandchildrenregexp="", bool negategrandchildrenregexp=false)
QList< SubSystemInfo * > subsysInfoList
VP1GeoFlags::SubSystemFlags initialSubSystemsTurnedOn
void showSCTBarrelModules(VolumeHandle *)
void showPixelModules(VolumeHandle *)
static void catchKbdState(void *userData, SoEventCallback *CB)
void showITkPixelModules(VolumeHandle *, bool brl, bool ecA, bool ecC)
void updateTouchedMuonChamber(VolumeHandle *chamberhandle)
std::map< PVConstLink, VolumeHandle * > muonchambers_pv2handles
SoSeparator * m_textSep
Separator used to hold all visible labels.
PhiSectorManager * phisectormanager
std::pair< SbVec3f, SbVec3f > getClosestMuonDriftTubeDirections(const SbVec3f &cameraDirection, const SbVec3f &cameraUpDirection, VolumeHandle *chamberhandle)
VolumeHandle * previousAlignedChamberHandle
static double volume(const PVConstLink &pv)
void ensureInitPV2MuonStationMap()
void changeStateOfVisibleNonStandardVolumesRecursively(VolumeHandle *, VP1GeoFlags::VOLSTATE)
void buildSystem(SubSystemInfo *)
DetVisAttributes * detVisAttributes
void ensureInitVisAttributes()
std::map< GeoPVConstLink, const MuonGM::MuonStation * > pv2MuonStation
void updatePV2MuonStationMap(const MuonGM::MuonReadoutElement *elem)
std::map< SoSeparator *, VolumeHandle * > sonodesep2volhandle
static double inclusiveMass(const PVConstLink &pv)
VolVisAttributes * volVisAttributes
void iconifyVisibleVolumesRecursively(VolumeHandle *, const QRegExp &, bool bymatname)
GeoSysController * controller
void applyTopVolStates(const QMap< quint32, QByteArray > &, bool disablenotif=false)
Imp(VP1GeometrySystem *gs, const VP1GeoFlags::SubSystemFlags &ssf)
std::map< QObject *, std::set< GeoPVConstLink > > sender2ChamberList
int last_appropriatemdtprojections
const SoKeyboardEvent * kbEvent
QList< const std::map< GeoPVConstLink, float > * > chamberT0s
std::pair< SbVec3f, SbVec3f > getClosestCSCOrTGCEdgeDirections(const SbVec3f &cameraDirection, VolumeHandle *chamberhandle)
MatVisAttributes * matVisAttributes
VolumeTreeModel * volumetreemodel
static double exclusiveMass(const PVConstLink &pv)
QMap< quint32, QByteArray > restoredTopvolstates
void buildPermanentSceneGraph(StoreGateSvc *detstore, SoSeparator *root)
void setShowVolumeOutLines(bool)
void loadMaterialsFromFile(const QString &)
void muonChamberT0sChanged(const std::map< GeoPVConstLink, float > &, int)
The map is the dt0 per chamber, plus a label identifier, which by convention (!) is 0=Moore,...
void userPickedNode(SoNode *pickedNode, SoPath *pickedPath)
void setOrientViewToMuonChambersOnClick(bool)
void autoAdaptMuonNSW(bool reset, bool stgc, bool mm, bool passiveSpacer, bool passiveStructure, bool passiveAPlate)
QWidget * buildController()
void setZoomToVolumeOnClick(bool)
void setCurvedSurfaceRealism(int)
virtual ~VP1GeometrySystem()
void emit_appropriateMDTProjectionsChanged()
void enableMuonChamberLabels(bool, bool)
first is t0s, 2nd is hits
VP1GeometrySystem(const VP1GeoFlags::SubSystemFlags &SubSystemsTurnedOn=VP1GeoFlags::None, const QString &name="Geo")
void orientViewToMuonChamber(const GeoPVConstLink &chamberPV)
void resetSubSystems(VP1GeoFlags::SubSystemFlags)
void autoIconifyByVolumeOrMaterialName(bool, const QString &)
void volumeResetRequested(VolumeHandle *)
void plotSpectrum(QStack< QString > &, int copyNumber=-1)
void adaptMuonChambersStyleChanged()
void autoAdaptPixelsOrSCT(bool, bool, bool, bool, bool, bool)
void autoAdaptHGTD(bool reset, bool flex, bool hybrid, bool glue, bool sensors, bool inactive, bool asic, bool supportPlate, bool frontCover, bool backCover, bool moderatorIn, bool moderatorOut, bool outerRCover, bool coolingLines)
void setGeometrySelectable(bool)
void volumeStateChangeRequested(VolumeHandle *, VP1GeoFlags::VOLSTATE)
void setLabelPosOffsets(const QList< int > &)
void systemcreate(StoreGateSvc *detstore)
void updateTransparency()
void autoExpandByVolumeOrMaterialName(bool, const QString &)
void appropriateMDTProjectionsChanged(int)
void actionOnAllNonStandardVolumes(bool)
void setAutoAdaptMuonChambersToEventData(bool)
void adaptMuonChambersToEventData()
void reiconizeToShowSpecificMuonChambers(const std::set< GeoPVConstLink > &)
void saveMaterialsToFile(const QString &, bool)
void restoreFromState(QByteArray)
static bool hasMuonNSWGeometry()
static bool hasGeoModelExperiment()
static bool hasPixelGeometry()
static bool hasSCTGeometry()
static bool hasHGTDGeometry()
static bool hasITkGeometry()
static bool hasMuonGeometry()
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 void transformToMatrix(SoTransform *xf, SbMatrix &result)
static void messageDebug(const QString &)
static void message(const QString &, IVP1System *sys=0)
static bool changePathTail(SoPath *path, SoNode *commonBranchPoint, SoNode *newtail)
static void setShowVolumeOutlines(SoGroup *nodesep, bool showvol)
void setState(const VP1GeoFlags::VOLSTATE &state)
const SbMatrix & getGlobalTransformToVolume() const
std::string getNameStdString() const
VP1GeoFlags::VOLSTATE state() const
const GeoMaterial * geoMaterial() const
void initialiseChildren()
VolumeHandleListItr childrenBegin()
SbMatrix getLocalTransformToVolume() const
VolumeHandleListItr childrenEnd()
VolumeHandle * topLevelParent()
void contractDaughtersRecursively()
SoSeparator * nodeSoSeparator() const
std::vector< VolumeHandle * > VolumeHandleList
GeoPVConstLink geoPVConstLink() const
bool isInMuonChamber() const
void setMuonChamberDirty(bool)
virtual QString getDescriptiveName() const
VolumeHandleList::iterator VolumeHandleListItr
VP1GeoFlags::SubSystemFlag subsystem() const
unsigned nChildren() const
bool exists(const std::string &filename)
does a file exist
HepGeom::Transform3D EigenTransformToCLHEP(const Amg::Transform3D &eigenTransf)
Converts an Eigen-based Amg::Transform3D into a CLHEP-based HepGeom::Transform3D.
path
python interpreter configuration --------------------------------------—