Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 45 additions & 10 deletions Fireworks/Tracks/plugins/FWPhase2TrackerCluster1DProxyBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
//
//

#include "TEvePointSet.h"
#include "TEveStraightLineSet.h"
#include "TEveCompound.h"
#include "TEveBox.h"
Expand All @@ -29,6 +28,11 @@ class FWPhase2TrackerCluster1DProxyBuilder : public FWProxyBuilderBase {
const FWPhase2TrackerCluster1DProxyBuilder& operator=(const FWPhase2TrackerCluster1DProxyBuilder&) = delete;

private:
void localModelChanges(const FWModelId& iId,
TEveElement* parent,
FWViewType::EType viewType,
const FWViewContext* vc) override;

using FWProxyBuilderBase::build;
void build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*) override;
};
Expand Down Expand Up @@ -61,24 +65,55 @@ void FWPhase2TrackerCluster1DProxyBuilder::build(const FWEventItem* iItem,
TEveElement* itemHolder = createCompound();
product->AddElement(itemHolder);

TEvePointSet* pointSet = new TEvePointSet;

if (!geom->contains(id)) {
fwLog(fwlog::kWarning) << "failed get geometry of Phase2TrackerCluster1D with detid: " << id << std::endl;
continue;
}

float localPoint[3] = {fireworks::phase2PixelLocalX((*itc).center(), pars, shape),
fireworks::phase2PixelLocalY((*itc).column(), pars, shape),
0.0};
float halfLength = shape[2];
float pitchSecond = pars[1];

// line
//
TEveStraightLineSet* lineSet = new TEveStraightLineSet;
float localPointBeg[3] = {fireworks::phase2PixelLocalX((*itc).center(), pars, shape),
float((*itc).column()) * pitchSecond - halfLength,
0.0};
float localPointEnd[3] = {fireworks::phase2PixelLocalX((*itc).center(), pars, shape),
float((*itc).column() + 1.0) * pitchSecond - halfLength,
0.0};

float globalPointBeg[3];
float globalPointEnd[3];
geom->localToGlobal(id, localPointBeg, globalPointBeg);
geom->localToGlobal(id, localPointEnd, globalPointEnd);

lineSet->AddLine(globalPointBeg, globalPointEnd);
lineSet->AddMarker(0, 0.5f);

float globalPoint[3];
geom->localToGlobal(id, localPoint, globalPoint);
const FWDisplayProperties& dp = FWProxyBuilderBase::item()->defaultDisplayProperties();
lineSet->SetMarkerColor(dp.color());

pointSet->SetNextPoint(globalPoint[0], globalPoint[1], globalPoint[2]);
setupAddElement(lineSet, itemHolder);
}
}
}

setupAddElement(pointSet, itemHolder);
void FWPhase2TrackerCluster1DProxyBuilder::localModelChanges(const FWModelId& iId,
TEveElement* parent,
FWViewType::EType viewType,
const FWViewContext* vc) {
if (TEveStraightLineSet* ls = dynamic_cast<TEveStraightLineSet*>(*parent->BeginChildren())) {
Color_t c = FWProxyBuilderBase::item()->modelInfo(iId.index()).displayProperties().color();
for (TEveProjectable::ProjList_i j = ls->BeginProjecteds(); j != ls->EndProjecteds(); ++j) {
if (TEveStraightLineSet* pls = dynamic_cast<TEveStraightLineSet*>(*j)) {
pls->SetMarkerColor(c);
pls->ElementChanged();
}
}

ls->SetMarkerColor(c);
ls->ElementChanged();
}
}

Expand Down