CMS 3D CMS Logo

List of all members | Public Member Functions | Private 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 ()
 
bool havePerViewProduct (FWViewType::EType) const override
 
virtual void invertBox (bool x)
 
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 ()
 
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 Member Functions

 FWCaloRecHitDigitSetProxyBuilder (const FWCaloRecHitDigitSetProxyBuilder &)=delete
 
const FWCaloRecHitDigitSetProxyBuilderoperator= (const FWCaloRecHitDigitSetProxyBuilder &)=delete
 

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() [1/2]

FWCaloRecHitDigitSetProxyBuilder::FWCaloRecHitDigitSetProxyBuilder ( )

Definition at line 13 of file FWCaloRecHitDigitSetProxyBuilder.cc.

14  : m_invertBox(false), m_ignoreGeoShapeSize(false), m_enlarge(1.0) {}

◆ ~FWCaloRecHitDigitSetProxyBuilder()

FWCaloRecHitDigitSetProxyBuilder::~FWCaloRecHitDigitSetProxyBuilder ( void  )
inlineoverride

Definition at line 12 of file FWCaloRecHitDigitSetProxyBuilder.h.

12 {}

◆ FWCaloRecHitDigitSetProxyBuilder() [2/2]

FWCaloRecHitDigitSetProxyBuilder::FWCaloRecHitDigitSetProxyBuilder ( const FWCaloRecHitDigitSetProxyBuilder )
privatedelete

Member Function Documentation

◆ build()

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

Reimplemented from FWProxyBuilderBase.

Definition at line 127 of file FWCaloRecHitDigitSetProxyBuilder.cc.

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 }

References FWDigitSetProxyBuilder::addBox(), FWDigitSetProxyBuilder::addBoxSetToProduct(), FWProxyBuilderBase::context(), FWEventItem::ModelInfo::displayProperties(), 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(), Scenarios_cff::scale, scaleFactor(), FWEventItem::size(), findQualityFiles::size, FWProxyBuilderConfiguration::value(), viewContextBoxScale(), and fireworks::Context::voteMaxEtAndEnergy().

◆ havePerViewProduct()

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

Reimplemented from FWProxyBuilderBase.

Definition at line 16 of file FWCaloRecHitDigitSetProxyBuilder.h.

16 { return true; }

◆ invertBox()

virtual void FWCaloRecHitDigitSetProxyBuilder::invertBox ( bool  x)
inlinevirtual

◆ operator=()

const FWCaloRecHitDigitSetProxyBuilder& FWCaloRecHitDigitSetProxyBuilder::operator= ( const FWCaloRecHitDigitSetProxyBuilder )
privatedelete

◆ scaleFactor()

float FWCaloRecHitDigitSetProxyBuilder::scaleFactor ( const FWViewContext vc)
virtual

Reimplemented in FWCastorRecHitProxyBuilder.

Definition at line 92 of file FWCaloRecHitDigitSetProxyBuilder.cc.

92  {
93  // printf("scale face %f \n", vc->getEnergyScale()->getScaleFactor3D());
94  return vc->getEnergyScale()->getScaleFactor3D() / 50;
95 }

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

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

◆ scaleProduct()

void FWCaloRecHitDigitSetProxyBuilder::scaleProduct ( TEveElementList *  parent,
FWViewType::EType  type,
const FWViewContext vc 
)
overridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 99 of file FWCaloRecHitDigitSetProxyBuilder.cc.

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 }

References cms::cuda::assert(), b, FWGeometry::getCorners(), FWViewContext::getEnergyScale(), FWEventItem::getGeom(), FWViewEnergyScale::getPlotEt(), FWProxyBuilderBase::item(), FWEventItem::modelData(), class-composition::parent, Scenarios_cff::scale, scaleFactor(), FWEventItem::size(), findQualityFiles::size, and viewContextBoxScale().

◆ setItem()

void FWCaloRecHitDigitSetProxyBuilder::setItem ( const FWEventItem iItem)
overridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 18 of file FWCaloRecHitDigitSetProxyBuilder.cc.

18  {
20  if (iItem) {
21  iItem->getConfig()->assertParam("Enlarge", 1.0, 1.0, 5.0);
22  // iItem->getConfig()->assertParam( "IgnoreShapeSize", false);
23  }
24 }

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

◆ viewContextBoxScale()

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.

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 }

References f, mps_fire::i, fireworks::invertBox(), m_enlarge, m_ignoreGeoShapeSize, m_invertBox, m_vector, and Scenarios_cff::scale.

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

Member Data Documentation

◆ m_enlarge

double FWCaloRecHitDigitSetProxyBuilder::m_enlarge
private

Definition at line 31 of file FWCaloRecHitDigitSetProxyBuilder.h.

Referenced by build(), and viewContextBoxScale().

◆ m_ignoreGeoShapeSize

bool FWCaloRecHitDigitSetProxyBuilder::m_ignoreGeoShapeSize
private

Definition at line 30 of file FWCaloRecHitDigitSetProxyBuilder.h.

Referenced by viewContextBoxScale().

◆ m_invertBox

bool FWCaloRecHitDigitSetProxyBuilder::m_invertBox
private

Definition at line 29 of file FWCaloRecHitDigitSetProxyBuilder.h.

Referenced by invertBox(), and viewContextBoxScale().

◆ m_vector

TEveVector FWCaloRecHitDigitSetProxyBuilder::m_vector
private

Definition at line 32 of file FWCaloRecHitDigitSetProxyBuilder.h.

Referenced by build(), and viewContextBoxScale().

FWEventItem::modelInfo
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:446
mps_fire.i
i
Definition: mps_fire.py:355
FWCaloRecHitDigitSetProxyBuilder::m_ignoreGeoShapeSize
bool m_ignoreGeoShapeSize
Definition: FWCaloRecHitDigitSetProxyBuilder.h:30
FWDigitSetProxyBuilder::addBoxSetToProduct
TEveBoxSet * addBoxSetToProduct(TEveElementList *product)
Definition: FWDigitSetProxyBuilder.cc:73
FWGeometry::getCorners
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:464
FWEventItem::getConfig
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:150
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
cms::cuda::assert
assert(be >=bs)
FWEventItem::modelData
const void * modelData(int iIndex) const
Definition: FWEventItem.cc:466
FWViewEnergyScale::getPlotEt
bool getPlotEt() const
Definition: FWViewEnergyScale.h:47
DDAxes::x
CaloRecHit
Definition: CaloRecHit.h:23
FWDigitSetProxyBuilder::addBox
void addBox(TEveBoxSet *set, const float *pnts, const FWDisplayProperties &dp)
Definition: FWDigitSetProxyBuilder.cc:94
FWCaloRecHitDigitSetProxyBuilder::m_enlarge
double m_enlarge
Definition: FWCaloRecHitDigitSetProxyBuilder.h:31
fireworks::Context::voteMaxEtAndEnergy
void voteMaxEtAndEnergy(float Et, float energy) const
Definition: Context.cc:162
b
double b
Definition: hdecay.h:118
FWProxyBuilderConfiguration::assertParam
FWGenericParameter< T > * assertParam(const std::string &name, T def)
Definition: FWProxyBuilderConfiguration.cc:83
Scenarios_cff.scale
scale
Definition: Scenarios_cff.py:2186
FWCaloRecHitDigitSetProxyBuilder::m_invertBox
bool m_invertBox
Definition: FWCaloRecHitDigitSetProxyBuilder.h:29
fireworks::Context::getGeom
FWGeometry * getGeom() const
Definition: Context.h:72
FWCaloRecHitDigitSetProxyBuilder::m_vector
TEveVector m_vector
Definition: FWCaloRecHitDigitSetProxyBuilder.h:32
FWDigitSetProxyBuilder::BFreeBox_t
Definition: FWDigitSetProxyBuilder.h:47
FWEventItem::ModelInfo::displayProperties
const FWDisplayProperties & displayProperties() const
Definition: FWEventItem.h:64
FWEventItem::getGeom
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548
FWProxyBuilderBase::item
const FWEventItem * item() const
Definition: FWProxyBuilderBase.h:64
FWViewEnergyScale::getScaleFactor3D
float getScaleFactor3D() const
Definition: FWViewEnergyScale.h:44
FWCaloRecHitDigitSetProxyBuilder::scaleFactor
virtual float scaleFactor(const FWViewContext *vc)
Definition: FWCaloRecHitDigitSetProxyBuilder.cc:92
FWProxyBuilderConfiguration::value
T value(const std::string &name)
Definition: FWProxyBuilderConfiguration.cc:123
fireworks::invertBox
void invertBox(std::vector< float > &corners)
Definition: BuilderUtils.cc:133
FWCaloRecHitDigitSetProxyBuilder::viewContextBoxScale
virtual void viewContextBoxScale(const float *corners, float scale, bool plotEt, std::vector< float > &scaledCorners, const CaloRecHit *)
Definition: FWCaloRecHitDigitSetProxyBuilder.cc:27
FWProxyBuilderBase::context
const fireworks::Context & context() const
Definition: FWProxyBuilderBase.cc:412
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
FWProxyBuilderBase::setItem
virtual void setItem(const FWEventItem *iItem)
Definition: FWProxyBuilderBase.cc:83
FWViewContext::getEnergyScale
FWViewEnergyScale * getEnergyScale() const
Definition: FWViewContext.cc:25
class-composition.parent
parent
Definition: class-composition.py:88
hit
Definition: SiStripHitEffFromCalibTree.cc:88
FWEventItem::size
size_t size() const
Definition: FWEventItem.cc:457
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443