Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion Fireworks/Calo/interface/FWTauProxyBuilderBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ class FWTauProxyBuilderBase : public FWProxyBuilderBase {
void addConstituentTracks(const reco::BaseTau& tau, class TEveElement* product);
// Add leading Track
void addLeadTrack(const reco::BaseTau& tau, class TEveElement* product);
std::vector<fireworks::scaleMarker> m_lines;
};

#endif
56 changes: 26 additions & 30 deletions Fireworks/Calo/plugins/FWJetProxyBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ class FWJetProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::Jet> {
void setTextPos(fireworks::jetScaleMarker& s, const FWViewContext* vc, FWViewType::EType);

TEveElementList* m_common;

std::vector<fireworks::jetScaleMarker> m_lines;
};

//______________________________________________________________________________
Expand Down Expand Up @@ -134,9 +132,7 @@ void FWJetProxyBuilder::buildViewType(const reco::Jet& iData,

// scale markers in projected views
if (FWViewType::isProjected(type)) {
m_lines.push_back(
fireworks::jetScaleMarker(new TEveScalableStraightLineSet("jetline"), iData.et(), iData.energy(), vc));
fireworks::jetScaleMarker& markers = m_lines.back();
fireworks::jetScaleMarker markers(new TEveScalableStraightLineSet("jetline"), iData.et(), iData.energy(), vc);

float size = 1.f; // values are saved in scale
double theta = iData.theta();
Expand Down Expand Up @@ -190,34 +186,11 @@ void FWJetProxyBuilder::localModelChanges(const FWModelId& iId,
FWViewType::EType viewType,
const FWViewContext* vc) {
increaseComponentTransparency(iId.index(), iCompound, "TEveJetCone", 80);

for (Lines_t::iterator i = m_lines.begin(); i != m_lines.end(); ++i) {
TEveStraightLineSetProjected* projLineSet = (TEveStraightLineSetProjected*)(*(*i).m_ls->BeginProjecteds());
if (projLineSet)
projLineSet->UpdateProjection();
}
}

void FWJetProxyBuilder::cleanLocal() {
m_lines.clear();
m_common->DestroyElements();
}

void FWJetProxyBuilder::scaleProduct(TEveElementList* parent, FWViewType::EType type, const FWViewContext* vc) {
for (Lines_t::iterator i = m_lines.begin(); i != m_lines.end(); ++i) {
if (vc == (*i).m_vc) {
float value = vc->getEnergyScale()->getPlotEt() ? (*i).m_et : (*i).m_energy;

(*i).m_ls->SetScale(vc->getEnergyScale()->getScaleFactor3D() * value);
if ((*i).m_text) {
(*i).m_text->SetText(Form("%.1f", value));
setTextPos(*i, vc, type);
}
TEveStraightLineSetProjected* projLineSet = (TEveStraightLineSetProjected*)(*(*i).m_ls->BeginProjecteds());
projLineSet->UpdateProjection();
}
}
void FWJetProxyBuilder::cleanLocal() { m_common->DestroyElements(); }

void FWJetProxyBuilder::scaleProduct(TEveElementList* product, FWViewType::EType viewType, const FWViewContext* vc) {
// move jets to eventCenter
fireworks::Context* contextGl = fireworks::Context::getInstance();
TEveVector cv;
Expand All @@ -228,6 +201,29 @@ void FWJetProxyBuilder::scaleProduct(TEveElementList* parent, FWViewType::EType
cone->SetApex(cv);
}
}

// loop compounds in projected product
int idx = 0;
for (auto& c : product->RefChildren()) {
TEveElement* parent = c;
// check the compound has more than one element (the first one is jet)
if (parent->NumChildren() > 1) {
auto compIt = parent->BeginChildren();
compIt++;
TEveScalableStraightLineSet* lineSet = dynamic_cast<TEveScalableStraightLineSet*>(*compIt);
if (lineSet) {
// compund index in the product is an index of model data in the collection
const void* modelData = item()->modelData(idx);
const reco::Jet* jet = (const reco::Jet*)(modelData);
float value = vc->getEnergyScale()->getPlotEt() ? jet->et() : jet->energy();
lineSet->SetScale(vc->getEnergyScale()->getScaleFactor3D() * value);
for (TEveProjectable::ProjList_i j = lineSet->BeginProjecteds(); j != lineSet->EndProjecteds(); ++j) {
(*j)->UpdateProjection();
}
}
}
idx++;
}
}

void FWJetProxyBuilder::setTextPos(fireworks::jetScaleMarker& s, const FWViewContext* vc, FWViewType::EType type) {
Expand Down
32 changes: 13 additions & 19 deletions Fireworks/Calo/plugins/FWMETProxyBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ class FWMETProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::MET> {

void scaleProduct(TEveElementList* parent, FWViewType::EType, const FWViewContext* vc) override;

void cleanLocal() override { m_lines.clear(); }

REGISTER_PROXYBUILDER_METHODS();

private:
Expand All @@ -59,27 +57,24 @@ class FWMETProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::MET> {
TEveElement& oItemHolder,
FWViewType::EType type,
const FWViewContext*) override;

std::vector<fireworks::scaleMarker> m_lines;
};

void FWMETProxyBuilder::scaleProduct(TEveElementList* parent, FWViewType::EType type, const FWViewContext* vc) {
typedef std::vector<fireworks::scaleMarker> Lines_t;
FWViewEnergyScale* caloScale = vc->getEnergyScale();

// printf("MET %s %p -> %f\n", item()->name().c_str(), vc, caloScale->getScaleFactor3D() );
for (Lines_t::iterator i = m_lines.begin(); i != m_lines.end(); ++i) {
if (vc == (*i).m_vc) {
// printf("lineset %s %p val %f ...%f\n", item()->name().c_str(), (*i).m_ls , (*i).m_et, caloScale->getScaleFactor3D()*(*i).m_et);
float value = caloScale->getPlotEt() ? (*i).m_et : (*i).m_energy;

(*i).m_ls->SetScale(caloScale->getScaleFactor3D() * value);

TEveProjectable* pable = static_cast<TEveProjectable*>((*i).m_ls);
for (TEveProjectable::ProjList_i j = pable->BeginProjecteds(); j != pable->EndProjecteds(); ++j) {
void FWMETProxyBuilder::scaleProduct(TEveElementList* product, FWViewType::EType type, const FWViewContext* vc) {
int idx = 0;
for (auto& c : product->RefChildren()) {
// line set element is added at the end of the buildViewType function, therefore last child
TEveScalableStraightLineSet* lineSet = dynamic_cast<TEveScalableStraightLineSet*>(c->LastChild());
if (lineSet) {
// compund index in the product is an index of model data in the collection
const void* modelData = item()->modelData(idx);
const reco::MET* met = (const reco::MET*)(modelData);
float value = vc->getEnergyScale()->getPlotEt() ? met->et() : met->energy();
lineSet->SetScale(vc->getEnergyScale()->getScaleFactor3D() * value);
for (TEveProjectable::ProjList_i j = lineSet->BeginProjecteds(); j != lineSet->EndProjecteds(); ++j) {
(*j)->UpdateProjection();
}
}
idx++;
}
}

Expand Down Expand Up @@ -159,7 +154,6 @@ void FWMETProxyBuilder::buildViewType(const reco::MET& met,
setupAddElement(marker, &oItemHolder);

// printf("add line %s %f %f .... eta %f theta %f\n", item()->name().c_str(), met.et(), met.energy(), met.eta(), met.theta());
m_lines.push_back(fireworks::scaleMarker(marker, met.et(), met.energy(), vc)); // register for scales

context().voteMaxEtAndEnergy(met.et(), met.energy());
}
Expand Down
32 changes: 19 additions & 13 deletions Fireworks/Calo/src/FWTauProxyBuilderBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ void FWTauProxyBuilderBase::buildBaseTau(const reco::BaseTau& iTau,
FWViewEnergyScale* caloScale = vc->getEnergyScale();
marker->SetScale(caloScale->getScaleFactor3D() * (caloScale->getPlotEt() ? iTau.et() : iTau.energy()));
setupAddElement(marker, comp);
m_lines.push_back(fireworks::scaleMarker(marker, iTau.et(), iTau.energy(), vc));

context().voteMaxEtAndEnergy(iTau.et(), iTau.energy());
} else if (iJet) {
Expand Down Expand Up @@ -152,20 +151,27 @@ void FWTauProxyBuilderBase::localModelChanges(const FWModelId& iId,
increaseComponentTransparency(iId.index(), iCompound, "TEveJetCone", 80);
}

void FWTauProxyBuilderBase::scaleProduct(TEveElementList* parent, FWViewType::EType viewType, const FWViewContext* vc) {
if (FWViewType::isProjected(viewType)) {
typedef std::vector<fireworks::scaleMarker> Lines_t;
FWViewEnergyScale* caloScale = vc->getEnergyScale();
// printf("%p -> %f\n", this,caloScale->getValToHeight() );
for (Lines_t::iterator i = m_lines.begin(); i != m_lines.end(); ++i) {
if (vc == (*i).m_vc) {
float value = caloScale->getPlotEt() ? (*i).m_et : (*i).m_energy;
(*i).m_ls->SetScale(caloScale->getScaleFactor3D() * value);
TEveProjected* proj = *(*i).m_ls->BeginProjecteds();
proj->UpdateProjection();
void FWTauProxyBuilderBase::scaleProduct(TEveElementList* product,
FWViewType::EType viewType,
const FWViewContext* vc) {
int idx = 0;
for (auto& c : product->RefChildren()) {
// check the compound has more than one element (the first one is jet)
for (auto& compChld : c->RefChildren()) {
TEveScalableStraightLineSet* lineSet = dynamic_cast<TEveScalableStraightLineSet*>(compChld);
if (lineSet) {
// compund index in the product is an index of model data in the collection
const void* modelData = item()->modelData(idx);
const reco::BaseTau* ptr = (const reco::BaseTau*)(modelData);
float value = vc->getEnergyScale()->getPlotEt() ? ptr->et() : ptr->energy();
lineSet->SetScale(vc->getEnergyScale()->getScaleFactor3D() * value);
for (TEveProjectable::ProjList_i j = lineSet->BeginProjecteds(); j != lineSet->EndProjecteds(); ++j) {
(*j)->UpdateProjection();
}
}
}
idx++;
}
}

void FWTauProxyBuilderBase::cleanLocal() { m_lines.clear(); }
void FWTauProxyBuilderBase::cleanLocal() {}