19 #include "TGLScenePad.h" 20 #include "TGLViewer.h" 22 #include "TGLPerspectiveCamera.h" 23 #include "TEveManager.h" 24 #include "TEveElement.h" 26 #include "TEveBoxSet.h" 27 #include "TEveScene.h" 28 #include "TGLLogicalShape.h" 30 #include "TEveCaloData.h" 31 #include "TEveStraightLineSet.h" 43 class TGLClipsiLogical :
public TGLLogicalShape {
45 void DirectDraw(TGLRnrCtx& rnrCtx)
const override {}
48 TGLClipsiLogical() : TGLLogicalShape() {}
49 ~TGLClipsiLogical()
override {}
50 void Resize(Double_t
ext) {}
53 const float fgColor[4] = {1.0, 0.6, 0.2, 0.5};
55 class Clipsi :
public TGLClip {
57 Clipsi(
const Clipsi&) =
delete;
58 Clipsi& operator=(
const Clipsi&) =
delete;
63 TGLVertex3 appexOffset;
66 Clipsi(TGLRnrCtx* ctx) : TGLClip(*new TGLClipsiLogical, TGLMatrix(), fgColor), m_rnrCtx(ctx) {}
69 void Setup(
const TGLBoundingBox& bbox)
override {}
71 void SetPlaneInfo(TEveVector* vec) {
72 for (
int i = 0;
i < 4; ++
i) {
74 vtx[
i].Set(vec[
i].fX + appexOffset.X(), vec[
i].fY + appexOffset.Y(), vec[
i].fZ + appexOffset.Z());
78 void SetAppexOffset(TEveVector& vec) { appexOffset.Set(vec.fX, vec.fY, vec.fZ); }
80 using TGLClip::PlaneSet;
81 void PlaneSet(TGLPlaneSet_t& planeSet)
const override {
82 TGLVertex3
o = appexOffset;
84 planeSet.push_back(TGLPlane(
o,
vtx[0],
vtx[1]));
85 planeSet.push_back(TGLPlane(
o,
vtx[1],
vtx[2]));
86 planeSet.push_back(TGLPlane(
o,
vtx[2],
vtx[3]));
87 planeSet.push_back(TGLPlane(
o,
vtx[3],
vtx[0]));
104 m_showMuonBarrel(this,
"Show Muon Barrel", 0
l, 0
l, 2
l),
105 m_showMuonEndcap(this,
"Show Muon Endcap",
false),
106 m_showPixelBarrel(this,
"Show Pixel Barrel",
false),
107 m_showPixelEndcap(this,
"Show Pixel Endcap",
false),
108 m_showTrackerBarrel(this,
"Show Tracker Barrel",
false),
109 m_showTrackerEndcap(this,
"Show Tracker Endcap",
false),
110 m_showHGCalEE(this,
"Show HGCalEE",
false),
111 m_showHGCalHSi(this,
"Show HGCalHSi",
false),
112 m_showHGCalHSc(this,
"Show HGCalHSc",
false),
113 m_ecalBarrel(nullptr),
114 m_showEcalBarrel(this,
"Show Ecal Barrel",
false),
115 m_rnrStyle(this,
"Render Style", 0
l, 0
l, 2
l),
116 m_selectable(this,
"Enable Tooltips",
false),
117 m_cameraType(this,
"Camera Type", 0
l, 0
l, 5
l),
118 m_clipEnable(this,
"Enable Clip",
false),
119 m_clipTheta(this,
"Clip Theta", 0.0, -5.0, 5.0),
120 m_clipPhi(this,
"Clip Phi", 0.0, -2.0, 2.0),
121 m_clipDelta1(this,
"Clip Delta1", 0.2, 0.01, 2),
122 m_clipDelta2(this,
"Clip Delta2", 0.2, 0.01, 2),
123 m_clipAppexOffset(this,
"Appex Offset", 10
l, 0
l, 50
l),
124 m_clipHGCalLayerBegin(this,
"HGCal Lower Bound", 1
l, 1
l, 52
l),
125 m_clipHGCalLayerEnd(this,
"HGCal Upper Bound", 52
l, 1
l, 52
l),
128 viewerGL()->SetCurrentCamera(TGLViewer::kCameraPerspXOZ);
189 TGLClipPlane*
c =
new TGLClipPlane();
190 c->Setup(TGLVector3(1e10, 0, 0), TGLVector3(-1, 0, 0));
211 viewerGL()->RefCamera(TGLViewer::ECameraType(
x)).IncTimeStamp();
212 viewerGL()->SetCurrentCamera(TGLViewer::ECameraType(
x));
229 m_glClip->SetMode(TGLClip::kOutside);
233 for (TEveElement::List_i it = gEve->GetScenes()->BeginChildren(); it != gEve->GetScenes()->EndChildren(); ++it) {
234 if (strncmp((*it)->GetElementName(),
"TopGeoNodeScene", 15) == 0)
235 ((TEveScene*)(*it))->GetGLScene()->SetClip(
x ?
m_glClip :
nullptr);
256 float getBBoxLineLength(TEveScene* scene, TEveVector
in) {
257 if (!scene->NumChildren())
261 scene->GetGLScene()->CalcBoundingBox();
262 const TGLBoundingBox& bb = scene->GetGLScene()->BoundingBox();
271 TGLLine3
line(TGLVertex3(), TGLVertex3(inn.fX, inn.fY, inn.fZ));
272 std::vector<float>
res;
273 for (TGLPlaneSet_i
i = ps.begin();
i != ps.end(); ++
i) {
274 std::pair<Bool_t, TGLVertex3>
r = Intersection(*
i,
line,
false);
276 TGLVector3 vr(
r.second.X(),
r.second.Y(),
r.second.Z());
277 res.push_back(vr.Mag());
284 void setBBoxClipped(TGLBoundingBox& bbox, TEveVector
dir, TEveVector
b0, TEveVector
b1,
float fac) {
299 for (
int i = 4;
i < 8; ++
i)
312 for (
int i = 0;
i < 8; ++
i) {
313 bbv[
i].Set(bb[
i].fX, bb[
i].fY, bb[
i].fZ);
325 using namespace TMath;
329 TEveVector normXY(0., 1., 0);
330 TEveVector
b0 =
in.Cross(normXY);
331 TEveVector
b1 =
in.Cross(
b0);
349 for (
int i = 0;
i < 4; ++
i)
352 TEveVector aOff =
in;
356 ((Clipsi*)
m_glClip)->SetAppexOffset(aOff);
358 ((Clipsi*)
m_glClip)->SetPlaneInfo(&
c[0]);
378 TGLCamera& cam =
viewerGL()->CurrentCamera();
379 cam.SetExternalCenter(
true);
380 cam.SetCenterVec(bbox.Center().X(), bbox.Center().Y(), bbox.Center().Z());
381 cam.Setup(bbox,
true);
403 for (
const auto& it : HGCalEE->RefChildren()) {
406 it->SetRnrState(
layer >= r_lmin &&
layer <= r_lmax);
412 for (
const auto& it : HGCalHSi->RefChildren()) {
415 it->SetRnrState(
layer >= r_lmin &&
layer <= r_lmax);
421 for (
const auto& it : HGCalHSc->RefChildren()) {
424 it->SetRnrState(
layer >= r_lmin &&
layer <= r_lmax);
435 TGLPerspectiveCamera* camera =
dynamic_cast<TGLPerspectiveCamera*
>(&(
viewerGL()->CurrentCamera()));
445 TGLPerspectiveCamera* camera =
dynamic_cast<TGLPerspectiveCamera*
>(&(
viewerGL()->CurrentCamera()));
463 printf(
"ERROR!!!! FW3DViewBase::setCurrentDMTVertex \n");
504 Form(
"TEveGedEditor::SpawnNewEditor((TGLViewer*)0x%lx)", (
unsigned long)
viewerGL())));
508 new TGLayoutHints(kLHintsExpandX, 2, 2, 2, 2));
514 std::vector<unsigned int> ids =
516 m_ecalBarrel->Reset(TEveBoxSet::kBT_FreeBox,
true, ids.size());
517 for (std::vector<unsigned int>::iterator it = ids.begin(); it != ids.end(); ++it) {
533 TEveCalo3D* c3d =
dynamic_cast<TEveCalo3D*
>(
calo);
534 c3d->SetRnrFrame(!
x, !
x);
535 c3d->ElementChanged();
FWDoubleParameter m_clipTheta
bool requestGLHandlerPick() const override
void updateHGCalVisibility(bool)
void showEcalBarrel(bool)
void showMuonBarrel(long)
FWBoolParameter m_showMuonEndcap
void showMuonBarrel(bool)
void setClip(float eta, float phi)
TEveElementList const *const getHGCalHSc()
FWBoolParameter m_showHGCalEE
void addTo(FWConfiguration &) const override
ViewerParameterGUI & requestTab(const char *)
void showTrackerEndcap(bool)
ViewerParameterGUI & separator()
void setCurrentDMTVertex(double x, double y, double z)
FWBoolParameter m_showTrackerBarrel
FW3DViewDistanceMeasureTool * m_DMT
void showMuonBarrelFull(bool)
FWDoubleParameter m_clipPhi
constexpr std::array< uint8_t, layerIndexSize > layer
void showTrackerBarrel(bool)
void enableSceneClip(bool)
void setGeomTransparency(Color_t idx, bool projectedType)
const std::string & value(unsigned int iIndex=0) const
void showMuonEndcap(bool)
FWGeometry * getGeom() const
FWEnumParameter m_rnrStyle
const float * getCorners(unsigned int id) const
void updateClipPlanes(bool resetCamera)
FWBoolParameter m_clipEnable
TEveElementList const *const getHGCalHSi()
FWBoolParameter m_showPixelEndcap
FWDoubleParameter m_clipDelta1
bool addEntry(Long_t id, const std::string &txt)
virtual void resetCamera()
void setContext(const fireworks::Context &) override
void populateController(ViewerParameterGUI &) const override
FWLongParameter m_clipHGCalLayerBegin
const fireworks::Context & context()
FWBoolParameter m_showHGCalHSi
void populateController(ViewerParameterGUI &) const override
void setFrom(const FWConfiguration &) override
void setFromPerspectiveCamera(TGLPerspectiveCamera *, const std::string &, const FWConfiguration &)
void showPixelBarrel(bool)
FWBoolParameter m_showHGCalHSc
FWBoolParameter m_showEcalBarrel
ViewerParameterGUI & addParam(const FWParameterBase *)
TGCompositeFrame * getTabContainer()
void showPixelEndcap(bool)
const FWConfiguration * valueForKey(const std::string &iKey) const
TEveElementList const *const getHGCalEE()
TEveBoxSet * m_ecalBarrel
FWEnumParameter m_showMuonBarrel
FW3DViewBase(TEveWindowSlot *, FWViewType::EType, unsigned int version=8)
FW3DViewGeometry * m_geometry
sigc::signal< void(T)> changed_
FWViewType::EType typeId() const
void addToPerspectiveCamera(TGLPerspectiveCamera *, const std::string &, FWConfiguration &) const
static constexpr float b0
void addTo(FWConfiguration &) const override
FWBoolParameter m_selectable
FWLongParameter m_clipHGCalLayerEnd
FWEnumParameter m_cameraType
void setFrom(const FWConfiguration &) override
TGLViewer * viewerGL() const
FWLongParameter m_clipAppexOffset
Geom::Theta< T > theta() const
virtual void setContext(const fireworks::Context &x)
FWBoolParameter m_showTrackerEndcap
FWColorManager * colorManager() const
FWDoubleParameter m_clipDelta2
static constexpr float b1
unsigned int version() const
FWBoolParameter m_showPixelBarrel