2 #include "TGLFontManager.h" 4 #include "TEveManager.h" 5 #include "TEveStraightLineSet.h" 7 #include "TEveTrackPropagator.h" 10 #include "TEveGeoShape.h" 14 #include "TGLViewer.h" 42 m_moduleLabels(nullptr),
52 TGCompositeFrame*
f =
new TGVerticalFrame(
m_guiFrame);
54 f->AddFrame(
new TGLabel(
f,
"Module Transparency:"),
new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
55 m_slider =
new TGHSlider(
f, 120, kSlider1 | kScaleNo);
56 f->AddFrame(
m_slider,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 1, 4));
69 TGCheckButton*
b =
new TGCheckButton(
m_guiFrame,
"Show Module Labels");
70 b->SetState(kButtonUp,
false);
71 m_guiFrame->AddFrame(
b,
new TGLayoutHints(kLHintsNormal, 2, 3, 1, 4));
72 TQObject::Connect(
b,
"Clicked()",
"CSGAction",
action,
"activate()");
77 action->createTextButton(
m_guiFrame,
new TGLayoutHints(kLHintsNormal, 2, 0, 1, 4));
78 action->setToolTip(
"Click on object in viewer to set camera center.");
83 TGCompositeFrame*
p = (TGCompositeFrame*)
m_guiFrame->GetParent();
87 m_modules =
new TEveElementList(
"Modules");
91 m_hits =
new TEveElementList(
"Hits");
93 if (
track->extra().isAvailable()) {
98 TEveGeoShape*
gs =
dynamic_cast<TEveGeoShape*
>(*i);
99 const auto& rhs = *(*(
i));
100 if (
gs ==
nullptr && (*
i !=
nullptr)) {
101 std::cerr <<
"Got a " <<
typeid(rhs).
name() <<
", expecting TEveGeoShape. ignoring (it must be the clusters)." 105 gs->SetMainTransparency(75);
106 gs->SetPickable(kFALSE);
108 TString
name =
gs->GetElementTitle();
109 if (!
name.Contains(
"BAD") && !
name.Contains(
"INACTIVE") && !
name.Contains(
"LOST")) {
110 gs->SetMainColor(kBlue);
112 TEveText*
text =
new TEveText(
name.Data());
113 text->PtrMainTrans()->SetFrom(
gs->RefMainTrans().Array());
114 text->SetFontMode(TGLFont::kPixmap);
115 text->SetFontSize(12);
120 TEveTrackPropagator* prop =
new TEveTrackPropagator();
122 prop->SetStepper(TEveTrackPropagator::kRungeKutta);
128 trk->SetLineWidth(2);
129 trk->SetTitle(
"Track and its ref states");
130 prop->SetRnrDaughters(kTRUE);
131 prop->SetRnrReferences(kTRUE);
132 prop->SetRnrDecay(kTRUE);
133 prop->SetRnrFV(kTRUE);
134 trk->SetMainColor(
id.
item()->defaultDisplayProperties().color());
137 viewerGL()->SetStyle(TGLRnrCtx::kOutline);
138 viewerGL()->SetDrawCameraCenter(kTRUE);
139 viewerGL()->ResetCamerasAfterNextUpdate();
153 Color_t
x =
viewerGL()->GetRnrCtx()->ColorSet().Foreground().GetColorIndex();
155 (*i)->SetMainColor(
x);
163 (*i)->SetMainTransparency(
x);
174 TLatex* latex =
new TLatex(
x,
y,
"");
175 const double textsize(0.07);
176 latex->SetTextSize(2 * textsize);
179 y -= latex->GetTextSize() * 0.6;
181 latex->SetTextSize(textsize);
182 float lineH = latex->GetTextSize() * 0.6;
185 x,
y, Form(
" P_{T} = %.1f GeV, #eta = %0.2f, #varphi = %0.2f",
track->pt(),
track->eta(),
track->phi()));
188 if (
track->charge() > 0)
189 latex->DrawLatex(
x,
y,
" charge = +1");
191 latex->DrawLatex(
x,
y,
" charge = -1");
195 latex->DrawLatex(
x,
y,
"Track modules:");
201 Double_t boxH = 0.25 * textsize;
206 latex->DrawLatex(
x + 0.25,
y,
"Module");
212 latex->DrawLatex(
x + 0.25,
y,
"LOST Module");
218 latex->DrawLatex(
x + 0.25,
y,
"INACTIVE Module");
224 latex->DrawLatex(
x + 0.25,
y,
"BAD Module");
232 latex->DrawLatex(
x + 3 *
r2,
y,
"Pixel Hits");
237 latex->DrawLatex(
x + 3 *
r2,
y,
"Extra Pixel Hits");
246 m_legend =
new TLegend(0.01, 0.01, 0.99, 0.99,
nullptr,
"NDC");
253 TEveStraightLineSet*
legend =
new TEveStraightLineSet(
"siStripCluster");
255 legend->SetLineColor(kGreen);
258 TEveStraightLineSet* legend2 =
new TEveStraightLineSet(
"siStripCluster2");
259 legend2->SetLineWidth(3);
260 legend2->SetLineColor(kRed);
261 m_legend->AddEntry(legend2,
"Extra SiStripCluster",
"l");
263 TEveStraightLineSet* legend3 =
new TEveStraightLineSet(
"refStates");
264 legend3->SetDepthTest(kFALSE);
265 legend3->SetMarkerColor(kYellow);
266 legend3->SetMarkerStyle(
kPlus);
267 legend3->SetMarkerSize(2);
268 m_legend->AddEntry(legend3,
"Inner/Outermost States",
"p");
270 TEveStraightLineSet* legend4 =
new TEveStraightLineSet(
"vertex");
271 legend4->SetDepthTest(kFALSE);
272 legend4->SetMarkerColor(kRed);
273 legend4->SetMarkerStyle(kFullDotLarge);
274 legend4->SetMarkerSize(2);
275 m_legend->AddEntry(legend4,
"Vertex",
"p");
277 TEveStraightLineSet* legend5 =
new TEveStraightLineSet(
"cameraCenter");
278 legend5->SetDepthTest(kFALSE);
279 legend5->SetMarkerColor(kCyan);
280 legend5->SetMarkerStyle(kFullDotLarge);
281 legend5->SetMarkerSize(2);
282 m_legend->AddEntry(legend5,
"Camera center",
"p");
286 class TEveElementList* tList,
292 TEvePointSet* pointSet =
new TEvePointSet();
293 pointSet->SetMarkerSize(
size);
294 pointSet->SetMarkerStyle(4);
295 pointSet->SetPickable(kTRUE);
296 pointSet->SetTitle(
"Pixel Hits");
297 pointSet->SetMarkerColor(color);
299 for (std::vector<TVector3>::const_iterator
it = points.begin(), itEnd = points.end();
it != itEnd; ++
it) {
300 pointSet->SetNextPoint(
it->x(),
it->y(),
it->z());
302 tList->AddElement(pointSet);
307 TEveElement* trkList,
308 bool addNearbyHits) {
309 std::vector<TVector3> pixelPoints;
311 TEveElementList*
pixels =
new TEveElementList(
"Pixels");
312 trkList->AddElement(
pixels);
315 std::vector<TVector3> pixelExtraPoints;
327 TEveElementList*
strips =
new TEveElementList(
"Strips");
328 trkList->AddElement(
strips);
336 TEveElement* trkList,
338 std::set<unsigned int> ids;
342 if (!addLostHits && !(*recIt)->isValid())
344 if (
detid.rawId() != 0) {
346 switch (
detid.det()) {
352 switch (
detid.subdetId()) {
380 if (
nullptr !=
shape) {
381 shape->SetMainTransparency(65);
382 shape->SetPickable(kTRUE);
383 switch ((*recIt)->type()) {
391 shape->SetMainColor(kRed);
397 shape->SetMainColor(28);
401 shape->SetMainColor(218);
405 trkList->AddElement(
shape);
void setTextInfo(const FWModelId &id, const reco::Track *) override
TEveElementList * m_modules
TEveTrack * prepareTrack(const reco::Track &track, TEveTrackPropagator *propagator, const std::vector< TEveVector > &extraRefPoints=std::vector< TEveVector >())
sigc::signal< void(Int_t)> valueChanged_
std::string print(DetId detid) const
const FWEventItem * item()
const fireworks::Context & context() const
void addHits(const reco::Track &track, const FWEventItem *iItem, TEveElement *trkList, bool addNearbyHits)
void setBackgroundColor(Color_t) override
void addTrackerHits3D(std::vector< TVector3 > &points, class TEveElementList *tList, Color_t color, int size)
#define REGISTER_FWDETAILVIEW(_classname_, _name_,...)
U second(std::pair< T, U > const &p)
const TrackerTopology * getTrackerTopology() const
const FWDisplayProperties & defaultDisplayProperties() const
static void drawCanvasDot(Float_t x, Float_t y, Float_t r, Color_t)
TGCompositeFrame * m_guiFrame
constexpr unsigned getField(const uint32_t u, const unsigned mask, const unsigned offset)
void pushPixelHits(std::vector< TVector3 > &pixelPoints, const FWEventItem &iItem, const reco::Track &t)
~FWTrackHitsDetailView() override
void addSiStripClusters(const FWEventItem *iItem, const reco::Track &t, class TEveElement *tList, bool addNearbyClusters, bool master)
void build(const FWModelId &id, const reco::Track *) override
TEveGeoShape * getEveShape(unsigned int id) const
const FWGeometry * getGeom() const
TGLViewer * viewerGL() const
TEveElementList * m_moduleLabels
void addModules(const reco::Track &track, const FWEventItem *iItem, TEveElement *trkList, bool addLostHits)
std::string info(const DetId &)
static Bool_t setColorSetViewer(TGLViewer *, Color_t)
FWIntValueListener * m_sliderListener
void transparencyChanged(int)
strips
#turn off noise in all subdetectors simHcalUnsuppressedDigis.doNoise = False mix.digitizers.hcal.doNoise = False simEcalUnsuppressedDigis.doNoise = False mix.digitizers.ecal.doNoise = False simEcalUnsuppressedDigis.doESNoise = False simSiPixelDigis.AddNoise = False mix.digitizers.pixel.AddNoise = False simSiStripDigis.Noise = False mix.digitizers.strip.AddNoise = False
void pushNearbyPixelHits(std::vector< TVector3 > &pixelPoints, const FWEventItem &iItem, const reco::Track &t)
static void drawCanvasBox(Double_t *pos, Color_t fillCol, Int_t fillType=0, bool bg=kTRUE)