16 #include <boost/bind.hpp>
17 #include <boost/shared_ptr.hpp>
19 #include "TGLViewer.h"
20 #include "TGLScenePad.h"
21 #include "TEveManager.h"
22 #include "TEveElement.h"
23 #include "TEveScene.h"
24 #include "TEveProjections.h"
25 #include "TEveProjectionAxes.h"
27 #include "TEveProjectionManager.h"
30 #define protected public
59 m_showPixelBarrel(this,
"Show Pixel Barrel",
false ),
60 m_showPixelEndcap(this,
"Show Pixel Endcap",
false),
61 m_showTrackerBarrel(this,
"Show Tracker Barrel",
false ),
62 m_showTrackerEndcap(this,
"Show Tracker Endcap",
false),
64 m_shiftOrigin(this,
"Shift origin to beam-spot",
false),
65 m_fishEyeDistortion(this,
"Distortion",0., 0., 100.),
66 m_fishEyeR(this,
"FixedRadius",(double)fireworks::
Context::
caloR1(), 0.0, 150.0),
68 m_caloDistortion(this,
"Calo compression",1.0,0.01,10.),
69 m_muonDistortion(this,
"Muon compression",0.2,0.01,10.),
70 m_showProjectionAxes(this,
"Show projection axis",
false),
71 m_projectionAxesLabelSize(this,
"Projection axis label size", 0.015, 0.001, 0.2),
72 m_compressMuon(this,
"Compress detectors",
false),
76 TEveProjection::EPType_e projType = (
id ==
FWViewType::kRhoZ) ? TEveProjection::kPT_RhoZ : TEveProjection::kPT_RPhi;
78 m_projMgr =
new TEveProjectionManager(projType);
85 #ifdef TEVEPROJECTIONS_DISPLACE_ORIGIN_MODE
91 m_projMgr->GetProjection()->AddPreScaleEntry(0, 300, 0.2);
94 m_projMgr->GetProjection()->AddPreScaleEntry(1, 310, 1.0);
95 m_projMgr->GetProjection()->AddPreScaleEntry(0, 370, 0.2);
96 m_projMgr->GetProjection()->AddPreScaleEntry(1, 580, 0.2);
101 viewerGL()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
102 if ( TGLOrthoCamera* camera = dynamic_cast<TGLOrthoCamera*>( &(
viewerGL()->CurrentCamera()) ) ) {
103 camera->SetZoomMax(1e6);
105 geoScene()->GetGLScene()->SetSelectable(kFALSE);
145 return static_cast<TEveCaloViz*
>(
m_calo);
161 TEveCalo3D* calo3d =
new TEveCalo3D(data);
166 m_calo->SetBarrelRadius(177);
171 m_calo->SetAutoRange(
false);
172 m_calo->SetScaleAbs(
true);
190 TEveVector center(b.
x0(), b.
y0(), b.
z0());
191 m_projMgr->GetProjection()->SetCenter(center);
194 TGLCamera& cam =
viewerGL()->CurrentCamera();
195 cam.SetExternalCenter(
true);
198 double r = TMath::Sqrt( b.
x0()*b.
x0() + b.
y0()*b.
y0());
199 cam.SetCenterVec(b.
z0(), TMath::Sign(r, b.
y0()), 0);
203 cam.SetCenterVec(b.
x0(), b.
y0(), b.
z0());
218 #ifdef TEVEPROJECTIONS_DISPLACE_ORIGIN_MODE
220 TEveProjection*
p =
m_projMgr->GetProjection();
233 #ifdef TEVEPROJECTIONS_DISPLACE_ORIGIN_MODE
235 m_projMgr->GetProjection()->SetCenter(center);
239 float* pc =
m_projMgr->GetProjection()->GetProjectedCenter();
240 viewerGL()->CurrentCamera().SetExternalCenter(
true);
241 viewerGL()->CurrentCamera().SetCenterVec(pc[0], pc[1], pc[2]);
242 viewerGL()->SetDrawCameraCenter(
true);
253 #ifdef TEVEPROJECTIONS_DISPLACE_ORIGIN_MODE
255 TEveVector center(b.
x0(), b.
y0(), b.
z0());
256 m_projMgr->GetProjection()->SetCenter(center);
267 TEveProjection*
p =
m_projMgr->GetProjection();
297 m_projMgr->GetProjection()->SetUsePreScale(flag);
306 float oldLayer =
m_projMgr->GetCurrentDepth();
309 boost::shared_ptr<TEveProjectionManager> sentry(
m_projMgr,
310 boost::bind(&TEveProjectionManager::SetCurrentDepth,
312 m_projMgr->ImportElements(iChildren,iProjectedParent);
320 TGLOrthoCamera* camera =
dynamic_cast<TGLOrthoCamera*
>( &(
viewerGL()->CurrentCamera()) );
329 TGLOrthoCamera* camera =
dynamic_cast<TGLOrthoCamera*
>( &(
viewerGL()->CurrentCamera()) );
349 m_calo->SetEta(-eta_range,eta_range);
358 if (!
m_calo->GetData()->Empty())
360 m_calo->AssertCellIdCache();
362 TEveCaloData::CellData_t cellData;
363 typedef std::vector<TEveCaloData::vCellId_t*> vBinCells_t;
364 typedef std::vector<TEveCaloData::vCellId_t*>::iterator vBinCells_i;
366 vBinCells_t cellLists =
m_calo->fCellLists;
367 for (vBinCells_i it = cellLists.begin(); it != cellLists.end(); it++)
369 TEveCaloData::vCellId_t* binCells = *it;
372 TEveCaloData::vCellId_i
a = binCells->end();
374 for (TEveCaloData::vCellId_i
k = binCells->begin();
k !=
a; ++
k)
376 m_calo->GetData()->GetCellData((*
k), cellData);
377 sumEt += cellData.Value(
true);
378 sumE += cellData.Value(
false);
411 #ifdef TEVEPROJECTIONS_DISPLACE_ORIGIN_MODE
422 f->AddFrame(
new TGLabel(f,
"FishEye:"));
427 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
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
FWBoolParameter * m_showHF
TEveProjectionManager * m_projMgr
FWDoubleParameter m_fishEyeR
void initStdGeoElements(const FWViewType::EType id)
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
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
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