2 #include "TGLFontManager.h"
4 #include "TEveManager.h"
5 #include "TEveStraightLineSet.h"
7 #include "TEveTrackPropagator.h"
10 #include "TEveGeoShape.h"
14 #include "TGLViewer.h"
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" );
111 TEveGeoShape* gs =
dynamic_cast<TEveGeoShape*
>(*i);
112 if (gs == 0 && (*
i != 0)) {
113 std::cerr <<
"Got a " <<
typeid(**i).name() <<
", expecting TEveGeoShape. ignoring (it must be the clusters)." << std::endl;
116 gs->SetMainTransparency(75);
117 gs->SetPickable(kFALSE);
119 TString
name = gs->GetElementTitle();
120 if (!name.Contains(
"BAD") && !name.Contains(
"INACTIVE") && !name.Contains(
"LOST")) {
121 gs->SetMainColor(kBlue);
123 TEveText*
text =
new TEveText(name.Data());
124 text->PtrMainTrans()->SetFrom(gs->RefMainTrans().Array());
125 text->SetFontMode(TGLFont::kPixmap);
126 text->SetFontSize(12);
131 TEveTrackPropagator* prop =
new TEveTrackPropagator();
132 prop->SetMagFieldObj(
item()->
context().getField(),
false);
133 prop->SetStepper(TEveTrackPropagator::kRungeKutta);
137 prop->SetRnrDaughters(kTRUE);
138 prop->SetRnrReferences(kTRUE);
139 prop->SetRnrDecay(kTRUE);
140 prop->SetRnrFV(kTRUE);
144 trk1->SetLineWidth(2);
145 trk1->SetTitle(
"Track 1 and its ref states" );
146 trk1->SetMainColor(
id.
item()->defaultDisplayProperties().color());
151 trk0->SetLineWidth(2);
152 trk0->SetTitle(
"Track 0 and its ref states" );
153 trk0->SetMainColor(
id.
item()->defaultDisplayProperties().color());
156 viewerGL()->SetStyle(TGLRnrCtx::kOutline);
157 viewerGL()->SetDrawCameraCenter(kTRUE);
158 viewerGL()->ResetCamerasAfterNextUpdate();
175 Color_t
x =
viewerGL()->GetRnrCtx()->ColorSet().Foreground().GetColorIndex();
177 (*i)->SetMainColor(x);
192 (*i)->SetMainTransparency(x);
205 TLatex* latex =
new TLatex( x, y,
"" );
206 const double textsize( 0.07 );
207 latex->SetTextSize( 2*textsize );
209 latex->DrawLatex( x, y,
id.
item()->modelName(
id.
index()).c_str());
210 y -= latex->GetTextSize()*0.6;
212 latex->SetTextSize( textsize );
213 float lineH = latex->GetTextSize()*0.6;
215 latex->DrawLatex( x, y, Form(
"p_{T}=%.1f GeV, #eta=%0.2f, #varphi=%0.2f",
218 latex->DrawLatex( x, y, Form(
"vtx=(%.1f, %.1f, %.1f) r=%.1f [cm]",
222 latex->DrawLatex( x, y, Form(
"#Deltactg#theta=%.3f",
225 latex->DrawLatex( x, y, Form(
"#Delta#phi_{vtx}=%.3f",
228 latex->DrawLatex( x, y, Form(
"dist. min. app.=%.3f cm",
235 latex->DrawLatex( x, y, Form(
"Trk0 q=%i",track0->
charge()));
237 latex->DrawLatex( x, y, Form(
"p_{T}=%.1f GeV, #eta=%0.2f, #varphi=%0.2f",
238 track0->
pt(), track0->
eta(), track0->
phi()));
241 int nvalid_tk0=0, ninvalid_tk0=0, npix_tk0=0, nstrip_tk0=0;
248 }
else ninvalid_tk0++;
250 latex->DrawLatex( x, y, Form(
"valid hits: %i (pix. %i, str. %i)", nvalid_tk0, npix_tk0, nstrip_tk0) );
252 latex->DrawLatex( x, y, Form(
"invalid: %i", ninvalid_tk0) );
255 int npix_mhi_tk0=0, nstrip_mhi_tk0=0;
256 for(
int i_mhi_tk0=0; i_mhi_tk0<p_mhi_tk0.
numberOfHits(); i_mhi_tk0++) {
261 latex->DrawLatex( x, y, Form(
"miss. inner hits: pix. %i, str. %i", npix_mhi_tk0, nstrip_mhi_tk0) );
266 latex->DrawLatex( x, y, Form(
"Trk1 q=%i",track1->
charge()));
268 latex->DrawLatex( x, y, Form(
"p_{T}=%.1f GeV, #eta=%0.2f, #varphi=%0.2f",
269 track1->
pt(), track1->
eta(), track1->
phi()));
272 int nvalid_tk1=0, ninvalid_tk1=0, npix_tk1=0, nstrip_tk1=0;
279 }
else ninvalid_tk1++;
281 latex->DrawLatex( x, y, Form(
"valid hits: %i (pix. %i, str. %i)", nvalid_tk1, npix_tk1, nstrip_tk1) );
283 latex->DrawLatex( x, y, Form(
"invalid: %i", ninvalid_tk1) );
286 int npix_mhi_tk1=0, nstrip_mhi_tk1=0;
287 for(
int i_mhi_tk1=0; i_mhi_tk1<p_mhi_tk1.
numberOfHits(); i_mhi_tk1++) {
292 latex->DrawLatex( x, y, Form(
"miss. inner hits: pix. %i, str. %i", npix_mhi_tk1, nstrip_mhi_tk1) );
296 latex->DrawLatex( x, y,
"Placeholder for symbol legend");
298 latex->DrawLatex( x, y,
"and projection buttons");
349 m_legend =
new TLegend( 0.01, 0.01, 0.99, 0.99, 0,
"NDC" );
354 m_legend->SetEntrySeparation( 0.01 );
356 TEveStraightLineSet *legend =
new TEveStraightLineSet(
"siStripCluster" );
357 legend->SetLineWidth( 3 );
358 legend->SetLineColor( kGreen );
359 m_legend->AddEntry( legend,
"Exact SiStripCluster",
"l");
361 TEveStraightLineSet *legend2 =
new TEveStraightLineSet(
"siStripCluster2" );
362 legend2->SetLineWidth( 3 );
363 legend2->SetLineColor( kRed );
364 m_legend->AddEntry( legend2,
"Extra SiStripCluster",
"l");
366 TEveStraightLineSet *legend3 =
new TEveStraightLineSet(
"refStates" );
367 legend3->SetDepthTest( kFALSE );
368 legend3->SetMarkerColor( kYellow );
369 legend3->SetMarkerStyle(
kPlus );
370 legend3->SetMarkerSize( 2 );
371 m_legend->AddEntry( legend3,
"Inner/Outermost States",
"p");
373 TEveStraightLineSet *legend4 =
new TEveStraightLineSet(
"vertex" );
374 legend4->SetDepthTest( kFALSE );
375 legend4->SetMarkerColor( kRed );
376 legend4->SetMarkerStyle( kFullDotLarge );
377 legend4->SetMarkerSize( 2 );
378 m_legend->AddEntry( legend4,
"Vertex",
"p");
380 TEveStraightLineSet *legend5 =
new TEveStraightLineSet(
"cameraCenter" );
381 legend5->SetDepthTest( kFALSE );
382 legend5->SetMarkerColor( kCyan );
383 legend5->SetMarkerStyle( kFullDotLarge );
384 legend5->SetMarkerSize( 2 );
385 m_legend->AddEntry( legend5,
"Camera center",
"p");
394 TEvePointSet* pointSet =
new TEvePointSet();
395 pointSet->SetMarkerSize(size);
396 pointSet->SetMarkerStyle(4);
397 pointSet->SetPickable(kTRUE);
398 pointSet->SetTitle(
"Pixel Hits");
399 pointSet->SetMarkerColor(color);
401 for( std::vector<TVector3>::const_iterator it = points.begin(), itEnd = points.end(); it != itEnd; ++it) {
402 pointSet->SetNextPoint(it->x(), it->y(), it->z());
404 tList->AddElement(pointSet);
410 TEveElement* trkList,
413 std::vector<TVector3> pixelPoints;
415 TEveElementList* pixels =
new TEveElementList(
"Pixels" );
416 trkList->AddElement( pixels );
420 std::vector<TVector3> pixelExtraPoints;
434 TEveElementList*
strips =
new TEveElementList(
"Strips" );
435 trkList->AddElement( strips );
444 TEveElement* trkList,
447 std::set<unsigned int> ids;
449 recIt != recItEnd; ++recIt )
452 if( !addLostHits && !(*recIt)->isValid())
continue;
453 if( detid.
rawId() != 0 )
474 name =
"Pixel Barrel ";
477 name =
"Pixel Endcap ";
503 if( ! ids.insert( detid.
rawId()).
second )
continue;
509 shape->SetMainTransparency( 65 );
510 shape->SetPickable( kTRUE );
511 switch(( *recIt )->type())
518 shape->SetMainColor( kRed );
522 shape->SetMainColor( 28 );
526 shape->SetMainColor( 218 );
529 shape->SetTitle( name + ULong_t( detid.
rawId()));
530 trkList->AddElement( shape );
virtual ~FWConvTrackHitsDetailView()
virtual void setBackgroundColor(Color_t)
const reco::Vertex & conversionVertex() const
returns the reco conversion vertex
void addModules(const reco::Track &track, const FWEventItem *iItem, TEveElement *trkList, bool addLostHits)
const FWDisplayProperties & defaultDisplayProperties() const
TGLViewer * viewerGL() const
const TrackExtraRef & extra() const
reference to "extra" object
FWIntValueListener * m_sliderListener
TEveTrack * prepareTrack(const reco::Track &track, TEveTrackPropagator *propagator, const std::vector< TEveVector > &extraRefPoints=std::vector< TEveVector >())
static HepMC::IO_HEPEVT conv
double y() const
y coordinate
const FWEventItem * item()
sigc::signal< void > activated
double distOfMinimumApproach() const
double pairCotThetaSeparation() const
Delta cot(Theta) where Theta is the angle in the (y,z) plane between the two tracks. Original tracks are used.
void build(const FWModelId &id, const reco::Conversion *)
double phi() const
azimuthal angle of momentum vector
const Point & position() const
position
uint32_t rawId() const
get the raw id
U second(std::pair< T, U > const &p)
std::vector< edm::RefToBase< reco::Track > > tracks() const
vector of track to base references
void transparencyChanged(int)
const fireworks::Context & context() const
double eta() const
pseudorapidity of momentum vector
void setToolTip(const std::string &tip)
TEveGeoShape * getEveShape(unsigned int id) const
TEveElementList * m_moduleLabels
double pt() const
track transverse momentum
sigc::signal< void, Int_t > valueChanged_
bool stripHitFilter(uint32_t pattern) const
TGCompositeFrame * m_guiFrame
double z() const
y coordinate
const HitPattern & trackerExpectedHitsInner() const
Access the hit pattern counting (in the Tracker) the number of expected crossed layers before the fir...
FWConvTrackHitsDetailView()
void pushPixelHits(std::vector< TVector3 > &pixelPoints, const FWEventItem &iItem, const reco::Track &t)
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
bool validHitFilter(uint32_t pattern) const
bool pixelHitFilter(uint32_t pattern) const
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
TEveElementList * m_modules
void addHits(const reco::Track &track, const FWEventItem *iItem, TEveElement *trkList, bool addNearbyHits)
void addSiStripClusters(const FWEventItem *iItem, const reco::Track &t, class TEveElement *tList, bool addNearbyClusters, bool master)
unsigned int nTracks() const
Number of tracks= 0,1,2.
void setTextInfo(const FWModelId &id, const reco::Conversion *)
double x() const
x coordinate
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)
#define REGISTER_FWDETAILVIEW(_classname_, _name_)
std::string info(const DetId &)
static Bool_t setColorSetViewer(TGLViewer *, Color_t)
int charge() const
track electric charge
math::XYZVector pairMomentum() const
Conversion tracks momentum from the tracks inner momentum.
void addTrackerHits3D(std::vector< TVector3 > &points, class TEveElementList *tList, Color_t color, int size)
Detector det() const
get the detector field from this detid
uint32_t getHitPattern(int position) const
void pushNearbyPixelHits(std::vector< TVector3 > &pixelPoints, const FWEventItem &iItem, const reco::Track &t)
tuple size
Write out results.
const FWGeometry * getGeom() const
double dPhiTracksAtVtx() const
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.