4 #include "TGLFontManager.h" 6 #include "TEveManager.h" 7 #include "TEveStraightLineSet.h" 9 #include "TEveTrackPropagator.h" 10 #include "TEveTrans.h" 12 #include "TEveGeoShape.h" 20 #include "TEveCaloData.h" 61 void setCameraInit(TGLViewer*
v, TGLViewer::ECameraType
type,
const TEveVectorD b1, TEveVectorD b3, TEveVector center )
63 TGLCamera& cam = v->RefCamera(type);
64 TGLMatrix& trans = cam.RefCamBase();
66 trans.Set(trans.GetTranslation(), b3.Arr(), b1.Arr());
67 cam.Setup(v->RefOverallBoundingBox(), kTRUE);
69 cam.SetExternalCenter(
true);
70 cam.SetCenterVec(center.fX, center.fY, center.fZ);
98 m_guiFrame->AddFrame(
new TGLabel(
m_guiFrame,
"Camera Views:"),
new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
101 TGHorizontalFrame*
f =
new TGHorizontalFrame(
m_guiFrame);
102 m_guiFrame->AddFrame(f,
new TGLayoutHints(kLHintsExpandX, 2, 0, 0, 0));
106 TGTextButton*
b =
new TGTextButton(f, action->
getName().c_str());
107 f->AddFrame(b,
new TGLayoutHints( kLHintsExpandX));
108 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
109 b->SetToolTipText(
"plane normal: track0 x track1");
115 TGTextButton*
b =
new TGTextButton(f, action->
getName().c_str());
116 f->AddFrame(b,
new TGLayoutHints( kLHintsExpandX));
117 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
118 b->SetToolTipText(
"left fir: track1");
123 TGTextButton*
b =
new TGTextButton(f, action->
getName().c_str());
124 f->AddFrame(b,
new TGLayoutHints( kLHintsExpandX));
125 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
127 b->SetToolTipText(
"plane normal: track1 ");
141 b->SetState(kButtonDown,
false);
142 m_guiFrame->AddFrame(b,
new TGLayoutHints( kLHintsNormal, 2, 3, 1, 4));
143 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
149 b->SetState(kButtonDown,
false);
150 m_guiFrame->AddFrame(b,
new TGLayoutHints( kLHintsNormal, 2, 3, 1, 4));
151 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
155 TGCompositeFrame*
p = (TGCompositeFrame*)
m_guiFrame->GetParent();
159 m_modules =
new TEveElementList(
"Modules" );
163 m_hits =
new TEveElementList(
"Hits" );
177 TEveGeoShape*
gs =
dynamic_cast<TEveGeoShape*
>(*i);
178 const auto & rhs = *(*(
i));
179 if (gs ==
nullptr && (*
i !=
nullptr)) {
180 std::cerr <<
"Got a " <<
typeid( rhs ).
name() <<
", expecting TEveGeoShape. ignoring (it must be the clusters)." << std::endl;
186 TString
name = gs->GetElementTitle();
187 if (!name.Contains(
"BAD") && !name.Contains(
"INACTIVE") && !name.Contains(
"LOST")) {
188 gs->SetMainColor(kBlue);
190 TEveText*
text =
new TEveText(name.Data());
191 text->PtrMainTrans()->SetFrom(gs->RefMainTrans().Array());
192 text->SetFontMode(TGLFont::kPixmap);
193 text->SetFontSize(12);
198 TEveTrackPropagator* prop =
new TEveTrackPropagator();
200 prop->SetStepper(TEveTrackPropagator::kRungeKutta);
204 prop->SetRnrDaughters(kTRUE);
205 prop->SetRnrReferences(kTRUE);
206 prop->SetRnrDecay(kTRUE);
209 prop->SetRnrFV(kTRUE);
210 prop->RefFVAtt().SetMarkerColor(
id.
item()->defaultDisplayProperties().
color());
211 prop->RefFVAtt().SetMarkerSize(0.8);
214 prop->RefPMAtt().SetMarkerSize(0.5);
215 prop->RefPMAtt().SetMarkerColor(
id.
item()->defaultDisplayProperties().
color());
219 trk1->SetLineWidth(2);
220 trk1->SetTitle(
"Track 1 and its ref states" );
221 trk1->SetMainColor(
id.
item()->defaultDisplayProperties().
color());
222 trk1->SetLineStyle(7);
227 trk0->SetLineWidth(2);
228 trk0->SetTitle(
"Track 0 and its ref states" );
229 trk0->SetMainColor(
id.
item()->defaultDisplayProperties().
color());
240 TEveCalo3D* calo3d =
new TEveCalo3D(data);
241 gEve->AddElement(data);
242 calo3d->SetBarrelRadius(129.00);
243 calo3d->SetEndCapPos(268.36);
245 float theta = TEveCaloData::EtaToTheta(eta);
246 float ext = data->GetMaxVal(
true) * calo3d->GetValToHeight();
247 if (
TMath::Abs(eta) < calo3d->GetTransitionEta())
250 float x = calo3d->GetBarrelRadius() * TMath::Cos(phi);
251 float y = calo3d->GetBarrelRadius() * TMath::Sin(phi);
252 float z = calo3d->GetBarrelRadius() / TMath::Tan(theta);
254 calo3d->SetupBBoxCube(ext, x, y, z);
260 float r = z*TMath::Tan(theta);
261 calo3d->SetupBBoxCube(ext, r* TMath::Cos(phi), r*TMath::Sin(phi), z);
267 TEveVectorD fwd = trk1->GetMomentum().Cross(trk0->GetMomentum());
269 TEveVectorD lft =trk1->GetMomentum();
271 TEveVectorD
up = lft.Cross(fwd);
274 TEveVectorD
c = ( trk1->GetVertex() + trk0->GetVertex()) *0.5;
277 setCameraInit(
viewerGL(),TGLViewer::kCameraPerspXOZ, fwd, up, c);
278 setCameraInit(
viewerGL(),TGLViewer::kCameraPerspYOZ, up, lft,c);
279 setCameraInit(
viewerGL(),TGLViewer::kCameraPerspXOY, lft, fwd,c);
281 setCameraInit(
viewerGL(),TGLViewer::kCameraOrthoXOY, fwd, up,c);
282 setCameraInit(
viewerGL(),TGLViewer::kCameraOrthoXOZ, up, lft,c);
283 setCameraInit(
viewerGL(),TGLViewer::kCameraOrthoZOY, lft, fwd,c);
292 TEveStraightLineSet* bls =
new TEveStraightLineSet(
"base1");
293 bls->AddLine(c, fwd + c);
294 bls->SetMainColor(kBlue);
295 bls->SetMainTransparency(transp);
296 bls->SetPickable(
false);
301 TEveStraightLineSet* bls =
new TEveStraightLineSet(
"base2");
302 bls->AddLine(c, lft + c);
303 bls->SetMainColor(kBlue);
304 bls->SetMainTransparency(transp);
305 bls->SetPickable(
false);
310 TEveStraightLineSet* bls =
new TEveStraightLineSet(
"base3");
311 bls->AddLine(c, up + c);
312 bls->SetMainColor(kBlue);
313 bls->SetMainTransparency(transp);
314 bls->SetPickable(
false);
319 TEveStraightLineSet* bls =
new TEveStraightLineSet(
"Photon",
"Photon");
321 bls->AddLine(c.fX, c.fY, c.fZ, bs->
x0(), bs->
y0(), bs->
z0());
322 bls->SetMainColor(
id.
item()->defaultDisplayProperties().
color());
323 bls->SetLineStyle(3);
327 viewerGL()->SetStyle(TGLRnrCtx::kOutline);
328 viewerGL()->ResetCamerasAfterNextUpdate();
344 TLatex* latex =
new TLatex( x, y,
"" );
345 const double textsize( 0.07 );
346 latex->SetTextSize( 2*textsize );
349 y -= latex->GetTextSize()*0.6;
351 latex->SetTextSize( textsize );
352 float lineH = latex->GetTextSize()*0.6;
354 latex->DrawLatex( x, y, Form(
"p_{T}=%.1f GeV, #eta=%0.2f, #varphi=%0.2f",
357 latex->DrawLatex( x, y, Form(
"vtx=(%.1f, %.1f, %.1f) r=%.1f [cm]",
361 latex->DrawLatex( x, y, Form(
"#Deltactg#theta=%.3f",
364 latex->DrawLatex( x, y, Form(
"#Delta#phi_{vtx}=%.3f",
367 latex->DrawLatex( x, y, Form(
"dist. min. app.=%.3f cm",
374 latex->DrawLatex( x, y, Form(
"Trk0 q=%i",track0->
charge()));
376 latex->DrawLatex( x, y, Form(
"p_{T}=%.1f GeV, #eta=%0.2f, #varphi=%0.2f",
377 track0->
pt(), track0->
eta(), track0->
phi()));
380 int nvalid_tk0 = 0, ninvalid_tk0 = 0, npix_tk0 = 0, nstrip_tk0 = 0;
387 }
else ninvalid_tk0++;
389 latex->DrawLatex( x, y, Form(
"valid hits: %i (pix. %i, str. %i)", nvalid_tk0, npix_tk0, nstrip_tk0) );
391 latex->DrawLatex( x, y, Form(
"invalid: %i", ninvalid_tk0) );
394 int npix_mhi_tk0 = 0, nstrip_mhi_tk0 = 0;
400 latex->DrawLatex( x, y, Form(
"miss. inner hits: pix. %i, str. %i", npix_mhi_tk0, nstrip_mhi_tk0) );
405 latex->DrawLatex( x, y, Form(
"Trk1 q=%i",track1->
charge()));
407 latex->DrawLatex( x, y, Form(
"p_{T}=%.1f GeV, #eta=%0.2f, #varphi=%0.2f",
408 track1->
pt(), track1->
eta(), track1->
phi()));
412 int nvalid_tk1 = 0, ninvalid_tk1 = 0, npix_tk1 = 0, nstrip_tk1 = 0;
419 }
else ninvalid_tk1++;
421 latex->DrawLatex( x, y, Form(
"valid hits: %i (pix. %i, str. %i)", nvalid_tk1, npix_tk1, nstrip_tk1) );
423 latex->DrawLatex( x, y, Form(
"invalid: %i", ninvalid_tk1) );
426 int npix_mhi_tk1 = 0, nstrip_mhi_tk1 = 0;
432 latex->DrawLatex( x, y, Form(
"miss. inner hits: pix. %i, str. %i", npix_mhi_tk1, nstrip_mhi_tk1) );
444 TEvePointSet* pointSet =
new TEvePointSet();
445 pointSet->SetMarkerSize(size);
446 pointSet->SetMarkerStyle(4);
447 pointSet->SetPickable(kTRUE);
448 pointSet->SetTitle(
"Pixel Hits");
449 pointSet->SetMarkerColor(color);
451 for( std::vector<TVector3>::const_iterator it = points.begin(), itEnd = points.end(); it != itEnd; ++it) {
452 pointSet->SetNextPoint(it->x(), it->y(), it->z());
454 tList->AddElement(pointSet);
460 TEveElement* trkList,
463 std::vector<TVector3> pixelPoints;
465 TEveElementList* pixels =
new TEveElementList(
"Pixels" );
466 trkList->AddElement( pixels );
470 std::vector<TVector3> pixelExtraPoints;
484 TEveElementList*
strips =
new TEveElementList(
"Strips" );
485 trkList->AddElement( strips );
494 TEveElement* trkList,
497 std::set<unsigned int> ids;
499 recIt != recItEnd; ++recIt )
501 DetId detid = (*recIt)->geographicalId();
502 if( !addLostHits && !(*recIt)->isValid())
continue;
503 if( detid.
rawId() != 0 )
524 name =
"Pixel Barrel ";
527 name =
"Pixel Endcap ";
553 if( ! ids.insert( detid.
rawId()).
second )
continue;
557 if(
nullptr != shape )
559 shape->SetMainTransparency( 65 );
560 shape->SetPickable( kTRUE );
561 switch(( *recIt )->type())
570 shape->SetMainColor( kRed );
576 shape->SetMainColor( 28 );
580 shape->SetMainColor( 218 );
583 shape->SetTitle( name + ULong_t( detid.
rawId()));
584 trkList->AddElement( shape );
601 viewerGL()->SetDrawCameraCenter(kTRUE);
const reco::Vertex & conversionVertex() const
returns the reco conversion vertex
const std::string & getName() const
void addModules(const reco::Track &track, const FWEventItem *iItem, TEveElement *trkList, bool addLostHits)
const FWDisplayProperties & defaultDisplayProperties() const
~FWConvTrackHitsDetailView() override
void build(const FWModelId &id, const reco::Conversion *) override
TGLViewer * viewerGL() const
static bool pixelHitFilter(uint16_t pattern)
const TrackExtraRef & extra() const
reference to "extra" object
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
constexpr uint32_t rawId() const
get the raw id
Geom::Theta< T > theta() const
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.
double phi() const
azimuthal angle of momentum vector
const Point & position() const
position
TEveCaloData * buildCaloData(bool xyEE)
static bool validHitFilter(uint16_t pattern)
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)
void setTextInfo(const FWModelId &id, const reco::Conversion *) override
FWBeamSpot * getBeamSpot() const
const fireworks::Context & context() const
double eta() const
pseudorapidity of momentum vector
TEveGeoShape * getEveShape(unsigned int id) const
TEveElementList * m_moduleLabels
double pt() const
track transverse momentum
static bool stripHitFilter(uint16_t pattern)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
int numberOfAllHits(HitCategory category) const
TGCompositeFrame * m_guiFrame
double z() const
z coordinate
constexpr unsigned getField(const uint32_t u, const unsigned mask, const unsigned offset)
void setName(const std::string &name)
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.
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.
double x() const
x coordinate
math::XYZVectorF pairMomentum() const
Conversion tracks momentum from the tracks inner momentum.
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
#define REGISTER_FWDETAILVIEW(_classname_, _name_,...)
char data[epos_bytes_allocation]
std::string info(const DetId &)
CSGAction * m_camTypeAction
int charge() const
track electric charge
void addTrackerHits3D(std::vector< TVector3 > &points, class TEveElementList *tList, Color_t color, int size)
uint16_t getHitPattern(HitCategory category, int position) const
void pushNearbyPixelHits(std::vector< TVector3 > &pixelPoints, const FWEventItem &iItem, const reco::Track &t)
const FWGeometry * getGeom() const
double dPhiTracksAtVtx() const
std::vector< edm::RefToBase< reco::Track > > const & tracks() const
vector of track to base references
constexpr Detector det() const
get the detector field from this detid
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.