Skip to content

Commit

Permalink
Merge pull request #20633 from alja/master94originshift
Browse files Browse the repository at this point in the history
 ability to set origin to one of primary vertices (tested on 94X release)
  • Loading branch information
cmsbuild committed Sep 26, 2017
2 parents d21e27a + 5918bbc commit 6908180
Show file tree
Hide file tree
Showing 12 changed files with 241 additions and 132 deletions.
56 changes: 28 additions & 28 deletions Fireworks/Calo/plugins/FWJetProxyBuilder.cc
Expand Up @@ -16,7 +16,8 @@
#include "Fireworks/Core/interface/FWTextProjected.h"
#include "Fireworks/Core/interface/FWEventItem.h"
#include "Fireworks/Core/interface/FWProxyBuilderConfiguration.h"
#include "Fireworks/Core/interface/FWParameters.h"
#include "Fireworks/Core/interface/Context.h"
#include "Fireworks/Core/interface/CmsShowCommon.h"
// user include files
#include "Fireworks/Core/interface/FWSimpleProxyBuilderTemplate.h"
#include "Fireworks/Core/interface/FWEventItem.h"
Expand All @@ -27,13 +28,13 @@
#include "Fireworks/Calo/interface/scaleMarker.h"

#include "DataFormats/JetReco/interface/Jet.h"
#include "Fireworks/Core/interface/FWBeamSpot.h"


namespace fireworks {

struct jetScaleMarker : public scaleMarker {
jetScaleMarker(TEveScalableStraightLineSet* ls, float et, float e, const FWViewContext* vc):
scaleMarker(ls, et, e, vc) , m_text(0) {}
scaleMarker(ls, et, e, vc) , m_text(nullptr) {}

FWEveText* m_text;
};
Expand All @@ -49,40 +50,39 @@ class FWJetProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::Jet>
{
public:
FWJetProxyBuilder();
virtual ~FWJetProxyBuilder();
~FWJetProxyBuilder() override;

virtual bool havePerViewProduct(FWViewType::EType) const { return true; }
virtual bool haveSingleProduct() const { return false; } // different view types
virtual void cleanLocal();
bool havePerViewProduct(FWViewType::EType) const override { return true; }
bool haveSingleProduct() const override { return false; } // different view types
void cleanLocal() override;

virtual void setItem(const FWEventItem* iItem)
void setItem(const FWEventItem* iItem) override
{
FWProxyBuilderBase::setItem(iItem);
if (iItem) {
iItem->getConfig()->assertParam(kJetLabelsRhoPhiOn, false);
iItem->getConfig()->assertParam(kJetLabelsRhoZOn, false);
iItem->getConfig()->assertParam(kJetOffset, 2.1, 1.0, 5.0);
iItem->getConfig()->assertParam(kJetApexBeamSpot, false);
}
}

REGISTER_PROXYBUILDER_METHODS();

protected:
using FWSimpleProxyBuilderTemplate<reco::Jet>::buildViewType;
virtual void buildViewType(const reco::Jet& iData, unsigned int iIndex, TEveElement& oItemHolder, FWViewType::EType type , const FWViewContext*);
void buildViewType(const reco::Jet& iData, unsigned int iIndex, TEveElement& oItemHolder, FWViewType::EType type , const FWViewContext*) override;


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

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

private:
typedef std::vector<fireworks::jetScaleMarker> Lines_t;

FWJetProxyBuilder( const FWJetProxyBuilder& ); // stop default
const FWJetProxyBuilder& operator=( const FWJetProxyBuilder& ); // stop default
FWJetProxyBuilder( const FWJetProxyBuilder& ) = delete; // stop default
const FWJetProxyBuilder& operator=( const FWJetProxyBuilder& ) = delete; // stop default

TEveElementList* requestCommon();
void setTextPos(fireworks::jetScaleMarker& s, const FWViewContext* vc, FWViewType::EType);
Expand All @@ -95,7 +95,7 @@ class FWJetProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::Jet>

//______________________________________________________________________________
FWJetProxyBuilder::FWJetProxyBuilder():
m_common(0)
m_common(nullptr)
{
m_common = new TEveElementList( "common electron scene" );
m_common->IncDenyDestroy();
Expand All @@ -115,11 +115,6 @@ FWJetProxyBuilder::requestCommon()
{
TEveJetCone* cone = fireworks::makeEveJetCone(modelData(i), context());

if (item()->getConfig()->value<bool>(kJetApexBeamSpot))
{
FWBeamSpot* bs = context().getBeamSpot();
cone->SetApex(TEveVector(bs->x0(), bs->y0(), bs->z0()));
}
cone->SetFillColor(item()->defaultDisplayProperties().color());
cone->SetLineColor(item()->defaultDisplayProperties().color());

Expand Down Expand Up @@ -180,13 +175,6 @@ FWJetProxyBuilder::buildViewType(const reco::Jet& iData, unsigned int iIndex, TE
p2.Set((ecalR+size)*cos(phi), (ecalR+size)*sin(phi), 0);
}

if (item()->getConfig()->value<bool>(kJetApexBeamSpot))
{
FWBeamSpot* bs = context().getBeamSpot();
TEveVector bsOff(bs->x0(), bs->y0(), bs->z0());
p1 += bsOff;
p2 += bsOff;
}

markers.m_ls->SetScaleCenter(p1.fX, p1.fY, p1.fZ);
markers.m_ls->AddLine(p1, p2);
Expand Down Expand Up @@ -253,6 +241,18 @@ FWJetProxyBuilder::scaleProduct(TEveElementList* parent, FWViewType::EType type,
projLineSet->UpdateProjection();
}
}

// move jets to eventCenter
fireworks::Context* contextGl = fireworks::Context::getInstance();
TEveVector cv;
contextGl->commonPrefs()->getEventCenter(cv.Arr());
for (TEveElement::List_i i = m_common->BeginChildren(); i!= m_common->EndChildren(); ++ i)
{
TEveJetCone* cone = dynamic_cast<TEveJetCone*>(*i);
if (cone) {
cone->SetApex(cv);
}
}
}


Expand Down
29 changes: 20 additions & 9 deletions Fireworks/Core/interface/CmsShowCommon.h
Expand Up @@ -23,15 +23,18 @@

#include "Rtypes.h"
#include "TGLUtil.h"
#include "TEveVector.h"

#include "Fireworks/Core/interface/FWConfigurableParameterizable.h"
#include "Fireworks/Core/interface/FWBoolParameter.h"
#include "Fireworks/Core/interface/FWLongParameter.h"
#include "Fireworks/Core/interface/FWEnumParameter.h"
#include "Fireworks/Core/interface/FWColorManager.h"
#include "Fireworks/Core/interface/FWViewEnergyScale.h"
#include "Fireworks/Core/interface/FWViewContext.h"
#include "Fireworks/Core/interface/FWBeamSpot.h"

class CmsShowCommonPopup;
class FWViewEnergyScale;
class FWColorManager;
namespace fireworks
{
Expand All @@ -44,15 +47,15 @@ class CmsShowCommon : public FWConfigurableParameterizable

public:
CmsShowCommon(fireworks::Context*);
virtual ~CmsShowCommon();
~CmsShowCommon() override;

// ---------- const member functions ---------------------
virtual void addTo(FWConfiguration&) const;
void addTo(FWConfiguration&) const override;

// ---------- static member functions --------------------

// ---------- member functions ---------------------------
virtual void setFrom(const FWConfiguration&);
void setFrom(const FWConfiguration&) override;

void setTrackBreakMode();
void setDrawBreakMarkers();
Expand All @@ -66,9 +69,9 @@ class CmsShowCommon : public FWConfigurableParameterizable

void setGeomColor(FWGeomColorIndex, Color_t);
void setGeomTransparency(int val, bool projected);
FWViewEnergyScale* getEnergyScale() const { return m_viewContext.getEnergyScale(); }

FWViewEnergyScale* getEnergyScale() const { return m_energyScale.get(); }


const TGLColorSet& getLightColorSet() const { return m_lightColorSet; }
const TGLColorSet& getDarkColorSet() const { return m_darkColorSet; }

Expand All @@ -77,6 +80,12 @@ class CmsShowCommon : public FWConfigurableParameterizable
bool getRnrPTBMarkers() const { return m_drawBreakPoints.value(); }

void setView(CmsShowCommonPopup* x) { m_view= x;}

void getEventCenter(float* inC) const;
void setEventCenter(float, float, float);
void resetEventCenter();

mutable sigc::signal<void, const CmsShowCommon*> eventCenterChanged_;

protected:
const FWColorManager* colorManager() const;
Expand All @@ -103,12 +112,14 @@ class CmsShowCommon : public FWConfigurableParameterizable
TGLColorSet m_lightColorSet;
TGLColorSet m_darkColorSet;

std::auto_ptr<FWViewEnergyScale> m_energyScale;
FWViewContext m_viewContext;

bool m_useBeamSpot;
TEveVector m_externalEventCenter; //cached

private:
CmsShowCommon(const CmsShowCommon&); // stop default
const CmsShowCommon& operator=(const CmsShowCommon&); // stop default
CmsShowCommon(const CmsShowCommon&) = delete; // stop default
const CmsShowCommon& operator=(const CmsShowCommon&) = delete; // stop default

};

Expand Down
21 changes: 11 additions & 10 deletions Fireworks/Core/interface/FWEveView.h
Expand Up @@ -56,9 +56,9 @@ class FWEveView : public FWViewBase
{
public:
FWEveView(TEveWindowSlot*, FWViewType::EType, unsigned int version = 7);
virtual ~FWEveView();
~FWEveView() override;

virtual void setFrom(const FWConfiguration&);
void setFrom(const FWConfiguration&) override;
virtual void setBackgroundColor(Color_t);
virtual void eventEnd();
virtual void eventBegin();
Expand All @@ -68,10 +68,10 @@ class FWEveView : public FWViewBase

// ---------- const member functions ---------------------

virtual void addTo(FWConfiguration&) const;
virtual FWViewContextMenuHandlerBase* contextMenuHandler() const;
virtual void saveImageTo(const std::string& iName) const;
virtual void populateController(ViewerParameterGUI&) const;
void addTo(FWConfiguration&) const override;
FWViewContextMenuHandlerBase* contextMenuHandler() const override;
void saveImageTo(const std::string& iName) const override;
void populateController(ViewerParameterGUI&) const override;

TGLViewer* viewerGL() const;
TEveViewer* viewer();
Expand All @@ -89,17 +89,18 @@ class FWEveView : public FWViewBase
virtual void useGlobalEnergyScaleChanged();
virtual bool isEnergyScaleGlobal() const;
virtual void setupEnergyScale();
virtual void setupEventCenter();
virtual void voteCaloMaxVal();

virtual bool requestGLHandlerPick() const { return 0;}
virtual bool requestGLHandlerPick() const { return false;}

protected:
virtual void resetCamera();
virtual void pointLineScalesChanged();
virtual void cameraGuideChanged();

// scales
virtual TEveCaloViz* getEveCalo() const { return 0; }
virtual TEveCaloViz* getEveCalo() const { return nullptr; }

// config
void addToOrthoCamera(TGLOrthoCamera*, FWConfiguration&) const;
Expand All @@ -111,8 +112,8 @@ class FWEveView : public FWViewBase
const fireworks::Context* m_context;

private:
FWEveView(const FWEveView&); // stop default
const FWEveView& operator=(const FWEveView&); // stop default
FWEveView(const FWEveView&) = delete; // stop default
const FWEveView& operator=(const FWEveView&) = delete; // stop default


// ---------- member data --------------------------------
Expand Down
23 changes: 12 additions & 11 deletions Fireworks/Core/interface/FWEveViewManager.h
Expand Up @@ -58,35 +58,35 @@ class FWEveViewManager : public FWViewManagerBase
};

FWEveViewManager(FWGUIManager*);
virtual ~FWEveViewManager();
~FWEveViewManager() override;

// ---------- const member functions ---------------------

// ---------- static member functions --------------------

// ---------- member functions ---------------------------
virtual void newItem(const FWEventItem*);
void newItem(const FWEventItem*) override;
virtual void removeItem(const FWEventItem*);
virtual void eventBegin();
virtual void eventEnd();
virtual void setContext(const fireworks::Context*);
void eventBegin() override;
void eventEnd() override;
void setContext(const fireworks::Context*) override;

void highlightAdded(TEveElement*);
void selectionAdded(TEveElement*);
void selectionRemoved(TEveElement*);
void selectionCleared();

FWTypeToRepresentations supportedTypesAndRepresentations() const;
FWTypeToRepresentations supportedTypesAndRepresentations() const override;

static void syncAllViews() { s_syncAllViews = true; }
protected:
virtual void modelChangesComing();
virtual void modelChangesDone();
virtual void colorsChanged();
void modelChangesComing() override;
void modelChangesDone() override;
void colorsChanged() override;

private:
FWEveViewManager(const FWEveViewManager&); // stop default
const FWEveViewManager& operator=(const FWEveViewManager&); // stop default
FWEveViewManager(const FWEveViewManager&) = delete; // stop default
const FWEveViewManager& operator=(const FWEveViewManager&) = delete; // stop default

FWViewBase* buildView(TEveWindowSlot* iParent, const std::string& type);
FWEveView* finishViewCreate (std::shared_ptr<FWEveView>);
Expand All @@ -96,6 +96,7 @@ class FWEveViewManager : public FWViewManagerBase
void itemChanged(const FWEventItem*);
bool haveViewForBit (int) const;
void globalEnergyScaleChanged();
void eventCenterChanged();

// ---------- member data --------------------------------

Expand Down
24 changes: 13 additions & 11 deletions Fireworks/Core/interface/FWRPZView.h
Expand Up @@ -41,29 +41,31 @@ class FWRPZView : public FWEveView
{
public:
FWRPZView(TEveWindowSlot* iParent, FWViewType::EType);
virtual ~FWRPZView();
~FWRPZView() override;

// ---------- const member functions ---------------------

virtual void addTo(FWConfiguration&) const;
virtual void populateController(ViewerParameterGUI&) const;
virtual TEveCaloViz* getEveCalo() const;
void addTo(FWConfiguration&) const override;
void populateController(ViewerParameterGUI&) const override;
TEveCaloViz* getEveCalo() const override;

// ---------- member functions ---------------------------
virtual void setContext(const fireworks::Context&);
virtual void setFrom(const FWConfiguration&);
virtual void voteCaloMaxVal();
void setContext(const fireworks::Context&) override;
void setFrom(const FWConfiguration&) override;
void voteCaloMaxVal() override;

virtual void eventBegin();
void eventBegin() override;
void eventEnd() override;
void setupEventCenter() override;

//returns the new element created from this import
void importElements(TEveElement* iProjectableChild, float layer, TEveElement* iProjectedParent=0);
void importElements(TEveElement* iProjectableChild, float layer, TEveElement* iProjectedParent=nullptr);

void shiftOrigin(TEveVector& center);
void resetOrigin();
private:
FWRPZView(const FWRPZView&); // stop default
const FWRPZView& operator=(const FWRPZView&); // stop default
FWRPZView(const FWRPZView&) = delete; // stop default
const FWRPZView& operator=(const FWRPZView&) = delete; // stop default

void doPreScaleDistortion();
void doFishEyeDistortion();
Expand Down

0 comments on commit 6908180

Please sign in to comment.