2 #include "TGLFontManager.h"
4 #include "TEveManager.h"
5 #include "TEveStraightLineSet.h"
7 #include "TEveTrackPropagator.h"
10 #include "TEveGeoShape.h"
14 #include "TGLViewer.h"
55 TGCompositeFrame*
f =
new TGVerticalFrame(
m_guiFrame);
57 f->AddFrame(
new TGLabel(f,
"Module Transparency:"),
new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
58 m_slider =
new TGHSlider(f, 120, kSlider1 | kScaleNo);
59 f->AddFrame(
m_slider,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 1, 4));
64 TQObject::Connect(
m_slider,
"PositionChanged(Int_t)",
"FWIntValueListenerBase",
m_sliderListener,
"setValue(Int_t)");
70 TGCheckButton*
b =
new TGCheckButton(
m_guiFrame,
"Show Module Labels" );
71 b->SetState(kButtonUp,
false);
72 m_guiFrame->AddFrame(b,
new TGLayoutHints( kLHintsNormal, 2, 3, 1, 4));
73 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
79 action->
setToolTip(
"Click on object in viewer to set camera center.");
84 TGCompositeFrame*
p = (TGCompositeFrame*)
m_guiFrame->GetParent();
88 m_modules =
new TEveElementList(
"Modules" );
92 m_hits =
new TEveElementList(
"Hits" );
101 TEveGeoShape* gs =
dynamic_cast<TEveGeoShape*
>(*i);
102 if (gs == 0 && (*
i != 0)) {
103 std::cerr <<
"Got a " <<
typeid(**i).name() <<
", expecting TEveGeoShape. ignoring (it must be the clusters)." << std::endl;
106 gs->SetMainTransparency(75);
107 gs->SetPickable(kFALSE);
109 TString
name = gs->GetElementTitle();
110 if (!name.Contains(
"BAD") && !name.Contains(
"INACTIVE") && !name.Contains(
"LOST")) {
111 gs->SetMainColor(kBlue);
113 TEveText*
text =
new TEveText(name.Data());
114 text->PtrMainTrans()->SetFrom(gs->RefMainTrans().Array());
115 text->SetFontMode(TGLFont::kPixmap);
116 text->SetFontSize(12);
121 TEveTrackPropagator* prop =
new TEveTrackPropagator();
122 prop->SetMagFieldObj(
item()->
context().getField(),
false);
123 prop->SetStepper(TEveTrackPropagator::kRungeKutta);
129 trk->SetLineWidth(2);
130 trk->SetTitle(
"Track and its ref states" );
131 prop->SetRnrDaughters(kTRUE);
132 prop->SetRnrReferences(kTRUE);
133 prop->SetRnrDecay(kTRUE);
134 prop->SetRnrFV(kTRUE);
135 trk->SetMainColor(
id.
item()->defaultDisplayProperties().color());
138 viewerGL()->SetStyle(TGLRnrCtx::kOutline);
139 viewerGL()->SetDrawCameraCenter(kTRUE);
140 viewerGL()->ResetCamerasAfterNextUpdate();
157 Color_t
x =
viewerGL()->GetRnrCtx()->ColorSet().Foreground().GetColorIndex();
159 (*i)->SetMainColor(x);
174 (*i)->SetMainTransparency(x);
187 TLatex* latex =
new TLatex( x, y,
"" );
188 const double textsize( 0.07 );
189 latex->SetTextSize( 2*textsize );
191 latex->DrawLatex( x, y,
id.
item()->modelName(
id.
index()).c_str());
192 y -= latex->GetTextSize()*0.6;
194 latex->SetTextSize( textsize );
195 float lineH = latex->GetTextSize()*0.6;
197 latex->DrawLatex( x, y, Form(
" P_{T} = %.1f GeV, #eta = %0.2f, #varphi = %0.2f",
198 track->
pt(), track->
eta(), track->
phi()));
202 latex->DrawLatex( x, y,
" charge = +1" );
204 latex->DrawLatex( x, y,
" charge = -1" );
208 latex->DrawLatex( x, y,
"Track modules:");
214 Double_t boxH = 0.25*textsize;
216 pos[1] =
y; pos[3] = pos[1] + boxH;
218 latex->DrawLatex( x + 0.25, y,
"Module" );
221 pos[1] =
y; pos[3] = pos[1] + boxH;
223 latex->DrawLatex( x + 0.25, y,
"LOST Module" );
226 pos[1] =
y; pos[3] = pos[1] + boxH;
228 latex->DrawLatex( x + 0.25, y,
"INACTIVE Module" );
231 pos[1] =
y; pos[3] = pos[1] + boxH;
233 latex->DrawLatex( x + 0.25, y,
"BAD Module" );
241 latex->DrawLatex( x + 3 * r2, y,
"Pixel Hits" );
246 latex->DrawLatex( x + 3 * r2, y,
"Extra Pixel Hits" );
257 m_legend =
new TLegend( 0.01, 0.01, 0.99, 0.99, 0,
"NDC" );
262 m_legend->SetEntrySeparation( 0.01 );
264 TEveStraightLineSet *
legend =
new TEveStraightLineSet(
"siStripCluster" );
265 legend->SetLineWidth( 3 );
266 legend->SetLineColor( kGreen );
267 m_legend->AddEntry( legend,
"Exact SiStripCluster",
"l");
269 TEveStraightLineSet *legend2 =
new TEveStraightLineSet(
"siStripCluster2" );
270 legend2->SetLineWidth( 3 );
271 legend2->SetLineColor( kRed );
272 m_legend->AddEntry( legend2,
"Extra SiStripCluster",
"l");
274 TEveStraightLineSet *legend3 =
new TEveStraightLineSet(
"refStates" );
275 legend3->SetDepthTest( kFALSE );
276 legend3->SetMarkerColor( kYellow );
277 legend3->SetMarkerStyle(
kPlus );
278 legend3->SetMarkerSize( 2 );
279 m_legend->AddEntry( legend3,
"Inner/Outermost States",
"p");
281 TEveStraightLineSet *legend4 =
new TEveStraightLineSet(
"vertex" );
282 legend4->SetDepthTest( kFALSE );
283 legend4->SetMarkerColor( kRed );
284 legend4->SetMarkerStyle( kFullDotLarge );
285 legend4->SetMarkerSize( 2 );
286 m_legend->AddEntry( legend4,
"Vertex",
"p");
288 TEveStraightLineSet *legend5 =
new TEveStraightLineSet(
"cameraCenter" );
289 legend5->SetDepthTest( kFALSE );
290 legend5->SetMarkerColor( kCyan );
291 legend5->SetMarkerStyle( kFullDotLarge );
292 legend5->SetMarkerSize( 2 );
293 m_legend->AddEntry( legend5,
"Camera center",
"p");
302 TEvePointSet* pointSet =
new TEvePointSet();
303 pointSet->SetMarkerSize(size);
304 pointSet->SetMarkerStyle(4);
305 pointSet->SetPickable(kTRUE);
306 pointSet->SetTitle(
"Pixel Hits");
307 pointSet->SetMarkerColor(color);
309 for( std::vector<TVector3>::const_iterator it = points.begin(), itEnd = points.end(); it != itEnd; ++it) {
310 pointSet->SetNextPoint(it->x(), it->y(), it->z());
312 tList->AddElement(pointSet);
318 TEveElement* trkList,
321 std::vector<TVector3> pixelPoints;
323 TEveElementList* pixels =
new TEveElementList(
"Pixels" );
324 trkList->AddElement( pixels );
328 std::vector<TVector3> pixelExtraPoints;
342 TEveElementList*
strips =
new TEveElementList(
"Strips" );
343 trkList->AddElement( strips );
352 TEveElement* trkList,
355 std::set<unsigned int> ids;
357 recIt != recItEnd; ++recIt )
360 if( !addLostHits && !(*recIt)->isValid())
continue;
361 if( detid.
rawId() != 0 )
382 name =
"Pixel Barrel ";
385 name =
"Pixel Endcap ";
411 if( ! ids.insert( detid.
rawId()).
second )
continue;
417 shape->SetMainTransparency( 65 );
418 shape->SetPickable( kTRUE );
419 switch(( *recIt )->type())
426 shape->SetMainColor( kRed );
430 shape->SetMainColor( 28 );
434 shape->SetMainColor( 218 );
437 shape->SetTitle( name + ULong_t( detid.
rawId()));
438 trkList->AddElement( shape );
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
void addHits(const reco::Track &track, const FWEventItem *iItem, TEveElement *trkList, bool addNearbyHits)
double phi() const
azimuthal angle of momentum vector
void addTrackerHits3D(std::vector< TVector3 > &points, class TEveElementList *tList, Color_t color, int size)
uint32_t rawId() const
get the raw id
U second(std::pair< T, U > const &p)
const fireworks::Context & context() const
void setTextInfo(const FWModelId &id, const reco::Track *)
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) ...
void addSiStripClusters(const FWEventItem *iItem, const reco::Track &t, class TEveElement *tList, bool addNearbyClusters, bool master)
TEveElementList * m_moduleLabels
virtual void setBackgroundColor(Color_t)
void addModules(const reco::Track &track, const FWEventItem *iItem, TEveElement *trkList, bool addLostHits)
void createTextButton(TGCompositeFrame *p, TGLayoutHints *l=0, Int_t id=-1, GContext_t norm=TGButton::GetDefaultGC()(), FontStruct_t font=TGTextButton::GetDefaultFontStruct(), UInt_t option=kRaisedFrame|kDoubleBorder)
void build(const FWModelId &id, const reco::Track *)
#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
Detector det() const
get the detector field from this detid
virtual ~FWTrackHitsDetailView()
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)
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.