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 );
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");
265 if ( (!hits->empty()) && hits->front().hasCaloCell())
266 for (std::vector<reco::PFRecHit>::const_iterator it = hits->begin(); it != hits->end(); ++it)
268 TEveVector centre(it->position().x(), it->position().y(), it->position().z());
269 float E = it->energy();
280 for (std::vector<reco::PFRecTrack>::const_iterator it = tracks->begin(); it != tracks->end(); ++it)
307 if (!cluster)
return;
309 Color_t
col = kViolet+9;
311 TEveStraightLineSet*
ls =
new TEveStraightLineSet(
"cluster_ls");
312 ls->SetMainColor(col);
315 TEvePointSet* ps =
new TEvePointSet(
"cluster_ps");
316 ps->SetMainColor(col);
317 ps->SetMarkerStyle(2);
318 ps->SetMarkerSize(0.005);
321 for (std::vector<reco::PFCluster>::const_iterator it = cluster->begin(); it != cluster->end(); ++it)
323 if (!
isPntInRng(it->position().Eta(), it->position().Phi()))
326 ps->SetNextPoint(it->position().Eta(), it->position().Phi(), 0);
341 void WrapTwoPi(std::vector<TEveVector>&
hc,
float y)
348 if (hc[0].fY > 0 && hc[1].fY > 0 && hc[2].fY > 0 && hc[3].fY > 0 )
350 if (hc[0].fY < 0 && hc[1].fY < 0 && hc[2].fY < 0 && hc[3].fY < 0 )
354 for (
int i = 0;
i < 4; ++
i)
355 if (y > 0 && hc[
i].fY < 0)
357 else if (y < 0 && hc[
i].fY > 0)
365 TEveStraightLineSet::Line_t* AddLineToLineSet(TEveStraightLineSet*
ls,
const std::vector< TEveVector >& pnts,
int i0,
int i1)
368 printf(
"add line \n");
372 return ls->AddLine(pnts[i0], pnts[i1]);
379 TEveStraightLineSet* lsOutline = ( TEveStraightLineSet*)
m_eventList->FindChild(
"outlines");
381 TEvePointSet* ps =
new TEvePointSet(
"test");
383 ps->SetMainColor(kOrange);
386 if ( (!hits->empty()) && hits->front().hasCaloCell())
387 for (std::vector<reco::PFRecHit>::const_iterator it = hits->begin(); it != hits->end(); ++it)
389 const auto & corners = it->getCornersXYZ();
393 std::vector<TEveVector>
hc;
394 for (
int k = 0;
k < 4; ++
k) {
395 hc.push_back(TEveVector(corners[
k].
eta(), corners[
k].
phi(), 0));
399 WrapTwoPi(hc, corners[0].
phi());
401 AddLineToLineSet(lsOutline, hc, 0, 1);
402 AddLineToLineSet(lsOutline, hc, 1, 2);
403 AddLineToLineSet(lsOutline, hc, 2, 3);
404 AddLineToLineSet(lsOutline, hc, 3, 0);
408 TEveVector centerOfGravity = hc[0] + hc[1] + hc[2] + hc[3];
409 centerOfGravity *= 0.25;
411 std::vector<TEveVector> radialVectors;
412 for (
int k = 0;
k < 4; ++
k)
413 radialVectors.push_back(TEveVector(hc[
k] - centerOfGravity));
424 std::vector<TEveVector> scaledCorners;
425 for (
int k = 0;
k < 4; ++
k) {
426 radialVectors[
k] *= factor;
427 scaledCorners.push_back(TEveVector(radialVectors[
k] + centerOfGravity));
430 TEveStraightLineSet*
ls = ( TEveStraightLineSet*)
m_eventList->FindChild(Form(
"%d_rechit", it->depth() ));
431 AddLineToLineSet(ls, scaledCorners, 0, 1);
432 AddLineToLineSet(ls, scaledCorners, 1, 2);
433 AddLineToLineSet(ls, scaledCorners, 2, 3);
435 TEveStraightLineSet::Line_t* li = AddLineToLineSet(ls, scaledCorners, 3, 0);
436 ls->AddMarker(centerOfGravity, li->fId);
452 TEveStraightLineSet*
ls =
new TEveStraightLineSet(Form(
"%d_rechit",
depth));
454 if (
depth == 0 ) ls->SetLineColor(kGray);
455 else if (
depth == 1 ) ls->SetLineColor(kRed);
456 else if (
depth == 2 ) ls->SetLineColor(kGreen);
457 else if (
depth == 3 ) ls->SetLineColor(kMagenta);
458 else if (
depth == 4 ) ls->SetLineColor(kOrange);
459 else if (
depth == 5 ) ls->SetLineColor(kYellow);
461 ls->SetMarkerStyle(1);
465 TEveStraightLineSet*
ls =
new TEveStraightLineSet(
"outlines");
466 ls->SetLineColor(kGray);
467 ls->SetMainTransparency(80);
479 event->getByLabel(
edm::InputTag(
"particleFlowRecHitECAL"), ecalH);
489 event->getByLabel(
edm::InputTag(
"particleFlowRecHitHF"), ecalH);
499 event->getByLabel(
edm::InputTag(
"particleFlowRecHitHBHEHO"),hcalH);
514 event->getByLabel(
edm::InputTag(
"particleFlowClusterECAL"), ecalClustersH);
const std::string & getName() const
virtual double pt() const final
transverse momentum
bool isPntInRng(float x, float y)
TGLViewer * viewerGL() const
FWIntValueListener * m_sliderListener
virtual double eta() const final
momentum pseudorapidity
void voteMaxEtAndEnergy(float Et, float energy) const
const FWEventItem * item()
sigc::signal< void > activated
char const * what() const override
TEveElementList * m_eventList
virtual double phi() const final
momentum azimuthal angle
virtual int charge() const final
electric charge
void build(const FWModelId &id, const reco::PFCandidate *)
const fireworks::Context & context() const
const fireworks::Context & context() const
sigc::signal< void, Int_t > valueChanged_
TGCompositeFrame * m_guiFrame
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
T const * product() const
static FWGUIManager * getGUIManager()
const reco::PFCandidate * m_candidate
void addHits(const std::vector< reco::PFRecHit > *)
#define REGISTER_FWDETAILVIEW(_classname_, _name_,...)
virtual ~FWPFCandidateDetailView()
Particle reconstructed by the particle flow algorithm.
void addClusters(const std::vector< reco::PFCluster > *)
FWPFCandidateDetailView()
void setTextInfo(const FWModelId &id, const reco::PFCandidate *)
void addTracks(const std::vector< reco::PFRecTrack > *)