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);
84 if (
conv->nTracks() < 2)
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));
96 TGTextButton*
b =
new TGTextButton(
f,
action->getName().c_str());
97 f->AddFrame(
b,
new TGLayoutHints(kLHintsExpandX));
98 TQObject::Connect(
b,
"Clicked()",
"CSGAction",
action,
"activate()");
99 b->SetToolTipText(
"plane normal: track0 x track1");
105 TGTextButton*
b =
new TGTextButton(
f,
action->getName().c_str());
106 f->AddFrame(
b,
new TGLayoutHints(kLHintsExpandX));
107 TQObject::Connect(
b,
"Clicked()",
"CSGAction",
action,
"activate()");
108 b->SetToolTipText(
"left fir: track1");
113 TGTextButton*
b =
new TGTextButton(
f,
action->getName().c_str());
114 f->AddFrame(
b,
new TGLayoutHints(kLHintsExpandX));
115 TQObject::Connect(
b,
"Clicked()",
"CSGAction",
action,
"activate()");
117 b->SetToolTipText(
"plane normal: track1 ");
129 b->SetState(kButtonDown,
false);
130 m_guiFrame->AddFrame(
b,
new TGLayoutHints(kLHintsNormal, 2, 3, 1, 4));
131 TQObject::Connect(
b,
"Clicked()",
"CSGAction",
action,
"activate()");
137 b->SetState(kButtonDown,
false);
138 m_guiFrame->AddFrame(
b,
new TGLayoutHints(kLHintsNormal, 2, 3, 1, 4));
139 TQObject::Connect(
b,
"Clicked()",
"CSGAction",
action,
"activate()");
143 TGCompositeFrame*
p = (TGCompositeFrame*)
m_guiFrame->GetParent();
147 m_modules =
new TEveElementList(
"Modules");
151 m_hits =
new TEveElementList(
"Hits");
162 TEveGeoShape*
gs =
dynamic_cast<TEveGeoShape*
>(*i);
163 const auto& rhs = *(*(
i));
164 if (
gs ==
nullptr && (*
i !=
nullptr)) {
165 std::cerr <<
"Got a " <<
typeid(rhs).
name() <<
", expecting TEveGeoShape. ignoring (it must be the clusters)." 172 TString
name =
gs->GetElementTitle();
173 if (!
name.Contains(
"BAD") && !
name.Contains(
"INACTIVE") && !
name.Contains(
"LOST")) {
174 gs->SetMainColor(kBlue);
176 TEveText*
text =
new TEveText(
name.Data());
177 text->PtrMainTrans()->SetFrom(
gs->RefMainTrans().Array());
178 text->SetFontMode(TGLFont::kPixmap);
179 text->SetFontSize(12);
184 TEveTrackPropagator* prop =
new TEveTrackPropagator();
186 prop->SetStepper(TEveTrackPropagator::kRungeKutta);
190 prop->SetRnrDaughters(kTRUE);
191 prop->SetRnrReferences(kTRUE);
192 prop->SetRnrDecay(kTRUE);
195 prop->SetRnrFV(kTRUE);
196 prop->RefFVAtt().SetMarkerColor(
id.
item()->defaultDisplayProperties().color());
197 prop->RefFVAtt().SetMarkerSize(0.8);
200 prop->RefPMAtt().SetMarkerSize(0.5);
201 prop->RefPMAtt().SetMarkerColor(
id.
item()->defaultDisplayProperties().color());
205 trk1->SetLineWidth(2);
206 trk1->SetTitle(
"Track 1 and its ref states");
207 trk1->SetMainColor(
id.
item()->defaultDisplayProperties().color());
208 trk1->SetLineStyle(7);
213 trk0->SetLineWidth(2);
214 trk0->SetTitle(
"Track 0 and its ref states");
215 trk0->SetMainColor(
id.
item()->defaultDisplayProperties().color());
220 float phi =
conv->pairMomentum().phi();
221 float eta =
conv->pairMomentum().eta();
226 TEveCalo3D* calo3d =
new TEveCalo3D(
data);
227 gEve->AddElement(
data);
228 calo3d->SetBarrelRadius(129.00);
229 calo3d->SetEndCapPos(268.36);
231 float theta = TEveCaloData::EtaToTheta(
eta);
232 float ext =
data->GetMaxVal(
true) * calo3d->GetValToHeight();
233 if (TMath::Abs(
eta) < calo3d->GetTransitionEta()) {
235 float x = calo3d->GetBarrelRadius() * TMath::Cos(
phi);
236 float y = calo3d->GetBarrelRadius() * TMath::Sin(
phi);
237 float z = calo3d->GetBarrelRadius() / TMath::Tan(
theta);
239 calo3d->SetupBBoxCube(
ext,
x,
y,
z);
242 float z = TMath::Sign(calo3d->GetEndCapPos(),
eta);
243 float r =
z * TMath::Tan(
theta);
244 calo3d->SetupBBoxCube(
ext,
r * TMath::Cos(
phi),
r * TMath::Sin(
phi),
z);
250 TEveVectorD fwd = trk1->GetMomentum().Cross(trk0->GetMomentum());
252 TEveVectorD lft = trk1->GetMomentum();
254 TEveVectorD
up = lft.Cross(fwd);
256 TEveVectorD
c = (trk1->GetVertex() + trk0->GetVertex()) * 0.5;
258 setCameraInit(
viewerGL(), TGLViewer::kCameraPerspXOZ, fwd,
up,
c);
259 setCameraInit(
viewerGL(), TGLViewer::kCameraPerspYOZ,
up, lft,
c);
260 setCameraInit(
viewerGL(), TGLViewer::kCameraPerspXOY, lft, fwd,
c);
262 setCameraInit(
viewerGL(), TGLViewer::kCameraOrthoXOY, fwd,
up,
c);
263 setCameraInit(
viewerGL(), TGLViewer::kCameraOrthoXOZ,
up, lft,
c);
264 setCameraInit(
viewerGL(), TGLViewer::kCameraOrthoZOY, lft, fwd,
c);
273 TEveStraightLineSet* bls =
new TEveStraightLineSet(
"base1");
274 bls->AddLine(
c, fwd +
c);
275 bls->SetMainColor(kBlue);
276 bls->SetMainTransparency(transp);
277 bls->SetPickable(
false);
282 TEveStraightLineSet* bls =
new TEveStraightLineSet(
"base2");
283 bls->AddLine(
c, lft +
c);
284 bls->SetMainColor(kBlue);
285 bls->SetMainTransparency(transp);
286 bls->SetPickable(
false);
291 TEveStraightLineSet* bls =
new TEveStraightLineSet(
"base3");
292 bls->AddLine(
c,
up +
c);
293 bls->SetMainColor(kBlue);
294 bls->SetMainTransparency(transp);
295 bls->SetPickable(
false);
300 TEveStraightLineSet* bls =
new TEveStraightLineSet(
"Photon",
"Photon");
302 bls->AddLine(
c.fX,
c.fY,
c.fZ,
bs->x0(),
bs->y0(),
bs->z0());
303 bls->SetMainColor(
id.
item()->defaultDisplayProperties().color());
304 bls->SetLineStyle(3);
308 viewerGL()->SetStyle(TGLRnrCtx::kOutline);
309 viewerGL()->ResetCamerasAfterNextUpdate();
323 TLatex* latex =
new TLatex(
x,
y,
"");
324 const double textsize(0.07);
325 latex->SetTextSize(2 * textsize);
328 y -= latex->GetTextSize() * 0.6;
330 latex->SetTextSize(textsize);
331 float lineH = latex->GetTextSize() * 0.6;
335 Form(
"p_{T}=%.1f GeV, #eta=%0.2f, #varphi=%0.2f",
337 conv->pairMomentum().eta(),
338 conv->pairMomentum().phi()));
342 Form(
"vtx=(%.1f, %.1f, %.1f) r=%.1f [cm]",
343 conv->conversionVertex().x(),
344 conv->conversionVertex().y(),
345 conv->conversionVertex().z(),
346 conv->conversionVertex().position().rho()));
348 latex->DrawLatex(
x,
y, Form(
"#Deltactg#theta=%.3f",
conv->pairCotThetaSeparation()));
350 latex->DrawLatex(
x,
y, Form(
"#Delta#phi_{vtx}=%.3f",
conv->dPhiTracksAtVtx()));
352 latex->DrawLatex(
x,
y, Form(
"dist. min. app.=%.3f cm",
conv->distOfMinimumApproach()));
357 latex->DrawLatex(
x,
y, Form(
"Trk0 q=%i", track0->
charge()));
359 latex->DrawLatex(
x,
y, Form(
"p_{T}=%.1f GeV, #eta=%0.2f, #varphi=%0.2f", track0->
pt(), track0->
eta(), track0->
phi()));
362 int nvalid_tk0 = 0, ninvalid_tk0 = 0, npix_tk0 = 0, nstrip_tk0 = 0;
374 latex->DrawLatex(
x,
y, Form(
"valid hits: %i (pix. %i, str. %i)", nvalid_tk0, npix_tk0, nstrip_tk0));
376 latex->DrawLatex(
x,
y, Form(
"invalid: %i", ninvalid_tk0));
379 int npix_mhi_tk0 = 0, nstrip_mhi_tk0 = 0;
387 latex->DrawLatex(
x,
y, Form(
"miss. inner hits: pix. %i, str. %i", npix_mhi_tk0, nstrip_mhi_tk0));
392 latex->DrawLatex(
x,
y, Form(
"Trk1 q=%i", track1->
charge()));
394 latex->DrawLatex(
x,
y, Form(
"p_{T}=%.1f GeV, #eta=%0.2f, #varphi=%0.2f", track1->
pt(), track1->
eta(), track1->
phi()));
398 int nvalid_tk1 = 0, ninvalid_tk1 = 0, npix_tk1 = 0, nstrip_tk1 = 0;
410 latex->DrawLatex(
x,
y, Form(
"valid hits: %i (pix. %i, str. %i)", nvalid_tk1, npix_tk1, nstrip_tk1));
412 latex->DrawLatex(
x,
y, Form(
"invalid: %i", ninvalid_tk1));
415 int npix_mhi_tk1 = 0, nstrip_mhi_tk1 = 0;
423 latex->DrawLatex(
x,
y, Form(
"miss. inner hits: pix. %i, str. %i", npix_mhi_tk1, nstrip_mhi_tk1));
429 class TEveElementList* tList,
435 TEvePointSet* pointSet =
new TEvePointSet();
436 pointSet->SetMarkerSize(
size);
437 pointSet->SetMarkerStyle(4);
438 pointSet->SetPickable(kTRUE);
439 pointSet->SetTitle(
"Pixel Hits");
440 pointSet->SetMarkerColor(color);
442 for (std::vector<TVector3>::const_iterator it =
points.begin(), itEnd =
points.end(); it != itEnd; ++it) {
443 pointSet->SetNextPoint(it->x(), it->y(), it->z());
445 tList->AddElement(pointSet);
450 TEveElement* trkList,
451 bool addNearbyHits) {
452 std::vector<TVector3> pixelPoints;
454 TEveElementList* pixels =
new TEveElementList(
"Pixels");
455 trkList->AddElement(pixels);
458 std::vector<TVector3> pixelExtraPoints;
470 TEveElementList*
strips =
new TEveElementList(
"Strips");
471 trkList->AddElement(
strips);
479 TEveElement* trkList,
481 std::set<unsigned int> ids;
484 DetId detid = (*recIt)->geographicalId();
485 if (!addLostHits && !(*recIt)->isValid())
487 if (detid.
rawId() != 0) {
489 switch (detid.
det()) {
505 name =
"Pixel Barrel ";
508 name =
"Pixel Endcap ";
537 if (
nullptr != shape) {
538 shape->SetMainTransparency(65);
539 shape->SetPickable(kTRUE);
540 switch ((*recIt)->type()) {
548 shape->SetMainColor(kRed);
554 shape->SetMainColor(28);
558 shape->SetMainColor(218);
561 shape->SetTitle(
name + ULong_t(detid.
rawId()));
562 trkList->AddElement(shape);
576 viewerGL()->SetDrawCameraCenter(kTRUE);
void addModules(const reco::Track &track, const FWEventItem *iItem, TEveElement *trkList, bool addLostHits)
~FWConvTrackHitsDetailView() override
void build(const FWModelId &id, const reco::Conversion *) override
static bool pixelHitFilter(uint16_t pattern)
TEveTrack * prepareTrack(const reco::Track &track, TEveTrackPropagator *propagator, const std::vector< TEveVector > &extraRefPoints=std::vector< TEveVector >())
static constexpr auto TID
int numberOfAllHits(HitCategory category) const
FWBeamSpot * getBeamSpot() const
const FWEventItem * item()
const fireworks::Context & context() const
#define REGISTER_FWDETAILVIEW(_classname_, _name_,...)
constexpr Detector det() const
get the detector field from this detid
TEMPL(T2) struct Divides void
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)
double pt() const
track transverse momentum
void setTextInfo(const FWModelId &id, const reco::Conversion *) override
int charge() const
track electric charge
TEveElementList * m_moduleLabels
const FWDisplayProperties & defaultDisplayProperties() const
static bool stripHitFilter(uint16_t pattern)
TGCompositeFrame * m_guiFrame
constexpr unsigned getField(const uint32_t u, const unsigned mask, const unsigned offset)
double phi() const
azimuthal angle of momentum vector
void setName(const std::string &name)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
FWConvTrackHitsDetailView()
void pushPixelHits(std::vector< TVector3 > &pixelPoints, const FWEventItem &iItem, const reco::Track &t)
static constexpr auto TOB
TEveElementList * m_modules
uint16_t getHitPattern(HitCategory category, int position) const
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)
double eta() const
pseudorapidity of momentum vector
TEveGeoShape * getEveShape(unsigned int id) const
const FWGeometry * getGeom() const
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
TGLViewer * viewerGL() const
constexpr uint32_t rawId() const
get the raw id
static constexpr auto TIB
char data[epos_bytes_allocation]
std::string info(const DetId &)
sigc::signal< void()> activated
CSGAction * m_camTypeAction
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
void addTrackerHits3D(std::vector< TVector3 > &points, class TEveElementList *tList, Color_t color, int size)
Geom::Theta< T > theta() const
void pushNearbyPixelHits(std::vector< TVector3 > &pixelPoints, const FWEventItem &iItem, const reco::Track &t)
static constexpr auto TEC
static constexpr float b1
const TrackExtraRef & extra() const
reference to "extra" object