2 #include "TGLFontManager.h" 4 #include "TEveManager.h" 5 #include "TEveStraightLineSet.h" 7 #include "TEveTrackPropagator.h" 10 #include "TEveGeoShape.h" 14 #include "TGLViewer.h" 41 #include "boost/bind.hpp" 60 TGCompositeFrame*
f =
new TGVerticalFrame(
m_guiFrame);
62 f->AddFrame(
new TGLabel(f,
"Module Transparency:"),
new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
63 m_slider =
new TGHSlider(f, 120, kSlider1 | kScaleNo);
64 f->AddFrame(
m_slider,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 1, 4));
69 TQObject::Connect(
m_slider,
"PositionChanged(Int_t)",
"FWIntValueListenerBase",
m_sliderListener,
"setValue(Int_t)");
75 TGCheckButton*
b =
new TGCheckButton(
m_guiFrame,
"Show Module Labels" );
76 b->SetState(kButtonUp,
false);
77 m_guiFrame->AddFrame(b,
new TGLayoutHints( kLHintsNormal, 2, 3, 1, 4));
78 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
84 action->
setToolTip(
"Click on object in viewer to set camera center.");
89 TGCompositeFrame*
p = (TGCompositeFrame*)
m_guiFrame->GetParent();
93 m_modules =
new TEveElementList(
"Modules" );
97 m_hits =
new TEveElementList(
"Hits" );
106 TEveGeoShape*
gs =
dynamic_cast<TEveGeoShape*
>(*i);
107 if (gs ==
nullptr && (*
i !=
nullptr)) {
108 std::cerr <<
"Got a " <<
typeid(**i).name() <<
", expecting TEveGeoShape. ignoring (it must be the clusters)." << std::endl;
111 gs->SetMainTransparency(75);
112 gs->SetPickable(kFALSE);
114 TString
name = gs->GetElementTitle();
115 if (!name.Contains(
"BAD") && !name.Contains(
"INACTIVE") && !name.Contains(
"LOST")) {
116 gs->SetMainColor(kBlue);
118 TEveText*
text =
new TEveText(name.Data());
119 text->PtrMainTrans()->SetFrom(gs->RefMainTrans().Array());
120 text->SetFontMode(TGLFont::kPixmap);
121 text->SetFontSize(12);
126 TEveTrackPropagator* prop =
new TEveTrackPropagator();
128 prop->SetStepper(TEveTrackPropagator::kRungeKutta);
134 trk->SetLineWidth(2);
135 trk->SetTitle(
"Track and its ref states" );
136 prop->SetRnrDaughters(kTRUE);
137 prop->SetRnrReferences(kTRUE);
138 prop->SetRnrDecay(kTRUE);
139 prop->SetRnrFV(kTRUE);
140 trk->SetMainColor(
id.
item()->defaultDisplayProperties().
color());
143 viewerGL()->SetStyle(TGLRnrCtx::kOutline);
144 viewerGL()->SetDrawCameraCenter(kTRUE);
145 viewerGL()->ResetCamerasAfterNextUpdate();
162 Color_t
x =
viewerGL()->GetRnrCtx()->ColorSet().Foreground().GetColorIndex();
164 (*i)->SetMainColor(x);
179 (*i)->SetMainTransparency(x);
192 TLatex* latex =
new TLatex( x, y,
"" );
193 const double textsize( 0.07 );
194 latex->SetTextSize( 2*textsize );
197 y -= latex->GetTextSize()*0.6;
199 latex->SetTextSize( textsize );
200 float lineH = latex->GetTextSize()*0.6;
202 latex->DrawLatex( x, y, Form(
" P_{T} = %.1f GeV, #eta = %0.2f, #varphi = %0.2f",
203 track->
pt(), track->
eta(), track->
phi()));
207 latex->DrawLatex( x, y,
" charge = +1" );
209 latex->DrawLatex( x, y,
" charge = -1" );
213 latex->DrawLatex( x, y,
"Track modules:");
219 Double_t boxH = 0.25*textsize;
221 pos[1] =
y; pos[3] = pos[1] + boxH;
223 latex->DrawLatex( x + 0.25, y,
"Module" );
226 pos[1] =
y; pos[3] = pos[1] + boxH;
228 latex->DrawLatex( x + 0.25, y,
"LOST Module" );
231 pos[1] =
y; pos[3] = pos[1] + boxH;
233 latex->DrawLatex( x + 0.25, y,
"INACTIVE Module" );
236 pos[1] =
y; pos[3] = pos[1] + boxH;
238 latex->DrawLatex( x + 0.25, y,
"BAD Module" );
246 latex->DrawLatex( x + 3 * r2, y,
"Pixel Hits" );
251 latex->DrawLatex( x + 3 * r2, y,
"Extra Pixel Hits" );
262 m_legend =
new TLegend( 0.01, 0.01, 0.99, 0.99,
nullptr,
"NDC" );
267 m_legend->SetEntrySeparation( 0.01 );
269 TEveStraightLineSet *
legend =
new TEveStraightLineSet(
"siStripCluster" );
270 legend->SetLineWidth( 3 );
271 legend->SetLineColor( kGreen );
272 m_legend->AddEntry( legend,
"Exact SiStripCluster",
"l");
274 TEveStraightLineSet *legend2 =
new TEveStraightLineSet(
"siStripCluster2" );
275 legend2->SetLineWidth( 3 );
276 legend2->SetLineColor( kRed );
277 m_legend->AddEntry( legend2,
"Extra SiStripCluster",
"l");
279 TEveStraightLineSet *legend3 =
new TEveStraightLineSet(
"refStates" );
280 legend3->SetDepthTest( kFALSE );
281 legend3->SetMarkerColor( kYellow );
282 legend3->SetMarkerStyle(
kPlus );
283 legend3->SetMarkerSize( 2 );
284 m_legend->AddEntry( legend3,
"Inner/Outermost States",
"p");
286 TEveStraightLineSet *legend4 =
new TEveStraightLineSet(
"vertex" );
287 legend4->SetDepthTest( kFALSE );
288 legend4->SetMarkerColor( kRed );
289 legend4->SetMarkerStyle( kFullDotLarge );
290 legend4->SetMarkerSize( 2 );
291 m_legend->AddEntry( legend4,
"Vertex",
"p");
293 TEveStraightLineSet *legend5 =
new TEveStraightLineSet(
"cameraCenter" );
294 legend5->SetDepthTest( kFALSE );
295 legend5->SetMarkerColor( kCyan );
296 legend5->SetMarkerStyle( kFullDotLarge );
297 legend5->SetMarkerSize( 2 );
298 m_legend->AddEntry( legend5,
"Camera center",
"p");
307 TEvePointSet* pointSet =
new TEvePointSet();
308 pointSet->SetMarkerSize(size);
309 pointSet->SetMarkerStyle(4);
310 pointSet->SetPickable(kTRUE);
311 pointSet->SetTitle(
"Pixel Hits");
312 pointSet->SetMarkerColor(color);
314 for( std::vector<TVector3>::const_iterator it = points.begin(), itEnd = points.end(); it != itEnd; ++it) {
315 pointSet->SetNextPoint(it->x(), it->y(), it->z());
317 tList->AddElement(pointSet);
323 TEveElement* trkList,
326 std::vector<TVector3> pixelPoints;
328 TEveElementList* pixels =
new TEveElementList(
"Pixels" );
329 trkList->AddElement( pixels );
333 std::vector<TVector3> pixelExtraPoints;
347 TEveElementList*
strips =
new TEveElementList(
"Strips" );
348 trkList->AddElement( strips );
357 TEveElement* trkList,
360 std::set<unsigned int>
ids;
362 recIt != recItEnd; ++recIt )
364 DetId detid = (*recIt)->geographicalId();
365 if( !addLostHits && !(*recIt)->isValid())
continue;
366 if( detid.
rawId() != 0 )
387 name =
"Pixel Barrel ";
390 unsigned int layer = idid.
layer();
394 name += TString::Format(
": Layer=%u, Ladder=%u, Module=%u \n",
395 layer, ladder, module );
399 name =
"Pixel Endcap ";
402 unsigned int side = idid.
side();
403 unsigned int disk = idid.
disk();
404 unsigned int blade = idid.
blade();
405 unsigned int panel = idid.
panel();
408 name += TString::Format(
": Side=%u, Disk=%u, Blade=%u, Panel=%u, Module=%u \n",
409 side, disk, blade, panel, module );
443 if( ! ids.insert( detid.
rawId()).
second )
continue;
447 if(
nullptr != shape )
449 shape->SetMainTransparency( 65 );
450 shape->SetPickable( kTRUE );
451 switch(( *recIt )->type())
460 shape->SetMainColor( kRed );
466 shape->SetMainColor( 28 );
470 shape->SetMainColor( 218 );
473 shape->SetTitle( name + ULong_t( detid.
rawId()));
474 trkList->AddElement( shape );
void setTextInfo(const FWModelId &id, const reco::Track *) override
const FWDisplayProperties & defaultDisplayProperties() const
unsigned int panel() const
panel id
TEveElementList * m_modules
TGLViewer * viewerGL() const
const TrackExtraRef & extra() const
reference to "extra" object
unsigned getField(const uint32_t u, const unsigned mask, const unsigned offset)
TEveTrack * prepareTrack(const reco::Track &track, TEveTrackPropagator *propagator, const std::vector< TEveVector > &extraRefPoints=std::vector< TEveVector >())
const FWEventItem * item()
sigc::signal< void > activated
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)
unsigned int ladder() const
ladder id
unsigned int layer() const
layer id
unsigned int blade() const
blade id
uint32_t rawId() const
get the raw id
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_
unsigned int module() const
det id
TGCompositeFrame * m_guiFrame
unsigned int module() const
det id
void pushPixelHits(std::vector< TVector3 > &pixelPoints, const FWEventItem &iItem, const reco::Track &t)
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
~FWTrackHitsDetailView() override
unsigned int disk() const
disk id
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)
unsigned int side() const
positive or negative id
FWIntValueListener * m_sliderListener
void transparencyChanged(int)
int charge() const
track electric charge
Detector det() const
get the detector field from this detid
void pushNearbyPixelHits(std::vector< TVector3 > &pixelPoints, const FWEventItem &iItem, const reco::Track &t)
const FWGeometry * getGeom() const
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
static void drawCanvasBox(Double_t *pos, Color_t fillCol, Int_t fillType=0, bool bg=kTRUE)
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.