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(
"particleFlowRecHitHCAL"),hcalH);
227 event->getByLabel(
edm::InputTag(
"particleFlowRecHitHO"),hoH);
231 event->getByLabel(
edm::InputTag(
"particleFlowRecHitHF"),hfH);
240 m_eveScene->GetGLScene()->SetSelectable(
false);
245 viewerGL()->SetStyle(TGLRnrCtx::kOutline);
246 viewerGL()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
248 TGLCameraOverlay* co =
viewerGL()->GetCameraOverlay();
249 co->SetShowOrthographic(kTRUE);
250 co->SetOrthographicMode(TGLCameraOverlay::kAxis);
252 viewerGL()->ResetCamerasAfterNextUpdate();
257 printf(
"unknown exception \n");
274 for (std::vector<reco::PFRecHit>::const_iterator it = hits->begin(); it != hits->end(); ++it)
276 TEveVector centre(it->position().x(), it->position().y(), it->position().z());
277 float E = it->energy();
288 for (std::vector<reco::PFRecTrack>::const_iterator it = tracks->begin(); it != tracks->end(); ++it)
315 if (!cluster)
return;
317 Color_t
col = kViolet+9;
319 TEveStraightLineSet*
ls =
new TEveStraightLineSet(
"cluster_ls");
320 ls->SetMainColor(col);
323 TEvePointSet* ps =
new TEvePointSet(
"cluster_ps");
324 ps->SetMainColor(col);
325 ps->SetMarkerStyle(2);
326 ps->SetMarkerSize(0.005);
329 for (std::vector<reco::PFCluster>::const_iterator it = cluster->begin(); it != cluster->end(); ++it)
331 if (!
isPntInRng(it->position().Eta(), it->position().Phi()))
334 ps->SetNextPoint(it->position().Eta(), it->position().Phi(), 0);
349 void WrapTwoPi(std::vector<TEveVector>&
hc,
float y)
356 if (hc[0].fY > 0 && hc[1].fY > 0 && hc[2].fY > 0 && hc[3].fY > 0 )
358 if (hc[0].fY < 0 && hc[1].fY < 0 && hc[2].fY < 0 && hc[3].fY < 0 )
362 for (
int i = 0;
i < 4; ++
i)
363 if (y > 0 && hc[
i].fY < 0)
365 else if (y < 0 && hc[
i].fY > 0)
373 TEveStraightLineSet::Line_t* AddLineToLineSet(TEveStraightLineSet*
ls,
const std::vector< TEveVector >& pnts,
int i0,
int i1)
376 printf(
"add line \n");
380 return ls->AddLine(pnts[i0], pnts[i1]);
387 TEveStraightLineSet* lsOutline = ( TEveStraightLineSet*)
m_eventList->FindChild(
"outlines");
389 TEvePointSet* ps =
new TEvePointSet(
"test");
391 ps->SetMainColor(kOrange);
393 for (std::vector<reco::PFRecHit>::const_iterator it = hits->begin(); it != hits->end(); ++it)
395 const std::vector< math::XYZPoint >& corners = it->getCornersXYZ();
399 std::vector<TEveVector>
hc;
400 for (
int k = 0;
k < 4; ++
k) {
401 hc.push_back(TEveVector(corners[
k].
eta(), corners[
k].
phi(), 0));
405 WrapTwoPi(hc, corners[0].
phi());
407 AddLineToLineSet(lsOutline, hc, 0, 1);
408 AddLineToLineSet(lsOutline, hc, 1, 2);
409 AddLineToLineSet(lsOutline, hc, 2, 3);
410 AddLineToLineSet(lsOutline, hc, 3, 0);
414 TEveVector centerOfGravity = hc[0] + hc[1] + hc[2] + hc[3];
415 centerOfGravity *= 0.25;
417 std::vector<TEveVector> radialVectors;
418 for (
int k = 0;
k < 4; ++
k)
419 radialVectors.push_back(TEveVector(hc[
k] - centerOfGravity));
430 std::vector<TEveVector> scaledCorners;
431 for (
int k = 0;
k < 4; ++
k) {
432 radialVectors[
k] *= factor;
433 scaledCorners.push_back(TEveVector(radialVectors[
k] + centerOfGravity));
436 TEveStraightLineSet* ls = ( TEveStraightLineSet*)
m_eventList->FindChild(Form(
"%d_rechit", it->depth() ));
437 AddLineToLineSet(ls, scaledCorners, 0, 1);
438 AddLineToLineSet(ls, scaledCorners, 1, 2);
439 AddLineToLineSet(ls, scaledCorners, 2, 3);
441 TEveStraightLineSet::Line_t* li = AddLineToLineSet(ls, scaledCorners, 3, 0);
442 ls->AddMarker(centerOfGravity, li->fId);
458 TEveStraightLineSet* ls =
new TEveStraightLineSet(Form(
"%d_rechit",
depth));
460 if (
depth == 0 ) ls->SetLineColor(kGray);
461 else if (
depth == 1 ) ls->SetLineColor(kRed);
462 else if (
depth == 2 ) ls->SetLineColor(kGreen);
463 else if (
depth == 3 ) ls->SetLineColor(kMagenta);
464 else if (
depth == 4 ) ls->SetLineColor(kOrange);
465 else if (
depth == 5 ) ls->SetLineColor(kYellow);
467 ls->SetMarkerStyle(1);
471 TEveStraightLineSet* ls =
new TEveStraightLineSet(
"outlines");
472 ls->SetLineColor(kGray);
473 ls->SetMainTransparency(80);
485 event->getByLabel(
edm::InputTag(
"particleFlowRecHitECAL"), ecalH);
495 event->getByLabel(
edm::InputTag(
"particleFlowRecHitHF"), hfH);
505 event->getByLabel(
edm::InputTag(
"particleFlowRecHitHBHE"),hcalH);
514 event->getByLabel(
edm::InputTag(
"particleFlowRecHitHO"),hcalH);
529 event->getByLabel(
edm::InputTag(
"particleFlowClusterECAL"), ecalClustersH);
540 event->getByLabel(
edm::InputTag(
"particleFlowClusterHCAL"), hcalClustersH);
549 event->getByLabel(
edm::InputTag(
"particleFlowClusterHO"), hcalClustersH);
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
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 > *)