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 ()
 
 FWJetProxyBuilder (const FWJetProxyBuilder &)=delete
 
bool havePerViewProduct (FWViewType::EType) const override
 
bool haveSingleProduct () const override
 
const FWJetProxyBuilderoperator= (const FWJetProxyBuilder &)=delete
 
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 ()
 
 FWSimpleProxyBuilderTemplate (const FWSimpleProxyBuilderTemplate &)=delete
 
const FWSimpleProxyBuilderTemplateoperator= (const FWSimpleProxyBuilderTemplate &)=delete
 
- Public Member Functions inherited from FWSimpleProxyBuilder
 FWSimpleProxyBuilder (const std::type_info &iType)
 
 FWSimpleProxyBuilder (const FWSimpleProxyBuilder &)=delete
 
const FWSimpleProxyBuilderoperator= (const FWSimpleProxyBuilder &)=delete
 
 ~FWSimpleProxyBuilder () override
 
- 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 >
void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *) override
 
virtual void build (const void *, unsigned int iIndex, TEveElement &iItemHolder, const FWViewContext *)=0
 
void build ()
 
virtual void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *)
 
void build (const void *iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *context) override
 
virtual void build (const reco::Jet &iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *)
 
virtual void buildViewType (const void *, unsigned int iIndex, TEveElement &iItemHolder, FWViewType::EType, const FWViewContext *)=0
 
virtual void buildViewType (const FWEventItem *iItem, TEveElementList *, FWViewType::EType, const FWViewContext *)
 
void buildViewType (const FWEventItem *iItem, TEveElementList *product, FWViewType::EType viewType, const FWViewContext *) override
 
void buildViewType (const void *iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType viewType, const FWViewContext *context) override
 
const reco::JetmodelData (int index)
 
- Protected Member Functions inherited from FWSimpleProxyBuilder
void build ()
 
virtual void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *)
 
void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *) override
 
virtual void buildViewType (const FWEventItem *iItem, TEveElementList *, FWViewType::EType, const FWViewContext *)
 
void buildViewType (const FWEventItem *iItem, TEveElementList *product, FWViewType::EType viewType, const FWViewContext *) override
 
void clean () override
 
- 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

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

Private Attributes

TEveElementList * m_common
 

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 47 of file FWJetProxyBuilder.cc.

Member Typedef Documentation

◆ Lines_t

Definition at line 86 of file FWJetProxyBuilder.cc.

Constructor & Destructor Documentation

◆ FWJetProxyBuilder() [1/2]

FWJetProxyBuilder::FWJetProxyBuilder ( )

Definition at line 95 of file FWJetProxyBuilder.cc.

References m_common.

95  : m_common(nullptr) {
96  m_common = new TEveElementList("common electron scene");
97  m_common->IncDenyDestroy();
98 }
TEveElementList * m_common

◆ ~FWJetProxyBuilder()

FWJetProxyBuilder::~FWJetProxyBuilder ( )
override

Definition at line 100 of file FWJetProxyBuilder.cc.

References m_common.

100 { m_common->DecDenyDestroy(); }
TEveElementList * m_common

◆ FWJetProxyBuilder() [2/2]

FWJetProxyBuilder::FWJetProxyBuilder ( const FWJetProxyBuilder )
delete

Member Function Documentation

◆ buildViewType()

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 116 of file FWJetProxyBuilder.cc.

References fireworks::Context::caloR1(), fireworks::Context::caloZ1(), fireworks::Context::caloZ2(), FWProxyBuilderBase::context(), funct::cos(), FWEventItem::defaultDisplayProperties(), Calorimetry_cff::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_PI, pv::markers, METSkim_cff::Min, LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, phi, reco::LeafCandidate::phi(), alignCSCRings::r, requestCommon(), setTextPos(), FWProxyBuilderBase::setupAddElement(), funct::sin(), findQualityFiles::size, funct::tan(), reco::LeafCandidate::theta(), theta(), FWProxyBuilderConfiguration::value(), and fireworks::Context::voteMaxEtAndEnergy().

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

◆ classPurpose()

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

Definition at line 256 of file FWJetProxyBuilder.cc.

◆ classRegisterTypeName()

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

Definition at line 256 of file FWJetProxyBuilder.cc.

◆ classTypeName()

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

Definition at line 256 of file FWJetProxyBuilder.cc.

◆ classView()

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

Definition at line 256 of file FWJetProxyBuilder.cc.

◆ cleanLocal()

void FWJetProxyBuilder::cleanLocal ( )
overridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 191 of file FWJetProxyBuilder.cc.

References m_common.

191 { m_common->DestroyElements(); }
TEveElementList * m_common

◆ havePerViewProduct()

bool FWJetProxyBuilder::havePerViewProduct ( FWViewType::EType  ) const
inlineoverridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 52 of file FWJetProxyBuilder.cc.

52 { return true; }

◆ haveSingleProduct()

bool FWJetProxyBuilder::haveSingleProduct ( void  ) const
inlineoverridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 53 of file FWJetProxyBuilder.cc.

53 { return false; } // different view types

◆ localModelChanges()

void FWJetProxyBuilder::localModelChanges ( const FWModelId iId,
TEveElement *  iCompound,
FWViewType::EType  viewType,
const FWViewContext vc 
)
overrideprotectedvirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 184 of file FWJetProxyBuilder.cc.

References FWProxyBuilderBase::increaseComponentTransparency(), and FWModelId::index().

187  {
188  increaseComponentTransparency(iId.index(), iCompound, "TEveJetCone", 80);
189 }
int index() const
Definition: FWModelId.h:41
void increaseComponentTransparency(unsigned int index, TEveElement *holder, const std::string &name, Char_t transpOffset)

◆ operator=()

const FWJetProxyBuilder& FWJetProxyBuilder::operator= ( const FWJetProxyBuilder )
delete

◆ purpose()

const std::string& FWJetProxyBuilder::purpose ( ) const
inline

◆ requestCommon()

TEveElementList * FWJetProxyBuilder::requestCommon ( )
private

Definition at line 102 of file FWJetProxyBuilder.cc.

References hltPFPuppi_cfi::cone, FWProxyBuilderBase::context(), mps_fire::i, FWProxyBuilderBase::item(), m_common, fireworks::makeEveJetCone(), FWSimpleProxyBuilderTemplate< reco::Jet >::modelData(), and FWEventItem::size().

Referenced by buildViewType().

102  {
103  if (m_common->HasChildren() == false) {
104  for (int i = 0; i < static_cast<int>(item()->size()); ++i) {
105  TEveJetCone* cone = fireworks::makeEveJetCone(modelData(i), context());
106 
107  cone->SetFillColor(item()->defaultDisplayProperties().color());
108  cone->SetLineColor(item()->defaultDisplayProperties().color());
109 
110  m_common->AddElement(cone);
111  }
112  }
113  return m_common;
114 }
size_t size() const
Definition: FWEventItem.cc:457
const fireworks::Context & context() const
TEveElementList * m_common
const FWEventItem * item() const
TEveJetCone * makeEveJetCone(const reco::Jet &iData, const fireworks::Context &context)

◆ scaleProduct()

void FWJetProxyBuilder::scaleProduct ( TEveElementList *  parent,
FWViewType::EType  viewType,
const FWViewContext vc 
)
overrideprotectedvirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 193 of file FWJetProxyBuilder.cc.

References HltBtagPostValidation_cff::c, fireworks::Context::commonPrefs(), hltPFPuppi_cfi::cone, cuy::cv, FWViewContext::getEnergyScale(), CmsShowCommon::getEventCenter(), fireworks::Context::getInstance(), FWViewEnergyScale::getPlotEt(), FWViewEnergyScale::getScaleFactor3D(), mps_fire::i, heavyIonCSV_trainingSettings::idx, FWProxyBuilderBase::item(), dqmiolumiharvest::j, metsig::jet, m_common, FWSimpleProxyBuilderTemplate< reco::Jet >::modelData(), FWEventItem::modelData(), class-composition::parent, and relativeConstraints::value.

193  {
194  // move jets to eventCenter
196  TEveVector cv;
197  contextGl->commonPrefs()->getEventCenter(cv.Arr());
198  for (TEveElement::List_i i = m_common->BeginChildren(); i != m_common->EndChildren(); ++i) {
199  TEveJetCone* cone = dynamic_cast<TEveJetCone*>(*i);
200  if (cone) {
201  cone->SetApex(cv);
202  }
203  }
204 
205  // loop compounds in projected product
206  int idx = 0;
207  for (auto& c : product->RefChildren()) {
208  TEveElement* parent = c;
209  // check the compound has more than one element (the first one is jet)
210  if (parent->NumChildren() > 1) {
211  auto compIt = parent->BeginChildren();
212  compIt++;
213  TEveScalableStraightLineSet* lineSet = dynamic_cast<TEveScalableStraightLineSet*>(*compIt);
214  if (lineSet) {
215  // compund index in the product is an index of model data in the collection
216  const void* modelData = item()->modelData(idx);
217  const reco::Jet* jet = (const reco::Jet*)(modelData);
218  float value = vc->getEnergyScale()->getPlotEt() ? jet->et() : jet->energy();
219  lineSet->SetScale(vc->getEnergyScale()->getScaleFactor3D() * value);
220  for (TEveProjectable::ProjList_i j = lineSet->BeginProjecteds(); j != lineSet->EndProjecteds(); ++j) {
221  (*j)->UpdateProjection();
222  }
223  }
224  }
225  idx++;
226  }
227 }
const void * modelData(int iIndex) const
Definition: FWEventItem.cc:466
CmsShowCommon * commonPrefs() const
Definition: Context.cc:167
Base class for all types of Jets.
Definition: Jet.h:20
cv
Definition: cuy.py:363
bool getPlotEt() const
FWViewEnergyScale * getEnergyScale() const
Definition: value.py:1
static Context * getInstance()
Definition: Context.cc:209
TEveElementList * m_common
float getScaleFactor3D() const
void getEventCenter(float *inC) const
const FWEventItem * item() const

◆ setItem()

void FWJetProxyBuilder::setItem ( const FWEventItem iItem)
inlineoverridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 56 of file FWJetProxyBuilder.cc.

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

56  {
58  if (iItem) {
59  iItem->getConfig()->assertParam(kJetLabelsRhoPhiOn, false);
60  iItem->getConfig()->assertParam(kJetLabelsRhoZOn, false);
61  iItem->getConfig()->assertParam(kJetOffset, 2.1, 1.0, 5.0);
62  }
63  }
static const std::string kJetLabelsRhoPhiOn("Draw Labels in RhoPhi View")
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:150
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)

◆ setTextPos()

void FWJetProxyBuilder::setTextPos ( fireworks::jetScaleMarker s,
const FWViewContext vc,
FWViewType::EType  type 
)
private

Definition at line 229 of file FWJetProxyBuilder.cc.

References FWProxyBuilderBase::context(), FWEventItem::getConfig(), FWViewContext::getEnergyScale(), fireworks::Context::getMaxEnergyInEvent(), FWViewEnergyScale::getPlotEt(), FWProxyBuilderBase::item(), kJetOffset(), MainPageGenerator::l, alignCSCRings::s, FWEveTextProjected::UpdateProjection(), findQualityFiles::v, FWProxyBuilderConfiguration::value(), x, y, and z.

Referenced by buildViewType().

229  {
230  TEveChunkManager::iterator li(s.m_ls->GetLinePlex());
231  li.next();
232  TEveStraightLineSet::Line_t& l = *(TEveStraightLineSet::Line_t*)li();
233  TEveVector v(l.fV2[0] - l.fV1[0], l.fV2[1] - l.fV1[1], l.fV2[2] - l.fV1[2]);
234  v.Normalize();
235 
236  double off = item()->getConfig()->value<double>(kJetOffset) - 1;
237  float value = vc->getEnergyScale()->getPlotEt() ? s.m_et : s.m_energy;
238  double trs = off * 130 * value / context().getMaxEnergyInEvent(vc->getEnergyScale()->getPlotEt());
239  v *= trs;
240 
241  float x = l.fV1[0] + v[0];
242  float y = l.fV1[1] + v[1];
243  float z = l.fV1[2] + v[2];
244 
245  s.m_text->m_offsetZ = value / context().getMaxEnergyInEvent(vc->getEnergyScale()->getPlotEt());
246  s.m_text->RefMainTrans().SetPos(x, y, z);
247  if ((s.m_text)->BeginProjecteds() != (s.m_text)->EndProjecteds()) {
248  FWEveTextProjected* textProjected = (FWEveTextProjected*)(*(s.m_text)->BeginProjecteds());
249  textProjected->UpdateProjection();
250  }
251 }
void UpdateProjection() override
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:150
float getMaxEnergyInEvent(bool isEt) const
Definition: Context.cc:181
static const std::string kJetOffset("Label Offset")
const fireworks::Context & context() const
bool getPlotEt() const
FWViewEnergyScale * getEnergyScale() const
Definition: value.py:1
const FWEventItem * item() const

◆ typeName()

const std::string& FWJetProxyBuilder::typeName ( ) const
inline

◆ view()

const std::string& FWJetProxyBuilder::view ( ) const
inline

Member Data Documentation

◆ m_common

TEveElementList* FWJetProxyBuilder::m_common
private