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
54 m_shiftOrigin(this,
"Shift origin to beam-spot",
true),
55 m_fishEyeDistortion(this,
"Distortion",0., 0., 100.),
56 m_fishEyeR(this,
"FixedRadius",(double)fireworks::
Context::caloR1(), 0.0, 150.0),
58 m_caloDistortion(this,
"Calo compression",1.0,0.01,10.),
59 m_muonDistortion(this,
"Muon compression",0.2,0.01,10.),
60 m_showProjectionAxes(this,
"Show projection axis",
false),
61 m_compressMuon(this,
"Compress detectors",
false),
66 TEveProjection::EPType_e projType = (
id ==
FWViewType::kRhoZ) ? TEveProjection::kPT_RhoZ : TEveProjection::kPT_RPhi;
68 m_projMgr =
new TEveProjectionManager(projType);
75 #ifdef TEVEPROJECTIONS_DISPLACE_ORIGIN_MODE
81 m_projMgr->GetProjection()->AddPreScaleEntry(0, 300, 0.2);
84 m_projMgr->GetProjection()->AddPreScaleEntry(1, 310, 1.0);
85 m_projMgr->GetProjection()->AddPreScaleEntry(0, 370, 0.2);
86 m_projMgr->GetProjection()->AddPreScaleEntry(1, 580, 0.2);
91 viewerGL()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
92 if ( TGLOrthoCamera* camera = dynamic_cast<TGLOrthoCamera*>( &(
viewerGL()->CurrentCamera()) ) ) {
93 camera->SetZoomMax(1e6);
95 geoScene()->GetGLScene()->SetSelectable(kFALSE);
99 m_axes->SetLabelSize(0.015);
133 return static_cast<TEveCaloViz*
>(
m_calo);
150 TEveCalo3D* calo3d =
new TEveCalo3D(data);
155 m_calo->SetBarrelRadius(177);
160 m_calo->SetAutoRange(
false);
161 m_calo->SetScaleAbs(
true);
173 TEveVector center(b.
x0(), b.
y0(), b.
z0());
174 m_projMgr->GetProjection()->SetCenter(center);
177 TGLCamera& cam =
viewerGL()->CurrentCamera();
178 cam.SetExternalCenter(
true);
181 double r = TMath::Sqrt( b.
x0()*b.
x0() + b.
y0()*b.
y0());
182 cam.SetCenterVec(b.
z0(), TMath::Sign(r, b.
y0()), 0);
186 cam.SetCenterVec(b.
x0(), b.
y0(), b.
z0());
194 #ifdef TEVEPROJECTIONS_DISPLACE_ORIGIN_MODE
196 TEveProjection*
p =
m_projMgr->GetProjection();
209 TEveProjection*
p =
m_projMgr->GetProjection();
239 m_projMgr->GetProjection()->SetUsePreScale(flag);
248 float oldLayer =
m_projMgr->GetCurrentDepth();
251 boost::shared_ptr<TEveProjectionManager> sentry(
m_projMgr,
252 boost::bind(&TEveProjectionManager::SetCurrentDepth,
254 m_projMgr->ImportElements(iChildren,iProjectedParent);
262 TGLOrthoCamera* camera =
dynamic_cast<TGLOrthoCamera*
>( &(
viewerGL()->CurrentCamera()) );
271 TGLOrthoCamera* camera =
dynamic_cast<TGLOrthoCamera*
>( &(
viewerGL()->CurrentCamera()) );
291 m_calo->SetEta(-eta_range,eta_range);
300 if (!
m_calo->GetData()->Empty())
302 m_calo->AssertCellIdCache();
304 TEveCaloData::CellData_t cellData;
305 typedef std::vector<TEveCaloData::vCellId_t*> vBinCells_t;
306 typedef std::vector<TEveCaloData::vCellId_t*>::iterator vBinCells_i;
308 vBinCells_t cellLists =
m_calo->fCellLists;
309 for (vBinCells_i it = cellLists.begin(); it != cellLists.end(); it++)
311 TEveCaloData::vCellId_t* binCells = *it;
314 TEveCaloData::vCellId_i
a = binCells->end();
316 for (TEveCaloData::vCellId_i
k = binCells->begin();
k !=
a; ++
k)
318 m_calo->GetData()->GetCellData((*
k), cellData);
319 sumEt += cellData.Value(
true);
320 sumE += cellData.Value(
false);
332 m_axes->SetRnrState(kTRUE);
334 m_axes->SetRnrState(kFALSE);
343 #ifdef TEVEPROJECTIONS_DISPLACE_ORIGIN_MODE
351 f->AddFrame(
new TGLabel(f,
"FishEye:"));
356 f->AddFrame(
new TGLabel(f,
"PreScales:"));
static float caloTransEta()
TEveElement * getGeoElements(const FWViewType::EType id)
static FWRPZViewGeometry * s_geometryList
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 &)
virtual void populateController(ViewerParameterGUI &) const
void voteMaxEtAndEnergy(float Et, float energy) const
ViewerParameterGUI & requestTab(const char *)
virtual void setFrom(const FWConfiguration &)
ViewerParameterGUI & separator()
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
FWBeamSpot * getBeamSpot() const
virtual void setFrom(const FWConfiguration &)
virtual void voteCaloMaxVal()
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
FWBoolParameter m_compressMuon
const std::string & value(unsigned int iIndex=0) const
const fireworks::Context & context()
virtual void eventBegin()
void doPreScaleDistortion()
FWBoolParameter * m_showEndcaps
static const float s_distortFInv
FWDoubleParameter m_fishEyeDistortion
ViewerParameterGUI & addParam(const FWParameterBase *)
TGCompositeFrame * getTabContainer()
static double caloMaxEta()
FWDoubleParameter m_muonDistortion
FWDoubleParameter m_caloDistortion
const FWConfiguration * valueForKey(const std::string &iKey) const
void setFromOrthoCamera(TGLOrthoCamera *, const FWConfiguration &)
virtual void addTo(FWConfiguration &) const
static const float s_distortF
virtual void setContext(const fireworks::Context &x)
FWViewType::EType typeId() const