CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes
FWJetProxyBuilder Class Reference
Inheritance diagram for FWJetProxyBuilder:
FWSimpleProxyBuilderTemplate< reco::Jet > FWSimpleProxyBuilder FWProxyBuilderBase

Public Member Functions

void cleanLocal () override
 
 FWJetProxyBuilder ()
 
bool havePerViewProduct (FWViewType::EType) const override
 
bool haveSingleProduct () const override
 
const std::string & purpose () const
 
void setItem (const FWEventItem *iItem) override
 
const std::string & typeName () const
 
const std::string & view () const
 
 ~FWJetProxyBuilder () override
 
- Public Member Functions inherited from FWSimpleProxyBuilderTemplate< reco::Jet >
 FWSimpleProxyBuilderTemplate ()
 
- Public Member Functions inherited from FWSimpleProxyBuilder
 FWSimpleProxyBuilder (const std::type_info &iType)
 
virtual ~FWSimpleProxyBuilder ()
 
- Public Member Functions inherited from FWProxyBuilderBase
void build ()
 
virtual bool canHandle (const FWEventItem &)
 
const fireworks::Contextcontext () const
 
TEveElementList * createProduct (FWViewType::EType, const FWViewContext *)
 
 FWProxyBuilderBase ()
 
bool getHaveWindow () const
 
const FWEventItemitem () const
 
virtual void itemBeingDestroyed (const FWEventItem *)
 
void itemChanged (const FWEventItem *)
 
int layer () const
 
void modelChanges (const FWModelIds &)
 
void removePerViewProduct (FWViewType::EType, const FWViewContext *vc)
 
void scaleChanged (const FWViewContext *)
 
void setHaveWindow (bool iFlag)
 
virtual void setInteractionList (FWInteractionList *, const std::string &)
 
void setupAddElement (TEveElement *el, TEveElement *parent, bool set_color=true) const
 
void setupElement (TEveElement *el, bool color=true) const
 
virtual bool willHandleInteraction () const
 
virtual ~FWProxyBuilderBase ()
 

Static Public Member Functions

static const std::string & classPurpose ()
 
static const std::string & classRegisterTypeName ()
 
static const std::string & classTypeName ()
 
static const std::string & classView ()
 
- Static Public Member Functions inherited from FWSimpleProxyBuilder
static std::string typeOfBuilder ()
 Used by the plugin system to determine how the proxy uses the data from FWEventItem. More...
 
- Static Public Member Functions inherited from FWProxyBuilderBase
static bool representsSubPart ()
 
static std::string typeOfBuilder ()
 Used by the plugin system to determine how the proxy uses the data from FWEventItem. More...
 

Protected Member Functions

void buildViewType (const reco::Jet &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *) override
 
void localModelChanges (const FWModelId &iId, TEveElement *iCompound, FWViewType::EType viewType, const FWViewContext *vc) override
 
void scaleProduct (TEveElementList *parent, FWViewType::EType, const FWViewContext *vc) override
 
- Protected Member Functions inherited from FWSimpleProxyBuilderTemplate< reco::Jet >
virtual void build (const void *iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *context)
 
virtual void build (const reco::Jet &iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *)
 
virtual void buildViewType (const void *iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType viewType, const FWViewContext *context)
 
const reco::JetmodelData (int index)
 
- Protected Member Functions inherited from FWSimpleProxyBuilder
virtual void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *)
 
virtual void buildViewType (const FWEventItem *iItem, TEveElementList *product, FWViewType::EType viewType, const FWViewContext *)
 
virtual void clean ()
 
- Protected Member Functions inherited from FWProxyBuilderBase
TEveCompound * createCompound (bool set_color=true, bool propagate_color_to_all_children=false) const
 
 FWProxyBuilderBase (const FWProxyBuilderBase &)
 
void increaseComponentTransparency (unsigned int index, TEveElement *holder, const std::string &name, Char_t transpOffset)
 
virtual void modelChanges (const FWModelIds &, Product *)
 
const FWProxyBuilderBaseoperator= (const FWProxyBuilderBase &)
 

Private Types

typedef std::vector< fireworks::jetScaleMarkerLines_t
 

Private Member Functions

 FWJetProxyBuilder (const FWJetProxyBuilder &)=delete
 
const FWJetProxyBuilderoperator= (const FWJetProxyBuilder &)=delete
 
TEveElementList * requestCommon ()
 
void setTextPos (fireworks::jetScaleMarker &s, const FWViewContext *vc, FWViewType::EType)
 

Private Attributes

TEveElementList * m_common
 
std::vector< fireworks::jetScaleMarkerm_lines
 

Additional Inherited Members

- Protected Types inherited from FWProxyBuilderBase
typedef std::vector< Product * >::iterator Product_it
 
- Protected Attributes inherited from FWSimpleProxyBuilder
FWSimpleProxyHelper m_helper
 
- Protected Attributes inherited from FWProxyBuilderBase
std::vector< Product * > m_products
 

Detailed Description

Definition at line 49 of file FWJetProxyBuilder.cc.

Member Typedef Documentation

Definition at line 82 of file FWJetProxyBuilder.cc.

Constructor & Destructor Documentation

FWJetProxyBuilder::FWJetProxyBuilder ( )

Definition at line 97 of file FWJetProxyBuilder.cc.

References m_common.

97  :
98  m_common(nullptr)
99 {
100  m_common = new TEveElementList( "common electron scene" );
101  m_common->IncDenyDestroy();
102 }
TEveElementList * m_common
FWJetProxyBuilder::~FWJetProxyBuilder ( )
override

Definition at line 104 of file FWJetProxyBuilder.cc.

References m_common.

105 {
106  m_common->DecDenyDestroy();
107 }
TEveElementList * m_common
FWJetProxyBuilder::FWJetProxyBuilder ( const FWJetProxyBuilder )
privatedelete

Member Function Documentation

void FWJetProxyBuilder::buildViewType ( const reco::Jet iData,
unsigned int  iIndex,
TEveElement &  oItemHolder,
FWViewType::EType  type,
const FWViewContext vc 
)
overrideprotectedvirtual

Reimplemented from FWSimpleProxyBuilderTemplate< reco::Jet >.

Definition at line 128 of file FWJetProxyBuilder.cc.

References fireworks::Context::caloR1(), fireworks::Context::caloZ1(), fireworks::Context::caloZ2(), FWDisplayProperties::color(), create_public_lumi_plots::color, FWProxyBuilderBase::context(), funct::cos(), FWEventItem::defaultDisplayProperties(), reco::dp, reco::LeafCandidate::energy(), reco::LeafCandidate::et(), FWEventItem::getConfig(), FWViewContext::getEnergyScale(), FWViewEnergyScale::getPlotEt(), FWViewEnergyScale::getScaleFactor3D(), FWViewType::isProjected(), FWProxyBuilderBase::item(), kJetLabelsRhoPhiOn(), kJetLabelsRhoZOn(), FWViewType::kRhoPhi, FWViewType::kRhoZ, m_lines, fireworks::scaleMarker::m_ls, M_PI, fireworks::jetScaleMarker::m_text, Min(), p1, p2, phi, reco::LeafCandidate::phi(), alignCSCRings::r, requestCommon(), setTextPos(), FWProxyBuilderBase::setupAddElement(), funct::sin(), findQualityFiles::size, funct::tan(), reco::LeafCandidate::theta(), theta(), FWDisplayProperties::transparency(), FWProxyBuilderConfiguration::value(), and fireworks::Context::voteMaxEtAndEnergy().

129 {
130  // add cone from shared pool
131  TEveElementList* cones = requestCommon();
132  TEveElement::List_i coneIt = cones->BeginChildren();
133  std::advance(coneIt, iIndex);
134 
136  setupAddElement( *coneIt, &oItemHolder );
137  (*coneIt)->SetMainTransparency(TMath::Min(100, 80 + dp.transparency() / 5));
138 
139  TEveVector p1;
140  TEveVector p2;
141 
142  // scale markers in projected views
144  {
145  m_lines.push_back(fireworks::jetScaleMarker(new TEveScalableStraightLineSet("jetline"), iData.et(), iData.energy(), vc));
146  fireworks::jetScaleMarker& markers = m_lines.back();
147 
148  float size = 1.f; // values are saved in scale
149  double theta = iData.theta();
150  double phi = iData.phi();
151 
152  if ( type == FWViewType::kRhoZ )
153  {
154  static const float_t offr = 4;
155  float r_ecal = context().caloR1() + offr;
156  float z_ecal = context().caloZ1() + offr/tan(context().caloTransAngle());
157  double r(0);
158  if ( theta < context().caloTransAngle() || M_PI-theta < context().caloTransAngle())
159  {
160  z_ecal = context().caloZ2() + offr/tan(context().caloTransAngle());
161  r = z_ecal/fabs(cos(theta));
162  }
163  else
164  {
165  r = r_ecal/sin(theta);
166  }
167 
168  p1.Set( 0., (phi>0 ? r*fabs(sin(theta)) : -r*fabs(sin(theta))), r*cos(theta));
169  p2.Set( 0., (phi>0 ? (r+size)*fabs(sin(theta)) : -(r+size)*fabs(sin(theta))), (r+size)*cos(theta) );
170  }
171  else
172  {
173  float ecalR = context().caloR1() + 4;
174  p1.Set(ecalR*cos(phi), ecalR*sin(phi), 0);
175  p2.Set((ecalR+size)*cos(phi), (ecalR+size)*sin(phi), 0);
176  }
177 
178 
179  markers.m_ls->SetScaleCenter(p1.fX, p1.fY, p1.fZ);
180  markers.m_ls->AddLine(p1, p2);
181 
182  markers.m_ls->SetLineWidth(4);
183  markers.m_ls->SetLineColor(dp.color());
184  FWViewEnergyScale* caloScale = vc->getEnergyScale();
185  markers.m_ls->SetScale(caloScale->getScaleFactor3D()*(caloScale->getPlotEt() ? iData.et() : iData.energy()));
186 
187  if ((type == FWViewType::kRhoZ && item()->getConfig()->value<bool>(kJetLabelsRhoZOn))||
189  {
190  markers.m_text = new FWEveText(Form("%.1f", vc->getEnergyScale()->getPlotEt() ? iData.et() : iData.energy()));
191  markers.m_text->SetMainColor( item()->defaultDisplayProperties().color());
192  setTextPos(markers, vc, type);
193  }
194 
195  markers.m_ls->SetMarkerColor(markers.m_ls->GetMainColor());
196  setupAddElement( markers.m_ls, &oItemHolder );
197  if (markers.m_text) setupAddElement( markers.m_text, &oItemHolder , false);
198 
199  }
200  context().voteMaxEtAndEnergy(iData.et(), iData.energy());
201 
202 }
size
Write out results.
type
Definition: HCALResponse.h:21
const fireworks::Context & context() const
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:169
float getScaleFactor3D() const
const FWDisplayProperties & defaultDisplayProperties() const
Definition: FWEventItem.cc:453
static const std::string kJetLabelsRhoPhiOn("Draw Labels in RhoPhi View")
void voteMaxEtAndEnergy(float Et, float energy) const
Definition: Context.cc:183
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
FWViewEnergyScale * getEnergyScale() const
Geom::Theta< T > theta() const
static float caloZ2(bool offset=true)
Definition: Context.cc:223
T Min(T a, T b)
Definition: MathUtil.h:39
const FWEventItem * item() const
Color_t color() const
virtual double phi() const final
momentum azimuthal angle
static bool isProjected(int)
Definition: FWViewType.cc:128
virtual double et() const final
transverse energy
virtual double theta() const final
momentum polar angle
Char_t transparency() const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
virtual double energy() const final
energy
static float caloR1(bool offset=true)
Definition: Context.cc:208
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
static const std::string kJetLabelsRhoZOn("Draw Labels in RhoZ View")
double p2[4]
Definition: TauolaWrapper.h:90
#define M_PI
auto dp
Definition: deltaR.h:22
TEveScalableStraightLineSet * m_ls
Definition: scaleMarker.h:37
double p1[4]
Definition: TauolaWrapper.h:89
static float caloZ1(bool offset=true)
Definition: Context.cc:218
std::vector< fireworks::jetScaleMarker > m_lines
TEveElementList * requestCommon()
void setTextPos(fireworks::jetScaleMarker &s, const FWViewContext *vc, FWViewType::EType)
bool getPlotEt() const
const std::string & FWJetProxyBuilder::classPurpose ( )
static

Definition at line 286 of file FWJetProxyBuilder.cc.

const std::string & FWJetProxyBuilder::classRegisterTypeName ( )
static

Definition at line 286 of file FWJetProxyBuilder.cc.

const std::string & FWJetProxyBuilder::classTypeName ( )
static

Definition at line 286 of file FWJetProxyBuilder.cc.

const std::string & FWJetProxyBuilder::classView ( )
static

Definition at line 286 of file FWJetProxyBuilder.cc.

void FWJetProxyBuilder::cleanLocal ( )
overridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 219 of file FWJetProxyBuilder.cc.

References m_common, and m_lines.

220 {
221  m_lines.clear();
222  m_common->DestroyElements();
223 }
TEveElementList * m_common
std::vector< fireworks::jetScaleMarker > m_lines
bool FWJetProxyBuilder::havePerViewProduct ( FWViewType::EType  ) const
inlineoverridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 55 of file FWJetProxyBuilder.cc.

55 { return true; }
bool FWJetProxyBuilder::haveSingleProduct ( void  ) const
inlineoverridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 56 of file FWJetProxyBuilder.cc.

56 { return false; } // different view types
void FWJetProxyBuilder::localModelChanges ( const FWModelId iId,
TEveElement *  iCompound,
FWViewType::EType  viewType,
const FWViewContext vc 
)
overrideprotectedvirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 205 of file FWJetProxyBuilder.cc.

References mps_fire::i, FWProxyBuilderBase::increaseComponentTransparency(), FWModelId::index(), and m_lines.

207 {
208  increaseComponentTransparency(iId.index(), iCompound, "TEveJetCone", 80);
209 
210  for (Lines_t::iterator i = m_lines.begin(); i!= m_lines.end(); ++ i)
211  {
212  TEveStraightLineSetProjected* projLineSet = (TEveStraightLineSetProjected*)(*(*i).m_ls->BeginProjecteds());
213  if (projLineSet) projLineSet->UpdateProjection();
214  }
215 }
int index() const
Definition: FWModelId.h:49
std::vector< fireworks::jetScaleMarker > m_lines
void increaseComponentTransparency(unsigned int index, TEveElement *holder, const std::string &name, Char_t transpOffset)
const FWJetProxyBuilder& FWJetProxyBuilder::operator= ( const FWJetProxyBuilder )
privatedelete
const std::string& FWJetProxyBuilder::purpose ( ) const
inline
TEveElementList * FWJetProxyBuilder::requestCommon ( )
private

Definition at line 110 of file FWJetProxyBuilder.cc.

References create_public_lumi_plots::color, FWProxyBuilderBase::context(), funct::false, mps_fire::i, FWProxyBuilderBase::item(), m_common, fireworks::makeEveJetCone(), FWSimpleProxyBuilderTemplate< reco::Jet >::modelData(), and FWEventItem::size().

Referenced by buildViewType().

111 {
112  if( m_common->HasChildren() == false )
113  {
114  for (int i = 0; i < static_cast<int>(item()->size()); ++i)
115  {
116  TEveJetCone* cone = fireworks::makeEveJetCone(modelData(i), context());
117 
118  cone->SetFillColor(item()->defaultDisplayProperties().color());
119  cone->SetLineColor(item()->defaultDisplayProperties().color());
120 
121  m_common->AddElement(cone);
122  }
123  }
124  return m_common;
125 }
const fireworks::Context & context() const
const FWEventItem * item() const
TEveElementList * m_common
size_t size() const
Definition: FWEventItem.cc:550
TEveJetCone * makeEveJetCone(const reco::Jet &iData, const fireworks::Context &context)
void FWJetProxyBuilder::scaleProduct ( TEveElementList *  parent,
FWViewType::EType  type,
const FWViewContext vc 
)
overrideprotectedvirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 226 of file FWJetProxyBuilder.cc.

References fireworks::Context::commonPrefs(), cuy::cv, FWViewContext::getEnergyScale(), CmsShowCommon::getEventCenter(), fireworks::Context::getInstance(), FWViewEnergyScale::getPlotEt(), FWViewEnergyScale::getScaleFactor3D(), mps_fire::i, m_common, m_lines, setTextPos(), and relativeConstraints::value.

227 {
228  for (Lines_t::iterator i = m_lines.begin(); i!= m_lines.end(); ++ i)
229  {
230  if (vc == (*i).m_vc)
231  {
232  float value = vc->getEnergyScale()->getPlotEt() ? (*i).m_et : (*i).m_energy;
233 
234  (*i).m_ls->SetScale(vc->getEnergyScale()->getScaleFactor3D() * value );
235  if ((*i).m_text)
236  {
237  (*i).m_text->SetText(Form("%.1f", value));
238  setTextPos(*i, vc, type);
239  }
240  TEveStraightLineSetProjected* projLineSet = (TEveStraightLineSetProjected*)(*(*i).m_ls->BeginProjecteds());
241  projLineSet->UpdateProjection();
242  }
243  }
244 
245  // move jets to eventCenter
247  TEveVector cv;
248  contextGl->commonPrefs()->getEventCenter(cv.Arr());
249  for (TEveElement::List_i i = m_common->BeginChildren(); i!= m_common->EndChildren(); ++ i)
250  {
251  TEveJetCone* cone = dynamic_cast<TEveJetCone*>(*i);
252  if (cone) {
253  cone->SetApex(cv);
254  }
255  }
256 }
type
Definition: HCALResponse.h:21
float getScaleFactor3D() const
FWViewEnergyScale * getEnergyScale() const
void getEventCenter(float *inC) const
cv
Definition: cuy.py:362
Definition: value.py:1
static Context * getInstance()
Definition: Context.cc:243
TEveElementList * m_common
CmsShowCommon * commonPrefs() const
Definition: Context.cc:177
std::vector< fireworks::jetScaleMarker > m_lines
void setTextPos(fireworks::jetScaleMarker &s, const FWViewContext *vc, FWViewType::EType)
bool getPlotEt() const
void FWJetProxyBuilder::setItem ( const FWEventItem iItem)
inlineoverridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 59 of file FWJetProxyBuilder.cc.

References FWProxyBuilderConfiguration::assertParam(), FWEventItem::getConfig(), kJetLabelsRhoPhiOn(), kJetLabelsRhoZOn(), kJetOffset(), and FWProxyBuilderBase::setItem().

Referenced by Vispa.Plugins.EdmBrowser.EventContentView.EventContentView::_addRow(), Vispa.Views.TableView.TableView::_createItem(), Vispa.Views.PropertyView.PropertyView::addCategory(), and Vispa.Views.PropertyView.PropertyView::append().

60  {
62  if (iItem) {
63  iItem->getConfig()->assertParam(kJetLabelsRhoPhiOn, false);
64  iItem->getConfig()->assertParam(kJetLabelsRhoZOn, false);
65  iItem->getConfig()->assertParam(kJetOffset, 2.1, 1.0, 5.0);
66  }
67  }
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:169
static const std::string kJetLabelsRhoPhiOn("Draw Labels in RhoPhi View")
static const std::string kJetOffset("Label Offset")
virtual void setItem(const FWEventItem *iItem)
static const std::string kJetLabelsRhoZOn("Draw Labels in RhoZ View")
FWGenericParameter< T > * assertParam(const std::string &name, T def)
void FWJetProxyBuilder::setTextPos ( fireworks::jetScaleMarker s,
const FWViewContext vc,
FWViewType::EType  type 
)
private

Definition at line 259 of file FWJetProxyBuilder.cc.

References FWProxyBuilderBase::context(), FWEventItem::getConfig(), FWViewContext::getEnergyScale(), fireworks::Context::getMaxEnergyInEvent(), FWViewEnergyScale::getPlotEt(), FWProxyBuilderBase::item(), kJetOffset(), checklumidiff::l, fireworks::scaleMarker::m_energy, fireworks::scaleMarker::m_et, fireworks::scaleMarker::m_ls, FWEveText::m_offsetZ, fireworks::jetScaleMarker::m_text, FWEveTextProjected::UpdateProjection(), findQualityFiles::v, FWProxyBuilderConfiguration::value(), x, y, and z.

Referenced by buildViewType(), and scaleProduct().

260 {
261  TEveChunkManager::iterator li( s.m_ls->GetLinePlex() );
262  li.next();
263  TEveStraightLineSet::Line_t &l = * ( TEveStraightLineSet::Line_t* ) li();
264  TEveVector v(l.fV2[0] - l.fV1[0], l.fV2[1] - l.fV1[1], l.fV2[2] - l.fV1[2] );
265  v.Normalize();
266 
267 
268  double off = item()->getConfig()->value<double>(kJetOffset) -1;
269  float value = vc->getEnergyScale()->getPlotEt() ? s.m_et : s.m_energy;
270  double trs = off * 130 * value/context().getMaxEnergyInEvent(vc->getEnergyScale()->getPlotEt());
271  v *= trs;
272 
273  float x = l.fV1[0] + v[0];
274  float y = l.fV1[1] + v[1];
275  float z = l.fV1[2] + v[2];
276 
278  s.m_text->RefMainTrans().SetPos(x, y, z);
279  if ((s.m_text)->BeginProjecteds() != (s.m_text)->EndProjecteds()) {
280  FWEveTextProjected* textProjected = (FWEveTextProjected*)(*(s.m_text)->BeginProjecteds());
281  textProjected->UpdateProjection();
282  }
283 
284 }
const fireworks::Context & context() const
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:169
virtual void UpdateProjection()
float m_offsetZ
FWViewEnergyScale * getEnergyScale() const
static const std::string kJetOffset("Label Offset")
const FWEventItem * item() const
float getMaxEnergyInEvent(bool isEt) const
Definition: Context.cc:199
Definition: value.py:1
TEveScalableStraightLineSet * m_ls
Definition: scaleMarker.h:37
bool getPlotEt() const
const std::string& FWJetProxyBuilder::typeName ( ) const
inline
const std::string& FWJetProxyBuilder::view ( ) const
inline

Member Data Documentation

TEveElementList* FWJetProxyBuilder::m_common
private
std::vector<fireworks::jetScaleMarker> FWJetProxyBuilder::m_lines
private

Definition at line 92 of file FWJetProxyBuilder.cc.

Referenced by buildViewType(), cleanLocal(), localModelChanges(), and scaleProduct().