2 #include "TGLFontManager.h" 4 #include "TEveManager.h" 5 #include "TEveStraightLineSet.h" 7 #include "TEveTrackPropagator.h" 10 #include "TEveGeoShape.h" 14 #include "TGLViewer.h" 39 #include "boost/bind.hpp" 58 TGCompositeFrame*
f =
new TGVerticalFrame(
m_guiFrame);
60 f->AddFrame(
new TGLabel(f,
"Module Transparency:"),
new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
61 m_slider =
new TGHSlider(f, 120, kSlider1 | kScaleNo);
62 f->AddFrame(
m_slider,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 1, 4));
67 TQObject::Connect(
m_slider,
"PositionChanged(Int_t)",
"FWIntValueListenerBase",
m_sliderListener,
"setValue(Int_t)");
73 TGCheckButton*
b =
new TGCheckButton(
m_guiFrame,
"Show Module Labels" );
74 b->SetState(kButtonUp,
false);
75 m_guiFrame->AddFrame(b,
new TGLayoutHints( kLHintsNormal, 2, 3, 1, 4));
76 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
82 action->
setToolTip(
"Click on object in viewer to set camera center.");
87 TGCompositeFrame*
p = (TGCompositeFrame*)
m_guiFrame->GetParent();
91 m_modules =
new TEveElementList(
"Modules" );
95 m_hits =
new TEveElementList(
"Hits" );
104 TEveGeoShape*
gs =
dynamic_cast<TEveGeoShape*
>(*i);
105 const auto & rhs = *(*(
i));
106 if (gs ==
nullptr && (*
i !=
nullptr)) {
107 std::cerr <<
"Got a " <<
typeid(rhs).
name() <<
", expecting TEveGeoShape. ignoring (it must be the clusters)." << std::endl;
110 gs->SetMainTransparency(75);
111 gs->SetPickable(kFALSE);
113 TString
name = gs->GetElementTitle();
114 if (!name.Contains(
"BAD") && !name.Contains(
"INACTIVE") && !name.Contains(
"LOST")) {
115 gs->SetMainColor(kBlue);
117 TEveText*
text =
new TEveText(name.Data());
118 text->PtrMainTrans()->SetFrom(gs->RefMainTrans().Array());
119 text->SetFontMode(TGLFont::kPixmap);
120 text->SetFontSize(12);
125 TEveTrackPropagator* prop =
new TEveTrackPropagator();
127 prop->SetStepper(TEveTrackPropagator::kRungeKutta);
133 trk->SetLineWidth(2);
134 trk->SetTitle(
"Track and its ref states" );
135 prop->SetRnrDaughters(kTRUE);
136 prop->SetRnrReferences(kTRUE);
137 prop->SetRnrDecay(kTRUE);
138 prop->SetRnrFV(kTRUE);
139 trk->SetMainColor(
id.
item()->defaultDisplayProperties().
color());
142 viewerGL()->SetStyle(TGLRnrCtx::kOutline);
143 viewerGL()->SetDrawCameraCenter(kTRUE);
144 viewerGL()->ResetCamerasAfterNextUpdate();
161 Color_t
x =
viewerGL()->GetRnrCtx()->ColorSet().Foreground().GetColorIndex();
163 (*i)->SetMainColor(x);
178 (*i)->SetMainTransparency(x);
191 TLatex* latex =
new TLatex( x, y,
"" );
192 const double textsize( 0.07 );
193 latex->SetTextSize( 2*textsize );
196 y -= latex->GetTextSize()*0.6;
198 latex->SetTextSize( textsize );
199 float lineH = latex->GetTextSize()*0.6;
201 latex->DrawLatex( x, y, Form(
" P_{T} = %.1f GeV, #eta = %0.2f, #varphi = %0.2f",
202 track->
pt(), track->
eta(), track->
phi()));
206 latex->DrawLatex( x, y,
" charge = +1" );
208 latex->DrawLatex( x, y,
" charge = -1" );
212 latex->DrawLatex( x, y,
"Track modules:");
218 Double_t boxH = 0.25*textsize;
220 pos[1] =
y; pos[3] = pos[1] + boxH;
222 latex->DrawLatex( x + 0.25, y,
"Module" );
225 pos[1] =
y; pos[3] = pos[1] + boxH;
227 latex->DrawLatex( x + 0.25, y,
"LOST Module" );
230 pos[1] =
y; pos[3] = pos[1] + boxH;
232 latex->DrawLatex( x + 0.25, y,
"INACTIVE Module" );
235 pos[1] =
y; pos[3] = pos[1] + boxH;
237 latex->DrawLatex( x + 0.25, y,
"BAD Module" );
245 latex->DrawLatex( x + 3 * r2, y,
"Pixel Hits" );
250 latex->DrawLatex( x + 3 * r2, y,
"Extra Pixel Hits" );
261 m_legend =
new TLegend( 0.01, 0.01, 0.99, 0.99,
nullptr,
"NDC" );
266 m_legend->SetEntrySeparation( 0.01 );
268 TEveStraightLineSet *
legend =
new TEveStraightLineSet(
"siStripCluster" );
269 legend->SetLineWidth( 3 );
270 legend->SetLineColor( kGreen );
271 m_legend->AddEntry( legend,
"Exact SiStripCluster",
"l");
273 TEveStraightLineSet *legend2 =
new TEveStraightLineSet(
"siStripCluster2" );
274 legend2->SetLineWidth( 3 );
275 legend2->SetLineColor( kRed );
276 m_legend->AddEntry( legend2,
"Extra SiStripCluster",
"l");
278 TEveStraightLineSet *legend3 =
new TEveStraightLineSet(
"refStates" );
279 legend3->SetDepthTest( kFALSE );
280 legend3->SetMarkerColor( kYellow );
281 legend3->SetMarkerStyle(
kPlus );
282 legend3->SetMarkerSize( 2 );
283 m_legend->AddEntry( legend3,
"Inner/Outermost States",
"p");
285 TEveStraightLineSet *legend4 =
new TEveStraightLineSet(
"vertex" );
286 legend4->SetDepthTest( kFALSE );
287 legend4->SetMarkerColor( kRed );
288 legend4->SetMarkerStyle( kFullDotLarge );
289 legend4->SetMarkerSize( 2 );
290 m_legend->AddEntry( legend4,
"Vertex",
"p");
292 TEveStraightLineSet *legend5 =
new TEveStraightLineSet(
"cameraCenter" );
293 legend5->SetDepthTest( kFALSE );
294 legend5->SetMarkerColor( kCyan );
295 legend5->SetMarkerStyle( kFullDotLarge );
296 legend5->SetMarkerSize( 2 );
297 m_legend->AddEntry( legend5,
"Camera center",
"p");
306 TEvePointSet* pointSet =
new TEvePointSet();
307 pointSet->SetMarkerSize(size);
308 pointSet->SetMarkerStyle(4);
309 pointSet->SetPickable(kTRUE);
310 pointSet->SetTitle(
"Pixel Hits");
311 pointSet->SetMarkerColor(color);
313 for( std::vector<TVector3>::const_iterator it = points.begin(), itEnd = points.end(); it != itEnd; ++it) {
314 pointSet->SetNextPoint(it->x(), it->y(), it->z());
316 tList->AddElement(pointSet);
322 TEveElement* trkList,
325 std::vector<TVector3> pixelPoints;
327 TEveElementList* pixels =
new TEveElementList(
"Pixels" );
328 trkList->AddElement( pixels );
332 std::vector<TVector3> pixelExtraPoints;
346 TEveElementList*
strips =
new TEveElementList(
"Strips" );
347 trkList->AddElement( strips );
356 TEveElement* trkList,
359 std::set<unsigned int> ids;
361 recIt != recItEnd; ++recIt )
363 DetId detid = (*recIt)->geographicalId();
364 if( !addLostHits && !(*recIt)->isValid())
continue;
365 if( detid.
rawId() != 0 )
400 if( ! ids.insert( detid.
rawId()).
second )
continue;
404 if(
nullptr != shape )
406 shape->SetMainTransparency( 65 );
407 shape->SetPickable( kTRUE );
408 switch(( *recIt )->type())
417 shape->SetMainColor( kRed );
423 shape->SetMainColor( 28 );
427 shape->SetMainColor( 218 );
430 shape->SetTitle( name + ULong_t( detid.
rawId()));
431 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)
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
double pt() const
track transverse momentum
static void drawCanvasDot(Float_t x, Float_t y, Float_t r, Color_t)
sigc::signal< void, Int_t > valueChanged_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
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)
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)
#define REGISTER_FWDETAILVIEW(_classname_, _name_,...)
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)
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.