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" 67 float sd = TMath::Sqrt(
dx *
dx +
dy *
dy);
74 m_legend =
new TLegend(0.01, 0.01, 0.99, 0.99,
nullptr,
"NDC");
85 static float kSliderRangeFactor = 0.2;
103 TLatex* latex =
new TLatex(
x,
y,
"");
104 const double textsize(0.07);
105 latex->SetTextSize(textsize);
108 y -= latex->GetTextSize() * 0.6;
110 latex->SetTextSize(textsize);
111 float lineH = latex->GetTextSize() * 0.6;
114 x,
y, Form(
" P_{T} = %.1f GeV, #eta = %0.2f, #varphi = %0.2f",
track->pt(),
track->eta(),
track->phi()));
117 if (
track->charge() > 0)
118 latex->DrawLatex(
x,
y,
" charge = +1");
120 latex->DrawLatex(
x,
y,
" charge = -1");
149 TGCompositeFrame*
f =
new TGVerticalFrame(
m_guiFrame);
151 f->AddFrame(
new TGLabel(
f,
"Rng:"),
new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
152 m_slider =
new TGHSlider(
f, 120, kSlider1 | kScaleNo);
153 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) {
293 ps->SetNextPoint(
it->position().Eta(),
it->position().Phi(), 0);
307 void WrapTwoPi(std::vector<TEveVector>& hc,
float y) {
308 if (TMath::Abs(hc[0].fY) < 2)
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;
354 for (
int k = 0;
k < 4; ++
k) {
355 hc.push_back(TEveVector(corners[
k].
eta(), corners[
k].
phi(), 0));
359 WrapTwoPi(hc, corners[0].
phi());
361 AddLineToLineSet(lsOutline, hc, 0, 1);
362 AddLineToLineSet(lsOutline, hc, 1, 2);
363 AddLineToLineSet(lsOutline, hc, 2, 3);
364 AddLineToLineSet(lsOutline, hc, 3, 0);
367 TEveVector centerOfGravity = hc[0] + hc[1] + hc[2] + hc[3];
368 centerOfGravity *= 0.25;
370 std::vector<TEveVector> radialVectors;
371 radialVectors.reserve(4);
372 for (
int k = 0;
k < 4; ++
k)
373 radialVectors.push_back(TEveVector(hc[
k] - centerOfGravity));
382 std::vector<TEveVector> scaledCorners;
383 for (
int k = 0;
k < 4; ++
k) {
385 scaledCorners.push_back(TEveVector(radialVectors[
k] + centerOfGravity));
388 TEveStraightLineSet*
ls = (TEveStraightLineSet*)
m_eventList->FindChild(Form(
"%d_rechit",
it->depth()));
389 AddLineToLineSet(
ls, scaledCorners, 0, 1);
390 AddLineToLineSet(
ls, scaledCorners, 1, 2);
391 AddLineToLineSet(
ls, scaledCorners, 2, 3);
393 TEveStraightLineSet::Line_t* li = AddLineToLineSet(
ls, scaledCorners, 3, 0);
394 ls->AddMarker(centerOfGravity, li->fId);
405 TEveStraightLineSet*
ls =
new TEveStraightLineSet(Form(
"%d_rechit",
depth));
408 ls->SetLineColor(kGray);
410 ls->SetLineColor(kRed);
412 ls->SetLineColor(kGreen);
414 ls->SetLineColor(kMagenta);
416 ls->SetLineColor(kOrange);
418 ls->SetLineColor(kYellow);
420 ls->SetMarkerStyle(1);
424 TEveStraightLineSet*
ls =
new TEveStraightLineSet(
"outlines");
425 ls->SetLineColor(kGray);
426 ls->SetMainTransparency(80);
436 event->getByLabel(
edm::InputTag(
"particleFlowRecHitECAL"), ecalH);
445 event->getByLabel(
edm::InputTag(
"particleFlowRecHitHF"), ecalH);
453 event->getByLabel(
edm::InputTag(
"particleFlowRecHitHBHEHO"), hcalH);
465 event->getByLabel(
edm::InputTag(
"particleFlowClusterECAL"), ecalClustersH);
bool isPntInRng(float x, float y)
FWIntValueListener * m_sliderListener
sigc::signal< void(Int_t)> valueChanged_
const FWEventItem * item()
T const * product() const
float getMaxEnergyInEvent(bool isEt) const
void setTextInfo(const FWModelId &id, const reco::PFCandidate *) override
const fireworks::Context & context() const
TEveElementList * m_eventList
#define REGISTER_FWDETAILVIEW(_classname_, _name_,...)
__host__ __device__ VT * co
const fireworks::Context & context() const
const edm::EventBase * getCurrentEvent() const
void voteMaxEtAndEnergy(float Et, float energy) const
TGCompositeFrame * m_guiFrame
float calculateEt(const TEveVector ¢re, float e)
void voteMaxEtEVal(const std::vector< reco::PFRecHit > *hits)
~FWPFCandidateDetailView() override
TGLViewer * viewerGL() 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 > *)
char const * what() const noexcept override
void build(const FWModelId &id, const reco::PFCandidate *) override
double phi() const final
momentum azimuthal angle
FWPFCandidateDetailView()
void addTracks(const std::vector< reco::PFRecTrack > *)
double eta() const final
momentum pseudorapidity