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()");
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");
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);
178 latex->DrawLatex(x, y,
id.
item()->modelName(
id.
index()).c_str());
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()));
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;
204 pos[3] = pos[1] + boxH;
206 latex->DrawLatex(x + 0.25, y,
"Module");
210 pos[3] = pos[1] + boxH;
212 latex->DrawLatex(x + 0.25, y,
"LOST Module");
216 pos[3] = pos[1] + boxH;
218 latex->DrawLatex(x + 0.25, y,
"INACTIVE Module");
222 pos[3] = pos[1] + boxH;
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");
254 legend->SetLineWidth(3);
255 legend->SetLineColor(kGreen);
256 m_legend->AddEntry(legend,
"Exact SiStripCluster",
"l");
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;
341 DetId detid = (*recIt)->geographicalId();
342 if (!addLostHits && !(*recIt)->isValid())
344 if (detid.
rawId() != 0) {
346 switch (detid.
det()) {
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);
404 shape->SetTitle(name + ULong_t(detid.
rawId()));
405 trkList->AddElement(shape);
void setTextInfo(const FWModelId &id, const reco::Track *) override
const FWDisplayProperties & defaultDisplayProperties() const
TEveElementList * m_modules
TGLViewer * viewerGL() const
const TrackExtraRef & extra() const
reference to "extra" object
TEveTrack * prepareTrack(const reco::Track &track, TEveTrackPropagator *propagator, const std::vector< TEveVector > &extraRefPoints=std::vector< TEveVector >())
const FWEventItem * item()
sigc::signal< void > activated
constexpr uint32_t rawId() const
get the raw id
void addHits(const reco::Track &track, const FWEventItem *iItem, TEveElement *trkList, bool addNearbyHits)
void setBackgroundColor(Color_t) override
double phi() const
azimuthal angle of momentum vector
void addTrackerHits3D(std::vector< TVector3 > &points, class TEveElementList *tList, Color_t color, int size)
#define REGISTER_FWDETAILVIEW(_classname_, _name_,...)
std::string print(DetId detid) const
U second(std::pair< T, U > const &p)
void createTextButton(TGCompositeFrame *p, TGLayoutHints *l=nullptr, Int_t id=-1, GContext_t norm=TGButton::GetDefaultGC()(), FontStruct_t font=TGTextButton::GetDefaultFontStruct(), UInt_t option=kRaisedFrame|kDoubleBorder)
const fireworks::Context & context() const
double eta() const
pseudorapidity of momentum vector
void setToolTip(const std::string &tip)
TEveGeoShape * getEveShape(unsigned int id) const
tuple 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
double pt() const
track transverse momentum
static void drawCanvasDot(Float_t x, Float_t y, Float_t r, Color_t)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
sigc::signal< void, Int_t > valueChanged_
TGCompositeFrame * m_guiFrame
uint16_t const *__restrict__ x
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)
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
~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
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)
int charge() const
track electric charge
const TrackerTopology * getTrackerTopology() const
void pushNearbyPixelHits(std::vector< TVector3 > &pixelPoints, const FWEventItem &iItem, const reco::Track &t)
tuple size
Write out results.
const FWGeometry * getGeom() const
static void drawCanvasBox(Double_t *pos, Color_t fillCol, Int_t fillType=0, bool bg=kTRUE)
constexpr Detector det() const
get the detector field from this detid
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.