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"
48 m_geometryList(nullptr),
54 m_showPixelBarrel(this,
"Show Pixel Barrel",
false),
55 m_showPixelEndcap(this,
"Show Pixel Endcap",
false),
56 m_showTrackerBarrel(this,
"Show Tracker Barrel",
false),
57 m_showTrackerEndcap(this,
"Show Tracker Endcap",
false),
58 m_showRpcEndcap(this,
"Show RPC Endcap",
false),
59 m_showGEM(this,
"Show GEM",
false),
60 m_showME0(this,
"Show ME0",
false),
62 m_shiftOrigin(this,
"Shift origin to beam-spot",
false),
63 m_fishEyeDistortion(this,
"Distortion", 0., 0., 100.),
64 m_fishEyeR(this,
"FixedRadius", (double)fireworks::
Context::
caloR1(), 0.0, 150.0),
66 m_caloDistortion(this,
"Calo compression", 1.0, 0.01, 10.),
67 m_muonDistortion(this,
"Muon compression", 0.2, 0.01, 10.),
68 m_showProjectionAxes(this,
"Show projection axis",
false),
69 m_projectionAxesLabelSize(this,
"Projection axis label size", 0.015, 0.001, 0.2),
70 m_compressMuon(this,
"Compress detectors",
false),
72 m_showEndcaps(nullptr) {
73 TEveProjection::EPType_e projType = (
id ==
FWViewType::kRhoZ) ? TEveProjection::kPT_RhoZ : TEveProjection::kPT_RPhi;
75 m_projMgr =
new TEveProjectionManager(projType);
82 #ifdef TEVEPROJECTIONS_DISPLACE_ORIGIN_MODE
88 m_projMgr->GetProjection()->AddPreScaleEntry(0, 300, 0.2);
91 m_projMgr->GetProjection()->AddPreScaleEntry(1, 310, 1.0);
92 m_projMgr->GetProjection()->AddPreScaleEntry(0, 370, 0.2);
93 m_projMgr->GetProjection()->AddPreScaleEntry(1, 580, 0.2);
97 viewerGL()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
98 if (TGLOrthoCamera* camera = dynamic_cast<TGLOrthoCamera*>(&(
viewerGL()->CurrentCamera()))) {
99 camera->SetZoomMax(1e6);
101 geoScene()->GetGLScene()->SetSelectable(kFALSE);
150 TEveCalo3D* calo3d =
new TEveCalo3D(data);
155 m_calo->SetBarrelRadius(177);
160 m_calo->SetAutoRange(
false);
161 m_calo->SetScaleAbs(
true);
178 float c[3] = {0, 0, 0};
182 TEveVector center(c[0], c[1], c[2]);
183 m_projMgr->GetProjection()->SetCenter(center);
186 TGLCamera& cam =
viewerGL()->CurrentCamera();
187 cam.SetExternalCenter(
true);
189 double r = center.Mag();
190 cam.SetCenterVec(center.fZ, TMath::Sign(r, center.fY), 0);
192 cam.SetCenterVec(c[0], c[1], c[2]);
212 #ifdef TEVEPROJECTIONS_DISPLACE_ORIGIN_MODE
214 TEveProjection*
p =
m_projMgr->GetProjection();
224 #ifdef TEVEPROJECTIONS_DISPLACE_ORIGIN_MODE
226 m_projMgr->GetProjection()->SetCenter(center);
230 float* pc =
m_projMgr->GetProjection()->GetProjectedCenter();
231 viewerGL()->CurrentCamera().SetExternalCenter(
true);
232 viewerGL()->CurrentCamera().SetCenterVec(pc[0], pc[1], pc[2]);
233 viewerGL()->SetDrawCameraCenter(
true);
242 #ifdef TEVEPROJECTIONS_DISPLACE_ORIGIN_MODE
244 TEveVector center(b.
x0(), b.
y0(), b.
z0());
245 m_projMgr->GetProjection()->SetCenter(center);
253 TEveProjection*
p =
m_projMgr->GetProjection();
279 m_projMgr->GetProjection()->SetUsePreScale(flag);
286 float oldLayer =
m_projMgr->GetCurrentDepth();
289 std::shared_ptr<TEveProjectionManager> sentry(
290 m_projMgr, std::bind(&TEveProjectionManager::SetCurrentDepth, std::placeholders::_1, oldLayer));
291 m_projMgr->ImportElements(iChildren, iProjectedParent);
296 TGLOrthoCamera* camera =
dynamic_cast<TGLOrthoCamera*
>(&(
viewerGL()->CurrentCamera()));
304 TGLOrthoCamera* camera =
dynamic_cast<TGLOrthoCamera*
>(&(
viewerGL()->CurrentCamera()));
323 m_calo->SetEta(-eta_range, eta_range);
330 if (!
m_calo->GetData()->Empty()) {
331 m_calo->AssertCellIdCache();
333 TEveCaloData::CellData_t cellData;
334 typedef std::vector<TEveCaloData::vCellId_t*> vBinCells_t;
335 typedef std::vector<TEveCaloData::vCellId_t*>::iterator vBinCells_i;
337 vBinCells_t cellLists =
m_calo->GetBinLists();
338 for (vBinCells_i it = cellLists.begin(); it != cellLists.end(); it++) {
339 TEveCaloData::vCellId_t* binCells = *it;
343 TEveCaloData::vCellId_i
a = binCells->end();
345 for (TEveCaloData::vCellId_i
k = binCells->begin();
k !=
a; ++
k) {
346 m_calo->GetData()->GetCellData((*
k), cellData);
347 sumEt += cellData.Value(
true);
348 sumE += cellData.Value(
false);
387 #ifdef TEVEPROJECTIONS_DISPLACE_ORIGIN_MODE
395 f->AddFrame(
new TGLabel(f,
"FishEye:"));
398 f->AddFrame(
new TGLabel(f,
"PreScales:"));
static float caloTransEta()
void doShiftOriginToBeamSpot()
void addToOrthoCamera(TGLOrthoCamera *, FWConfiguration &) const
void doFishEyeDistortion()
FWBoolParameter m_shiftOrigin
const edm::EventSetup & c
void setupEventCenter() override
FWBoolParameter m_showProjectionAxes
FWRPZView(TEveWindowSlot *iParent, FWViewType::EType)
TEveCaloViz * getEveCalo() const override
FWBoolParameter m_showME0
FWDoubleParameter m_projectionAxesLabelSize
void voteMaxEtAndEnergy(float Et, float energy) const
ViewerParameterGUI & requestTab(const char *)
ViewerParameterGUI & separator()
void getEventCenter(float *inC) const
void voteCaloMaxVal() override
unsigned int version() const
void setFrom(const FWConfiguration &) override
virtual void setupEventCenter()
void setContext(const fireworks::Context &) override
virtual void setupEnergyScale()
void populateController(ViewerParameterGUI &) const override
TEveProjectionAxes * m_axes
TGLViewer * viewerGL() const
FWParameters::Bool FWBoolParameter
const fireworks::Context * m_context
const VersionInfo & versionInfo() const
FWBoolParameter * m_showHF
void addTo(FWConfiguration &) const override
TEveProjectionManager * m_projMgr
FWDoubleParameter m_fishEyeR
FWBoolParameter m_showRpcEndcap
void initStdGeoElements(const FWViewType::EType id)
bool haveExtraDet(const char *) const
FWBeamSpot * getBeamSpot() const
FWBoolParameter m_showTrackerBarrel
void showProjectionAxes()
static float caloR1(bool offset=true)
TEveCaloDataHist * getCaloData() const
void showPixelEndcap(bool)
void eventBegin() override
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)
void populateController(ViewerParameterGUI &) const override
void setFrom(const FWConfiguration &) override
void doPreScaleDistortion()
FWBoolParameter * m_showEndcaps
FWBoolParameter m_showGEM
static const float s_distortFInv
void showTrackerBarrel(bool)
FWDoubleParameter m_fishEyeDistortion
void importElements(TEveElement *iProjectableChild, float layer, TEveElement *iProjectedParent=nullptr)
ViewerParameterGUI & addParam(const FWParameterBase *)
CmsShowCommon * commonPrefs() const
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
sigc::signal< void(T)> changed_
void addTo(FWConfiguration &) const override
FWBoolParameter m_showPixelBarrel
void setFromOrthoCamera(TGLOrthoCamera *, const FWConfiguration &)
static const float s_distortF
FWGeometry * getGeom() const
void projectionAxesLabelSize()
virtual void setContext(const fireworks::Context &x)
FWViewType::EType typeId() const