3 #include "TEveManager.h"
4 #include "TEveStraightLineSet.h"
6 #include "TEveTrackPropagator.h"
9 #include "TEveGeoShape.h"
10 #include "TGLViewer.h"
11 #include "TGLScenePad.h"
22 #include "TGLCameraOverlay.h"
25 #include "boost/bind.hpp"
80 float sd = TMath::Sqrt(dx*dx + dy*dy);
89 m_legend =
new TLegend( 0.01, 0.01, 0.99, 0.99, 0,
"NDC" );
94 m_legend->SetEntrySeparation( 0.01 );
102 static float kSliderRangeFactor = 0.2;
104 m_range = x * kSliderRangeFactor;
122 TLatex* latex =
new TLatex( x, y,
"" );
123 const double textsize( 0.07 );
124 latex->SetTextSize( textsize );
126 latex->DrawLatex( x, y,
id.
item()->modelName(
id.
index()).c_str());
127 y -= latex->GetTextSize()*0.6;
129 latex->SetTextSize( textsize );
130 float lineH = latex->GetTextSize()*0.6;
132 latex->DrawLatex( x, y, Form(
" P_{T} = %.1f GeV, #eta = %0.2f, #varphi = %0.2f",
133 track->
pt(), track->
eta(), track->
phi()));
137 latex->DrawLatex( x, y,
" charge = +1" );
139 latex->DrawLatex( x, y,
" charge = -1" );
174 TGCompositeFrame*
f =
new TGVerticalFrame(
m_guiFrame);
176 f->AddFrame(
new TGLabel(f,
"Rng:"),
new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
177 m_slider =
new TGHSlider(f, 120, kSlider1 | kScaleNo);
178 f->AddFrame(
m_slider,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 1, 4));
183 TQObject::Connect(
m_slider,
"PositionChanged(Int_t)",
"FWIntValueListenerBase",
m_sliderListener,
"setValue(Int_t)");
188 b->SetState(kButtonDown,
true);
189 m_guiFrame->AddFrame(b,
new TGLayoutHints( kLHintsNormal, 2, 3, 1, 4));
190 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
196 b->SetState(kButtonDown,
true);
197 m_guiFrame->AddFrame(b,
new TGLayoutHints( kLHintsNormal, 2, 3, 1, 4));
198 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
206 TGCompositeFrame*
p = (TGCompositeFrame*)
m_guiFrame->GetParent();
219 event->getByLabel(
edm::InputTag(
"particleFlowRecHitECAL"), ecalH);
223 event->getByLabel(
edm::InputTag(
"particleFlowRecHitHBHEHO"),hcalH);
230 m_eveScene->GetGLScene()->SetSelectable(
false);
235 viewerGL()->SetStyle(TGLRnrCtx::kOutline);
236 viewerGL()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
238 TGLCameraOverlay* co =
viewerGL()->GetCameraOverlay();
239 co->SetShowOrthographic(kTRUE);
240 co->SetOrthographicMode(TGLCameraOverlay::kAxis);
242 viewerGL()->ResetCamerasAfterNextUpdate();
247 printf(
"unknown exception \n");
264 for (std::vector<reco::PFRecHit>::const_iterator it = hits->begin(); it != hits->end(); ++it)
266 TEveVector centre(it->position().x(), it->position().y(), it->position().z());
267 float E = it->energy();
278 for (std::vector<reco::PFRecTrack>::const_iterator it = tracks->begin(); it != tracks->end(); ++it)
305 if (!cluster)
return;
307 Color_t
col = kViolet+9;
309 TEveStraightLineSet*
ls =
new TEveStraightLineSet(
"cluster_ls");
310 ls->SetMainColor(col);
313 TEvePointSet* ps =
new TEvePointSet(
"cluster_ps");
314 ps->SetMainColor(col);
315 ps->SetMarkerStyle(2);
316 ps->SetMarkerSize(0.005);
319 for (std::vector<reco::PFCluster>::const_iterator it = cluster->begin(); it != cluster->end(); ++it)
321 if (!
isPntInRng(it->position().Eta(), it->position().Phi()))
324 ps->SetNextPoint(it->position().Eta(), it->position().Phi(), 0);
339 void WrapTwoPi(std::vector<TEveVector>&
hc,
float y)
346 if (hc[0].fY > 0 && hc[1].fY > 0 && hc[2].fY > 0 && hc[3].fY > 0 )
348 if (hc[0].fY < 0 && hc[1].fY < 0 && hc[2].fY < 0 && hc[3].fY < 0 )
352 for (
int i = 0;
i < 4; ++
i)
353 if (y > 0 && hc[
i].fY < 0)
355 else if (y < 0 && hc[
i].fY > 0)
363 TEveStraightLineSet::Line_t* AddLineToLineSet(TEveStraightLineSet*
ls,
const std::vector< TEveVector >& pnts,
int i0,
int i1)
366 printf(
"add line \n");
370 return ls->AddLine(pnts[i0], pnts[i1]);
377 TEveStraightLineSet* lsOutline = ( TEveStraightLineSet*)
m_eventList->FindChild(
"outlines");
379 TEvePointSet* ps =
new TEvePointSet(
"test");
381 ps->SetMainColor(kOrange);
383 for (std::vector<reco::PFRecHit>::const_iterator it = hits->begin(); it != hits->end(); ++it)
385 const std::vector< math::XYZPoint >& corners = it->getCornersXYZ();
389 std::vector<TEveVector>
hc;
390 for (
int k = 0;
k < 4; ++
k) {
391 hc.push_back(TEveVector(corners[
k].
eta(), corners[
k].
phi(), 0));
395 WrapTwoPi(hc, corners[0].
phi());
397 AddLineToLineSet(lsOutline, hc, 0, 1);
398 AddLineToLineSet(lsOutline, hc, 1, 2);
399 AddLineToLineSet(lsOutline, hc, 2, 3);
400 AddLineToLineSet(lsOutline, hc, 3, 0);
404 TEveVector centerOfGravity = hc[0] + hc[1] + hc[2] + hc[3];
405 centerOfGravity *= 0.25;
407 std::vector<TEveVector> radialVectors;
408 for (
int k = 0;
k < 4; ++
k)
409 radialVectors.push_back(TEveVector(hc[
k] - centerOfGravity));
420 std::vector<TEveVector> scaledCorners;
421 for (
int k = 0;
k < 4; ++
k) {
422 radialVectors[
k] *= factor;
423 scaledCorners.push_back(TEveVector(radialVectors[
k] + centerOfGravity));
426 TEveStraightLineSet* ls = ( TEveStraightLineSet*)
m_eventList->FindChild(Form(
"%d_rechit", it->depth() ));
427 AddLineToLineSet(ls, scaledCorners, 0, 1);
428 AddLineToLineSet(ls, scaledCorners, 1, 2);
429 AddLineToLineSet(ls, scaledCorners, 2, 3);
431 TEveStraightLineSet::Line_t* li = AddLineToLineSet(ls, scaledCorners, 3, 0);
432 ls->AddMarker(centerOfGravity, li->fId);
448 TEveStraightLineSet* ls =
new TEveStraightLineSet(Form(
"%d_rechit",
depth));
450 if (
depth == 0 ) ls->SetLineColor(kGray);
451 else if (
depth == 1 ) ls->SetLineColor(kRed);
452 else if (
depth == 2 ) ls->SetLineColor(kGreen);
453 else if (
depth == 3 ) ls->SetLineColor(kMagenta);
454 else if (
depth == 4 ) ls->SetLineColor(kOrange);
455 else if (
depth == 5 ) ls->SetLineColor(kYellow);
457 ls->SetMarkerStyle(1);
461 TEveStraightLineSet* ls =
new TEveStraightLineSet(
"outlines");
462 ls->SetLineColor(kGray);
463 ls->SetMainTransparency(80);
475 event->getByLabel(
edm::InputTag(
"particleFlowRecHitECAL"), ecalH);
485 event->getByLabel(
edm::InputTag(
"particleFlowRecHitHF"), ecalH);
495 event->getByLabel(
edm::InputTag(
"particleFlowRecHitHBHEHO"),hcalH);
510 event->getByLabel(
edm::InputTag(
"particleFlowClusterECAL"), ecalClustersH);
const std::string & getName() const
virtual char const * what() const
bool isPntInRng(float x, float y)
TGLViewer * viewerGL() const
FWIntValueListener * m_sliderListener
void voteMaxEtAndEnergy(float Et, float energy) const
const FWEventItem * item()
sigc::signal< void > activated
TEveElementList * m_eventList
#define REGISTER_FWDETAILVIEW(_classname_, _name_,...)
virtual double eta() const
momentum pseudorapidity
virtual double pt() const
transverse momentum
T x() const
Cartesian x coordinate.
void build(const FWModelId &id, const reco::PFCandidate *)
const fireworks::Context & context() const
const fireworks::Context & context() const
sigc::signal< void, Int_t > valueChanged_
virtual int charge() const
electric charge
TGCompositeFrame * m_guiFrame
tuple particleFlowRecHitECAL
float getMaxEnergyInEvent(bool isEt) const
float calculateEt(const TEveVector ¢re, float e)
void voteMaxEtEVal(const std::vector< reco::PFRecHit > *hits)
const edm::EventBase * getCurrentEvent() const
tuple particleFlowRecHitHF
T const * product() const
static FWGUIManager * getGUIManager()
const reco::PFCandidate * m_candidate
void addHits(const std::vector< reco::PFRecHit > *)
virtual ~FWPFCandidateDetailView()
Particle reconstructed by the particle flow algorithm.
void addClusters(const std::vector< reco::PFCluster > *)
tuple particleFlowClusterECAL
virtual double phi() const
momentum azimuthal angle
FWPFCandidateDetailView()
void setTextInfo(const FWModelId &id, const reco::PFCandidate *)
void addTracks(const std::vector< reco::PFRecTrack > *)