6 #include "ui_calolegocontrollerform.h"
10 #include <Inventor/nodes/SoSwitch.h>
11 #include <Inventor/nodes/SoSeparator.h>
12 #include <Inventor/nodes/SoCube.h>
13 #include <Inventor/nodes/SoMaterial.h>
14 #include <Inventor/nodes/SoTranslation.h>
15 #include <Inventor/nodes/SoLineSet.h>
16 #include <Inventor/nodes/SoLightModel.h>
17 #include <Inventor/nodes/SoDrawStyle.h>
37 #define MAX_OBJECTS_PER_TECHNOLOGY 3000
58 std::map < SoNode *, const FCALTile *>
TileMap;
59 std::map < SoNode *, HECCellConstLink>
HECMap;
60 std::map < SoNode *, EMECCellConstLink>
EMECMap;
61 std::map < SoNode *, EMBCellConstLink>
EMBMap;
64 SoSeparator *
root =
nullptr;
69 :
IVP13DSystemSimple(
"CaloLego",
"Display the readout in an eta-phi view",
"boudreau@pitt.edu"),
84 QWidget* controller =
new QWidget(0);
85 Ui::frmCaloLegoController ui;
86 ui.setupUi(controller);
90 controller->setEnabled(
false);
129 for (
int i=0;
i<3;
i++) {
136 SoSeparator * dummyCubeSep =
new SoSeparator;
138 SoMaterial * dummyMat =
new SoMaterial;
139 dummyMat->transparency = 1.0f;
140 SoTranslation * dummyTransl =
new SoTranslation;
141 dummyTransl->translation.setValue(SbVec3f(0,3.15,0));
142 SoCube * dummyCube =
new SoCube;
143 dummyCube->width = 6.7;
144 dummyCube->height = 6.3;
145 dummyCube->depth = 0.1;
146 dummyCubeSep->addChild(dummyMat);
147 dummyCubeSep->addChild(dummyTransl);
148 dummyCubeSep->addChild(dummyCube);
149 root->addChild(dummyCubeSep);
151 for (
int i=0;
i<4;
i++) {
197 for (
int i=0;
i<4;
i++) {
220 SoDrawStyle *drawStyle =
new SoDrawStyle();
221 drawStyle->lineWidth=1;
222 SoLightModel *lm =
new SoLightModel();
223 lm->model=SoLightModel::BASE_COLOR;
225 SoMaterial *
blue=
new SoMaterial();
226 blue->diffuseColor.setValue(0,0,1);
228 SoMaterial *
green=
new SoMaterial();
229 green->diffuseColor.setValue(0 , 1, 0);
231 SoMaterial *
yellow=
new SoMaterial();
232 yellow->diffuseColor.setValue(0, 1.00, 1.00);
234 SoMaterial *magenta =
new SoMaterial();
235 magenta->diffuseColor.setValue(1.00,0.00, 1.00);
237 for (
int i=0;
i<4;
i++) {
264 SoSeparator *sep1 =
new SoSeparator();
269 double x =
t->getX();
270 double y =
t->getY();
278 SoVertexProperty *vtxProperty =
new SoVertexProperty();
279 vtxProperty->vertex.set1Value(
cc++, SbVec3f(
x-
dx+3,
y-
dy+3 ,0));
280 vtxProperty->vertex.set1Value(
cc++, SbVec3f(
x+
dx-3,
y-
dy+3, 0));
281 vtxProperty->vertex.set1Value(
cc++, SbVec3f(
x+
dx-3,
y+
dy-3 ,0));
282 vtxProperty->vertex.set1Value(
cc++, SbVec3f(
x-
dx+3,
y+
dy-3 ,0));
283 vtxProperty->vertex.set1Value(
cc++, SbVec3f(
x-
dx+3,
y-
dy+3 ,0));
285 SoLineSet *
ls =
new SoLineSet();
287 ls->vertexProperty=vtxProperty;
308 SoSeparator *sep1 =
new SoSeparator();
316 double phiMin = cellPtr->getPhiLocalLower();
317 double phiMax = cellPtr->getPhiLocalUpper();
318 double etaMin = cellPtr->getEtaMinNominal();
319 double etaMax = cellPtr->getEtaMaxNominal();
322 phiMin =
M_PI-phiMin;
323 phiMax =
M_PI-phiMax;
329 SoVertexProperty *vtxProperty =
new SoVertexProperty();
330 vtxProperty->vertex.set1Value(
cc++, SbVec3f(
etaMin,phiMin ,0));
331 vtxProperty->vertex.set1Value(
cc++, SbVec3f(
etaMin,phiMax ,0));
332 vtxProperty->vertex.set1Value(
cc++, SbVec3f(
etaMax,phiMax ,0));
333 vtxProperty->vertex.set1Value(
cc++, SbVec3f(
etaMax,phiMin ,0));
334 vtxProperty->vertex.set1Value(
cc++, SbVec3f(
etaMin,phiMin ,0));
336 SoLineSet *
ls =
new SoLineSet();
338 ls->vertexProperty=vtxProperty;
363 SoSeparator *sep1 =
new SoSeparator();
373 double phiMin = cellPtr->getPhiLocalLower();
374 double phiMax = cellPtr->getPhiLocalUpper();
375 double etaMin = cellPtr->getEtaMin();
376 double etaMax = cellPtr->getEtaMax();
379 phiMin =
M_PI-phiMin;
380 phiMax =
M_PI-phiMax;
386 SoVertexProperty *vtxProperty =
new SoVertexProperty();
387 vtxProperty->vertex.set1Value(
cc++, SbVec3f(
etaMin,phiMin ,0));
388 vtxProperty->vertex.set1Value(
cc++, SbVec3f(
etaMin,phiMax ,0));
389 vtxProperty->vertex.set1Value(
cc++, SbVec3f(
etaMax,phiMax ,0));
390 vtxProperty->vertex.set1Value(
cc++, SbVec3f(
etaMax,phiMin ,0));
391 vtxProperty->vertex.set1Value(
cc++, SbVec3f(
etaMin,phiMin ,0));
393 SoLineSet *
ls =
new SoLineSet();
395 ls->vertexProperty=vtxProperty;
412 SoSeparator *sep1 =
new SoSeparator();
420 double phiMin = cellPtr->getPhiLocalLower();
421 double phiMax = cellPtr->getPhiLocalUpper();
422 double etaMin = cellPtr->getEtaMin();
423 double etaMax = cellPtr->getEtaMax();
426 phiMin =
M_PI-phiMin;
427 phiMax =
M_PI-phiMax;
433 SoVertexProperty *vtxProperty =
new SoVertexProperty();
434 vtxProperty->vertex.set1Value(
cc++, SbVec3f(
etaMin,phiMin ,0));
435 vtxProperty->vertex.set1Value(
cc++, SbVec3f(
etaMin,phiMax ,0));
436 vtxProperty->vertex.set1Value(
cc++, SbVec3f(
etaMax,phiMax ,0));
437 vtxProperty->vertex.set1Value(
cc++, SbVec3f(
etaMax,phiMin ,0));
438 vtxProperty->vertex.set1Value(
cc++, SbVec3f(
etaMin,phiMin ,0));
440 SoLineSet *
ls =
new SoLineSet();
442 ls->vertexProperty=vtxProperty;
463 QCheckBox* cb =
dynamic_cast<QCheckBox*
>(sender());
475 sw->whichChild = SO_SWITCH_ALL;
478 sw->whichChild = SO_SWITCH_NONE;
496 QMap<QString,bool> checkboxstate;
497 while (
it.hasNext()) {
499 checkboxstate.insert(
it.key(),
it.value()->isChecked());
511 if (
state.version()==0) {
512 message(
"Warning: State data in .vp1 file has obsolete format - ignoring!");
515 if (
state.version()!=1) {
516 message(
"Warning: State data in .vp1 file is in wrong format - ignoring!");
523 QMap<QString,bool> checkboxstate(
state.restore<QMap<QString,bool> >());
525 while (
it.hasNext()) {
527 state.widgetHandled(
it.value());
528 if (checkboxstate.contains(
it.key())) {
529 bool checked = checkboxstate.value(
it.key());
530 if (
it.value()->isChecked()!=checked)
531 it.value()->setChecked(checked);