12 #include <boost/bind.hpp>
17 #include "TGLScenePad.h"
18 #include "TGLViewer.h"
20 #include "TGLPerspectiveCamera.h"
21 #include "TEveManager.h"
22 #include "TEveElement.h"
24 #include "TEveBoxSet.h"
25 #include "TEveScene.h"
26 #include "TGLLogicalShape.h"
28 #include "TEveCaloData.h"
29 #include "TEveStraightLineSet.h"
41 class TGLClipsiLogical :
public TGLLogicalShape
44 virtual void DirectDraw(TGLRnrCtx & rnrCtx)
const override{}
47 TGLClipsiLogical() : TGLLogicalShape() {}
48 virtual ~TGLClipsiLogical() {}
49 void Resize(Double_t ext){}
52 const float fgColor[4] = { 1.0, 0.6, 0.2, 0.5 };
54 class Clipsi :
public TGLClip
58 Clipsi(
const Clipsi&);
59 Clipsi& operator=(
const Clipsi&);
64 Clipsi(TGLRnrCtx* ctx):TGLClip(* new TGLClipsiLogical, TGLMatrix(), fgColor), m_rnrCtx(ctx){}
67 virtual void Setup(
const TGLBoundingBox & bbox)
override {}
69 void SetPlaneInfo(TEveVector* vec)
71 for (
int i = 0;
i < 4; ++
i) {
73 vtx[
i].Set(vec[
i].fX, vec[
i].fY, vec[
i].fZ);
77 using TGLClip::PlaneSet;
78 virtual void PlaneSet(TGLPlaneSet_t & planeSet)
const override
81 planeSet.push_back(TGLPlane(o, vtx[0], vtx[1]));
82 planeSet.push_back(TGLPlane(o, vtx[1], vtx[2]));
83 planeSet.push_back(TGLPlane(o, vtx[2], vtx[3]));
84 planeSet.push_back(TGLPlane(o, vtx[3], vtx[0]));
101 m_showMuonBarrel(this,
"Show Muon Barrel", 0
l, 0
l, 2
l ),
102 m_showMuonEndcap(this,
"Show Muon Endcap",
false ),
103 m_showPixelBarrel(this,
"Show Pixel Barrel",
false ),
104 m_showPixelEndcap(this,
"Show Pixel Endcap",
false),
105 m_showTrackerBarrel(this,
"Show Tracker Barrel",
false ),
106 m_showTrackerEndcap(this,
"Show Tracker Endcap",
false),
109 m_rnrStyle(this,
"Render Style", 0
l, 0
l, 2
l),
110 m_selectable(this,
"Enable Tooltips",
false),
111 m_cameraType(this,
"Camera Type", 0
l, 0
l, 5
l),
112 m_clipEnable(this,
"Enable Clip",
false),
113 m_clipEta(this,
"Clip Eta", 0.0, -5.0, 5.0),
114 m_clipPhi(this,
"Clip Phi", 0.0, -2.0, 2.0),
115 m_clipDelta1(this,
"Clip Delta1", 0.2, 0.01, 2),
116 m_clipDelta2(this,
"Clip Delta2", 0.2, 0.01, 2),
120 viewerGL()->SetCurrentCamera(TGLViewer::kCameraPerspXOZ);
179 TGLClipPlane*
c=
new TGLClipPlane();
180 c->Setup(TGLVector3(1e10,0,0), TGLVector3(-1,0,0));
205 viewerGL()->RefCamera(TGLViewer::ECameraType(x)).IncTimeStamp();
206 viewerGL()->SetCurrentCamera(TGLViewer::ECameraType(x));
215 geoScene()->GetGLScene()->SetStyle(x);
223 geoScene()->GetGLScene()->SetSelectable(x);
231 m_glClip->SetMode(TGLClip::kOutside);
235 for (TEveElement::List_i it =gEve->GetScenes()->BeginChildren(); it != gEve->GetScenes()->EndChildren(); ++it )
237 if (strncmp((*it)->GetElementName(),
"TopGeoNodeScene", 15) == 0)
238 ((TEveScene*)(*it))->GetGLScene()->SetClip(x ? m_glClip : 0);
240 eventScene()->GetGLScene()->SetClip(x ? m_glClip : 0);
270 using namespace TMath;
271 TEveVector
in(Sin(eta)*Cos(phi), Sin(eta)*Sin(phi), Cos(eta));
274 TEveVector normXY(0., 1., 0);
275 TEveVector b0 = in.Cross(normXY);
276 TEveVector b1 = in.Cross(b0);
286 c[0] += b0;
c[0] += b1;
287 c[1] -= b0;
c[1] += b1;
288 c[2] -= b0;
c[2] -= b1;
289 c[3] += b0;
c[3] -= b1;
290 for (
int i = 0;
i < 4; ++
i)
293 ((Clipsi*)
m_glClip)->SetPlaneInfo(&
c[0]);
309 TEvePointSet*
psi = (TEvePointSet*)
eventScene()->FindChild(TString(
"marker"));
310 TEvePointSet*
marker = (TEvePointSet*)(
psi);
312 marker =
new TEvePointSet(8);
314 marker->SetName(
"marker");
315 marker->SetMarkerColor(kOrange);
316 marker->SetMarkerStyle(3);
317 marker->SetMarkerSize(0.2);
319 for (
int i = 0;
i < 4; ++
i)
336 TGLPerspectiveCamera* camera =
dynamic_cast<TGLPerspectiveCamera*
>(&(
viewerGL()->CurrentCamera()));
348 TGLPerspectiveCamera* camera =
dynamic_cast<TGLPerspectiveCamera*
>(&(
viewerGL()->CurrentCamera()));
371 printf(
"ERROR!!!! FW3DViewBase::setCurrentDMTVertex \n");
406 Form(
"TEveGedEditor::SpawnNewEditor((TGLViewer*)0x%lx)", (
unsigned long)
viewerGL())));
416 m_ecalBarrel->Reset(TEveBoxSet::kBT_FreeBox,
true, ids.size() );
417 for (std::vector<unsigned int>::iterator it = ids.begin(); it != ids.end(); ++it) {
431 TEveElement* calo =
eventScene()->FindChild(
"calo barrel");
433 TEveCalo3D* c3d =
dynamic_cast<TEveCalo3D*
>(calo);
434 c3d->SetRnrFrame(!x, !x);
435 c3d->ElementChanged();
FWDoubleParameter m_clipEta
virtual bool requestGLHandlerPick() const
void showEcalBarrel(bool)
void showMuonBarrel(long)
virtual void setFrom(const FWConfiguration &)
FWBoolParameter m_showMuonEndcap
void showMuonBarrel(bool)
void setClip(float eta, float phi)
virtual void populateController(ViewerParameterGUI &) const
const FWGeometry * getGeom() const
FWColorManager * colorManager() const
ViewerParameterGUI & requestTab(const char *)
void showTrackerEndcap(bool)
virtual void setFrom(const FWConfiguration &)
ViewerParameterGUI & separator()
unsigned int version() const
void setCurrentDMTVertex(double x, double y, double z)
FWBoolParameter m_showTrackerBarrel
TGLViewer * viewerGL() const
sigc::signal< void, T > changed_
FW3DViewDistanceMeasureTool * m_DMT
void showMuonBarrelFull(bool)
std::map< std::string, int, std::less< std::string > > psi
FWDoubleParameter m_clipPhi
void showTrackerBarrel(bool)
void enableSceneClip(bool)
void setGeomTransparency(Color_t idx, bool projectedType)
virtual void addTo(FWConfiguration &) const
virtual void populateController(ViewerParameterGUI &) const
void showMuonEndcap(bool)
FWEnumParameter m_rnrStyle
FWBoolParameter m_clipEnable
FWBoolParameter m_showPixelEndcap
FWDoubleParameter m_clipDelta1
bool addEntry(Long_t id, const std::string &txt)
virtual void setContext(const fireworks::Context &)
const std::string & value(unsigned int iIndex=0) const
const fireworks::Context & context()
const float * getCorners(unsigned int id) const
void setFromPerspectiveCamera(TGLPerspectiveCamera *, const std::string &, const FWConfiguration &)
void showPixelBarrel(bool)
FWBoolParameter m_showEcalBarrel
ViewerParameterGUI & addParam(const FWParameterBase *)
TGCompositeFrame * getTabContainer()
void showPixelEndcap(bool)
std::vector< unsigned int > getMatchedIds(Detector det, SubDetector subdet) const
TEveBoxSet * m_ecalBarrel
FWEnumParameter m_showMuonBarrel
FW3DViewBase(TEveWindowSlot *, FWViewType::EType, unsigned int version=8)
FW3DViewGeometry * m_geometry
const FWConfiguration * valueForKey(const std::string &iKey) const
volatile std::atomic< bool > shutdown_flag false
FWBoolParameter m_selectable
FWEnumParameter m_cameraType
virtual void addTo(FWConfiguration &) const
virtual void setContext(const fireworks::Context &x)
FWBoolParameter m_showTrackerEndcap
FWDoubleParameter m_clipDelta2
FWBoolParameter m_showPixelBarrel
FWViewType::EType typeId() const
void addToPerspectiveCamera(TGLPerspectiveCamera *, const std::string &, FWConfiguration &) const