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_showMtdBarrel(this,
"Show MTD Barrel",
false),
114 m_showMtdEndcap(this,
"Show MTD Endcap",
false),
115 m_ecalBarrel(nullptr),
116 m_showEcalBarrel(this,
"Show Ecal Barrel",
false),
117 m_rnrStyle(this,
"Render Style", 0
l, 0
l, 2
l),
118 m_selectable(this,
"Enable Tooltips",
false),
119 m_cameraType(this,
"Camera Type", 0
l, 0
l, 5
l),
120 m_clipEnable(this,
"Enable Clip",
false),
121 m_clipTheta(this,
"Clip Theta", 0.0, -5.0, 5.0),
122 m_clipPhi(this,
"Clip Phi", 0.0, -2.0, 2.0),
123 m_clipDelta1(this,
"Clip Delta1", 0.2, 0.01, 2),
124 m_clipDelta2(this,
"Clip Delta2", 0.2, 0.01, 2),
125 m_clipAppexOffset(this,
"Appex Offset", 10
l, 0
l, 50
l),
126 m_clipHGCalLayerBegin(this,
"HGCal Lower Bound", 1
l, 1
l, 52
l),
127 m_clipHGCalLayerEnd(this,
"HGCal Upper Bound", 52
l, 1
l, 52
l),
130 viewerGL()->SetCurrentCamera(TGLViewer::kCameraPerspXOZ);
193 TGLClipPlane*
c =
new TGLClipPlane();
194 c->Setup(TGLVector3(1e10, 0, 0), TGLVector3(-1, 0, 0));
215 viewerGL()->RefCamera(TGLViewer::ECameraType(
x)).IncTimeStamp();
216 viewerGL()->SetCurrentCamera(TGLViewer::ECameraType(
x));
233 m_glClip->SetMode(TGLClip::kOutside);
237 for (TEveElement::List_i it = gEve->GetScenes()->BeginChildren(); it != gEve->GetScenes()->EndChildren(); ++it) {
238 if (strncmp((*it)->GetElementName(),
"TopGeoNodeScene", 15) == 0)
239 ((TEveScene*)(*it))->GetGLScene()->SetClip(
x ?
m_glClip :
nullptr);
260 float getBBoxLineLength(TEveScene* scene, TEveVector
in) {
261 if (!scene->NumChildren())
265 scene->GetGLScene()->CalcBoundingBox();
266 const TGLBoundingBox& bb = scene->GetGLScene()->BoundingBox();
275 TGLLine3
line(TGLVertex3(), TGLVertex3(inn.fX, inn.fY, inn.fZ));
276 std::vector<float>
res;
277 for (TGLPlaneSet_i
i = ps.begin();
i != ps.end(); ++
i) {
278 std::pair<Bool_t, TGLVertex3>
r = Intersection(*
i,
line,
false);
280 TGLVector3 vr(
r.second.X(),
r.second.Y(),
r.second.Z());
281 res.push_back(vr.Mag());
288 void setBBoxClipped(TGLBoundingBox& bbox, TEveVector
dir, TEveVector
b0, TEveVector
b1,
float fac) {
303 for (
int i = 4;
i < 8; ++
i)
316 for (
int i = 0;
i < 8; ++
i) {
317 bbv[
i].Set(bb[
i].fX, bb[
i].fY, bb[
i].fZ);
329 using namespace TMath;
333 TEveVector normXY(0., 1., 0);
334 TEveVector
b0 =
in.Cross(normXY);
335 TEveVector
b1 =
in.Cross(
b0);
353 for (
int i = 0;
i < 4; ++
i)
356 TEveVector aOff =
in;
360 ((Clipsi*)
m_glClip)->SetAppexOffset(aOff);
362 ((Clipsi*)
m_glClip)->SetPlaneInfo(&
c[0]);
382 TGLCamera& cam =
viewerGL()->CurrentCamera();
383 cam.SetExternalCenter(
true);
384 cam.SetCenterVec(bbox.Center().X(), bbox.Center().Y(), bbox.Center().Z());
385 cam.Setup(bbox,
true);
407 for (
const auto& it : HGCalEE->RefChildren()) {
410 it->SetRnrState(
layer >= r_lmin &&
layer <= r_lmax);
416 for (
const auto& it : HGCalHSi->RefChildren()) {
419 it->SetRnrState(
layer >= r_lmin &&
layer <= r_lmax);
425 for (
const auto& it : HGCalHSc->RefChildren()) {
428 it->SetRnrState(
layer >= r_lmin &&
layer <= r_lmax);
439 TGLPerspectiveCamera* camera =
dynamic_cast<TGLPerspectiveCamera*
>(&(
viewerGL()->CurrentCamera()));
449 TGLPerspectiveCamera* camera =
dynamic_cast<TGLPerspectiveCamera*
>(&(
viewerGL()->CurrentCamera()));
467 printf(
"ERROR!!!! FW3DViewBase::setCurrentDMTVertex \n");
510 Form(
"TEveGedEditor::SpawnNewEditor((TGLViewer*)0x%lx)", (
unsigned long)
viewerGL())));
514 new TGLayoutHints(kLHintsExpandX, 2, 2, 2, 2));
520 std::vector<unsigned int> ids =
522 m_ecalBarrel->Reset(TEveBoxSet::kBT_FreeBox,
true, ids.size());
523 for (std::vector<unsigned int>::iterator it = ids.begin(); it != ids.end(); ++it) {
539 TEveCalo3D* c3d =
dynamic_cast<TEveCalo3D*
>(
calo);
540 c3d->SetRnrFrame(!
x, !
x);
541 c3d->ElementChanged();
FWDoubleParameter m_clipTheta
bool requestGLHandlerPick() const override
void updateHGCalVisibility(bool)
FWBoolParameter m_showMtdBarrel
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
void showTrackerBarrel(bool)
void enableSceneClip(bool)
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
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
FWBoolParameter m_showMtdEndcap
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
unsigned int version() const
FWBoolParameter m_showPixelBarrel