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" 68 float sd = TMath::Sqrt(dx * dx + dy * dy);
75 m_legend =
new TLegend(0.01, 0.01, 0.99, 0.99,
nullptr,
"NDC");
86 static float kSliderRangeFactor = 0.2;
88 m_range = x * kSliderRangeFactor;
104 TLatex* latex =
new TLatex(x, y,
"");
105 const double textsize(0.07);
106 latex->SetTextSize(textsize);
109 y -= latex->GetTextSize() * 0.6;
111 latex->SetTextSize(textsize);
112 float lineH = latex->GetTextSize() * 0.6;
115 x, y, Form(
" P_{T} = %.1f GeV, #eta = %0.2f, #varphi = %0.2f", track->
pt(), track->
eta(), track->
phi()));
119 latex->DrawLatex(x, y,
" charge = +1");
121 latex->DrawLatex(x, y,
" charge = -1");
150 TGCompositeFrame*
f =
new TGVerticalFrame(
m_guiFrame);
152 f->AddFrame(
new TGLabel(f,
"Rng:"),
new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
153 m_slider =
new TGHSlider(f, 120, kSlider1 | kScaleNo);
154 f->AddFrame(
m_slider,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 1, 4));
165 b->SetState(kButtonDown,
true);
166 m_guiFrame->AddFrame(b,
new TGLayoutHints(kLHintsNormal, 2, 3, 1, 4));
167 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
173 b->SetState(kButtonDown,
true);
174 m_guiFrame->AddFrame(b,
new TGLayoutHints(kLHintsNormal, 2, 3, 1, 4));
175 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
182 TGCompositeFrame*
p = (TGCompositeFrame*)
m_guiFrame->GetParent();
194 event->getByLabel(
edm::InputTag(
"particleFlowRecHitECAL"), ecalH);
199 event->getByLabel(
edm::InputTag(
"particleFlowRecHitHBHEHO"), hcalH);
206 m_eveScene->GetGLScene()->SetSelectable(
false);
210 viewerGL()->SetStyle(TGLRnrCtx::kOutline);
211 viewerGL()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
213 TGLCameraOverlay* co =
viewerGL()->GetCameraOverlay();
214 co->SetShowOrthographic(kTRUE);
215 co->SetOrthographicMode(TGLCameraOverlay::kAxis);
217 viewerGL()->ResetCamerasAfterNextUpdate();
221 printf(
"unknown exception \n");
238 if ((!hits->empty()) && hits->front().hasCaloCell())
239 for (std::vector<reco::PFRecHit>::const_iterator it = hits->begin(); it != hits->end(); ++it) {
240 TEveVector centre(it->position().x(), it->position().y(), it->position().z());
241 float E = it->energy();
250 for (std::vector<reco::PFRecTrack>::const_iterator it = tracks->begin(); it != tracks->end(); ++it) {
277 Color_t
col = kViolet + 9;
279 TEveStraightLineSet*
ls =
new TEveStraightLineSet(
"cluster_ls");
280 ls->SetMainColor(col);
283 TEvePointSet* ps =
new TEvePointSet(
"cluster_ps");
284 ps->SetMainColor(col);
285 ps->SetMarkerStyle(2);
286 ps->SetMarkerSize(0.005);
289 for (std::vector<reco::PFCluster>::const_iterator it = cluster->begin(); it != cluster->end(); ++it) {
290 if (!
isPntInRng(it->position().Eta(), it->position().Phi()))
293 ps->SetNextPoint(it->position().Eta(), it->position().Phi(), 0);
307 void WrapTwoPi(std::vector<TEveVector>&
hc,
float y) {
311 if (hc[0].fY > 0 && hc[1].fY > 0 && hc[2].fY > 0 && hc[3].fY > 0)
313 if (hc[0].fY < 0 && hc[1].fY < 0 && hc[2].fY < 0 && hc[3].fY < 0)
316 for (
int i = 0;
i < 4; ++
i)
317 if (y > 0 && hc[
i].fY < 0)
319 else if (y < 0 && hc[
i].fY > 0)
325 TEveStraightLineSet::Line_t* AddLineToLineSet(TEveStraightLineSet*
ls,
326 const std::vector<TEveVector>& pnts,
330 printf(
"add line \n");
334 return ls->AddLine(pnts[i0], pnts[i1]);
339 TEveStraightLineSet* lsOutline = (TEveStraightLineSet*)
m_eventList->FindChild(
"outlines");
341 TEvePointSet* ps =
new TEvePointSet(
"test");
343 ps->SetMainColor(kOrange);
346 if ((!hits->empty()) && hits->front().hasCaloCell())
347 for (std::vector<reco::PFRecHit>::const_iterator it = hits->begin(); it != hits->end(); ++it) {
348 const auto& corners = it->getCornersXYZ();
352 std::vector<TEveVector>
hc;
353 for (
int k = 0;
k < 4; ++
k) {
354 hc.push_back(TEveVector(corners[
k].
eta(), corners[
k].
phi(), 0));
358 WrapTwoPi(hc, corners[0].
phi());
360 AddLineToLineSet(lsOutline, hc, 0, 1);
361 AddLineToLineSet(lsOutline, hc, 1, 2);
362 AddLineToLineSet(lsOutline, hc, 2, 3);
363 AddLineToLineSet(lsOutline, hc, 3, 0);
366 TEveVector centerOfGravity = hc[0] + hc[1] + hc[2] + hc[3];
367 centerOfGravity *= 0.25;
369 std::vector<TEveVector> radialVectors;
370 for (
int k = 0;
k < 4; ++
k)
371 radialVectors.push_back(TEveVector(hc[
k] - centerOfGravity));
380 std::vector<TEveVector> scaledCorners;
381 for (
int k = 0;
k < 4; ++
k) {
383 scaledCorners.push_back(TEveVector(radialVectors[
k] + centerOfGravity));
386 TEveStraightLineSet*
ls = (TEveStraightLineSet*)
m_eventList->FindChild(Form(
"%d_rechit", it->depth()));
387 AddLineToLineSet(ls, scaledCorners, 0, 1);
388 AddLineToLineSet(ls, scaledCorners, 1, 2);
389 AddLineToLineSet(ls, scaledCorners, 2, 3);
391 TEveStraightLineSet::Line_t* li = AddLineToLineSet(ls, scaledCorners, 3, 0);
392 ls->AddMarker(centerOfGravity, li->fId);
403 TEveStraightLineSet*
ls =
new TEveStraightLineSet(Form(
"%d_rechit",
depth));
406 ls->SetLineColor(kGray);
408 ls->SetLineColor(kRed);
410 ls->SetLineColor(kGreen);
412 ls->SetLineColor(kMagenta);
414 ls->SetLineColor(kOrange);
416 ls->SetLineColor(kYellow);
418 ls->SetMarkerStyle(1);
422 TEveStraightLineSet*
ls =
new TEveStraightLineSet(
"outlines");
423 ls->SetLineColor(kGray);
424 ls->SetMainTransparency(80);
434 event->getByLabel(
edm::InputTag(
"particleFlowRecHitECAL"), ecalH);
443 event->getByLabel(
edm::InputTag(
"particleFlowRecHitHF"), ecalH);
451 event->getByLabel(
edm::InputTag(
"particleFlowRecHitHBHEHO"), hcalH);
463 event->getByLabel(
edm::InputTag(
"particleFlowClusterECAL"), ecalClustersH);
const std::string & getName() const
bool isPntInRng(float x, float y)
double eta() const final
momentum pseudorapidity
TGLViewer * viewerGL() const
FWIntValueListener * m_sliderListener
void voteMaxEtAndEnergy(float Et, float energy) const
const FWEventItem * item()
sigc::signal< void > activated
void setTextInfo(const FWModelId &id, const reco::PFCandidate *) override
double pt() const final
transverse momentum
int charge() const final
electric charge
char const * what() const override
TEveElementList * m_eventList
#define REGISTER_FWDETAILVIEW(_classname_, _name_,...)
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
~FWPFCandidateDetailView() override
T const * product() const
static FWGUIManager * getGUIManager()
const reco::PFCandidate * m_candidate
void addHits(const std::vector< reco::PFRecHit > *)
Particle reconstructed by the particle flow algorithm.
void addClusters(const std::vector< reco::PFCluster > *)
void build(const FWModelId &id, const reco::PFCandidate *) override
double phi() const final
momentum azimuthal angle
FWPFCandidateDetailView()
void addTracks(const std::vector< reco::PFRecTrack > *)