15 #include <boost/bind.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"
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.),
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);
174 float c[3] = {0, 0, 0};
178 TEveVector center(
c[0],
c[1],
c[2]);
179 m_projMgr->GetProjection()->SetCenter(center);
182 TGLCamera& cam =
viewerGL()->CurrentCamera();
183 cam.SetExternalCenter(
true);
185 double r = center.Mag();
186 cam.SetCenterVec(center.fZ,
TMath::Sign(
r, center.fY), 0);
188 cam.SetCenterVec(
c[0],
c[1],
c[2]);
208 #ifdef TEVEPROJECTIONS_DISPLACE_ORIGIN_MODE
210 TEveProjection*
p =
m_projMgr->GetProjection();
220 #ifdef TEVEPROJECTIONS_DISPLACE_ORIGIN_MODE
222 m_projMgr->GetProjection()->SetCenter(center);
226 float* pc =
m_projMgr->GetProjection()->GetProjectedCenter();
227 viewerGL()->CurrentCamera().SetExternalCenter(
true);
228 viewerGL()->CurrentCamera().SetCenterVec(pc[0], pc[1], pc[2]);
229 viewerGL()->SetDrawCameraCenter(
true);
238 #ifdef TEVEPROJECTIONS_DISPLACE_ORIGIN_MODE
240 TEveVector center(
b.x0(),
b.y0(),
b.z0());
241 m_projMgr->GetProjection()->SetCenter(center);
249 TEveProjection*
p =
m_projMgr->GetProjection();
282 float oldLayer =
m_projMgr->GetCurrentDepth();
285 std::shared_ptr<TEveProjectionManager> sentry(
m_projMgr,
286 boost::bind(&TEveProjectionManager::SetCurrentDepth, _1, oldLayer));
287 m_projMgr->ImportElements(iChildren, iProjectedParent);
292 TGLOrthoCamera* camera = dynamic_cast<TGLOrthoCamera*>(&(
viewerGL()->CurrentCamera()));
300 TGLOrthoCamera* camera = dynamic_cast<TGLOrthoCamera*>(&(
viewerGL()->CurrentCamera()));
319 m_calo->SetEta(-eta_range, eta_range);
326 if (!
m_calo->GetData()->Empty()) {
327 m_calo->AssertCellIdCache();
329 TEveCaloData::CellData_t cellData;
330 typedef std::vector<TEveCaloData::vCellId_t*> vBinCells_t;
331 typedef std::vector<TEveCaloData::vCellId_t*>::iterator vBinCells_i;
333 vBinCells_t cellLists =
m_calo->GetBinLists();
334 for (vBinCells_i it = cellLists.begin(); it != cellLists.end(); it++) {
335 TEveCaloData::vCellId_t* binCells = *it;
339 TEveCaloData::vCellId_i
a = binCells->end();
341 for (TEveCaloData::vCellId_i
k = binCells->begin();
k !=
a; ++
k) {
342 m_calo->GetData()->GetCellData((*
k), cellData);
343 sumEt += cellData.Value(
true);
344 sumE += cellData.Value(
false);
383 #ifdef TEVEPROJECTIONS_DISPLACE_ORIGIN_MODE
391 f->AddFrame(
new TGLabel(
f,
"FishEye:"));
394 f->AddFrame(
new TGLabel(
f,
"PreScales:"));