15 #include <boost/bind.hpp>
16 #include <boost/shared_ptr.hpp>
18 #include "TGLViewer.h"
19 #include "TGLScenePad.h"
20 #include "TEveManager.h"
21 #include "TEveElement.h"
22 #include "TEveScene.h"
23 #include "TEveProjections.h"
24 #include "TEveProjectionAxes.h"
26 #include "TEveProjectionManager.h"
29 #define protected public
58 m_showPixelBarrel(this,
"Show Pixel Barrel",
false ),
59 m_showPixelEndcap(this,
"Show Pixel Endcap",
false),
60 m_showTrackerBarrel(this,
"Show Tracker Barrel",
false ),
61 m_showTrackerEndcap(this,
"Show Tracker Endcap",
false),
62 m_showRpcEndcap(this,
"Show RPC Endcap",
false ),
63 m_showGEM(this,
"Show GEM",
false ),
65 m_shiftOrigin(this,
"Shift origin to beam-spot",
false),
66 m_fishEyeDistortion(this,
"Distortion",0., 0., 100.),
67 m_fishEyeR(this,
"FixedRadius",(double)fireworks::
Context::
caloR1(), 0.0, 150.0),
69 m_caloDistortion(this,
"Calo compression",1.0,0.01,10.),
70 m_muonDistortion(this,
"Muon compression",0.2,0.01,10.),
71 m_showProjectionAxes(this,
"Show projection axis",
false),
72 m_projectionAxesLabelSize(this,
"Projection axis label size", 0.015, 0.001, 0.2),
73 m_compressMuon(this,
"Compress detectors",
false),
77 TEveProjection::EPType_e projType = (
id ==
FWViewType::kRhoZ) ? TEveProjection::kPT_RhoZ : TEveProjection::kPT_RPhi;
79 m_projMgr =
new TEveProjectionManager(projType);
86 #ifdef TEVEPROJECTIONS_DISPLACE_ORIGIN_MODE
92 m_projMgr->GetProjection()->AddPreScaleEntry(0, 300, 0.2);
95 m_projMgr->GetProjection()->AddPreScaleEntry(1, 310, 1.0);
96 m_projMgr->GetProjection()->AddPreScaleEntry(0, 370, 0.2);
97 m_projMgr->GetProjection()->AddPreScaleEntry(1, 580, 0.2);
102 viewerGL()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
103 if ( TGLOrthoCamera* camera = dynamic_cast<TGLOrthoCamera*>( &(
viewerGL()->CurrentCamera()) ) ) {
104 camera->SetZoomMax(1e6);
106 geoScene()->GetGLScene()->SetSelectable(kFALSE);
146 return static_cast<TEveCaloViz*
>(
m_calo);
162 TEveCalo3D* calo3d =
new TEveCalo3D(data);
167 m_calo->SetBarrelRadius(177);
172 m_calo->SetAutoRange(
false);
173 m_calo->SetScaleAbs(
true);
193 TEveVector center(b.
x0(), b.
y0(), b.
z0());
194 m_projMgr->GetProjection()->SetCenter(center);
197 TGLCamera& cam =
viewerGL()->CurrentCamera();
198 cam.SetExternalCenter(
true);
201 double r = TMath::Sqrt( b.
x0()*b.
x0() + b.
y0()*b.
y0());
202 cam.SetCenterVec(b.
z0(), TMath::Sign(r, b.
y0()), 0);
206 cam.SetCenterVec(b.
x0(), b.
y0(), b.
z0());
221 #ifdef TEVEPROJECTIONS_DISPLACE_ORIGIN_MODE
223 TEveProjection*
p =
m_projMgr->GetProjection();
236 #ifdef TEVEPROJECTIONS_DISPLACE_ORIGIN_MODE
238 m_projMgr->GetProjection()->SetCenter(center);
242 float* pc =
m_projMgr->GetProjection()->GetProjectedCenter();
243 viewerGL()->CurrentCamera().SetExternalCenter(
true);
244 viewerGL()->CurrentCamera().SetCenterVec(pc[0], pc[1], pc[2]);
245 viewerGL()->SetDrawCameraCenter(
true);
256 #ifdef TEVEPROJECTIONS_DISPLACE_ORIGIN_MODE
258 TEveVector center(b.
x0(), b.
y0(), b.
z0());
259 m_projMgr->GetProjection()->SetCenter(center);
270 TEveProjection*
p =
m_projMgr->GetProjection();
300 m_projMgr->GetProjection()->SetUsePreScale(flag);
309 float oldLayer =
m_projMgr->GetCurrentDepth();
312 boost::shared_ptr<TEveProjectionManager> sentry(
m_projMgr,
313 boost::bind(&TEveProjectionManager::SetCurrentDepth,
315 m_projMgr->ImportElements(iChildren,iProjectedParent);
323 TGLOrthoCamera* camera =
dynamic_cast<TGLOrthoCamera*
>( &(
viewerGL()->CurrentCamera()) );
332 TGLOrthoCamera* camera =
dynamic_cast<TGLOrthoCamera*
>( &(
viewerGL()->CurrentCamera()) );
352 m_calo->SetEta(-eta_range,eta_range);
361 if (!
m_calo->GetData()->Empty())
363 m_calo->AssertCellIdCache();
365 TEveCaloData::CellData_t cellData;
366 typedef std::vector<TEveCaloData::vCellId_t*> vBinCells_t;
367 typedef std::vector<TEveCaloData::vCellId_t*>::iterator vBinCells_i;
369 vBinCells_t cellLists =
m_calo->fCellLists;
370 for (vBinCells_i it = cellLists.begin(); it != cellLists.end(); it++)
372 TEveCaloData::vCellId_t* binCells = *it;
375 TEveCaloData::vCellId_i
a = binCells->end();
377 for (TEveCaloData::vCellId_i
k = binCells->begin();
k !=
a; ++
k)
379 m_calo->GetData()->GetCellData((*
k), cellData);
380 sumEt += cellData.Value(
true);
381 sumE += cellData.Value(
false);
420 #ifdef TEVEPROJECTIONS_DISPLACE_ORIGIN_MODE
431 f->AddFrame(
new TGLabel(f,
"FishEye:"));
436 f->AddFrame(
new TGLabel(f,
"PreScales:"));
static float caloTransEta()
void doShiftOriginToBeamSpot()
void addToOrthoCamera(TGLOrthoCamera *, FWConfiguration &) const
void doFishEyeDistortion()
virtual void populateController(ViewerParameterGUI &) const
FWBoolParameter m_shiftOrigin
FWBoolParameter m_showProjectionAxes
FWRPZView(TEveWindowSlot *iParent, FWViewType::EType)
virtual TEveCaloViz * getEveCalo() const
virtual void setContext(const fireworks::Context &)
FWDoubleParameter m_projectionAxesLabelSize
virtual void populateController(ViewerParameterGUI &) const
const FWGeometry * getGeom() const
void voteMaxEtAndEnergy(float Et, float energy) const
ViewerParameterGUI & requestTab(const char *)
virtual void setFrom(const FWConfiguration &)
const std::string & typeName() const
unsigned int version() const
virtual void setupEnergyScale()
TEveProjectionAxes * m_axes
TGLViewer * viewerGL() const
sigc::signal< void, T > changed_
FWParameters::Bool FWBoolParameter
const fireworks::Context * m_context
const VersionInfo & versionInfo() const
FWBoolParameter * m_showHF
TEveProjectionManager * m_projMgr
FWDoubleParameter m_fishEyeR
FWBoolParameter m_showRpcEndcap
void initStdGeoElements(const FWViewType::EType id)
bool haveExtraDet(const char *) const
FWBeamSpot * getBeamSpot() const
virtual void setFrom(const FWConfiguration &)
virtual void voteCaloMaxVal()
FWBoolParameter m_showTrackerBarrel
void showProjectionAxes()
static float caloR1(bool offset=true)
void importElements(TEveElement *iProjectableChild, float layer, TEveElement *iProjectedParent=0)
TEveCaloDataHist * getCaloData() const
virtual void addTo(FWConfiguration &) const
void showPixelEndcap(bool)
FWBoolParameter m_compressMuon
FWRPZViewGeometry * m_geometryList
void shiftOrigin(TEveVector ¢er)
const std::string & value(unsigned int iIndex=0) const
const fireworks::Context & context()
void showPixelBarrel(bool)
virtual void eventBegin()
void doPreScaleDistortion()
FWBoolParameter * m_showEndcaps
FWBoolParameter m_showGEM
static const float s_distortFInv
void showTrackerBarrel(bool)
FWDoubleParameter m_fishEyeDistortion
ViewerParameterGUI & addParam(const FWParameterBase *)
FWBoolParameter m_showTrackerEndcap
TGCompositeFrame * getTabContainer()
char data[epos_bytes_allocation]
static double caloMaxEta()
FWDoubleParameter m_muonDistortion
FWBoolParameter m_showPixelEndcap
FWDoubleParameter m_caloDistortion
void showTrackerEndcap(bool)
const FWConfiguration * valueForKey(const std::string &iKey) const
volatile std::atomic< bool > shutdown_flag false
FWBoolParameter m_showPixelBarrel
void setFromOrthoCamera(TGLOrthoCamera *, const FWConfiguration &)
virtual void addTo(FWConfiguration &) const
static const float s_distortF
void projectionAxesLabelSize()
virtual void setContext(const fireworks::Context &x)
FWViewType::EType typeId() const