2 #include "TGLFontManager.h"
4 #include "TEveManager.h"
5 #include "TEveStraightLineSet.h"
7 #include "TEveTrackPropagator.h"
10 #include "TEveGeoShape.h"
14 #include "TGLViewer.h"
57 TGCompositeFrame*
f =
new TGVerticalFrame(
m_guiFrame);
59 f->AddFrame(
new TGLabel(f,
"Module Transparency:"),
new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
60 m_slider =
new TGHSlider(f, 120, kSlider1 | kScaleNo);
61 f->AddFrame(
m_slider,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 1, 4));
66 TQObject::Connect(
m_slider,
"PositionChanged(Int_t)",
"FWIntValueListenerBase",
m_sliderListener,
"setValue(Int_t)");
72 TGCheckButton*
b =
new TGCheckButton(
m_guiFrame,
"Show Module Labels" );
73 b->SetState(kButtonUp,
false);
74 m_guiFrame->AddFrame(b,
new TGLayoutHints( kLHintsNormal, 2, 3, 1, 4));
75 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
81 action->
setToolTip(
"Click on object in viewer to set camera center.");
86 TGCompositeFrame*
p = (TGCompositeFrame*)
m_guiFrame->GetParent();
90 m_modules =
new TEveElementList(
"Modules" );
94 m_hits =
new TEveElementList(
"Hits" );
103 TEveGeoShape* gs =
dynamic_cast<TEveGeoShape*
>(*i);
104 if (gs == 0 && (*
i != 0)) {
105 std::cerr <<
"Got a " <<
typeid(**i).name() <<
", expecting TEveGeoShape. ignoring (it must be the clusters)." << std::endl;
108 gs->SetMainTransparency(75);
109 gs->SetPickable(kFALSE);
111 TString
name = gs->GetElementTitle();
112 if (!name.Contains(
"BAD") && !name.Contains(
"INACTIVE") && !name.Contains(
"LOST")) {
113 gs->SetMainColor(kBlue);
115 TEveText*
text =
new TEveText(name.Data());
116 text->PtrMainTrans()->SetFrom(gs->RefMainTrans().Array());
117 text->SetFontMode(TGLFont::kPixmap);
118 text->SetFontSize(12);
123 TEveTrackPropagator* prop =
new TEveTrackPropagator();
124 prop->SetMagFieldObj(
item()->
context().getField(),
false);
125 prop->SetStepper(TEveTrackPropagator::kRungeKutta);
131 trk->SetLineWidth(2);
132 trk->SetTitle(
"Track and its ref states" );
133 prop->SetRnrDaughters(kTRUE);
134 prop->SetRnrReferences(kTRUE);
135 prop->SetRnrDecay(kTRUE);
136 prop->SetRnrFV(kTRUE);
137 trk->SetMainColor(
id.
item()->defaultDisplayProperties().
color());
140 viewerGL()->SetStyle(TGLRnrCtx::kOutline);
141 viewerGL()->SetDrawCameraCenter(kTRUE);
142 viewerGL()->ResetCamerasAfterNextUpdate();
159 Color_t
x =
viewerGL()->GetRnrCtx()->ColorSet().Foreground().GetColorIndex();
161 (*i)->SetMainColor(x);
176 (*i)->SetMainTransparency(x);
189 TLatex* latex =
new TLatex( x, y,
"" );
190 const double textsize( 0.07 );
191 latex->SetTextSize( 2*textsize );
193 latex->DrawLatex( x, y,
id.
item()->modelName(
id.
index()).c_str());
194 y -= latex->GetTextSize()*0.6;
196 latex->SetTextSize( textsize );
197 float lineH = latex->GetTextSize()*0.6;
199 latex->DrawLatex( x, y, Form(
" P_{T} = %.1f GeV, #eta = %0.2f, #varphi = %0.2f",
200 track->
pt(), track->
eta(), track->
phi()));
204 latex->DrawLatex( x, y,
" charge = +1" );
206 latex->DrawLatex( x, y,
" charge = -1" );
210 latex->DrawLatex( x, y,
"Track modules:");
216 Double_t boxH = 0.25*textsize;
218 pos[1] =
y; pos[3] = pos[1] + boxH;
220 latex->DrawLatex( x + 0.25, y,
"Module" );
223 pos[1] =
y; pos[3] = pos[1] + boxH;
225 latex->DrawLatex( x + 0.25, y,
"LOST Module" );
228 pos[1] =
y; pos[3] = pos[1] + boxH;
230 latex->DrawLatex( x + 0.25, y,
"INACTIVE Module" );
233 pos[1] =
y; pos[3] = pos[1] + boxH;
235 latex->DrawLatex( x + 0.25, y,
"BAD Module" );
243 latex->DrawLatex( x + 3 * r2, y,
"Pixel Hits" );
248 latex->DrawLatex( x + 3 * r2, y,
"Extra Pixel Hits" );
259 m_legend =
new TLegend( 0.01, 0.01, 0.99, 0.99, 0,
"NDC" );
264 m_legend->SetEntrySeparation( 0.01 );
266 TEveStraightLineSet *legend =
new TEveStraightLineSet(
"siStripCluster" );
267 legend->SetLineWidth( 3 );
268 legend->SetLineColor( kGreen );
269 m_legend->AddEntry( legend,
"Exact SiStripCluster",
"l");
271 TEveStraightLineSet *legend2 =
new TEveStraightLineSet(
"siStripCluster2" );
272 legend2->SetLineWidth( 3 );
273 legend2->SetLineColor( kRed );
274 m_legend->AddEntry( legend2,
"Extra SiStripCluster",
"l");
276 TEveStraightLineSet *legend3 =
new TEveStraightLineSet(
"refStates" );
277 legend3->SetDepthTest( kFALSE );
278 legend3->SetMarkerColor( kYellow );
279 legend3->SetMarkerStyle(
kPlus );
280 legend3->SetMarkerSize( 2 );
281 m_legend->AddEntry( legend3,
"Inner/Outermost States",
"p");
283 TEveStraightLineSet *legend4 =
new TEveStraightLineSet(
"vertex" );
284 legend4->SetDepthTest( kFALSE );
285 legend4->SetMarkerColor( kRed );
286 legend4->SetMarkerStyle( kFullDotLarge );
287 legend4->SetMarkerSize( 2 );
288 m_legend->AddEntry( legend4,
"Vertex",
"p");
290 TEveStraightLineSet *legend5 =
new TEveStraightLineSet(
"cameraCenter" );
291 legend5->SetDepthTest( kFALSE );
292 legend5->SetMarkerColor( kCyan );
293 legend5->SetMarkerStyle( kFullDotLarge );
294 legend5->SetMarkerSize( 2 );
295 m_legend->AddEntry( legend5,
"Camera center",
"p");
304 TEvePointSet* pointSet =
new TEvePointSet();
305 pointSet->SetMarkerSize(size);
306 pointSet->SetMarkerStyle(4);
307 pointSet->SetPickable(kTRUE);
308 pointSet->SetTitle(
"Pixel Hits");
309 pointSet->SetMarkerColor(color);
311 for( std::vector<TVector3>::const_iterator it = points.begin(), itEnd = points.end(); it != itEnd; ++it) {
312 pointSet->SetNextPoint(it->x(), it->y(), it->z());
314 tList->AddElement(pointSet);
320 TEveElement* trkList,
323 std::vector<TVector3> pixelPoints;
325 TEveElementList* pixels =
new TEveElementList(
"Pixels" );
326 trkList->AddElement( pixels );
330 std::vector<TVector3> pixelExtraPoints;
344 TEveElementList*
strips =
new TEveElementList(
"Strips" );
345 trkList->AddElement( strips );
354 TEveElement* trkList,
357 std::set<unsigned int> ids;
359 recIt != recItEnd; ++recIt )
362 if( !addLostHits && !(*recIt)->isValid())
continue;
363 if( detid.
rawId() != 0 )
384 name =
"Pixel Barrel ";
387 unsigned int layer = idid.
layer();
388 unsigned int ladder = idid.
ladder();
391 name += TString::Format(
": Layer=%u, Ladder=%u, Module=%u \n",
392 layer, ladder, module );
396 name =
"Pixel Endcap ";
399 unsigned int side = idid.
side();
400 unsigned int disk = idid.
disk();
401 unsigned int blade = idid.
blade();
402 unsigned int panel = idid.
panel();
405 name += TString::Format(
": Side=%u, Disk=%u, Blade=%u, Panel=%u, Module=%u \n",
406 side, disk, blade, panel, module );
434 if( ! ids.insert( detid.
rawId()).
second )
continue;
440 shape->SetMainTransparency( 65 );
441 shape->SetPickable( kTRUE );
442 switch(( *recIt )->type())
449 shape->SetMainColor( kRed );
453 shape->SetMainColor( 28 );
457 shape->SetMainColor( 218 );
460 shape->SetTitle( name + ULong_t( detid.
rawId()));
461 trkList->AddElement( shape );
const FWDisplayProperties & defaultDisplayProperties() const
unsigned int panel() const
panel id
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)
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)
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_
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) ...
unsigned int disk() const
disk id
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)
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
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.