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 if (gs ==
nullptr && (*
i !=
nullptr)) {
106 std::cerr <<
"Got a " <<
typeid(**i).name() <<
", expecting TEveGeoShape. ignoring (it must be the clusters)." << std::endl;
109 gs->SetMainTransparency(75);
110 gs->SetPickable(kFALSE);
112 TString
name = gs->GetElementTitle();
113 if (!name.Contains(
"BAD") && !name.Contains(
"INACTIVE") && !name.Contains(
"LOST")) {
114 gs->SetMainColor(kBlue);
116 TEveText*
text =
new TEveText(name.Data());
117 text->PtrMainTrans()->SetFrom(gs->RefMainTrans().Array());
118 text->SetFontMode(TGLFont::kPixmap);
119 text->SetFontSize(12);
124 TEveTrackPropagator* prop =
new TEveTrackPropagator();
126 prop->SetStepper(TEveTrackPropagator::kRungeKutta);
132 trk->SetLineWidth(2);
133 trk->SetTitle(
"Track and its ref states" );
134 prop->SetRnrDaughters(kTRUE);
135 prop->SetRnrReferences(kTRUE);
136 prop->SetRnrDecay(kTRUE);
137 prop->SetRnrFV(kTRUE);
138 trk->SetMainColor(
id.
item()->defaultDisplayProperties().
color());
141 viewerGL()->SetStyle(TGLRnrCtx::kOutline);
142 viewerGL()->SetDrawCameraCenter(kTRUE);
143 viewerGL()->ResetCamerasAfterNextUpdate();
160 Color_t
x =
viewerGL()->GetRnrCtx()->ColorSet().Foreground().GetColorIndex();
162 (*i)->SetMainColor(x);
177 (*i)->SetMainTransparency(x);
190 TLatex* latex =
new TLatex( x, y,
"" );
191 const double textsize( 0.07 );
192 latex->SetTextSize( 2*textsize );
195 y -= latex->GetTextSize()*0.6;
197 latex->SetTextSize( textsize );
198 float lineH = latex->GetTextSize()*0.6;
200 latex->DrawLatex( x, y, Form(
" P_{T} = %.1f GeV, #eta = %0.2f, #varphi = %0.2f",
201 track->
pt(), track->
eta(), track->
phi()));
205 latex->DrawLatex( x, y,
" charge = +1" );
207 latex->DrawLatex( x, y,
" charge = -1" );
211 latex->DrawLatex( x, y,
"Track modules:");
217 Double_t boxH = 0.25*textsize;
219 pos[1] =
y; pos[3] = pos[1] + boxH;
221 latex->DrawLatex( x + 0.25, y,
"Module" );
224 pos[1] =
y; pos[3] = pos[1] + boxH;
226 latex->DrawLatex( x + 0.25, y,
"LOST Module" );
229 pos[1] =
y; pos[3] = pos[1] + boxH;
231 latex->DrawLatex( x + 0.25, y,
"INACTIVE Module" );
234 pos[1] =
y; pos[3] = pos[1] + boxH;
236 latex->DrawLatex( x + 0.25, y,
"BAD Module" );
244 latex->DrawLatex( x + 3 * r2, y,
"Pixel Hits" );
249 latex->DrawLatex( x + 3 * r2, y,
"Extra Pixel Hits" );
260 m_legend =
new TLegend( 0.01, 0.01, 0.99, 0.99,
nullptr,
"NDC" );
265 m_legend->SetEntrySeparation( 0.01 );
267 TEveStraightLineSet *
legend =
new TEveStraightLineSet(
"siStripCluster" );
268 legend->SetLineWidth( 3 );
269 legend->SetLineColor( kGreen );
270 m_legend->AddEntry( legend,
"Exact SiStripCluster",
"l");
272 TEveStraightLineSet *legend2 =
new TEveStraightLineSet(
"siStripCluster2" );
273 legend2->SetLineWidth( 3 );
274 legend2->SetLineColor( kRed );
275 m_legend->AddEntry( legend2,
"Extra SiStripCluster",
"l");
277 TEveStraightLineSet *legend3 =
new TEveStraightLineSet(
"refStates" );
278 legend3->SetDepthTest( kFALSE );
279 legend3->SetMarkerColor( kYellow );
280 legend3->SetMarkerStyle(
kPlus );
281 legend3->SetMarkerSize( 2 );
282 m_legend->AddEntry( legend3,
"Inner/Outermost States",
"p");
284 TEveStraightLineSet *legend4 =
new TEveStraightLineSet(
"vertex" );
285 legend4->SetDepthTest( kFALSE );
286 legend4->SetMarkerColor( kRed );
287 legend4->SetMarkerStyle( kFullDotLarge );
288 legend4->SetMarkerSize( 2 );
289 m_legend->AddEntry( legend4,
"Vertex",
"p");
291 TEveStraightLineSet *legend5 =
new TEveStraightLineSet(
"cameraCenter" );
292 legend5->SetDepthTest( kFALSE );
293 legend5->SetMarkerColor( kCyan );
294 legend5->SetMarkerStyle( kFullDotLarge );
295 legend5->SetMarkerSize( 2 );
296 m_legend->AddEntry( legend5,
"Camera center",
"p");
305 TEvePointSet* pointSet =
new TEvePointSet();
306 pointSet->SetMarkerSize(size);
307 pointSet->SetMarkerStyle(4);
308 pointSet->SetPickable(kTRUE);
309 pointSet->SetTitle(
"Pixel Hits");
310 pointSet->SetMarkerColor(color);
312 for( std::vector<TVector3>::const_iterator it = points.begin(), itEnd = points.end(); it != itEnd; ++it) {
313 pointSet->SetNextPoint(it->x(), it->y(), it->z());
315 tList->AddElement(pointSet);
321 TEveElement* trkList,
324 std::vector<TVector3> pixelPoints;
326 TEveElementList* pixels =
new TEveElementList(
"Pixels" );
327 trkList->AddElement( pixels );
331 std::vector<TVector3> pixelExtraPoints;
345 TEveElementList*
strips =
new TEveElementList(
"Strips" );
346 trkList->AddElement( strips );
355 TEveElement* trkList,
358 std::set<unsigned int>
ids;
360 recIt != recItEnd; ++recIt )
362 DetId detid = (*recIt)->geographicalId();
363 if( !addLostHits && !(*recIt)->isValid())
continue;
364 if( detid.
rawId() != 0 )
399 if( ! ids.insert( detid.
rawId()).
second )
continue;
403 if(
nullptr != shape )
405 shape->SetMainTransparency( 65 );
406 shape->SetPickable( kTRUE );
407 switch(( *recIt )->type())
416 shape->SetMainColor( kRed );
422 shape->SetMainColor( 28 );
426 shape->SetMainColor( 218 );
429 shape->SetTitle( name + ULong_t( detid.
rawId()));
430 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
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)
std::string print(DetId detid) const
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_
TGCompositeFrame * m_guiFrame
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
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
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
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.