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>
102 #ifndef BUILDVP1LIGHT
106 const unsigned n_chamber_t0_sources=2;
107 for (
unsigned i=0;i<n_chamber_t0_sources;++i)
129 SubSystemInfo( QCheckBox* cb,
const QRegExp& the_geomodeltreetopregexp,
bool the_negatetreetopregexp,
131 const std::string& the_matname,
132 const QRegExp& the_geomodelgrandchildrenregexp,
bool the_negategrandchildrenregexp=
false)
147 muonchambers = ( matname==
"CSC"||matname==
"TGC"||matname==
"EndcapMdt"||matname==
"MM"||matname==
"sTGC"
148 ||matname==
"BarrelInner"||matname==
"BarrelMiddle"||matname==
"BarrelOuter" );
183 HepGeom::Transform3D
xf;
210 std::cout<<
" SubSystemInfo @ "<<
this<<
"\n"
211 <<(
isbuilt?
"Is built.\n":
"Is not built.\n")
212 <<(
muonchambers?
"Has muon chambers.\n":
"No muon chambers.\n");
213 std::cout<<
"Contains following volhandles: [";
214 for (
auto vol :
vollist) std::cout<<&vol<<
",";
215 std::cout<<
"]"<<std::endl;
216 std::cout<<
"Matname = "<<
matname<<std::endl;
217 std::cout<<
"Contains following TreetopInfo: [";
218 for (
const auto& tt :
treetopinfo) std::cout<<tt.volname<<
",";
219 std::cout<<
"]"<<std::endl;
227 const QString& treetopregexp,
const QString& childrenregexp=
"",
228 const std::string& matname=
"",
bool negatetreetopregexp =
false,
bool negatechildrenregexp =
false,
229 const QString& grandchildrenregexp=
"",
bool negategrandchildrenregexp =
false);
251 static double volume(
const PVConstLink& pv);
254 static void catchKbdState(
void *userData, SoEventCallback *CB);
276 #ifndef BUILDVP1LIGHT
292 void applyTopVolStates(
const QMap<quint32,QByteArray>&,
bool disablenotif =
false);
305 "This system displays the geometry as defined in the GeoModel tree.",
306 "Riccardo.Maria.Bianchi@cern.ch"),
307 m_d(new
Imp(this,SubSystemsTurnedOn))
316 m_d->volumetreemodel->cleanup();
317 delete m_d->matVisAttributes;
m_d->matVisAttributes = 0;
318 delete m_d->detVisAttributes;
m_d->detVisAttributes = 0;
319 delete m_d->volVisAttributes;
m_d->volVisAttributes = 0;
323 m_d->subsysInfoList.clear();
337 m_d->controller->setGeometrySelectable(b);
343 m_d->controller->setZoomToVolumeOnClick(b);
350 m_d->controller->setOrientViewToMuonChambersOnClick(b);
357 if (
m_d->controller->autoAdaptMuonChambersToEventData()!=b) {
358 m_d->controller->setAutoAdaptMuonChambersToEventData(b);
366 const QString& treetopregexp,
const QString& childrenregexp,
367 const std::string& matname,
bool negatetreetopregexp,
bool negatechildrenregexp,
368 const QString& grandchildrenregexp,
bool negategrandchildrenregexp)
370 theclass->messageDebug(
"VP1GeometrySystem::Imp::addSubSystem - flag: '" + QString(f) +
"' - matName: '" +
str(matname.c_str()) +
"'." );
372 QCheckBox * cb =
controller->subSystemCheckBox(f);
374 theclass->message(
"Error: Problems retrieving checkbox for subsystem "+
str(f));
378 QRegExp(childrenregexp),negatechildrenregexp,f,matname,
379 QRegExp(grandchildrenregexp), negategrandchildrenregexp);
386 message(
"VP1GeometrySystem::buildController");
404 connect(
m_d->controller,SIGNAL(muonChamberAdaptionStyleChanged(VP1GeoFlags::MuonChamberAdaptionStyleFlags)),
409 connect(
m_d->controller,SIGNAL(
autoAdaptPixelsOrSCT(
bool,
bool,
bool,
bool,
bool,
bool)),
this,SLOT(
autoAdaptPixelsOrSCT(
bool,
bool,
bool,
bool,
bool,
bool)));
410 connect(
m_d->controller,SIGNAL(
autoAdaptMuonNSW(
bool,
bool,
bool,
bool,
bool,
bool)),
this,SLOT(
autoAdaptMuonNSW(
bool,
bool,
bool,
bool,
bool,
bool)));
413 connect(
m_d->controller,SIGNAL(labelsChanged(
int)),
this,SLOT(
setLabels(
int)));
414 connect(
m_d->controller,SIGNAL(labelPosOffsetChanged(QList<int>)),
this,SLOT(
setLabelPosOffsets(QList<int>)));
480 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);
490 m_d->controller->volumeTreeBrowser()->header()->hide();
491 m_d->controller->volumeTreeBrowser()->uniformRowHeights();
492 m_d->controller->volumeTreeBrowser()->setModel(
m_d->volumetreemodel);
494 return m_d->controller;
501 m_d->ensureInitVisAttributes();
508 This->
kbEvent =
static_cast<const SoKeyboardEvent *
>(CB->getEvent());
514 m_d->sceneroot = root;
516 #ifndef BUILDVP1LIGHT
518 message(
"Error: GeoModel not configured properly in job.");
525 message(
"Error: Could not retrieve the ATLAS GeoModelExperiment from detector store");
535 if (!
m_d->m_textSep) {
538 m_d->m_textSep =
new SoSeparator;
539 m_d->m_textSep->setName(
"TextSep");
540 m_d->m_textSep->ref();
542 m_d->sceneroot->addChild(
m_d->m_textSep);
545 SoFont *myFont =
new SoFont;
546 myFont->name.setValue(
"Arial");
547 myFont->size.setValue(12.0);
548 m_d->m_textSep->addChild(myFont);
550 bool save = root->enableNotify(
false);
553 SoEventCallback *catchEvents =
new SoEventCallback();
555 root->addChild(catchEvents);
557 root->addChild(
m_d->controller->drawOptions());
558 root->addChild(
m_d->controller->pickStyle());
561 qDebug() <<
"Configuring the default systems... - subsysInfoList len:" << (
m_d->subsysInfoList).
length();
567 bool on(
m_d->initialSubSystemsTurnedOn & subsys->
flag);
569 subsys->
checkbox->setEnabled(
false);
570 subsys->
checkbox->setToolTip(
"This sub-system is not available");
579 qDebug() <<
"Looping on volumes from the input GeoModel...";
581 GeoVolumeCursor av(world);
582 while (!av.atEnd()) {
584 std::string
name = av.getName();
586 qDebug() <<
"volume name:" << QString::fromStdString(
name);
597 if (subsys->
checkbox==checkBoxOther&&found) {
613 SoSwitch * sw =
new SoSwitch();
616 if (sw->whichChild.getValue() != SO_SWITCH_NONE)
617 sw->whichChild = SO_SWITCH_NONE;
618 SoSeparator * sep =
new SoSeparator;
623 subsys->
checkbox->setToolTip(
"Toggle the display of the "+subsys->
checkbox->text()+
" sub system");
629 message(
"Warning: Found unexpected GeoModel treetop: "+QString(
name.c_str()));
636 if (!checkBoxOther->isEnabled())
637 checkBoxOther->setVisible(
false);
643 m_d->buildSystem(subsys);
645 if (subsys->
soswitch->whichChild.getValue() != SO_SWITCH_ALL)
646 subsys->
soswitch->whichChild = SO_SWITCH_ALL;
648 m_d->volumetreemodel->enableSubSystem(subsys->
flag);
651 if (!
m_d->restoredTopvolstates.isEmpty()) {
652 m_d->applyTopVolStates(
m_d->restoredTopvolstates,
false);
653 m_d->restoredTopvolstates.clear();
655 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
656 root->enableNotify(save);
661 if (
m_d->controller->autoAdaptMuonChambersToEventData())
673 return getGeometryFromLocalDB();
679GeoModelExperiment* VP1GeometrySystem::Imp::createTheExperiment(GeoPhysVol* world)
681 if (world ==
nullptr)
684 double densityOfAir=0.1;
685 const GeoMaterial* worldMat =
new GeoMaterial(
"std::Air", densityOfAir);
686 const GeoBox* worldBox =
new GeoBox(1000*CLHEP::cm, 1000*CLHEP::cm, 1000*CLHEP::cm);
687 const GeoLogVol* worldLog =
new GeoLogVol(
"WorldLog", worldBox, worldMat);
689 world =
new GeoPhysVol(worldLog);
692 GeoModelExperiment* theExperiment =
new GeoModelExperiment(world);
693 return theExperiment;
698GeoModelExperiment* VP1GeometrySystem::Imp::getDummyGeometry()
701 GeoModelExperiment* theExperiment = createTheExperiment();
709 VP1Msg::messageDebug(
"Method VP1GeometrySystem::Imp::getDummyGeometry() has to be ported to the new standalone GeoModel.");
711 return theExperiment;
716GeoModelExperiment* VP1GeometrySystem::Imp::getGeometryFromLocalDB()
722 QSettings settings(
"ATLAS",
"VP1Light");
723 QString
path = settings.value(
"db/path").toString();
725 qDebug() <<
"Using this DB file:" <<
path;
730 if (! QFileInfo(path).
exists() ) {
731 qWarning() <<
"ERROR!! DB '" <<
path <<
"' does not exist!!";
732 qWarning() <<
"Returning..." <<
"\n";
737 GMDBManager*
db =
new GMDBManager(path);
741 qDebug() <<
"OK! Database is open!";
746 qDebug() <<
"Database is not open!";
753 GeoModelPers::GReadIn readInGeo = GeoModelPers::GReadIn(db);
755 qDebug() <<
"GReadIn set.";
759 GeoPhysVol* dbPhys = readInGeo.buildGeoModel();
762 qDebug() <<
"GReadIn::buildGeoModel() done.";
765 GeoModelExperiment* theExperiment = createTheExperiment(dbPhys);
768 return theExperiment;
776 QCheckBox * cb =
static_cast<QCheckBox*
>(sender());
779 if (cb==
ss->checkbox) {
785 message(
"ERROR: Unknown checkbox");
791 if (cb->isChecked()) {
792 SbBool save = sw->enableNotify(
false);
793 if (sw->getNumChildren()==0) {
794 m_d->buildSystem(subsys);
795 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
797 if (sw->whichChild.getValue() != SO_SWITCH_ALL)
798 sw->whichChild = SO_SWITCH_ALL;
799 sw->enableNotify(save);
801 m_d->volumetreemodel->enableSubSystem(subsys->
flag);
806 if (sw->whichChild.getValue() != SO_SWITCH_NONE)
807 sw->whichChild = SO_SWITCH_NONE;
808 m_d->volumetreemodel->disableSubSystem(subsys->
flag);
841 if (pickedPath->getNodeFromTail(0)->getTypeId()==SoCylinder::getClassTypeId())
844 if (pickedPath->getLength()<5) {
849 SoSeparator * nodesep(0);
851 if (pickedPath->getNodeFromTail(1)->getTypeId()==SoSeparator::getClassTypeId()
852 && pickedPath->getNodeFromTail(2)->getTypeId()==SoSwitch::getClassTypeId()
853 && pickedPath->getNodeFromTail(3)->getTypeId()==SoSeparator::getClassTypeId())
856 nodesep =
static_cast<SoSeparator*
>(pickedPath->getNodeFromTail(3));
859 else if (pickedPath->getNodeFromTail(1)->getTypeId()==SoSwitch::getClassTypeId()
860 && pickedPath->getNodeFromTail(2)->getTypeId()==SoSeparator::getClassTypeId())
863 nodesep =
static_cast<SoSeparator*
>(pickedPath->getNodeFromTail(2));
865 else if (pickedPath->getNodeFromTail(1)->getTypeId()==SoSeparator::getClassTypeId()) {
867 nodesep =
static_cast<SoSeparator*
>(pickedPath->getNodeFromTail(1));
870 message(
"Unexpected picked path");
873 if ( (!(nodesep)) || (
m_d->sonodesep2volhandle.find(nodesep) ==
m_d->sonodesep2volhandle.end()) ) {
874 message(
"Problems finding volume handle");
879 message(
"Found NULL volume handle");
893 bool shift_isdown = (Qt::ShiftModifier & QApplication::keyboardModifiers());
902 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
906 bool ctrl_isdown = (Qt::ControlModifier & QApplication::keyboardModifiers());
916 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
920 bool z_isdown =
m_d->kbEvent && SO_KEY_PRESS_EVENT(
m_d->kbEvent,SoKeyboardEvent::Z);
935 bool orientedView(
false);
936 if (
m_d->controller->orientViewToMuonChambersOnClick() && volhandle->
isInMuonChamber()) {
945 message(
"Warning: Failed to relocate picked node.");
955 if (!orientedView&&
m_d->controller->zoomToVolumeOnClick()) {
958 std::set<SoCamera*>::iterator it,itE = cameras.end();
959 for (it=cameras.begin();it!=itE;++it) {
970 m_d->controller->setLastSelectedVolume(volhandle);
978 if (
m_d->controller->printInfoOnClick_Shape()) {
983 if (
m_d->controller->printInfoOnClick_Material()) {
989 if (
m_d->controller->printInfoOnClick_CopyNumber() ) {
991 message(
"===> CopyNo : "+(cn>=0?QString::number(cn):QString(cn==-1?
"Invalid":
"Error reconstructing copynumber")));
994 if (
m_d->controller->printInfoOnClick_Transform() ) {
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");
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"))
1032 if (
m_d->controller->printInfoOnClick_Mass()) {
1036 message(
"===> Total Mass <===");
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));
1059 QStack<QString> partspectPath, extras;
1060 QString detFactoryName;
1062 VolumeHandle *parentVH(volhandle), *childVH(volhandle);
1063 m_d->createPathExtras(volhandle,detFactoryName,extras);
1066 parentVH = parentVH->parent();
1067 PVConstLink parentPVLink = parentVH ? parentVH->geoPVConstLink() : childVH->
geoPVConstLink()->getParent();
1071 std::string childPVName = parentPVLink->getNameOfChildVol(indexOfChild);
1072 QString pathEntry = childPVName==
"ANON" ? detFactoryName+childVH->
getName() : QString(childPVName.c_str());
1074 std::optional<int> childCopyNo = parentPVLink->getIdOfChildVol(indexOfChild);
1077 strCopyNo.setNum(*childCopyNo);
1078 pathEntry += (
"::"+strCopyNo);
1080 partspectPath.push(pathEntry);
1085 while(!extras.isEmpty())
1086 partspectPath.push(extras.pop());
1088 partspectPath.push(
"Atlas::Atlas");
1108 #ifndef BUILDVP1LIGHT
1118 SoSeparator * subsystemsep =
new SoSeparator;
1122 SbBool save = si->
soswitch->enableNotify(
false);
1126 std::vector<SubSystemInfo::TreetopInfo>::const_iterator it, itE = si->
treetopinfo.end();
1134 theclass->message(
"Warning: Did not find a predefined material for volume: "+QString(it->volname.c_str()));
1147 std::vector<SubSystemInfo::TreetopInfo>::const_iterator it, itE = si->
treetopinfo.end();
1155 SoMaterial*mat_top(0);
1162 volhandle_subsysdata->
ref();
1166 GeoVolumeCursor av(it->pV);
1168 while (!av.atEnd()) {
1175 PVConstLink pVD = av.getVolume();
1182 if (hasMuonChambers){
1183 #ifndef BUILDVP1LIGHT
1186 #ifdef BUILDVP1LIGHT
1191 std::cout<<
"Has muon chamber VH="<<vh<<std::endl;
1196 vh =
new VolumeHandle(volhandle_subsysdata,0,pVD,ichild++,
1225 volhandle_subsysdata->
unref();
1240 VP1Msg::messageDebug(
"Perform auto expansion of all ether volumes (needed for muon dead material)");
1243 for (it = si->
vollist.begin(); it!=itE; ++it){
1245 (*it)->expandMothersRecursivelyToNonEther();
1253 si->
soswitch->addChild(subsystemsep);
1262 const GeoLogVol* lv = pv->getLogVol();
1263 const GeoMaterial *material = lv->getMaterial();
1264 double density = material->getDensity();
1265 return density*
volume(pv);
1271 const GeoLogVol * lv = pv->getLogVol();
1272 const GeoShape *shape = lv->getShape();
1273 return shape->volume();
1280 const GeoLogVol* lv = pv->getLogVol();
1281 const GeoMaterial *material = lv->getMaterial();
1282 double density = material->getDensity();
1286 GeoVolumeCursor av(pv);
1287 while (!av.atEnd()) {
1289 mass -=
volume(av.getVolume())*density;
1305 serialise.save(
m_d->controller->saveSettings());
1308 QMap<QString,bool> subsysstate;
1310 serialise.widgetHandled(subsys->
checkbox);
1311 subsysstate.insert(subsys->
checkbox->text(),subsys->
checkbox->isChecked());
1313 serialise.save(subsysstate);
1316 QMap<quint32,QByteArray> topvolstates;
1322 topvolstates.insert((*it)->hashID(),(*it)->getPersistifiableState());
1324 serialise.save(topvolstates);
1326 m_d->ensureInitVisAttributes();
1327 serialise.save(
m_d->detVisAttributes->getState());
1328 serialise.save(
m_d->matVisAttributes->getState());
1329 serialise.save(
m_d->volVisAttributes->getState());
1331 serialise.disableUnsavedChecks();
1332 return serialise.result();
1339 message(
"Warning: State data in .vp1 file is in wrong format - ignoring!");
1342 if (
state.version()<=5) {
1343 message(
"Warning: State data in .vp1 file is in obsolete format - ignoring!");
1351 m_d->controller->restoreSettings(
state.restoreByteArray());
1354 VP1GeoFlags::SubSystemFlags flags;
1355 QMap<QString,bool> subsysstate =
state.restore<QMap<QString,bool> >();
1358 if (subsysstate.contains(subsys->
checkbox->text())&&subsysstate[subsys->
checkbox->text()])
1359 flags |= subsys->
flag;
1361 m_d->initialSubSystemsTurnedOn = flags;
1364 QMap<quint32,QByteArray> topvolstates;
1365 topvolstates =
state.restore<QMap<quint32,QByteArray> >();
1367 m_d->applyTopVolStates(topvolstates,
true);
1369 m_d->restoredTopvolstates = topvolstates;
1371 if (
state.version()>=7) {
1372 m_d->ensureInitVisAttributes();
1373 m_d->detVisAttributes->applyState(
state.restoreByteArray());
1374 m_d->matVisAttributes->applyState(
state.restoreByteArray());
1375 m_d->volVisAttributes->applyState(
state.restoreByteArray());
1378 state.disableUnrestoredChecks();
1381 if (
m_d->controller->autoAdaptMuonChambersToEventData())
1390 QMap<quint32,QByteArray>::const_iterator topvolstatesItr;
1393 for (;it!=itE;++it) {
1394 topvolstatesItr = topvolstates.find((*it)->hashID());
1395 if (topvolstatesItr!=topvolstates.end())
1396 (*it)->applyPersistifiableState(topvolstatesItr.value());
1410 prefix = QString(
"Pixel::");
1413 entries.push(
"ITkPixel::ITkPixel");
1419 prefix = QString(
"SCT::");
1422 entries.push(
"ITkStrip::ITkStrip");
1428 prefix = QString(
"TRT::");
1434 prefix = QString(
"InDetServMat::");
1439 prefix = QString(
"LArMgr::");
1441 entries.push(
"LArMgr::LArMgr");
1445 prefix = QString(
"Tile::");
1463 prefix = QString(
"Muon::");
1464 entries.push(
"MUONQ02::MUONQ02");
1465 entries.push(
"Muon::MuonSys");
1469 prefix = QString(
"BeamPipe::");
1470 entries.push(
"BeamPipe::BeamPipe");
1491 if (val<0||val>100) {
1492 message(
"setCurvedSurfaceRealism Error: Value "+
str(val)+
"out of range!");
1495 m_d->controller->setComplexity(val==100?1.0:(val==0?0.0:val/100.0));
1505 float transparency =
m_d->controller->transparency();
1508 m_d->controller->setLastSelectedVolume(0);
1509 m_d->ensureInitVisAttributes();
1510 m_d->detVisAttributes->overrideTransparencies(transparency);
1511 m_d->matVisAttributes->overrideTransparencies(transparency);
1512 m_d->volVisAttributes->overrideTransparencies(transparency);
1513 m_d->controller->setLastSelectedVolume(lastSelVol);
1530 for (;it!=itE;++it) {
1531 messageDebug(
"resetting volume --> " + (*it)->getName() );
1541 if (
m_d->muonchambers_pv2handles.empty())
1544 std::set<GeoPVConstLink> allchambers;
1545 if (!
m_d->sender2ChamberList.empty()) {
1546 allchambers = (
m_d->sender2ChamberList.begin())->second;
1547 std::map<QObject*,std::set<GeoPVConstLink> >
::iterator itLists,itListsE(
m_d->sender2ChamberList.end());
1548 for (itLists =
m_d->sender2ChamberList.begin(),++itLists;itLists != itListsE;++itLists) {
1549 allchambers.insert(itLists->second.begin(),itLists->second.end());
1554 bool save =
m_d->sceneroot->enableNotify(
false);
1555 m_d->phisectormanager->largeChangesBegin();
1558 std::map<PVConstLink,VolumeHandle*>::iterator it, itE=
m_d->muonchambers_pv2handles.end();
1559 std::set<GeoPVConstLink>::iterator itchambersE = allchambers.end();
1560 for (it=
m_d->muonchambers_pv2handles.begin();it!=itE;++it) {
1561 if (allchambers.find(it->first)==itchambersE)
1564 if (it->second->muonChamberDirty())
1565 m_d->updateTouchedMuonChamber(it->second);
1568 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
1569 m_d->phisectormanager->largeChangesEnd();
1571 m_d->sceneroot->enableNotify(
true);
1572 m_d->sceneroot->touch();
1580 std::map<PVConstLink,VolumeHandle*>::iterator it, itE=
m_d->muonchambers_pv2handles.end();
1581 for (it=
m_d->muonchambers_pv2handles.begin();it!=itE;++it)
1582 it->second->setMuonChamberDirty(
true);
1585 if (
m_d->controller->autoAdaptMuonChambersToEventData())
1593 if (!
m_d->controller) {
1594 message(
"emit_appropriateMDTProjectionsChanged called before controller built.");
1597 VP1GeoFlags::MuonChamberAdaptionStyleFlags f(
m_d->controller->muonChamberAdaptionStyle());
1600 int i (option_openmdtchambers?(option_hidetubes?0:1):2);
1601 if (
m_d->last_appropriatemdtprojections != i ) {
1602 m_d->last_appropriatemdtprojections = i;
1611 bool listChanged(
m_d->sender2ChamberList.find(sender())!=
m_d->sender2ChamberList.end()?
1612 (chambers !=
m_d->sender2ChamberList[sender()]):
true);
1613 m_d->sender2ChamberList[sender()] = chambers;
1616 if ( listChanged &&
m_d->controller->autoAdaptMuonChambersToEventData() )
1624 if (stationname.empty()) {
1625 theclass->message(
"Warning: Asked to handle muon chamber (station) with empty name!");
1633 VP1GeoFlags::MuonChamberAdaptionStyleFlags f(
controller->muonChamberAdaptionStyle());
1640 char firstletter = stationname[0];
1641 std::string name1,name2;
1642 if (firstletter==
'E' || firstletter ==
'B') {
1646 if (option_openmdtchambers) {
1651 for (;itch!=itchE;++itch) {
1655 name1 = (*itch)->getNameStdString();
1656 if (name1.size()>2&&name1[0]==
'D'&&name1[1]==
'e'&&name1[2]==
'd')
1659 (*itch)->initialiseChildren();
1661 for (;itch2!=itch2E;++itch2) {
1665 name2 = (*itch2)->getNameStdString();
1667 if (option_hidetubes&&name2==
"MDTDriftWall") {
1669 }
else if (name2.size()>2&&name2[0]==
'R'&&((name2[1]==
'p'&&name2[2]==
'c')||(name2[1]==
'P'&&name2[2]==
'C'))) {
1670 zap = (option_hiderpcvolumes||name2!=
"Rpclayer");
1671 }
else if (name2.size()>2&&name2[0]==
'D'&&name2[1]==
'e'&&name2[2]==
'd') {
1680 chamberhandle->
reset();
1683 if (firstletter==
'C') {
1687 if (option_opencscchambers) {
1691 for (;itch!=itchE;++itch) {
1692 if ((*itch)->hasName(
"CSCspacer")) {
1696 if ((*itch)->nChildren()<1)
1698 (*itch)->initialiseChildren();
1700 for (;itch2!=itch2E;++itch2) {
1701 if ((*itch2)->nChildren()<1)
1703 (*itch2)->initialiseChildren();
1705 for (;itch3!=itch3E;++itch3) {
1706 if ((*itch3)->getNameStdString()==
"CscArCO2")
1721 if (option_opentgcchambers) {
1725 for (;itch!=itchE;++itch) {
1726 if ((*itch)->nChildren()<1)
1728 (*itch)->initialiseChildren();
1730 for (;itch2!=itch2E;++itch2) {
1731 if ((*itch2)->getNameStdString()==
"muo::TGCGas")
1750 std::string
name = chamberPV->getLogVol()->getName();
1755 if (!subsys->hasMuonChambers())
1757 if (subsys->childrenRegExpNameCompatible(
name)) {
1769 if (!
m_d->sceneroot)
1775 message(
"Error: Asked to orient view to chamber volume '"
1776 +QString(chamberPV->getLogVol()->getName().c_str())
1777 +
"', which doesn't fit the known format of any chamber!");
1783 message(
"Warning: Asked to orient view to muon chamber volume which is not available. Perhaps muon geometry was not built?");
1788 std::map<PVConstLink,VolumeHandle*>::iterator itChamber =
m_d->muonchambers_pv2handles.find(chamberPV);
1789 if (itChamber==
m_d->muonchambers_pv2handles.end()) {
1791 m_d->buildSystem(subsys);
1792 itChamber =
m_d->muonchambers_pv2handles.find(chamberPV);
1793 if (itChamber==
m_d->muonchambers_pv2handles.end()) {
1794 message(
"Error: Asked to orient view to chamber volume '"
1795 +QString(chamberPV->getLogVol()->getName().c_str())
1796 +
"', but could not find chamber handle!");
1806 bool isCSCOrTGC =
name.size()>=2 && ( (
name[0]==
'C' &&
name[1]==
'S') || (
name[0]==
'T') );
1807 if (!isCSCOrTGC&&!(
name.size()>=1&&(
name[0]==
'E'||
name[0]==
'B'))) {
1809 message(
"orientViewToMuonChamber Warning: Not CSC, TGC or MDT station!");
1813 bool save = subsys->
soswitch->enableNotify(
false);
1816 int32_t soswitch_val = subsys->
soswitch->whichChild.getValue();
1817 if (soswitch_val!=SO_SWITCH_ALL)
1818 subsys->
soswitch->whichChild = SO_SWITCH_ALL;
1826 std::set<SoCamera*>::iterator it,itE = cameras.end();
1827 for (it=cameras.begin();it!=itE;++it) {
1833 SbRotation camrot = (*it)->orientation.getValue();
1834 SbVec3f cameraDir(0, 0, -1);
1835 camrot.multVec(cameraDir, cameraDir);
1836 SbVec3f cameraUpVec(0, 1, 0);
1837 camrot.multVec(cameraUpVec, cameraUpVec);
1839 std::pair<SbVec3f,SbVec3f> chamberdirections;
1842 chamberdirections =
m_d->getClosestCSCOrTGCEdgeDirections(cameraDir,chamberHandle);
1845 chamberdirections =
m_d->getClosestMuonDriftTubeDirections(cameraDir,cameraUpVec,chamberHandle);
1847 SbVec3f newdirection = - chamberdirections.first;
1848 SbVec3f newup(cameraUpVec);
1849 const float epsilon(0.00001f);
1850 if (
m_d->previousAlignedChamberHandle==chamberHandle&&cameraDir.equals(newdirection,epsilon)) {
1854 SbRotation rot(cameraDir,0.5*
M_PI);
1855 SbVec3f chambdir1 = chamberdirections.second;
1856 SbVec3f chambdir2,chambdir3,chambdir4;
1857 rot.multVec(chambdir1,chambdir2);
1858 rot.multVec(chambdir2,chambdir3);
1859 rot.multVec(chambdir3,chambdir4);
1860 if (cameraUpVec.equals(chambdir1,epsilon)) {
1862 }
else if (cameraUpVec.equals(chambdir2,epsilon)) {
1864 }
else if (cameraUpVec.equals(chambdir3,epsilon)) {
1866 }
else if (cameraUpVec.equals(chambdir4,epsilon)) {
1870 float cos1 = chambdir1.dot(cameraUpVec);
1871 float cos2 = chambdir2.dot(cameraUpVec);
1872 float cos3 = chambdir3.dot(cameraUpVec);
1873 float cos4 = chambdir4.dot(cameraUpVec);
1874 float maxcos = std::max(std::max(cos1,cos2),std::max(cos3,cos4));
1877 else if (cos2==maxcos)
1879 else if (cos3==maxcos)
1893 chamberHandle->
setState(oldChamberState);
1894 if (soswitch_val!=SO_SWITCH_ALL)
1895 subsys->
soswitch->whichChild.setValue(soswitch_val);
1897 subsys->
soswitch->enableNotify(
true);
1900 m_d->previousAlignedChamberHandle=chamberHandle;
1907 const SbVec3f& cameraUpDirection,
1911 SbVec3f closesttubedir(cameraDirection);
1912 SbVec3f closesttubeupvec(cameraUpDirection);
1913 float smallestcosangle(1.1);
1918 for (;itch!=itchE;++itch) {
1920 std::string name1 = (*itch)->getNameStdString();
1921 if (name1.size()>2&&name1[0]==
'D'&&name1[1]==
'e'&&name1[2]==
'd')
1924 (*itch)->initialiseChildren();
1927 const SbVec3f unitz(0.0f,0.0f,1.0f);
1928 const SbVec3f unity(0.0f,1.0f,0.0f);
1930 SbVec3f translation, scale;
1931 SbRotation rotation, scalerotation;
1933 for (;itch2!=itch2E;++itch2) {
1934 if ((*itch2)->getNameStdString()==
"MDTDriftWall") {
1938 (*itch2)->getGlobalTransformToVolume().getTransform(translation,rotation,scale,scalerotation);
1939 rotation.multVec (unitz, tubeglob);
1940 if (tubeglob.dot(cameraDirection)<smallestcosangle) {
1941 smallestcosangle = tubeglob.dot(cameraDirection);
1942 closesttubedir = tubeglob;
1943 rotation.multVec(unity, closesttubeupvec);
1945 if (tubeglob.dot(-cameraDirection)<smallestcosangle) {
1946 smallestcosangle = tubeglob.dot(-cameraDirection);
1947 closesttubedir = -tubeglob;
1948 rotation.multVec(unity, closesttubeupvec);
1953 return std::pair<SbVec3f,SbVec3f>(closesttubedir,closesttubeupvec);
1961 std::vector<SbVec3f> directions;
1962 directions.push_back(SbVec3f(0.0f,1.0f,0.0f));
1963 directions.push_back(SbVec3f(0.0f,-1.0f,0.0f));
1964 directions.push_back(SbVec3f(0.0f,0.0f,1.0f));
1965 directions.push_back(SbVec3f(0.0f,0.0f,-1.0f));
1967 directions.push_back(SbVec3f(1.0f,0.0f,0.0f));
1968 directions.push_back(SbVec3f(-1.0f,0.0f,0.0f));
1971 SbVec3f translation, scale;
1972 SbRotation rotation, scalerotation;
1976 for (
unsigned i = 0; i<directions.size();++i)
1977 rotation.multVec(directions[i],directions[i]);
1980 SbVec3f chamberDir(-cameraDirection);
1981 float smallestcosangle(1.1);
1982 for (
unsigned i = 0; i<directions.size();++i) {
1983 if (directions.at(i).dot(cameraDirection)<smallestcosangle) {
1984 smallestcosangle = directions.at(i).dot(cameraDirection);
1985 chamberDir = directions.at(i);
1993 chamberDir.getValue(
x,
y,
z);
1995 rotation.multVec(SbVec3f(0.0f,1.0f,0.0f),chamberUp);
1997 rotation.multVec(SbVec3f(1.0f,0.0f,0.0f),chamberUp);
2001 return std::pair<SbVec3f,SbVec3f>(chamberDir,chamberUp);
2032 std::vector<std::pair<VolumeHandle::VolumeHandleListItr,VolumeHandle::VolumeHandleListItr> > roothandles;
2033 m_d->volumetreemodel->getRootHandles(roothandles);
2036 bool save =
m_d->sceneroot->enableNotify(
false);
2037 m_d->phisectormanager->largeChangesBegin();
2041 for (
unsigned i = 0; i<roothandles.size();++i) {
2042 it = roothandles.at(i).first;
2043 itE = roothandles.at(i).second;
2044 for(;it!=itE;++it) {
2045 m_d->changeStateOfVisibleNonStandardVolumesRecursively(*it,target);
2049 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
2050 m_d->phisectormanager->largeChangesEnd();
2052 m_d->sceneroot->enableNotify(
true);
2053 m_d->sceneroot->touch();
2060 if (targetname.isEmpty()) {
2065 messageVerbose(
"Auto expansions of visible volumes requested. Target all volumes with "
2066 +
str(bymatname?
"material name":
"name")+
" matching "+targetname);
2068 QRegExp selregexp(targetname,Qt::CaseSensitive,QRegExp::Wildcard);
2070 std::vector<std::pair<VolumeHandle::VolumeHandleListItr,VolumeHandle::VolumeHandleListItr> > roothandles;
2071 m_d->volumetreemodel->getRootHandles(roothandles);
2074 bool save =
m_d->sceneroot->enableNotify(
false);
2075 m_d->phisectormanager->largeChangesBegin();
2079 for (
unsigned i = 0; i<roothandles.size();++i) {
2080 it = roothandles.at(i).first;
2081 itE = roothandles.at(i).second;
2083 m_d->expandVisibleVolumesRecursively(*it,selregexp,bymatname);
2086 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
2087 m_d->phisectormanager->largeChangesEnd();
2089 m_d->sceneroot->enableNotify(
true);
2090 m_d->sceneroot->touch();
2102 && selregexp.exactMatch(bymatname?QString(handle->
geoMaterial()->getName().c_str()):handle->
getName())) {
2123 if( selregexp.exactMatch(bymatname?QString(handle->
geoMaterial()->getName().c_str()):handle->
getName())) {
2140 if (targetname.isEmpty()) {
2145 messageVerbose(
"Auto iconification/zapping of visible volumes requested. Target all volumes with "
2146 +
str(bymatname?
"material name":
"name")+
" matching "+targetname);
2148 QRegExp selregexp(targetname,Qt::CaseSensitive,QRegExp::Wildcard);
2150 std::vector<std::pair<VolumeHandle::VolumeHandleListItr,VolumeHandle::VolumeHandleListItr> > roothandles;
2151 m_d->volumetreemodel->getRootHandles(roothandles);
2154 bool save =
m_d->sceneroot->enableNotify(
false);
2155 m_d->phisectormanager->largeChangesBegin();
2159 for (
unsigned i = 0; i<roothandles.size();++i) {
2160 it = roothandles.at(i).first;
2161 itE = roothandles.at(i).second;
2163 m_d->iconifyVisibleVolumesRecursively(*it,selregexp,bymatname);
2166 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
2167 m_d->phisectormanager->largeChangesEnd();
2169 m_d->sceneroot->enableNotify(
true);
2170 m_d->sceneroot->touch();
2173#ifndef BUILDVP1LIGHT
2179 GeoPVConstLink pvlink = elem->getMaterialGeom()->getParent();
2182 theclass->message(
"WARNING: Ignored null station pointer");
2196 theclass->messageVerbose(
"Initializing physical volume link -> MuonStation map.");
2200 VP1Msg::message(
"WARNING: Could not get muon detector manager to construct volume -> muon station map!");
2203 if (mgr->nMdtRE()) {
2204 for (
auto det_el = mgr->mdtIdHelper()->detectorElement_begin();
2205 det_el != mgr->mdtIdHelper()->detectorElement_end(); ++det_el) {
2209 if (mgr->nRpcRE()) {
2210 for (
auto det_el = mgr->rpcIdHelper()->detectorElement_begin();
2211 det_el != mgr->rpcIdHelper()->detectorElement_end(); ++det_el) {
2215 if (mgr->nCscRE()) {
2216 for (
auto det_el = mgr->cscIdHelper()->detectorElement_begin();
2217 det_el != mgr->cscIdHelper()->detectorElement_end(); ++det_el) {
2221 if (mgr->nTgcRE()) {
2222 for (
auto det_el = mgr->tgcIdHelper()->detectorElement_begin();
2223 det_el != mgr->tgcIdHelper()->detectorElement_end(); ++det_el) {
2249 #ifndef BUILDVP1LIGHT
2255 bool bcm(bcmA||bcmC);
2262 if (si->
flag == subSysFlag) {
2268 message(
"AutoAdaptPixelsOrSCT Error: Could not find subsystem");
2279 bool save =
m_d->sceneroot->enableNotify(
false);
2280 m_d->phisectormanager->largeChangesBegin();
2285 for (;it!=itE;++it) {
2286 (*it)->initialiseChildren();
2289 for (;itChl!=itChlE;++itChl) {
2293 if (brl&&(*itChl)->hasName(
"barrelLog")) {
2295 m_d->showPixelModules(*itChl);
2296 }
else if ((ec)&&(*itChl)->hasName(
"EndCapLog")) {
2297 if (((*itChl)->isPositiveZ()?ecA:ecC)) {
2298 m_d->showPixelModules(*itChl);
2301 }
else if (bcm&&(*itChl)->hasName(
"bcmModLog")) {
2302 if (((*itChl)->isPositiveZ()?bcmA:bcmC)) {
2308 if ((*itChl)->hasName(
"ITkPixelDetector")) {
2309 m_d->showITkPixelModules(*itChl, brl, ecA, ecC);
2320 for (;it!=itE;++it) {
2321 (*it)->initialiseChildren();
2326 if (brl&&(*it)->hasName(
"SCT_Barrel")) {
2328 m_d->showSCTBarrelModules(*it);
2329 }
else if (ecA&&(*it)->hasName(
"SCT_ForwardA")) {
2331 m_d->showSCTEndcapModules(*it);
2332 }
else if (ecC&&(*it)->hasName(
"SCT_ForwardC")) {
2334 m_d->showSCTEndcapModules(*it);
2337 m_d->showITkStripModules(*it, brl, ecA, ecC);
2344 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
2345 m_d->phisectormanager->largeChangesEnd();
2347 m_d->sceneroot->enableNotify(
true);
2348 m_d->sceneroot->touch();
2358 #ifndef BUILDVP1LIGHT
2373 if (si->
flag == subSysFlag) {
2379 message(
"autoAdaptMuonNSW Error: Could not find subsystem");
2390 bool save =
m_d->sceneroot->enableNotify(
false);
2391 m_d->phisectormanager->largeChangesBegin();
2396 for (;it!=itE;++it) {
2398 (*it)->initialiseChildren();
2403 for (;itChl!=itChlE;++itChl) {
2405 bool unzap( reset?
true :
false );
2409 if ( (stgc) && (*itChl)->hasName(
"NSW_sTGC") ) {
2412 }
else if ( (mm) && (*itChl)->hasName(
"NSW_MM") ) {
2415 }
else if ( (passiveSpacer) && (*itChl)->hasName(
"NSW_Spacer") ) {
2417 }
else if ( (passiveStructure) && (*itChl)->hasName(
"NSW_Aluminum_Structure_and_HUB") ) {
2419 }
else if ( (passiveAPlate) && (*itChl)->hasName(
"A_Plate") ) {
2430 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
2431 m_d->phisectormanager->largeChangesEnd();
2434 m_d->sceneroot->enableNotify(
true);
2435 m_d->sceneroot->touch();
2446 h->initialiseChildren();
2448 for (;it!=itE;++it) {
2449 if ((*it)->hasName(
"moduleLog")) {
2451 (*it)->contractDaughtersRecursively();
2452 (*it)->initialiseChildren();
2454 for (;itMod!=itModE;++itMod) {
2455 if ((*itMod)->getName().startsWith(
"si"))
2463 if ((*it)->hasName(
"pigtailLog")||(*it)->hasName(
"omegaLog")) {
2465 (*it)->contractDaughtersRecursively();
2468 if ((*it)->nChildren()<1) {
2480 if (
h->nChildren()==0) {
2481 if (isPixel and (ecA or ecC)) {
2482 float translation_x, translation_y, translation_z, rotaxis_x, rotaxis_y, rotaxis_z, rotangle_radians;
2484 translation_x, translation_y, translation_z,
2485 rotaxis_x, rotaxis_y, rotaxis_z, rotangle_radians );
2486 if ((!ecA || !ecC) && ((ecA and (translation_z<0.)) or (ecC and (translation_z>0.) ))) {
2493 std::vector< std::string > selected_volumes = {};
2496 selected_volumes.push_back(
"InnerBarrelSingleMod_Sensor");
2497 selected_volumes.push_back(
"InnerBarrelQuadMod_Sensor");
2498 selected_volumes.push_back(
"OuterBarrelQuadMod_Sensor");
2499 selected_volumes.push_back(
"LongeronCoolingTube");
2500 selected_volumes.push_back(
"InnerPixBarrelSupport_Stave");
2501 selected_volumes.push_back(
"InnerPixBarrelSupport_Stave1");
2502 selected_volumes.push_back(
"LongeronCornerBase");
2503 selected_volumes.push_back(
"LongeronCornerEnd");
2504 selected_volumes.push_back(
"LongeronTrussWall");
2505 selected_volumes.push_back(
"LongeronCapBase");
2506 selected_volumes.push_back(
"LongeronTopCap");
2509 selected_volumes.push_back(
"BRLSensorSS");
2510 selected_volumes.push_back(
"BRLSensorMS");
2511 selected_volumes.push_back(
"B_HybridPCB");
2512 selected_volumes.push_back(
"DCDC_PCB");
2513 selected_volumes.push_back(
"DCDC_Box");
2514 selected_volumes.push_back(
"Bex_HybridPCB_near");
2515 selected_volumes.push_back(
"Bex_HybridPCB_far");
2520 selected_volumes.push_back(
"InclinedQuadMod_Sensor");
2521 selected_volumes.push_back(
"InnerRingSingleMod_Sensor");
2522 selected_volumes.push_back(
"InnerEndcapQuadMod_Sensor");
2523 selected_volumes.push_back(
"OuterEndcapQuadMod_Sensor");
2524 selected_volumes.push_back(
"L2HalfRingCoolingPipe");
2525 selected_volumes.push_back(
"L3HalfRingCoolingPipe");
2526 selected_volumes.push_back(
"L4endcapcoolingpipe");
2527 selected_volumes.push_back(
"InclL2HalfShell");
2528 selected_volumes.push_back(
"InclL2Support");
2529 selected_volumes.push_back(
"InclL3HalfShell");
2530 selected_volumes.push_back(
"InclL3Support");
2531 selected_volumes.push_back(
"InclL4HalfShell");
2532 selected_volumes.push_back(
"InclL4Support");
2533 selected_volumes.push_back(
"InnerPixEndcap_CoupledRingSupport");
2534 selected_volumes.push_back(
"InnerPixEndcap_IntermediateRingSupport");
2535 selected_volumes.push_back(
"InnerPixEndcap_L1RingSupport");
2536 selected_volumes.push_back(
"L2HalfRingCarbonFoamInner");
2537 selected_volumes.push_back(
"L2HalfRingCarbonFoamOuter");
2538 selected_volumes.push_back(
"L2HalfRingFaceSheet");
2539 selected_volumes.push_back(
"L3HalfRingCarbonFoamInner");
2540 selected_volumes.push_back(
"L3HalfRingCarbonFoamOuter");
2541 selected_volumes.push_back(
"L3HalfRingFaceSheet");
2542 selected_volumes.push_back(
"L4endcapinnerCarbonFoam");
2543 selected_volumes.push_back(
"L4endcapouterCarbonFoam");
2544 selected_volumes.push_back(
"L4endcapFaceSheet");
2545 selected_volumes.push_back(
"L2HalfShell");
2546 selected_volumes.push_back(
"L3HalfShell");
2547 selected_volumes.push_back(
"L4HalfShell");
2549 selected_volumes.push_back(
"ECSensor0");
2550 selected_volumes.push_back(
"ECSensor1");
2551 selected_volumes.push_back(
"ECSensor2");
2552 selected_volumes.push_back(
"ECSensor3");
2553 selected_volumes.push_back(
"ECSensor4");
2554 selected_volumes.push_back(
"ECSensor5");
2555 selected_volumes.push_back(
"ECSensorBack0");
2556 selected_volumes.push_back(
"ECSensorBack1");
2557 selected_volumes.push_back(
"ECSensorBack2");
2558 selected_volumes.push_back(
"ECSensorBack3");
2559 selected_volumes.push_back(
"ECSensorBack4");
2560 selected_volumes.push_back(
"ECSensorBack5");
2564 std::string
name =
h->getName().toStdString();
2566 if (not isPixel and (ecA or ecC)) {
2568 if (
name.starts_with(
"ECHybrid") or
name.starts_with(
"DCDC_EC"))
2572 if (std::find(selected_volumes.begin(), selected_volumes.end(),
name) == selected_volumes.end()) {
2577 }
else if (not isPixel and (
h->getName().toStdString()==
"PetalCore" or
2578 h->getName().toStdString()==
"StaveCoreSS" or
2579 h->getName().toStdString() ==
"StaveCoreMS")) {
2582 h->initialiseChildren();
2586 for (;it!=itE;++it) {
2594 h->initialiseChildren();
2597 for (;it!=itE;++it) {
2606 h->initialiseChildren();
2609 for (;it!=itE;++it) {
2610 if (brl and (*it)->hasName(
"ITkStrip_Barrel")) {
2613 else if (ecA and (*it)->hasName(
"ITkStrip_ForwardPlus")) {
2616 else if (ecC and (*it)->hasName(
"ITkStrip_ForwardMinus")) {
2627 h->initialiseChildren();
2629 for (;it!=itE;++it) {
2630 if ((*it)->getName().startsWith(
"Layer")) {
2632 (*it)->initialiseChildren();
2634 for (;itLay!=itLayE;++itLay) {
2635 if ((*itLay)->getName().endsWith(
"Active")&&(*itLay)->getName().startsWith(
"Layer")) {
2637 (*itLay)->initialiseChildren();
2639 for (;itActLay!=itActLayE;++itActLay) {
2640 if ((*itActLay)->getName().startsWith(
"Ski")) {
2642 (*itActLay)->initialiseChildren();
2644 for (;itSki!=itSkiE;++itSki) {
2646 if ((*itSki)->hasName(
"Module")) {
2649 (*itSki)->initialiseChildren();
2651 for (;itMod!=itModE;++itMod) {
2652 if ((*itMod)->getName().contains(
"Envelope")) {
2654 (*itMod)->initialiseChildren();
2656 for(;itEnv!=itEnvE;++itEnv) {
2657 if ((*itEnv)->getName().contains(
"Sensor"))
2680 (*itLay)->contractDaughtersRecursively();
2686 (*it)->contractDaughtersRecursively();
2695 h->initialiseChildren();
2697 for (;it!=itE;++it) {
2698 if ((*it)->getName().startsWith(
"Wheel")) {
2700 (*it)->initialiseChildren();
2702 for (;itWhl!=itWhlE;++itWhl) {
2703 if ((*itWhl)->getName().startsWith(
"Ring")) {
2705 (*itWhl)->initialiseChildren();
2707 for (;itRng!=itRngE;++itRng) {
2708 if ((*itRng)->getName().startsWith(
"FwdModule")) {
2710 (*itRng)->initialiseChildren();
2712 for(;itMod!=itModE;++itMod) {
2713 if ((*itMod)->getName().startsWith(
"ECSensor")) {
2727 (*itWhl)->contractDaughtersRecursively();
2733 (*it)->contractDaughtersRecursively();
2746 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
2756 m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis();
2762 std::map<SoSeparator*,VolumeHandle*>::iterator it,itE(
m_d->sonodesep2volhandle.end());
2763 for (it =
m_d->sonodesep2volhandle.begin();it!=itE;++it)
2771 if (filename.isEmpty())
2775 QFileInfo fi(filename);
2777 if (!fi.isWritable()) {
2778 QMessageBox::critical(0,
"Error - could not save to file "+filename,
2779 "Could not save to file: <i>"+filename+
"</i>"
2780 +
"<br/><br/>Reason: File exists already and is write protected",QMessageBox::Ok,QMessageBox::Ok);
2785 QFile
file(filename);
2786 if (!
file.open(QIODevice::WriteOnly)) {
2787 QMessageBox::critical(0,
"Error - problems writing to file "+filename,
2788 "Problems writing to file: <i>"+filename+
"</i>",QMessageBox::Ok,QMessageBox::Ok);
2792 m_d->ensureInitVisAttributes();
2795 s.save(QString(
"VP1GeoMaterialsBegin"));
2796 s.save(
m_d->detVisAttributes->getState(onlyChangedMaterials));
2797 s.save(
m_d->matVisAttributes->getState(onlyChangedMaterials));
2798 s.save(
m_d->volVisAttributes->getState(onlyChangedMaterials));
2799 s.save(QString(
"VP1GeoMaterialsEnd"));
2800 s.disableUnsavedChecks();
2802 QDataStream outfile(&
file);
2803 outfile<<qCompress(s.result()).toBase64();
2810 if (filename.isEmpty())
2812 QFileInfo fi(filename);
2814 QMessageBox::critical(0,
"Error - file does not exists: "+filename,
2815 "File does not exists: <i>"+filename+
"</i>",QMessageBox::Ok,QMessageBox::Ok);
2818 if (!fi.isReadable()) {
2819 QMessageBox::critical(0,
"Error - file is not readable: "+filename,
2820 "File is not readable: <i>"+filename+
"</i>",QMessageBox::Ok,QMessageBox::Ok);
2824 QFile
file(filename);
2825 if (!
file.open(QIODevice::ReadOnly)) {
2826 QMessageBox::critical(0,
"Error - problems opening file "+filename,
2827 "Problems opening file: <i>"+filename+
"</i>",QMessageBox::Ok,QMessageBox::Ok);
2830 QByteArray byteArray64;
2831 QDataStream infile(&
file);
2832 infile >> byteArray64;
2833 QByteArray byteArray = qUncompress(QByteArray::fromBase64(byteArray64));
2836 if (s.version()!=0) {
2837 QMessageBox::critical(0,
"Error - File in wrong format "+filename,
2838 "File in wrong format: <i>"+filename+
"</i>",QMessageBox::Ok,QMessageBox::Ok);
2841 QString txtbegin, txtend;
2842 QByteArray baDet, baMat, baVol;
2843 txtbegin = s.restoreString();
2844 baDet = s.restoreByteArray();
2845 baMat = s.restoreByteArray();
2846 baVol = s.restoreByteArray();
2847 txtend = s.restoreString();
2848 s.disableUnrestoredChecks();
2849 if (txtbegin!=
"VP1GeoMaterialsBegin"||txtend!=
"VP1GeoMaterialsEnd") {
2850 QMessageBox::critical(0,
"Error - File in wrong format "+filename,
2851 "File in wrong format: <i>"+filename+
"</i>",QMessageBox::Ok,QMessageBox::Ok);
2855 m_d->ensureInitVisAttributes();
2856 m_d->detVisAttributes->applyState(baDet);
2857 m_d->matVisAttributes->applyState(baMat);
2858 m_d->volVisAttributes->applyState(baVol);
2861 m_d->controller->setLastSelectedVolume(0);
2862 m_d->controller->setLastSelectedVolume(lastsel);
2876 std::map<PVConstLink,VolumeHandle*>::const_iterator it =
m_d->muonchambers_pv2handles.begin(), itEnd =
m_d->muonchambers_pv2handles.end();
2877 for (; it!=itEnd ; ++it){
2878 if (it->second->isInMuonChamber()) it->second->updateLabels();
2883 m_d->controller->setLabelsEnabled(t0s,hits);
2887 messageVerbose(
"muonChamberT0sChanged for this many chambers:"+
str(t0s.size()));
2889 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 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 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)
bool childrenAreInitialised() const
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 isInitialisedAndHasNonStandardShape() 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 --------------------------------------—