CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
FWCaloRecHitDigitSetProxyBuilder Class Reference

#include <FWCaloRecHitDigitSetProxyBuilder.h>

Inheritance diagram for FWCaloRecHitDigitSetProxyBuilder:
FWDigitSetProxyBuilder FWProxyBuilderBase FWCastorRecHitProxyBuilder FWEcalRecHitProxyBuilder FWFTLRecHitProxyBuilder FWHBHERecHitProxyBuilder FWHFRecHitProxyBuilder FWHORecHitProxyBuilder FWZDCRecHitProxyBuilder

Public Member Functions

void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *) override
 
 FWCaloRecHitDigitSetProxyBuilder ()
 
 FWCaloRecHitDigitSetProxyBuilder (const FWCaloRecHitDigitSetProxyBuilder &)=delete
 
bool havePerViewProduct (FWViewType::EType) const override
 
virtual void invertBox (bool x)
 
const
FWCaloRecHitDigitSetProxyBuilder
operator= (const FWCaloRecHitDigitSetProxyBuilder &)=delete
 
virtual float scaleFactor (const FWViewContext *vc)
 
void scaleProduct (TEveElementList *parent, FWViewType::EType, const FWViewContext *vc) override
 
void setItem (const FWEventItem *iItem) override
 
virtual void viewContextBoxScale (const float *corners, float scale, bool plotEt, std::vector< float > &scaledCorners, const CaloRecHit *)
 
 ~FWCaloRecHitDigitSetProxyBuilder (void) override
 
- Public Member Functions inherited from FWDigitSetProxyBuilder
 FWDigitSetProxyBuilder ()
 
 FWDigitSetProxyBuilder (const FWDigitSetProxyBuilder &)=delete
 
const FWDigitSetProxyBuilderoperator= (const FWDigitSetProxyBuilder &)=delete
 
bool willHandleInteraction () const override
 
 ~FWDigitSetProxyBuilder () 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
 
virtual bool haveSingleProduct () 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 ~FWProxyBuilderBase ()
 

Private Attributes

double m_enlarge
 
bool m_ignoreGeoShapeSize
 
bool m_invertBox
 
TEveVector m_vector
 

Additional Inherited Members

- 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 Types inherited from FWProxyBuilderBase
typedef std::vector< Product * >
::iterator 
Product_it
 
- Protected Member Functions inherited from FWDigitSetProxyBuilder
void addBox (TEveBoxSet *set, const float *pnts, const FWDisplayProperties &dp)
 
TEveBoxSet * addBoxSetToProduct (TEveElementList *product)
 
TEveBoxSet * getBoxSet () const
 
- Protected Member Functions inherited from FWProxyBuilderBase
virtual void buildViewType (const FWEventItem *iItem, TEveElementList *, FWViewType::EType, const FWViewContext *)
 
virtual void clean ()
 
virtual void cleanLocal ()
 
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 localModelChanges (const FWModelId &iId, TEveElement *iCompound, FWViewType::EType viewType, const FWViewContext *vc)
 
const FWProxyBuilderBaseoperator= (const FWProxyBuilderBase &)
 
virtual bool visibilityModelChanges (const FWModelId &, TEveElement *, FWViewType::EType, const FWViewContext *)
 
- Protected Attributes inherited from FWProxyBuilderBase
std::vector< Product * > m_products
 

Detailed Description

Definition at line 9 of file FWCaloRecHitDigitSetProxyBuilder.h.

Constructor & Destructor Documentation

FWCaloRecHitDigitSetProxyBuilder::FWCaloRecHitDigitSetProxyBuilder ( )
FWCaloRecHitDigitSetProxyBuilder::~FWCaloRecHitDigitSetProxyBuilder ( void  )
inlineoverride

Definition at line 12 of file FWCaloRecHitDigitSetProxyBuilder.h.

12 {}
FWCaloRecHitDigitSetProxyBuilder::FWCaloRecHitDigitSetProxyBuilder ( const FWCaloRecHitDigitSetProxyBuilder )
delete

Member Function Documentation

void FWCaloRecHitDigitSetProxyBuilder::build ( const FWEventItem iItem,
TEveElementList *  product,
const FWViewContext vc 
)
overridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 127 of file FWCaloRecHitDigitSetProxyBuilder.cc.

References FWDigitSetProxyBuilder::addBox(), FWDigitSetProxyBuilder::addBoxSetToProduct(), FWProxyBuilderBase::context(), CaloRecHit::detid(), FWEventItem::ModelInfo::displayProperties(), CaloRecHit::energy(), validate-o2o-wbm::f, FWEventItem::getConfig(), FWGeometry::getCorners(), FWViewContext::getEnergyScale(), fireworks::Context::getGeom(), FWViewEnergyScale::getPlotEt(), mps_fire::i, FWProxyBuilderBase::item(), m_enlarge, m_vector, FWEventItem::modelData(), FWEventItem::modelInfo(), pileupReCalc_HLTpaths::scale, scaleFactor(), FWEventItem::size(), findQualityFiles::size, FWProxyBuilderConfiguration::value(), viewContextBoxScale(), and fireworks::Context::voteMaxEtAndEnergy().

129  {
130  size_t size = iItem->size();
131  if (!size)
132  return;
133 
134  // m_ignoreGeoShapeSize = item()->getConfig()->value<bool>("IgnoreShapeSize");
135  m_enlarge = item()->getConfig()->value<double>("Enlarge");
136 
137  std::vector<float> scaledCorners(24);
138 
139  float scale = scaleFactor(vc);
140 
141  TEveBoxSet* boxSet = addBoxSetToProduct(product);
142  boxSet->SetAntiFlick(kTRUE);
143  for (int index = 0; index < static_cast<int>(size); ++index) {
144  const CaloRecHit* hit = (const CaloRecHit*)item()->modelData(index);
145 
146  const float* corners = context().getGeom()->getCorners(hit->detid());
147  if (corners) {
148  m_vector.Set(0.f, 0.f, 0.f);
149  for (unsigned int i = 0; i < 24; i += 3) {
150  m_vector[0] += corners[i];
151  m_vector[1] += corners[i + 1];
152  m_vector[2] += corners[i + 2];
153  }
154  m_vector.Normalize();
155  context().voteMaxEtAndEnergy(m_vector.Perp() * hit->energy(), hit->energy());
156  viewContextBoxScale(corners, hit->energy() * scale, vc->getEnergyScale()->getPlotEt(), scaledCorners, hit);
157  }
158 
159  addBox(boxSet, &scaledCorners[0], iItem->modelInfo(index).displayProperties());
160  }
161 }
constexpr float energy() const
Definition: CaloRecHit.h:29
const fireworks::Context & context() const
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:150
const FWDisplayProperties & displayProperties() const
Definition: FWEventItem.h:64
constexpr const DetId & detid() const
Definition: CaloRecHit.h:33
void voteMaxEtAndEnergy(float Et, float energy) const
Definition: Context.cc:162
FWViewEnergyScale * getEnergyScale() const
virtual void viewContextBoxScale(const float *corners, float scale, bool plotEt, std::vector< float > &scaledCorners, const CaloRecHit *)
const FWEventItem * item() const
virtual float scaleFactor(const FWViewContext *vc)
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:461
size_t size() const
Definition: FWEventItem.cc:457
TEveBoxSet * addBoxSetToProduct(TEveElementList *product)
const void * modelData(int iIndex) const
Definition: FWEventItem.cc:466
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:446
void addBox(TEveBoxSet *set, const float *pnts, const FWDisplayProperties &dp)
FWGeometry * getGeom() const
Definition: Context.h:72
tuple size
Write out results.
bool getPlotEt() const
bool FWCaloRecHitDigitSetProxyBuilder::havePerViewProduct ( FWViewType::EType  ) const
inlineoverridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 16 of file FWCaloRecHitDigitSetProxyBuilder.h.

16 { return true; }
virtual void FWCaloRecHitDigitSetProxyBuilder::invertBox ( bool  x)
inlinevirtual
const FWCaloRecHitDigitSetProxyBuilder& FWCaloRecHitDigitSetProxyBuilder::operator= ( const FWCaloRecHitDigitSetProxyBuilder )
delete
float FWCaloRecHitDigitSetProxyBuilder::scaleFactor ( const FWViewContext vc)
virtual

Reimplemented in FWCastorRecHitProxyBuilder.

Definition at line 92 of file FWCaloRecHitDigitSetProxyBuilder.cc.

References FWViewContext::getEnergyScale(), and FWViewEnergyScale::getScaleFactor3D().

Referenced by build(), FWCastorRecHitProxyBuilder::scaleFactor(), and scaleProduct().

92  {
93  // printf("scale face %f \n", vc->getEnergyScale()->getScaleFactor3D());
94  return vc->getEnergyScale()->getScaleFactor3D() / 50;
95 }
float getScaleFactor3D() const
FWViewEnergyScale * getEnergyScale() const
void FWCaloRecHitDigitSetProxyBuilder::scaleProduct ( TEveElementList *  parent,
FWViewType::EType  type,
const FWViewContext vc 
)
overridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 99 of file FWCaloRecHitDigitSetProxyBuilder.cc.

References cms::cuda::assert(), b, CaloRecHit::detid(), CaloRecHit::energy(), FWDigitSetProxyBuilder::BFreeBox_t::fVertices, FWGeometry::getCorners(), FWViewContext::getEnergyScale(), FWEventItem::getGeom(), FWViewEnergyScale::getPlotEt(), FWProxyBuilderBase::item(), FWEventItem::modelData(), pileupReCalc_HLTpaths::scale, scaleFactor(), FWEventItem::size(), findQualityFiles::size, and viewContextBoxScale().

101  {
102  size_t size = item()->size();
103  if (!size)
104  return;
105 
106  std::vector<float> scaledCorners(24);
107  float scale = scaleFactor(vc);
108 
109  assert(parent->NumChildren() == 1);
110  TEveBoxSet* boxSet = static_cast<TEveBoxSet*>(*parent->BeginChildren());
111 
112  for (int index = 0; index < static_cast<int>(size); ++index) {
113  const CaloRecHit* hit = (const CaloRecHit*)item()->modelData(index);
114  const float* corners = item()->getGeom()->getCorners(hit->detid());
115  if (corners == nullptr)
116  continue;
117 
119 
120  viewContextBoxScale(corners, hit->energy() * scale, vc->getEnergyScale()->getPlotEt(), scaledCorners, hit);
121  memcpy(b->fVertices, &scaledCorners[0], sizeof(b->fVertices));
122  }
123  boxSet->ElementChanged();
124 }
constexpr float energy() const
Definition: CaloRecHit.h:29
constexpr const DetId & detid() const
Definition: CaloRecHit.h:33
FWViewEnergyScale * getEnergyScale() const
virtual void viewContextBoxScale(const float *corners, float scale, bool plotEt, std::vector< float > &scaledCorners, const CaloRecHit *)
assert(be >=bs)
const FWEventItem * item() const
virtual float scaleFactor(const FWViewContext *vc)
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:461
size_t size() const
Definition: FWEventItem.cc:457
double b
Definition: hdecay.h:118
const void * modelData(int iIndex) const
Definition: FWEventItem.cc:466
tuple size
Write out results.
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548
bool getPlotEt() const
void FWCaloRecHitDigitSetProxyBuilder::setItem ( const FWEventItem iItem)
overridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 18 of file FWCaloRecHitDigitSetProxyBuilder.cc.

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

18  {
20  if (iItem) {
21  iItem->getConfig()->assertParam("Enlarge", 1.0, 1.0, 5.0);
22  // iItem->getConfig()->assertParam( "IgnoreShapeSize", false);
23  }
24 }
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:150
virtual void setItem(const FWEventItem *iItem)
FWGenericParameter< T > * assertParam(const std::string &name, T def)
void FWCaloRecHitDigitSetProxyBuilder::viewContextBoxScale ( const float *  corners,
float  scale,
bool  plotEt,
std::vector< float > &  scaledCorners,
const CaloRecHit  
)
virtual

Reimplemented in FWEcalRecHitProxyBuilder.

Definition at line 27 of file FWCaloRecHitDigitSetProxyBuilder.cc.

References validate-o2o-wbm::f, mps_fire::i, fireworks::invertBox(), m_enlarge, m_ignoreGeoShapeSize, m_invertBox, m_vector, and pileupReCalc_HLTpaths::scale.

Referenced by build(), scaleProduct(), and FWEcalRecHitProxyBuilder::viewContextBoxScale().

28  {
29  scale *= m_enlarge;
31  // Same functionality as fireworks::energyTower3DCorners()
32 
33  for (int i = 0; i < 24; ++i)
34  scaledCorners[i] = corners[i];
35 
36  // Coordinates of a front face scaled
37  if (m_invertBox) {
38  // We know, that an ES rechit geometry in -Z needs correction.
39  // The back face is actually its front face.
40  for (unsigned int i = 0; i < 12; i += 3) {
41  m_vector.Set(corners[i] - corners[i + 12], corners[i + 1] - corners[i + 13], corners[i + 2] - corners[i + 14]);
42  m_vector.Normalize();
43  m_vector *= scale;
44 
45  scaledCorners[i] = corners[i] + m_vector.fX;
46  scaledCorners[i + 1] = corners[i + 1] + m_vector.fY;
47  scaledCorners[i + 2] = corners[i + 2] + m_vector.fZ;
48  }
49  } else {
50  for (unsigned int i = 0; i < 12; i += 3) {
51  m_vector.Set(corners[i + 12] - corners[i], corners[i + 13] - corners[i + 1], corners[i + 14] - corners[i + 2]);
52  m_vector.Normalize();
53  m_vector *= scale;
54 
55  scaledCorners[i] = corners[i + 12];
56  scaledCorners[i + 1] = corners[i + 13];
57  scaledCorners[i + 2] = corners[i + 14];
58 
59  scaledCorners[i + 12] = corners[i + 12] + m_vector.fX;
60  scaledCorners[i + 13] = corners[i + 13] + m_vector.fY;
61  scaledCorners[i + 14] = corners[i + 14] + m_vector.fZ;
62  }
63  }
64  } else {
65  // Same functionality as fireworks::energyScaledBox3DCorners().
66 
67  m_vector.Set(0.f, 0.f, 0.f);
68  for (unsigned int i = 0; i < 24; i += 3) {
69  m_vector[0] += corners[i];
70  m_vector[1] += corners[i + 1];
71  m_vector[2] += corners[i + 2];
72  }
73  m_vector *= 1.f / 8.f;
74 
75  if (plotEt) {
76  scale *= m_vector.Perp() / m_vector.Mag();
77  }
78 
79  // Coordinates for a scaled version of the original box
80  for (unsigned int i = 0; i < 24; i += 3) {
81  scaledCorners[i] = m_vector[0] + (corners[i] - m_vector[0]) * scale;
82  scaledCorners[i + 1] = m_vector[1] + (corners[i + 1] - m_vector[1]) * scale;
83  scaledCorners[i + 2] = m_vector[2] + (corners[i + 2] - m_vector[2]) * scale;
84  }
85 
86  if (m_invertBox)
87  fireworks::invertBox(scaledCorners);
88  }
89 }
void invertBox(std::vector< float > &corners)

Member Data Documentation

double FWCaloRecHitDigitSetProxyBuilder::m_enlarge
private

Definition at line 31 of file FWCaloRecHitDigitSetProxyBuilder.h.

Referenced by build(), and viewContextBoxScale().

bool FWCaloRecHitDigitSetProxyBuilder::m_ignoreGeoShapeSize
private

Definition at line 30 of file FWCaloRecHitDigitSetProxyBuilder.h.

Referenced by viewContextBoxScale().

bool FWCaloRecHitDigitSetProxyBuilder::m_invertBox
private

Definition at line 29 of file FWCaloRecHitDigitSetProxyBuilder.h.

Referenced by invertBox(), and viewContextBoxScale().

TEveVector FWCaloRecHitDigitSetProxyBuilder::m_vector
private

Definition at line 32 of file FWCaloRecHitDigitSetProxyBuilder.h.

Referenced by build(), and viewContextBoxScale().