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"
48 : m_modules(nullptr), m_moduleLabels(nullptr), m_hits(nullptr), m_legend(nullptr), m_orthographic(
false) {}
54 TGLViewer*
v, TGLViewer::ECameraType
type,
const TEveVectorD
b1, TEveVectorD b3, TEveVector center) {
55 TGLCamera& cam = v->RefCamera(type);
56 TGLMatrix& trans = cam.RefCamBase();
58 trans.Set(trans.GetTranslation(), b3.Arr(), b1.Arr());
59 cam.Setup(v->RefOverallBoundingBox(), kTRUE);
61 cam.SetExternalCenter(
true);
62 cam.SetCenterVec(center.fX, center.fY, center.fZ);
89 m_guiFrame->AddFrame(
new TGLabel(
m_guiFrame,
"Camera Views:"),
new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
92 TGHorizontalFrame*
f =
new TGHorizontalFrame(
m_guiFrame);
93 m_guiFrame->AddFrame(f,
new TGLayoutHints(kLHintsExpandX, 2, 0, 0, 0));
97 TGTextButton*
b =
new TGTextButton(f, action->
getName().c_str());
98 f->AddFrame(b,
new TGLayoutHints(kLHintsExpandX));
99 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
100 b->SetToolTipText(
"plane normal: track0 x track1");
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(
"left fir: track1");
114 TGTextButton*
b =
new TGTextButton(f, action->
getName().c_str());
115 f->AddFrame(b,
new TGLayoutHints(kLHintsExpandX));
116 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
118 b->SetToolTipText(
"plane normal: track1 ");
131 b->SetState(kButtonDown,
false);
132 m_guiFrame->AddFrame(b,
new TGLayoutHints(kLHintsNormal, 2, 3, 1, 4));
133 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
139 b->SetState(kButtonDown,
false);
140 m_guiFrame->AddFrame(b,
new TGLayoutHints(kLHintsNormal, 2, 3, 1, 4));
141 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
145 TGCompositeFrame*
p = (TGCompositeFrame*)
m_guiFrame->GetParent();
149 m_modules =
new TEveElementList(
"Modules");
153 m_hits =
new TEveElementList(
"Hits");
164 TEveGeoShape* gs =
dynamic_cast<TEveGeoShape*
>(*i);
165 const auto& rhs = *(*(
i));
166 if (gs ==
nullptr && (*
i !=
nullptr)) {
167 std::cerr <<
"Got a " <<
typeid(rhs).
name() <<
", expecting TEveGeoShape. ignoring (it must be the clusters)."
174 TString
name = gs->GetElementTitle();
175 if (!name.Contains(
"BAD") && !name.Contains(
"INACTIVE") && !name.Contains(
"LOST")) {
176 gs->SetMainColor(kBlue);
178 TEveText*
text =
new TEveText(name.Data());
179 text->PtrMainTrans()->SetFrom(gs->RefMainTrans().Array());
180 text->SetFontMode(TGLFont::kPixmap);
181 text->SetFontSize(12);
186 TEveTrackPropagator* prop =
new TEveTrackPropagator();
188 prop->SetStepper(TEveTrackPropagator::kRungeKutta);
192 prop->SetRnrDaughters(kTRUE);
193 prop->SetRnrReferences(kTRUE);
194 prop->SetRnrDecay(kTRUE);
197 prop->SetRnrFV(kTRUE);
198 prop->RefFVAtt().SetMarkerColor(
id.
item()->defaultDisplayProperties().color());
199 prop->RefFVAtt().SetMarkerSize(0.8);
202 prop->RefPMAtt().SetMarkerSize(0.5);
203 prop->RefPMAtt().SetMarkerColor(
id.
item()->defaultDisplayProperties().color());
207 trk1->SetLineWidth(2);
208 trk1->SetTitle(
"Track 1 and its ref states");
209 trk1->SetMainColor(
id.
item()->defaultDisplayProperties().color());
210 trk1->SetLineStyle(7);
215 trk0->SetLineWidth(2);
216 trk0->SetTitle(
"Track 0 and its ref states");
217 trk0->SetMainColor(
id.
item()->defaultDisplayProperties().color());
228 TEveCalo3D* calo3d =
new TEveCalo3D(data);
229 gEve->AddElement(data);
230 calo3d->SetBarrelRadius(129.00);
231 calo3d->SetEndCapPos(268.36);
233 float theta = TEveCaloData::EtaToTheta(eta);
234 float ext = data->GetMaxVal(
true) * calo3d->GetValToHeight();
235 if (
TMath::Abs(eta) < calo3d->GetTransitionEta()) {
237 float x = calo3d->GetBarrelRadius() * TMath::Cos(phi);
238 float y = calo3d->GetBarrelRadius() * TMath::Sin(phi);
239 float z = calo3d->GetBarrelRadius() / TMath::Tan(theta);
241 calo3d->SetupBBoxCube(ext, x, y, z);
245 float r = z * TMath::Tan(theta);
246 calo3d->SetupBBoxCube(ext, r * TMath::Cos(phi), r * TMath::Sin(phi), z);
252 TEveVectorD fwd = trk1->GetMomentum().Cross(trk0->GetMomentum());
254 TEveVectorD lft = trk1->GetMomentum();
256 TEveVectorD
up = lft.Cross(fwd);
258 TEveVectorD
c = (trk1->GetVertex() + trk0->GetVertex()) * 0.5;
260 setCameraInit(
viewerGL(), TGLViewer::kCameraPerspXOZ, fwd, up, c);
261 setCameraInit(
viewerGL(), TGLViewer::kCameraPerspYOZ, up, lft, c);
262 setCameraInit(
viewerGL(), TGLViewer::kCameraPerspXOY, lft, fwd, c);
264 setCameraInit(
viewerGL(), TGLViewer::kCameraOrthoXOY, fwd, up, c);
265 setCameraInit(
viewerGL(), TGLViewer::kCameraOrthoXOZ, up, lft, c);
266 setCameraInit(
viewerGL(), TGLViewer::kCameraOrthoZOY, lft, fwd, c);
275 TEveStraightLineSet* bls =
new TEveStraightLineSet(
"base1");
276 bls->AddLine(c, fwd + c);
277 bls->SetMainColor(kBlue);
278 bls->SetMainTransparency(transp);
279 bls->SetPickable(
false);
284 TEveStraightLineSet* bls =
new TEveStraightLineSet(
"base2");
285 bls->AddLine(c, lft + c);
286 bls->SetMainColor(kBlue);
287 bls->SetMainTransparency(transp);
288 bls->SetPickable(
false);
293 TEveStraightLineSet* bls =
new TEveStraightLineSet(
"base3");
294 bls->AddLine(c, up + c);
295 bls->SetMainColor(kBlue);
296 bls->SetMainTransparency(transp);
297 bls->SetPickable(
false);
302 TEveStraightLineSet* bls =
new TEveStraightLineSet(
"Photon",
"Photon");
304 bls->AddLine(c.fX, c.fY, c.fZ, bs->
x0(), bs->
y0(), bs->
z0());
305 bls->SetMainColor(
id.
item()->defaultDisplayProperties().color());
306 bls->SetLineStyle(3);
310 viewerGL()->SetStyle(TGLRnrCtx::kOutline);
311 viewerGL()->ResetCamerasAfterNextUpdate();
325 TLatex* latex =
new TLatex(x, y,
"");
326 const double textsize(0.07);
327 latex->SetTextSize(2 * textsize);
329 latex->DrawLatex(x, y,
id.
item()->modelName(
id.
index()).c_str());
330 y -= latex->GetTextSize() * 0.6;
332 latex->SetTextSize(textsize);
333 float lineH = latex->GetTextSize() * 0.6;
337 Form(
"p_{T}=%.1f GeV, #eta=%0.2f, #varphi=%0.2f",
344 Form(
"vtx=(%.1f, %.1f, %.1f) r=%.1f [cm]",
352 latex->DrawLatex(x, y, Form(
"#Delta#phi_{vtx}=%.3f", conv->
dPhiTracksAtVtx()));
359 latex->DrawLatex(x, y, Form(
"Trk0 q=%i", track0->
charge()));
361 latex->DrawLatex(x, y, Form(
"p_{T}=%.1f GeV, #eta=%0.2f, #varphi=%0.2f", track0->
pt(), track0->
eta(), track0->
phi()));
364 int nvalid_tk0 = 0, ninvalid_tk0 = 0, npix_tk0 = 0, nstrip_tk0 = 0;
376 latex->DrawLatex(x, y, Form(
"valid hits: %i (pix. %i, str. %i)", nvalid_tk0, npix_tk0, nstrip_tk0));
378 latex->DrawLatex(x, y, Form(
"invalid: %i", ninvalid_tk0));
381 int npix_mhi_tk0 = 0, nstrip_mhi_tk0 = 0;
389 latex->DrawLatex(x, y, Form(
"miss. inner hits: pix. %i, str. %i", npix_mhi_tk0, nstrip_mhi_tk0));
394 latex->DrawLatex(x, y, Form(
"Trk1 q=%i", track1->
charge()));
396 latex->DrawLatex(x, y, Form(
"p_{T}=%.1f GeV, #eta=%0.2f, #varphi=%0.2f", track1->
pt(), track1->
eta(), track1->
phi()));
400 int nvalid_tk1 = 0, ninvalid_tk1 = 0, npix_tk1 = 0, nstrip_tk1 = 0;
412 latex->DrawLatex(x, y, Form(
"valid hits: %i (pix. %i, str. %i)", nvalid_tk1, npix_tk1, nstrip_tk1));
414 latex->DrawLatex(x, y, Form(
"invalid: %i", ninvalid_tk1));
417 int npix_mhi_tk1 = 0, nstrip_mhi_tk1 = 0;
425 latex->DrawLatex(x, y, Form(
"miss. inner hits: pix. %i, str. %i", npix_mhi_tk1, nstrip_mhi_tk1));
431 class TEveElementList* tList,
437 TEvePointSet* pointSet =
new TEvePointSet();
438 pointSet->SetMarkerSize(size);
439 pointSet->SetMarkerStyle(4);
440 pointSet->SetPickable(kTRUE);
441 pointSet->SetTitle(
"Pixel Hits");
442 pointSet->SetMarkerColor(color);
444 for (std::vector<TVector3>::const_iterator it = points.begin(), itEnd = points.end(); it != itEnd; ++it) {
445 pointSet->SetNextPoint(it->x(), it->y(), it->z());
447 tList->AddElement(pointSet);
452 TEveElement* trkList,
453 bool addNearbyHits) {
454 std::vector<TVector3> pixelPoints;
456 TEveElementList* pixels =
new TEveElementList(
"Pixels");
457 trkList->AddElement(pixels);
460 std::vector<TVector3> pixelExtraPoints;
472 TEveElementList*
strips =
new TEveElementList(
"Strips");
473 trkList->AddElement(strips);
481 TEveElement* trkList,
483 std::set<unsigned int> ids;
486 DetId detid = (*recIt)->geographicalId();
487 if (!addLostHits && !(*recIt)->isValid())
489 if (detid.
rawId() != 0) {
491 switch (detid.
det()) {
507 name =
"Pixel Barrel ";
510 name =
"Pixel Endcap ";
539 if (
nullptr != shape) {
540 shape->SetMainTransparency(65);
541 shape->SetPickable(kTRUE);
542 switch ((*recIt)->type()) {
550 shape->SetMainColor(kRed);
556 shape->SetMainColor(28);
560 shape->SetMainColor(218);
563 shape->SetTitle(name + ULong_t(detid.
rawId()));
564 trkList->AddElement(shape);
578 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
const edm::EventSetup & c
~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 constexpr auto TID
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
#define REGISTER_FWDETAILVIEW(_classname_, _name_,...)
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
tuple strips
#turn off noise in all subdetectors simHcalUnsuppressedDigis.doNoise = False mix.digitizers.hcal.doNoise = False simEcalUnsuppressedDigis.doNoise = False mix.digitizers.ecal.doNoise = False simEcalUnsuppressedDigis.doESNoise = False simSiPixelDigis.AddNoise = False mix.digitizers.pixel.AddNoise = False simSiStripDigis.Noise = False mix.digitizers.strip.AddNoise = False
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.
static constexpr auto TOB
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.
static constexpr auto TIB
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)
tuple size
Write out results.
const FWGeometry * getGeom() const
double dPhiTracksAtVtx() const
static constexpr auto TEC
static constexpr float b1
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.